Qemu code fault automatic discovery with symbolic search
Paul Marinescu, Cristian Cadar, Chunjie Zhu, Philippe Gabriel
Qemu code fault automatic discovery with symbolic search Paul - - PowerPoint PPT Presentation
Qemu code fault automatic discovery with symbolic search Paul Marinescu, Cristian Cadar, Chunjie Zhu, Philippe Gabriel Goals of this presentation Introduction of KLEE (symbolic execution tool) Qemu fault/patch retrospective Understand
Paul Marinescu, Cristian Cadar, Chunjie Zhu, Philippe Gabriel
https://github.com/klee/klee
klee_make_symbolic(&a, sizeof(a), “a”) klee_make_symbolic(&b, sizeof(b), “b”) int foo(int x, int y) { int ret = 0; if (x + y < 15) { if (y != 10) ret = 1; else ret = 2; } else { if (y != 10) ret = 3; else ret = 4; } return ret; } foo(a, b);
https://github.com/klee/klee
test000001.ktest test000002.ktest test000003.ktest test000004.ktest (int32 overflow) args : ['test.o'] num objects: 2
2147483635
args : ['test.o'] num objects: 2
args : ['test.o'] num objects: 2
2110308033
37170385 args : ['test.o'] num objects: 2
2147483640
1. depth-first search/breadth-first search/non-uniform-random search 2. query-cost-optimization/code-coverage-optimization
1. constraint solver does not support symbolic-sized objects, e.g. malloc(size)
https://github.com/klee/klee
https://github.com/klee/klee
guest os <-> xen hypervisor guest os issues “IN AL, 0x10” VM exit traps guest os into hypervisor hypervisor packages an ioreq and fills it into ioreq queue (shared memory between hypervisor and qemu), notifies qemu to handle this request and waits the io instruction done (hypervisor schedules other task to execute on CPU, but does not block forever) qemu gives response, hypervisor reads the data
VMCS (See x86 VT-x spec) xen-hypervisor <-> qemu process (qemu calls libxc to map the shared memory into its own virtual memory address space at startsup) qemu event loop polls ioreq from queue qemu gets an ioreq and parse it (0x10, read, memory to store 0x10 data) qemu calls xen_platform ioport read function (xen_platform registers ioport 0x10) qemu writes the data into the memory block (ioreq contains a memory point which is used to store the data) qemu notifies hypervisor that job is done
stub libxc? klee libxc modeling?
boot toy OS using klee and do some initial symbolic checks