All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32
@ 2016-02-23 21:19 Andy Lutomirski
  2016-02-24 15:46 ` Brian Gerst
  2016-02-25  5:53 ` [tip:x86/urgent] " tip-bot for Andy Lutomirski
  0 siblings, 2 replies; 21+ messages in thread
From: Andy Lutomirski @ 2016-02-23 21:19 UTC (permalink / raw)
  To: x86; +Cc: Borislav Petkov, linux-kernel, Andy Lutomirski

Both before and after 5f310f739b4c ("x86/entry/32: Re-implement
SYSENTER using the new C path"), we relied on a uaccess very early
in the SYSENTER path to clear AC.  After that change, though, we can
potentially make it all the way into C code with AC set, which
enlarges the attack surface for SMAP bypass by doing SYSENTER with
AC set.

Strengthen the SMAP protection by addding the missing ASM_CLAC right
at the beginning.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---

This is probably an x86/urgent candidate.  It fixes a minor
hardening regression in 4.4.

It's lightly tested.  It's hard to test well right now because the
4.5 series is completely broken for 32-bit SMAP sytems.

arch/x86/entry/entry_32.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index f3facd40fd2d..9d6165c171eb 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -294,6 +294,7 @@ sysenter_past_esp:
 	pushl	$__USER_DS		/* pt_regs->ss */
 	pushl	%ebp			/* pt_regs->sp (stashed in bp) */
 	pushfl				/* pt_regs->flags (except IF = 0) */
+	ASM_CLAC			/* Clear AC after saving FLAGS */
 	orl	$X86_EFLAGS_IF, (%esp)	/* Fix IF */
 	pushl	$__USER_CS		/* pt_regs->cs */
 	pushl	$0			/* pt_regs->ip = 0 (placeholder) */
-- 
2.5.0

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

end of thread, other threads:[~2016-02-25 20:54 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-23 21:19 [PATCH] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski
2016-02-24 15:46 ` Brian Gerst
2016-02-24 16:56   ` Andy Lutomirski
2016-02-25  5:53 ` [tip:x86/urgent] " tip-bot for Andy Lutomirski
2016-02-25  6:00   ` H. Peter Anvin
2016-02-25  8:07     ` Andy Lutomirski
2016-02-25  8:11       ` Andy Lutomirski
2016-02-25  8:14       ` Ingo Molnar
2016-02-25  8:29         ` Mike Galbraith
2016-02-25  8:40           ` Ingo Molnar
2016-02-25  9:08             ` Mike Galbraith
     [not found]     ` <CALCETrWqCnhxvQ5qNp_O_7K7KW1H3FmHiX=mp+C5oeBEx=3YVA@mail.gmail.com>
2016-02-25 13:47       ` Brian Gerst
2016-02-25 15:42         ` Brian Gerst
2016-02-25 18:20           ` Andy Lutomirski
2016-02-25 18:30             ` Linus Torvalds
2016-02-25 18:40               ` Andy Lutomirski
2016-02-25 19:31               ` Brian Gerst
2016-02-25 19:39                 ` Andy Lutomirski
2016-02-25 19:49                   ` Brian Gerst
2016-02-25 19:52                     ` Andy Lutomirski
2016-02-25 20:54                 ` Linus Torvalds

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.