[CRIU] [PATCHv2 00/30] x86 Compatible C/R, part 2
Dmitry Safonov
dsafonov at virtuozzo.com
Fri Jun 24 08:08:05 PDT 2016
This patches set is based on the top of "Signal inheriting fix" patches:
https://lists.openvz.org/pipermail/criu/2016-June/029512.html
The following changes are available since v1:
* Run ZDTM with 32-bit tests
* Call sigaction with 32-bit syscall for proper signal delivering
* Fix for relative relacation of int80 helper on gcc v6.0
* builtin_memcpy fix in restorer's callee
* add error-message if remapping of vDSO failed
* dropped mov %edx,%ebx - as I can place right in %ebx
* rename test_compat_sigreturn to kdat_compat_sigreturn_test (bad naming)
* drop __restore_tls and make static stack32, which allocates when needed
* expected "vdso: Elf header magic mismatch" conceal (when trying to find
remapped vDSO page in compatible restorer)
After getting ZDTM working with 32-bit compatible binaries, I got
the following results by this moment:
[criu]# make test COMPAT_TEST=y
[criu]# ./test/zdtm.py run --all --keep-going > /tmp/compat-result
[criu]# grep ' FAIL at ' /tmp/compat-result | wc -l
54
[criu]# grep ' PASS ' /tmp/compat-result | wc -l
462
It looks like, if divide on 3 ns flavours, ~18 tests have failed.
There is a problem with vsyscall page that isn't mapped to process mm,
but shows at /proc/self/maps if TIF_IA32 flag isn't set.
So, ZDTM fails in a half more tests, saying that a new VMA has appeared
on restore. Yet, I'm thinking how to solve this nicely, so tests results
have been procured with "vsyscall=none" kernel boot option.
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 Check work of vDSO 32-bit trampolines and include fault-inject
test for that
o vsyscall emulated page unmapping
o 32-bit zdtm failures
o clone() with CLONE_SETTLS with TLS descriptor
o zdtm.py patch for `make test COMPAT_TEST=y`?
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
Description from v1 [3]:
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.
[1]: https://lkml.org/lkml/2016/5/17/243
[2]: http://thread.gmane.org/gmane.linux.kernel/2232320
[3]: https://lists.openvz.org/pipermail/criu/2016-June/029376.html
Thanks,
Dmitry
Dmitry Safonov (30):
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
x86: restore TLS
zdtm: add compatible tests building
restore/x86: call int80 for compat sigaction restore
signal/x86-32: use packed for compat rt_sigaction
vdso: suppress not ELF vDSO error
criu/arch/aarch64/crtools.c | 2 +-
criu/arch/aarch64/include/asm/parasite-syscall.h | 1 +
criu/arch/aarch64/include/asm/restorer.h | 22 ++-
criu/arch/aarch64/include/asm/types.h | 1 +
criu/arch/arm/include/asm/parasite-syscall.h | 1 +
criu/arch/arm/include/asm/restorer.h | 22 ++-
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 | 14 +-
criu/arch/ppc64/include/asm/types.h | 1 +
criu/arch/x86/Makefile | 2 +
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 | 224 +++++++++++++++++++++--
criu/arch/x86/include/asm/syscall32.h | 8 -
criu/arch/x86/include/asm/types.h | 45 ++++-
criu/arch/x86/parasite-head-32.S | 4 +-
criu/arch/x86/restorer.c | 58 ++++++
criu/arch/x86/sigaction_compat.c | 68 +++++++
criu/arch/x86/sigaction_compat_pie.c | 1 +
criu/cr-dump.c | 33 +++-
criu/cr-restore.c | 157 +++++++++++++---
criu/include/kerndat.h | 1 +
criu/include/page-pipe.h | 11 +-
criu/include/parasite-compat.h | 86 +++++++++
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 | 7 +-
criu/kerndat.c | 15 ++
criu/mem.c | 4 +-
criu/page-pipe.c | 57 +++++-
criu/page-xfer.c | 88 +++++----
criu/parasite-syscall.c | 210 ++++++++++++++-------
criu/pie/Makefile | 3 +
criu/pie/Makefile.library | 3 +
criu/pie/parasite-vdso.c | 64 ++++++-
criu/pie/parasite.c | 25 +--
criu/pie/restorer.c | 71 +++++--
criu/pie/util-vdso-elf32.c | 1 +
criu/pie/util-vdso.c | 14 +-
criu/shmem.c | 2 +-
criu/sigframe.c | 22 ++-
criu/vdso.c | 11 +-
images/core-x86.proto | 15 ++
images/sa.proto | 1 +
test/zdtm/Makefile | 8 +
55 files changed, 1559 insertions(+), 323 deletions(-)
create mode 100644 criu/arch/x86/call32.S
create mode 100644 criu/arch/x86/sigaction_compat.c
create mode 120000 criu/arch/x86/sigaction_compat_pie.c
create mode 100644 criu/include/parasite-compat.h
create mode 120000 criu/pie/util-vdso-elf32.c
--
2.9.0
More information about the CRIU
mailing list