]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0099-x86-entry-Add-task_top_of_stack-to-find-the-top-of-a.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0099-x86-entry-Add-task_top_of_stack-to-find-the-top-of-a.patch
CommitLineData
321d628a
FG
1From 181d224dabca9a9061a6955cf3d49a4eba7294bf Mon Sep 17 00:00:00 2001
2From: Andy Lutomirski <luto@kernel.org>
3Date: Thu, 2 Nov 2017 00:59:11 -0700
e4cdf2a5 4Subject: [PATCH 099/241] x86/entry: Add task_top_of_stack() to find the top of
321d628a
FG
5 a task's stack
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10CVE-2017-5754
11
12This will let us get rid of a few places that hardcode accesses to
13thread.sp0.
14
15Signed-off-by: Andy Lutomirski <luto@kernel.org>
16Cc: Borislav Petkov <bpetkov@suse.de>
17Cc: Brian Gerst <brgerst@gmail.com>
18Cc: Dave Hansen <dave.hansen@intel.com>
19Cc: Linus Torvalds <torvalds@linux-foundation.org>
20Cc: Peter Zijlstra <peterz@infradead.org>
21Cc: Thomas Gleixner <tglx@linutronix.de>
22Link: http://lkml.kernel.org/r/b49b3f95a8ff858c40c9b0f5b32be0355324327d.1509609304.git.luto@kernel.org
23Signed-off-by: Ingo Molnar <mingo@kernel.org>
24(cherry picked from commit 3500130b84a3cdc5b6796eba1daf178944935efe)
25Signed-off-by: Andy Whitcroft <apw@canonical.com>
26Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
27(cherry picked from commit f1078e10e361afaeb22ee72c54d5ad397e19728d)
28Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
29---
30 arch/x86/include/asm/processor.h | 2 ++
31 1 file changed, 2 insertions(+)
32
33diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
34index 85ddfc1a9bb5..f83fbf1b6dd9 100644
35--- a/arch/x86/include/asm/processor.h
36+++ b/arch/x86/include/asm/processor.h
37@@ -788,6 +788,8 @@ static inline void spin_lock_prefetch(const void *x)
38 #define TOP_OF_INIT_STACK ((unsigned long)&init_stack + sizeof(init_stack) - \
39 TOP_OF_KERNEL_STACK_PADDING)
40
41+#define task_top_of_stack(task) ((unsigned long)(task_pt_regs(task) + 1))
42+
43 #ifdef CONFIG_X86_32
44 /*
45 * User space process size: 3GB (default).
46--
472.14.2
48