| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- From 34b5c16ae093e5663c398c87569793bfbec1c7ca Mon Sep 17 00:00:00 2001
- From: Ricardo Neri <[email protected]>
- Date: Fri, 27 Oct 2017 13:25:30 -0700
- Subject: [PATCH 085/242] ptrace,x86: Make user_64bit_mode() available to
- 32-bit builds
- MIME-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- CVE-2017-5754
- In its current form, user_64bit_mode() can only be used when CONFIG_X86_64
- is selected. This implies that code built with CONFIG_X86_64=n cannot use
- it. If a piece of code needs to be built for both CONFIG_X86_64=y and
- CONFIG_X86_64=n and wants to use this function, it needs to wrap it in
- an #ifdef/#endif; potentially, in multiple places.
- This can be easily avoided with a single #ifdef/#endif pair within
- user_64bit_mode() itself.
- Suggested-by: Borislav Petkov <[email protected]>
- Signed-off-by: Ricardo Neri <[email protected]>
- Signed-off-by: Thomas Gleixner <[email protected]>
- Reviewed-by: Borislav Petkov <[email protected]>
- Cc: "Michael S. Tsirkin" <[email protected]>
- Cc: Peter Zijlstra <[email protected]>
- Cc: Dave Hansen <[email protected]>
- Cc: [email protected]
- Cc: Adrian Hunter <[email protected]>
- Cc: Paul Gortmaker <[email protected]>
- Cc: Huang Rui <[email protected]>
- Cc: Qiaowei Ren <[email protected]>
- Cc: Shuah Khan <[email protected]>
- Cc: Kees Cook <[email protected]>
- Cc: Jonathan Corbet <[email protected]>
- Cc: Jiri Slaby <[email protected]>
- Cc: Dmitry Vyukov <[email protected]>
- Cc: "Ravi V. Shankar" <[email protected]>
- Cc: Chris Metcalf <[email protected]>
- Cc: Brian Gerst <[email protected]>
- Cc: Arnaldo Carvalho de Melo <[email protected]>
- Cc: Andy Lutomirski <[email protected]>
- Cc: Colin Ian King <[email protected]>
- Cc: Chen Yucong <[email protected]>
- Cc: Adam Buchbinder <[email protected]>
- Cc: Vlastimil Babka <[email protected]>
- Cc: Lorenzo Stoakes <[email protected]>
- Cc: Masami Hiramatsu <[email protected]>
- Cc: Paolo Bonzini <[email protected]>
- Cc: Andrew Morton <[email protected]>
- Cc: Thomas Garnier <[email protected]>
- Link: https://lkml.kernel.org/r/1509135945-13762-4-git-send-email-ricardo.neri-calderon@linux.intel.com
- (cherry picked from commit e27c310af5c05cf876d9cad006928076c27f54d4)
- Signed-off-by: Andy Whitcroft <[email protected]>
- Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
- (cherry picked from commit 20ddf08f867d3d96788299cd2fb7676590d64250)
- Signed-off-by: Fabian Grünbichler <[email protected]>
- ---
- arch/x86/include/asm/ptrace.h | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
- diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
- index 2b5d686ea9f3..ea78a8438a8a 100644
- --- a/arch/x86/include/asm/ptrace.h
- +++ b/arch/x86/include/asm/ptrace.h
- @@ -115,9 +115,9 @@ static inline int v8086_mode(struct pt_regs *regs)
- #endif
- }
-
- -#ifdef CONFIG_X86_64
- static inline bool user_64bit_mode(struct pt_regs *regs)
- {
- +#ifdef CONFIG_X86_64
- #ifndef CONFIG_PARAVIRT
- /*
- * On non-paravirt systems, this is the only long mode CPL 3
- @@ -128,8 +128,12 @@ static inline bool user_64bit_mode(struct pt_regs *regs)
- /* Headers are too twisted for this to go in paravirt.h. */
- return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
- #endif
- +#else /* !CONFIG_X86_64 */
- + return false;
- +#endif
- }
-
- +#ifdef CONFIG_X86_64
- #define current_user_stack_pointer() current_pt_regs()->sp
- #define compat_user_stack_pointer() current_pt_regs()->sp
- #endif
- --
- 2.14.2
|