kexec, x86: Fix incorrect jump back address if not preserving context
authorHuang Ying <ying.huang@intel.com>
Thu, 14 Jul 2011 01:34:37 +0000 (09:34 +0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 21 Jul 2011 09:19:28 +0000 (11:19 +0200)
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.

Furthermore, jump back entry == 0 should be used to signal that
the jump back or preserve context is not enabled in the original
kernel.

But in the current implementation the stack position used for
function call return address is not cleared context
preservation is disabled. The patch fixes this bug.

Reported-and-tested-by: Yin Kangkai <kangkai.yin@intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/r/1310607277-25029-1-git-send-email-ying.huang@intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/relocate_kernel_32.S
arch/x86/kernel/relocate_kernel_64.S

index 41235531b11ca894c809f9ae97f4d3c4f14791a4..36818f8ec2be08dd8ccdc6872992e5877eba40cd 100644 (file)
@@ -97,6 +97,8 @@ relocate_kernel:
        ret
 
 identity_mapped:
+       /* set return address to 0 if not preserving context */
+       pushl   $0
        /* store the start address on the stack */
        pushl   %edx
 
index 4de8f5b3d476ca0aa544e025568cf00cb6c25ebb..7a6f3b3be3cfcd9c071672e2275213c3c7715607 100644 (file)
@@ -100,6 +100,8 @@ relocate_kernel:
        ret
 
 identity_mapped:
+       /* set return address to 0 if not preserving context */
+       pushq   $0
        /* store the start address on the stack */
        pushq   %rdx