From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759868AbcBYFy4 (ORCPT ); Thu, 25 Feb 2016 00:54:56 -0500 Received: from torg.zytor.com ([198.137.202.12]:54432 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759232AbcBYFyw (ORCPT ); Thu, 25 Feb 2016 00:54:52 -0500 Date: Wed, 24 Feb 2016 21:53:53 -0800 From: tip-bot for Andy Lutomirski Message-ID: Cc: dvlasenk@redhat.com, bp@alien8.de, luto@amacapital.net, hpa@zytor.com, luto@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, tglx@linutronix.de, brgerst@gmail.com, mingo@kernel.org, peterz@infradead.org Reply-To: peterz@infradead.org, brgerst@gmail.com, mingo@kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, luto@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, luto@amacapital.net, bp@alien8.de, dvlasenk@redhat.com In-Reply-To: <3e36be110724896e32a4a1fe73bacb349d3cba94.1456262295.git.luto@kernel.org> References: <3e36be110724896e32a4a1fe73bacb349d3cba94.1456262295.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Git-Commit-ID: 04d1d281dcfe683a53cddfab8371fc8bb302b069 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 04d1d281dcfe683a53cddfab8371fc8bb302b069 Gitweb: http://git.kernel.org/tip/04d1d281dcfe683a53cddfab8371fc8bb302b069 Author: Andy Lutomirski AuthorDate: Tue, 23 Feb 2016 13:19:29 -0800 Committer: Ingo Molnar CommitDate: Wed, 24 Feb 2016 08:43:04 +0100 x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 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 Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/3e36be110724896e32a4a1fe73bacb349d3cba94.1456262295.git.luto@kernel.org Signed-off-by: Ingo Molnar --- 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 77d8c51..bb3e376 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) */