[CRIU] [PATCH 0/2] x86: Parasite code preparation reworked

Cyrill Gorcunov gorcunov at openvz.org
Fri May 8 10:02:06 PDT 2015


Hi guys, just wanna share early new approach for parasite (restorer)
code generation. As you know on x86-64 we're rather relying on linker
and rip addressing, moreover our parasite code doesnt have any
statically defined _structures_, only pointers and integer objects.
Because of that linker can easily resolve all relocations inplace
giving us plain bytestream of code ready to use.

This won't work for 32 bit code because we will need to apply relocations
manually once CRIU know where exactly to place parasite/restorer. So for
this sake I wrote a simple code generator which would create bytestreams
for us and all additional information needed to do run-time relocations
manually.

Please take a look, even in current form trivial tests are passed,
but I would love to hear feedback especially from ARM and PowerPC
camp (because I modifed Makefiles that way so arm/powerpc uses
old scheme).

Cyrill Gorcunov (2):
  piegen: Implement tool building
  x86: Start using native object relocatable files in parasite code

 Makefile                |  17 ++-
 pie/Makefile            |  33 ++++-
 pie/pie-reloc.lds.S.in  |  27 ++++
 pie/piegen/Makefile     |  14 ++
 pie/piegen/elf-x86-32.c |  16 +++
 pie/piegen/elf-x86-64.c |  16 +++
 pie/piegen/elf.c        | 338 ++++++++++++++++++++++++++++++++++++++++++++++++
 pie/piegen/main.c       | 127 ++++++++++++++++++
 pie/piegen/piegen.h     |  34 +++++
 9 files changed, 619 insertions(+), 3 deletions(-)
 create mode 100644 pie/pie-reloc.lds.S.in
 create mode 100644 pie/piegen/Makefile
 create mode 100644 pie/piegen/elf-x86-32.c
 create mode 100644 pie/piegen/elf-x86-64.c
 create mode 100644 pie/piegen/elf.c
 create mode 100644 pie/piegen/main.c
 create mode 100644 pie/piegen/piegen.h

-- 
2.1.0



More information about the CRIU mailing list