Instrumenting Executables for Dynamic Analysis Jeff Perkins

Instrumenting Executables for Dynamic Analysis Jeff Perkins

Instrumenting Executables for Dynamic Analysis Jeff Perkins Instrumenting Executables for Dynamic Analysis Jeff Perkins and Michael Ernst MIT CSAIL Page 1 14 Nov 2005 09:45 Instrumenting Executables for Dynamic Analysis Jeff Perkins Compiled Instrumentation Approaches Source to Source Binary Other Scripting a debugger Linking with modified libraries Page 2 14 Nov 2005 09:45 Instrumenting Executables for Dynamic Analysis Jeff Perkins Source to Source Easy to create instrumentation Easy to debug Takes advantage of compiler optimizations Portable to different architectures Languages (such as C++) can be very complex. It is difficult to handle all constructs correctly. System libraries can't be instrumented Difficult for users -- multiple source and object files. Page 3 14 Nov 2005 09:45 Instrumenting Executables for Dynamic Analysis Jeff Perkins Binary instrumentation Instructions are simple Portable to different languages Libraries can be instrumented Easier for users Tied to machine architecture Instrumentation is tedious to produce (assemby or intermediate language) Page 4 14 Nov 2005 09:45 Instrumenting Executables for Dynamic Analysis Jeff Perkins Memory Safety Analysis needs to access variables Variables and pointers may be uninitialized Heap space may be deallocated Array lengths may not be known Analysis tools should never crash program or change its behavior Page 5 14 Nov 2005 09:45 Instrumenting Executables for Dynamic Analysis Jeff Perkins Memory Safety Solutions Smart pointers Safe-C (http://www.cs.wisc.edu/~austin/scc.html) Xu et al. FSE November 2004 Binary instrumentation Purify (http://www-306.ibm.com/software/awdtools/purifyplus/) Valgrind (http://valgrind.org/) Page 6 14 Nov 2005 09:45 Instrumenting Executables for Dynamic Analysis Jeff Perkins Fjalar Mixed level instrumentation toolkit Binary instrumentation Source level information via DWARF2 debugging information Based on Valgrind Access information on memory, registers etc Valgrind provides bit level information on memory initialization and allocation. Code insertion is handled automatically. Available soon Page 7 14 Nov 2005 09:45 Instrumenting Executables for Dynamic Analysis Jeff Perkins Instrumentation Example Define a helper function that takes a string name and the address of the basic block: di = unsafeIRDirty_0_N(2/*regparms*/, "enter_function", &enter_function, mkIRExprVec_2(IRExpr_Const(IRConst_U32((Addr)curFuncPtr->daikon_name)), IRExpr_Const(IRConst_U32(curren... Make the stack pointer available to that function di->nFxState = 1; di->fxState[0].fx = Ifx_Read; di->fxState[0].offset = mce->layout->offset_SP; di->fxState[0].size = mce->layout->sizeof_SP; Insert the code into the intermediate representation stmt( mce->bb, IRStmt_Dirty(di) ); Page 8 14 Nov 2005 09:45.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us