Add a tool for patching ELF libraries/executables offline

This is for patching ELF objects for use with elf_loader.cc.  It
allows system call instructions to be patched before the library or
executable is loaded.

For simplicity, we replace system calls with "int $0", which is not
very fast at run time.  A more sophisticated version could insert
jumps like library.cc does, but this would involve adding an extra
code segment to the ELF object.

BUG=http://code.google.com/p/seccompsandbox/issues/detail?id=13
TEST=For example:
  ./patch_offline /lib/ld-linux.so.2 -o ld.so.patched
  objdump -d ld.so.patched | grep -w int
Automated tests will be added in a later change.

Review URL: http://codereview.chromium.org/8589027

git-svn-id: http://seccompsandbox.googlecode.com/svn/trunk@173 55e79e8e-603c-11de-8c10-5fe6993ea61f
2 files changed