Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1372657
| From | Dmitry Safonov <dsafonov@virtuozzo.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 0/2] x86: add arch_prctl to switch between native/compat modes |
| Date | 2016-04-06 18:50 +0200 |
| Message-ID | <rkYOu-6Mu-9@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
With those patches it becomes possible to tell the kernel in which mode
current task is.
I need it for compatibility process C/R:
restorer is native x86_64 process, that maps vmas, restore task parameters,
does clone to add threads and so on. To restore 32-bit application, that
runs on x86_64 (in compatibility mode), I need to set proper CS selector
for USER32_CS and tell the kernel, that the process is now in compat mode.
Switching selector isn't a hard task (and it's done in other selftests
with long jump/lret).
This patch makes possible to tell Linux kernel in which mode you are.
I also did vdso/vvar blob remapping on compat <-> native switch.
This part isn't really needed by CRIU, as on restore stage we already
have dumped vdso/vvar vma images.
So, this part is for other processes that may need to switch their mode.
(I will drop this part if no one else needs this possibility).
I add a selftest and I did CRIU branch that uses this to C/R 32-bit processes:
https://github.com/0x7f454c46/criu/tree/compat-2
There are dozens of patches there and I will prepare them for CRIU master
branch after mainstreaming this switching patch.
Dmitry Safonov (2):
x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode
x86/tools/testing: add test for ARCH_SET_COMPAT
arch/x86/entry/vdso/vma.c | 76 ++++--
arch/x86/include/asm/vdso.h | 5 +
arch/x86/include/uapi/asm/prctl.h | 6 +
arch/x86/kernel/process_64.c | 87 ++++++
tools/testing/selftests/x86/Makefile | 1 +
.../testing/selftests/x86/arch_prctl_set_compat.c | 295 +++++++++++++++++++++
6 files changed, 453 insertions(+), 17 deletions(-)
create mode 100644 tools/testing/selftests/x86/arch_prctl_set_compat.c
--
2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 0/2] x86: add arch_prctl to switch between native/compat modes Dmitry Safonov <dsafonov@virtuozzo.com> - 2016-04-06 18:50 +0200
[PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Dmitry Safonov <dsafonov@virtuozzo.com> - 2016-04-06 18:50 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Andy Lutomirski <luto@amacapital.net> - 2016-04-06 20:10 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Andy Lutomirski <luto@amacapital.net> - 2016-04-06 21:00 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Cyrill Gorcunov <gorcunov@gmail.com> - 2016-04-07 14:30 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Dmitry Safonov <dsafonov@virtuozzo.com> - 2016-04-07 15:00 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Andy Lutomirski <luto@amacapital.net> - 2016-04-07 16:50 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Andy Lutomirski <luto@amacapital.net> - 2016-04-08 18:00 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Andy Lutomirski <luto@amacapital.net> - 2016-04-08 22:50 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Dmitry Safonov <0x7f454c46@gmail.com> - 2016-04-09 10:10 +0200
Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode Andy Lutomirski <luto@amacapital.net> - 2016-04-14 20:30 +0200
[PATCH 2/2] x86/tools/testing: add test for ARCH_SET_COMPAT Dmitry Safonov <dsafonov@virtuozzo.com> - 2016-04-06 18:50 +0200
csiph-web