Top Banner
Comprehensive Kernel Instrumentation via Dynamic Binary Translation Peter Feiner, Angela Demke Brown, Ashvin Goel University of Toronto Presenter: Chuong Ngo
30

Comprehensive Kernel Instrumentation via Dynamic Binary Translation

Jan 01, 2016

Download

Documents

randolph-tripp

Comprehensive Kernel Instrumentation via Dynamic Binary Translation. Presenter: Chuong Ngo. Peter Feiner , Angela Demke Brown, Ashvin Goel University of Toronto. No parents, uncles, or girlfriends were killed during the creation of this presentation. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

Comprehensive Kernel Instrumentation via Dynamic Binary

Translation

Peter Feiner, Angela Demke Brown, Ashvin Goel

University of Toronto

Presenter: Chuong Ngo

Page 2: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

THE ORIGIN STORY STARTING IN MEDIAS RES

No parents, uncles, or girlfriends were killed during the creation of this presentation

Page 3: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

DBT is the Answer!Emulation of one

instruction set by another through translation of binary code during execution.

More practical than static binary translation.◦ Simplifies identification of

executable code.◦ Amortization of translation

overhead costs over time.

Page 4: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

…and I Remember Everything!

Page 5: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

The Answer to What?Ports

◦AbandonwareAnalysisBug findingSecurity

Page 6: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

Assemble!

User Level

JIFLPinOS

PinDynamoRioValgrind

Power Level < 9K

Page 7: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

IT’S A BIRD! IT’S A PLANE! IT’S DRK!

All the way from Earth-1610 via Cataclysm

Page 8: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

But Who Hides Behind the Mask?4 Goals for kernel DBT

framework:◦Full coverage of kernel code.◦No direct overhead for user level

code.◦Preserve original concurrency and

execution interleaving.◦Be transparent.

DynamoRio for the kernel.

Page 9: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

DynamoRio Flashback!Code cacheCTIs return control to dispatcherDirect branching patchesNext Executing TailClient callbacks

Page 10: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

Well Victor…I’ve been thinking.

All kernel entry points point to dispatcher.◦Shadow descriptor table

Self-contained dispatcher◦Custom heap allocator◦“Pull” I/O model

CPU-private dataInterrupts delayed in code

cache, disabled in dispatcher.Exceptions use restored native

states.

Page 11: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

A Carbonadium Skeleton

Page 12: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

DRK Initialization

Individual CPU initialization◦ Allocate CPU resources◦ All kernel entry points to dispatcher◦ All interrupts redirected

Allocates memory for heap◦ Checks all processors

for successful memory mapping.

◦ Must be within 2GB of text and data segments.

Page 13: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

DRK Normal Operations

Determine target of control transfer instruction and dispatch.

Kernel exit points executed via native instructions.

Dispatcher creates and caches code fragment.Context switches to the code fragment.

Page 14: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

You Can’t Escape This Timeline!Exceptions run native

◦Native state must be restored.Interrupts are delayed and emulated.

◦Other interrupts are disabled.◦Captured interrupt executed between block

dispatches.

Page 15: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

HOW DOES IT STACK UP?

How did--? This… you… What are you?

Page 16: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

I’ve always found hardware to be more reliableTest System: Dell Optiplex 980

◦8 GB RAM◦4x Intel Core i7s at 2.8 GHz, no

hyperthreading2 Clients:

◦Null Client◦Instruction Count

Filebench

Page 17: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

I’m the best at what I do?

Page 18: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

There’s a whole new master of magnetism in town!

Page 19: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

I know everything. I can’t help it.

Page 20: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

With great power…4 Goals for kernel DBT

framework:◦Full coverage of kernel code.◦No direct overhead for user level

code.◦Preserve original concurrency and

execution interleaving.◦Be transparent.

Page 21: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

I’ll be there…around every corner Full coverage of kernel code. Preserve original concurrency and execution interleaving.

Page 22: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

Fastest man alive with a limpNo direct overhead for user level

code.◦Increased cache and TLB misses.

Page 23: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

The cosmic rays…what did they do to us?Be transparent.

◦ No code cache consistency.◦ Shadow descriptor tables

readable via hardware registers.◦ Page table inconsistencies.◦ CPU-private data.

Page 24: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

…comes great responsibility.4 Goals for kernel DBT

framework:◦Full coverage of kernel code.◦No direct overhead for user level

code.◦Preserve original concurrency and

execution interleaving.◦Be transparent.

Page 25: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

DRK APPLICATIONSThis was the world that I had created.

Page 26: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

DRK’s Shadow MemoryStoring metadata about memory

used.Ported UMBRA.

◦Simple indirect mapping.◦Copy-on-write.◦10x overhead vs. native.

Page 27: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

KAddrcheckMemory addressability checking

tool.Scans slab allocator’s data

structures to locate all pages and freelists.◦Triggers shadow memory allocations.

Addressability checks run on every memory access.

Page 28: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

Stackcheck

◦ Checks for addressability errors.◦ Kills calling thread and continues.

Modified KAddrcheckResolves overflow without system

crash.

Stack overflow guard

Page 29: Comprehensive Kernel Instrumentation via Dynamic Binary Translation

Triumph!DRK is a kernel-level DBT.DynamoRIO “port”.Heavy implementation.Missing a number of features.

Page 30: Comprehensive Kernel Instrumentation via Dynamic Binary Translation