linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "x86/uaccess: Add stack frame output operand in get_user() inline asm"
@ 2017-07-12 21:27 Matthias Kaehlcke
  2017-07-12 22:12 ` Josh Poimboeuf
  0 siblings, 1 reply; 32+ messages in thread
From: Matthias Kaehlcke @ 2017-07-12 21:27 UTC (permalink / raw)
  To: Chris J Arges, Josh Poimboeuf, Borislav Petkov, Thomas Gleixner,
	Ingo Molnar, H . Peter Anvin
  Cc: x86, linux-kernel, Douglas Anderson, Michael Davidson,
	Greg Hackmann, Nick Desaulniers, Stephen Hines, Kees Cook,
	Arnd Bergmann, Bernhard.Rosenkranzer, Matthias Kaehlcke

Commit f05058c4d652 supposedly "forces a stack frame to be created before
the inline asm code if CONFIG_FRAME_POINTER is enabled by listing the
stack pointer as an output operand for the get_user() inline assembly
statement.". This doesn't work as intended, at least with gcc v4.9.2 and
x86-64 the generated code is exactly the same with and without the patch.
However clang adds an extra instruction that adjusts %rsp, which ends up
causing double faults all over the place.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 arch/x86/include/asm/uaccess.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 476ea27f490b..9ec2beab73df 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -161,11 +161,10 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
 ({									\
 	int __ret_gu;							\
 	register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX);		\
-	register void *__sp asm(_ASM_SP);				\
 	__chk_user_ptr(ptr);						\
 	might_fault();							\
-	asm volatile("call __get_user_%P4"				\
-		     : "=a" (__ret_gu), "=r" (__val_gu), "+r" (__sp)	\
+	asm volatile("call __get_user_%P3"				\
+		     : "=a" (__ret_gu), "=r" (__val_gu)			\
 		     : "0" (ptr), "i" (sizeof(*(ptr))));		\
 	(x) = (__force __typeof__(*(ptr))) __val_gu;			\
 	__builtin_expect(__ret_gu, 0);					\
-- 
2.13.2.932.g7449e964c-goog

^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2017-07-29  1:06 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-12 21:27 [PATCH] Revert "x86/uaccess: Add stack frame output operand in get_user() inline asm" Matthias Kaehlcke
2017-07-12 22:12 ` Josh Poimboeuf
2017-07-12 22:20   ` Matthias Kaehlcke
2017-07-12 22:35     ` Josh Poimboeuf
2017-07-12 22:36       ` Josh Poimboeuf
2017-07-12 23:22         ` Matthias Kaehlcke
2017-07-13 18:00           ` Josh Poimboeuf
2017-07-13 18:47             ` Matthias Kaehlcke
2017-07-13 19:25               ` Josh Poimboeuf
2017-07-13 19:38                 ` Michael Davidson
2017-07-13 20:18                   ` Josh Poimboeuf
2017-07-13 20:20               ` Andrey Rybainin
2017-07-13 20:34                 ` Josh Poimboeuf
2017-07-13 21:12                   ` Matthias Kaehlcke
2017-07-13 21:34                     ` Josh Poimboeuf
2017-07-13 21:57                       ` Matthias Kaehlcke
2017-07-19 17:46                         ` Josh Poimboeuf
2017-07-19 21:50                           ` Matthias Kaehlcke
2017-07-20 10:01                           ` Andrey Ryabinin
2017-07-20 15:18                             ` Josh Poimboeuf
2017-07-20 15:30                               ` Andrey Ryabinin
2017-07-20 20:56                                 ` Josh Poimboeuf
2017-07-21  9:13                                   ` Andrey Ryabinin
2017-07-21 13:24                                     ` Josh Poimboeuf
2017-07-29  0:38                                   ` Matthias Kaehlcke
2017-07-29  0:55                                     ` Josh Poimboeuf
2017-07-29  0:58                                       ` Josh Poimboeuf
2017-07-29  1:06                                       ` Matthias Kaehlcke
2017-07-13 21:14                 ` Matthias Kaehlcke
2017-07-13 21:25                   ` Andrey Rybainin
2017-07-13 21:43                     ` Matthias Kaehlcke
2017-07-13 21:52                       ` Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).