Commit be783a37 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

compel/x86: hang in 32-bit mode on sw-break for compat tasks

Otherwise we'll try to set 32-bit register set to 64-bit task,
which is not possible with ptrace - it uses register set size,
according to processes mode. So we should set 32-bit regset
only to tasks those are in 32-bit mode already.
Please, see inline comment in the patch for more info.

travis-ci: success for 32-bit tests fixes
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 08cbdefb
......@@ -6,24 +6,44 @@
# error 64-bit parasite should compile with CONFIG_X86_64
#endif
.macro PARASITE_ENTRY
subq $16, %rsp
andq $~15, %rsp
pushq $0
movq %rsp, %rbp
movl __export_parasite_cmd(%rip), %edi
leaq __export_parasite_args(%rip), %rsi
call parasite_service
.endm
#ifdef CONFIG_COMPAT
.code32
ENTRY(__export_parasite_head_start_compat)
/* A long jump to 64-bit parasite. */
jmp $__USER_CS,$__export_parasite_head_start
jmp $__USER_CS,$1f
1:
.code64
PARASITE_ENTRY
pushq $__USER32_CS
pushq $2f
lretq
2:
.code32
/*
* parasite_service() can run commands in non-daemon mode
* with parasite_trap_cmd(): it waits that after return there
* is a software break.
* compel_run_in_thread() uses this and after hitting the break,
* it restores register set - that's the reason, why we should
* stop in 32-bit mode for compat tasks here.
*/
int $0x03
END(__export_parasite_head_start_compat)
.code64
#endif
ENTRY(__export_parasite_head_start)
subq $16, %rsp
andq $~15, %rsp
pushq $0
movq %rsp, %rbp
movl __export_parasite_cmd(%rip), %edi
leaq __export_parasite_args(%rip), %rsi
call parasite_service
PARASITE_ENTRY
int $0x03
END(__export_parasite_head_start)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment