]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.0.1/kexec-x86-fix-incorrect-jump-back-address-if-not.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 3.0.1 / kexec-x86-fix-incorrect-jump-back-address-if-not.patch
CommitLineData
7cb15094
GKH
1From 050438ed5a05b25cdf287f5691e56a58c2606997 Mon Sep 17 00:00:00 2001
2From: Huang Ying <ying.huang@intel.com>
3Date: Thu, 14 Jul 2011 09:34:37 +0800
4Subject: kexec, x86: Fix incorrect jump back address if not
5 preserving context
6
7From: Huang Ying <ying.huang@intel.com>
8
9commit 050438ed5a05b25cdf287f5691e56a58c2606997 upstream.
10
11In kexec jump support, jump back address passed to the kexeced
12kernel via function calling ABI, that is, the function call
13return address is the jump back entry.
14
15Furthermore, jump back entry == 0 should be used to signal that
16the jump back or preserve context is not enabled in the original
17kernel.
18
19But in the current implementation the stack position used for
20function call return address is not cleared context
21preservation is disabled. The patch fixes this bug.
22
23Reported-and-tested-by: Yin Kangkai <kangkai.yin@intel.com>
24Signed-off-by: Huang Ying <ying.huang@intel.com>
25Cc: Eric W. Biederman <ebiederm@xmission.com>
26Cc: Vivek Goyal <vgoyal@redhat.com>
27Link: http://lkml.kernel.org/r/1310607277-25029-1-git-send-email-ying.huang@intel.com
28Signed-off-by: Ingo Molnar <mingo@elte.hu>
29Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
30
31---
32 arch/x86/kernel/relocate_kernel_32.S | 2 ++
33 arch/x86/kernel/relocate_kernel_64.S | 2 ++
34 2 files changed, 4 insertions(+)
35
36--- a/arch/x86/kernel/relocate_kernel_32.S
37+++ b/arch/x86/kernel/relocate_kernel_32.S
38@@ -97,6 +97,8 @@ relocate_kernel:
39 ret
40
41 identity_mapped:
42+ /* set return address to 0 if not preserving context */
43+ pushl $0
44 /* store the start address on the stack */
45 pushl %edx
46
47--- a/arch/x86/kernel/relocate_kernel_64.S
48+++ b/arch/x86/kernel/relocate_kernel_64.S
49@@ -100,6 +100,8 @@ relocate_kernel:
50 ret
51
52 identity_mapped:
53+ /* set return address to 0 if not preserving context */
54+ pushq $0
55 /* store the start address on the stack */
56 pushq %rdx
57