Skip to content

Commit 2f62f36

Browse files
mirabjgross1
authored andcommitted
x86/xen: Make the boot CPU idle task reliable
The unwinder reports the boot CPU idle task's stack on XEN PV as unreliable, which affects at least live patching. There are two reasons for this. First, the task does not follow the x86 convention that its stack starts at the offset right below saved pt_regs. It allows the unwinder to easily detect the end of the stack and verify it. Second, startup_xen() function does not store the return address before jumping to xen_start_kernel() which confuses the unwinder. Amend both issues by moving the starting point of initial stack in startup_xen() and storing the return address before the jump, which is exactly what call instruction does. Signed-off-by: Miroslav Benes <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 69086bd commit 2f62f36

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/x86/xen/xen-head.S

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ SYM_CODE_START(startup_xen)
3535
rep __ASM_SIZE(stos)
3636

3737
mov %_ASM_SI, xen_start_info
38-
mov $init_thread_union+THREAD_SIZE, %_ASM_SP
38+
#ifdef CONFIG_X86_64
39+
mov initial_stack(%rip), %rsp
40+
#else
41+
mov pa(initial_stack), %esp
42+
#endif
3943

4044
#ifdef CONFIG_X86_64
4145
/* Set up %gs.
@@ -51,7 +55,7 @@ SYM_CODE_START(startup_xen)
5155
wrmsr
5256
#endif
5357

54-
jmp xen_start_kernel
58+
call xen_start_kernel
5559
SYM_CODE_END(startup_xen)
5660
__FINIT
5761
#endif

0 commit comments

Comments
 (0)