kexec, x86, Fix incorrect jump back address if not preserve context
In kexec jump support, jump back address passed to the kexeced kernel via function calling ABI, that is, the function call return address is the jump back entry. And jump back entry == 0 should be used to signal that jump back or preserve context is not enabled in original kernel. But in original implementation, the stack position used for function call return address is not cleared if preserve context is disabled. The patch fixes this issue.
Signed-off-by Huang Ying <[email protected]>
Reported-and-tested-by Yin Kangkai <[email protected]>
--- arch/x86/kernel/relocate_kernel_32.S | 2 ++ arch/x86/kernel/relocate_kernel_64.S | 2 ++ 2 files changed, 4 insertions(+)
arch/x86/kernel/relocate_kernel_32.S +2 -0
@@ -97,6 +97,8 @@ relocate_kernel: ret identity_mapped: + /* set return address as 0 if not preserve context */ + pushl $0 /* store the start address on the stack */ pushl %edx
arch/x86/kernel/relocate_kernel_64.S +2 -0
@@ -100,6 +100,8 @@ relocate_kernel: ret identity_mapped: + /* set return address as 0 if not preserve context */ + pushq $0 /* store the start address on the stack */ pushq %rdx