]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0085-ptrace-x86-Make-user_64bit_mode-available-to-32-bit-.patch
revert buggy SCSI error handler commit
[pve-kernel.git] / patches / kernel / 0085-ptrace-x86-Make-user_64bit_mode-available-to-32-bit-.patch
CommitLineData
321d628a
FG
1From 34b5c16ae093e5663c398c87569793bfbec1c7ca Mon Sep 17 00:00:00 2001
2From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
3Date: Fri, 27 Oct 2017 13:25:30 -0700
633c5ed1 4Subject: [PATCH 085/242] ptrace,x86: Make user_64bit_mode() available to
321d628a
FG
5 32-bit builds
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10CVE-2017-5754
11
12In its current form, user_64bit_mode() can only be used when CONFIG_X86_64
13is selected. This implies that code built with CONFIG_X86_64=n cannot use
14it. If a piece of code needs to be built for both CONFIG_X86_64=y and
15CONFIG_X86_64=n and wants to use this function, it needs to wrap it in
16an #ifdef/#endif; potentially, in multiple places.
17
18This can be easily avoided with a single #ifdef/#endif pair within
19user_64bit_mode() itself.
20
21Suggested-by: Borislav Petkov <bp@suse.de>
22Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
23Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
24Reviewed-by: Borislav Petkov <bp@suse.de>
25Cc: "Michael S. Tsirkin" <mst@redhat.com>
26Cc: Peter Zijlstra <peterz@infradead.org>
27Cc: Dave Hansen <dave.hansen@linux.intel.com>
28Cc: ricardo.neri@intel.com
29Cc: Adrian Hunter <adrian.hunter@intel.com>
30Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
31Cc: Huang Rui <ray.huang@amd.com>
32Cc: Qiaowei Ren <qiaowei.ren@intel.com>
33Cc: Shuah Khan <shuah@kernel.org>
34Cc: Kees Cook <keescook@chromium.org>
35Cc: Jonathan Corbet <corbet@lwn.net>
36Cc: Jiri Slaby <jslaby@suse.cz>
37Cc: Dmitry Vyukov <dvyukov@google.com>
38Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
39Cc: Chris Metcalf <cmetcalf@mellanox.com>
40Cc: Brian Gerst <brgerst@gmail.com>
41Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
42Cc: Andy Lutomirski <luto@kernel.org>
43Cc: Colin Ian King <colin.king@canonical.com>
44Cc: Chen Yucong <slaoub@gmail.com>
45Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
46Cc: Vlastimil Babka <vbabka@suse.cz>
47Cc: Lorenzo Stoakes <lstoakes@gmail.com>
48Cc: Masami Hiramatsu <mhiramat@kernel.org>
49Cc: Paolo Bonzini <pbonzini@redhat.com>
50Cc: Andrew Morton <akpm@linux-foundation.org>
51Cc: Thomas Garnier <thgarnie@google.com>
52Link: https://lkml.kernel.org/r/1509135945-13762-4-git-send-email-ricardo.neri-calderon@linux.intel.com
53
54(cherry picked from commit e27c310af5c05cf876d9cad006928076c27f54d4)
55Signed-off-by: Andy Whitcroft <apw@canonical.com>
56Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
57(cherry picked from commit 20ddf08f867d3d96788299cd2fb7676590d64250)
58Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
59---
60 arch/x86/include/asm/ptrace.h | 6 +++++-
61 1 file changed, 5 insertions(+), 1 deletion(-)
62
63diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
64index 2b5d686ea9f3..ea78a8438a8a 100644
65--- a/arch/x86/include/asm/ptrace.h
66+++ b/arch/x86/include/asm/ptrace.h
67@@ -115,9 +115,9 @@ static inline int v8086_mode(struct pt_regs *regs)
68 #endif
69 }
70
71-#ifdef CONFIG_X86_64
72 static inline bool user_64bit_mode(struct pt_regs *regs)
73 {
74+#ifdef CONFIG_X86_64
75 #ifndef CONFIG_PARAVIRT
76 /*
77 * On non-paravirt systems, this is the only long mode CPL 3
78@@ -128,8 +128,12 @@ static inline bool user_64bit_mode(struct pt_regs *regs)
79 /* Headers are too twisted for this to go in paravirt.h. */
80 return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
81 #endif
82+#else /* !CONFIG_X86_64 */
83+ return false;
84+#endif
85 }
86
87+#ifdef CONFIG_X86_64
88 #define current_user_stack_pointer() current_pt_regs()->sp
89 #define compat_user_stack_pointer() current_pt_regs()->sp
90 #endif
91--
922.14.2
93