[CRIU] [PATCHv1 00/26] x86 Compatible C/R, part 2

Dmitry Safonov dsafonov at virtuozzo.com
Thu Jun 16 03:53:17 PDT 2016


The second part of compatible patches.
With this part I'm able to C/R 32-bit applications on x86_64.
There are known issues which will be fixed after.
(described at the bottom of this cover)

All this works with the help of kernel patches [1][2], so
to test this one should apply them on a kernel.
As they yet not made a way in mainline, this patches are
targeted to criu-dev branch unless they got mainstreamed.
Without those patches in kernel 32-bit C/R will not work,
but yet nothing should broke for 64-bit applications C/R.
(There is kdat feature for that).

This patches set come big and a little dirty, so I think
there will be some iterations untill it'll be accepted.
To note, patches that are dirtiest and need more attention:
o parasite: add parasite-compat.h & convert parasite.h types
  This patch makes parasite arguments to be fix-sized.
o parasite-syscall: deserialize compat parasite's answers
  Deserializes parasite's answers which introduces a couple
  of new macroses and a little code duplication :(
Less dirty, but still hacky:
o page-pipe: add compatible iovec
o page-xfer: dump compatible iovec

There is in the patches set a hack to call 32-bit functions
from 64-bits. It's needed for restorer to call 32-bit syscalls
when it's really needed for restoring.

TODO:
o First major thing to do is to mainstream kernel part
  There isn't any big objections against it, but also no big
  interest from folks to merge it :-/
o Run ZDTM with 32-bit tests
o Add test to ZDTM about restored signal's ABI
o Call sigaction with 32-bit syscall for proper signal delivering
  with a 32-bit helper I include in patches
  (yet this patches set does not include it)
o Check work of vDSO 32-bit trampolines and include fault-inject
  test for that

Arguable:
o As compatible vDSO's PFN is unknown, we need to search it -
  optimize it by computing vDSO's PFN before dump
o Maybe include patches on TASK_SIZE
o Maybe refactor a little and introduce CONFIG_COMPAT for the
  generic code

[1]: https://lkml.org/lkml/2016/5/17/243
[2]: http://thread.gmane.org/gmane.linux.kernel/2232320

Thanks,
Dmitry

Dmitry Safonov (26):
  x86/dump: save gpregs_case
  sigframe: introduce SIGFRAME_MAX_OFFSET
  arm/restorer: fix {,rt_}sigframe typo
  sigframe: prepare macro helpers for two sigframes
  x86: add 32-bit sigframe for rt_sigreturn
  x86/restorer: add sigreturn to compat mode
  parasite-head-32: fix cmd & args load
  syscalls: add __NR(syscall, compat) wrapper
  x86/crtools: log dumping task's mode
  kdat: add compat_sigreturn feature
  parasite: add parasite-compat.h & convert parasite.h types
  parasite-syscall: deserialize compat parasite's answers
  page-pipe: add compatible iovec
  page-xfer: dump compatible iovec
  x86: change k_rtsigset_t sig type
  parasite: convert sigframe to u64
  vdso: try_fill_symtable always for compat tasks
  restorer: unmapping native blob in compat task
  restore: add arch_prctl mapping compatible vDSO
  pie/restorer: add vdso_fill_symtable_compat for 32-bit vdso
  restorer: refill symtable for rt-vdso
  page-pipe: grow page pipe on compatible iovec size
  x86: add helpers to call 32-bit code from 64-bit
  x86/call32: reserve space for saving 64-bit sp on 32-bit stack
  x86: dump TLS entries from GDT
  dirty/x86: restore TLS

 criu/arch/aarch64/crtools.c                      |   2 +-
 criu/arch/aarch64/include/asm/parasite-syscall.h |   1 +
 criu/arch/aarch64/include/asm/restorer.h         |  17 +-
 criu/arch/aarch64/include/asm/types.h            |   1 +
 criu/arch/arm/include/asm/parasite-syscall.h     |   1 +
 criu/arch/arm/include/asm/restorer.h             |  17 +-
 criu/arch/arm/include/asm/types.h                |   1 +
 criu/arch/ppc64/crtools.c                        |   6 +-
 criu/arch/ppc64/include/asm/parasite-syscall.h   |   2 +
 criu/arch/ppc64/include/asm/restorer.h           |   9 +-
 criu/arch/ppc64/include/asm/types.h              |   1 +
 criu/arch/x86/call32.S                           |  70 ++++++++
 criu/arch/x86/crtools.c                          | 188 +++++++++++++++-----
 criu/arch/x86/include/asm/dump.h                 |  25 ++-
 criu/arch/x86/include/asm/fpu.h                  |   4 +-
 criu/arch/x86/include/asm/parasite-syscall.h     |  10 ++
 criu/arch/x86/include/asm/parasite.h             |  51 +++++-
 criu/arch/x86/include/asm/restore.h              |  23 ++-
 criu/arch/x86/include/asm/restorer.h             | 212 +++++++++++++++++++++--
 criu/arch/x86/include/asm/syscall32.h            |   8 -
 criu/arch/x86/include/asm/types.h                |  33 +++-
 criu/arch/x86/parasite-head-32.S                 |   4 +-
 criu/arch/x86/restorer.c                         |  61 +++++++
 criu/cr-dump.c                                   |  33 +++-
 criu/cr-restore.c                                |  13 +-
 criu/include/kerndat.h                           |   1 +
 criu/include/page-pipe.h                         |  11 +-
 criu/include/parasite-compat.h                   |  89 ++++++++++
 criu/include/parasite-syscall.h                  |   7 +-
 criu/include/parasite-vdso.h                     |   5 +-
 criu/include/parasite.h                          |  98 ++++++-----
 criu/include/restorer.h                          |   2 +
 criu/include/sigframe.h                          |   7 +-
 criu/include/util-vdso.h                         |   4 +
 criu/kerndat.c                                   |  15 ++
 criu/mem.c                                       |   4 +-
 criu/page-pipe.c                                 |  57 +++++-
 criu/page-xfer.c                                 |  88 ++++++----
 criu/parasite-syscall.c                          | 205 +++++++++++++++-------
 criu/pie/Makefile                                |   1 +
 criu/pie/Makefile.library                        |   3 +
 criu/pie/parasite-vdso.c                         |  63 ++++++-
 criu/pie/parasite.c                              |  22 +--
 criu/pie/restorer.c                              |  56 ++++--
 criu/pie/util-vdso-elf32.c                       |   1 +
 criu/shmem.c                                     |   2 +-
 criu/sigframe.c                                  |  22 ++-
 criu/vdso.c                                      |   9 +-
 images/core-x86.proto                            |  15 ++
 49 files changed, 1288 insertions(+), 292 deletions(-)
 create mode 100644 criu/arch/x86/call32.S
 create mode 100644 criu/include/parasite-compat.h
 create mode 120000 criu/pie/util-vdso-elf32.c

-- 
2.8.3



More information about the CRIU mailing list