Skip to contentSkip to conversation

Patch "ptrace,x86: Make user_64bit_mode() available to 32-bit builds" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 21, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ptrace,x86: Make user_64bit_mode() available to 32-bit builds

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:

     ptrace-x86-make-user_64bit_mode-available-to-32-bit-builds.patch

and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e27c310af5c05cf876d9cad006928076c27f54d4 Mon Sep 17 00:00:00 2001

From: Ricardo Neri <[email protected]>
Date: Fri, 27 Oct 2017 13:25:30 -0700
Subject: ptrace,x86: Make user_64bit_mode() available to 32-bit builds

From: Ricardo Neri <[email protected]>

commit e27c310af5c05cf876d9cad006928076c27f54d4 upstream.

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.

Cc "Michael S. Tsirkin" <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Dave Hansen <[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]>
---
 arch/x86/include/asm/ptrace.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/include/asm/ptrace.h +5 -1
@@ -136,9 +136,9 @@ static inline int v8086_mode(struct pt_r
 #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
@@ -149,8 +149,12 @@ static inline bool user_64bit_mode(struc
 	/* 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

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/x86-boot-relocate-definition-of-the-initial-state-of-cr0.patch queue-4.14/ptrace-x86-make-user_64bit_mode-available-to-32-bit-builds.patch queue-4.14/x86-mm-relocate-page-fault-error-codes-to-traps.h.patch