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