From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965730AbcCJLDS (ORCPT ); Thu, 10 Mar 2016 06:03:18 -0500 Received: from torg.zytor.com ([198.137.202.12]:38012 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965646AbcCJLDE (ORCPT ); Thu, 10 Mar 2016 06:03:04 -0500 Date: Thu, 10 Mar 2016 03:01:54 -0800 From: tip-bot for Andy Lutomirski Message-ID: Cc: andrew.cooper3@citrix.com, luto@amacapital.net, brgerst@gmail.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, oleg@redhat.com, luto@kernel.org, hpa@zytor.com, bp@alien8.de, mingo@kernel.org, tglx@linutronix.de, peterz@infradead.org, dvlasenk@redhat.com Reply-To: mingo@kernel.org, tglx@linutronix.de, bp@alien8.de, dvlasenk@redhat.com, peterz@infradead.org, luto@kernel.org, hpa@zytor.com, oleg@redhat.com, luto@amacapital.net, andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, brgerst@gmail.com, torvalds@linux-foundation.org In-Reply-To: <3f98b207472dc9784838eb5ca2b89dcc845ce269.1457578375.git.luto@kernel.org> References: <3f98b207472dc9784838eb5ca2b89dcc845ce269.1457578375.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/entry/32: Restore FLAGS on SYSEXIT Git-Commit-ID: c2c9b52fab0d0cf993476ed4c34f24da5a1205ae 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: c2c9b52fab0d0cf993476ed4c34f24da5a1205ae Gitweb: http://git.kernel.org/tip/c2c9b52fab0d0cf993476ed4c34f24da5a1205ae Author: Andy Lutomirski AuthorDate: Wed, 9 Mar 2016 19:00:27 -0800 Committer: Ingo Molnar CommitDate: Thu, 10 Mar 2016 09:48:12 +0100 x86/entry/32: Restore FLAGS on SYSEXIT We weren't restoring FLAGS at all on SYSEXIT. Apparently no one cared. With this patch applied, native kernels should always honor task_pt_regs()->flags, which opens the door for some sys_iopl() cleanups. I'll do those as a separate series, though, since getting it right will involve tweaking some paravirt ops. ( The short version is that, before this patch, sys_iopl(), invoked via SYSENTER, wasn't guaranteed to ever transfer the updated regs->flags, so sys_iopl() had to change the hardware flags register as well. ) Reported-by: Brian Gerst Signed-off-by: Andy Lutomirski Cc: Andrew Cooper Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/3f98b207472dc9784838eb5ca2b89dcc845ce269.1457578375.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/entry/entry_32.S | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index 8daa812..7610906 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -343,6 +343,15 @@ sysenter_past_esp: popl %eax /* pt_regs->ax */ /* + * Restore all flags except IF. (We restore IF separately because + * STI gives a one-instruction window in which we won't be interrupted, + * whereas POPF does not.) + */ + addl $PT_EFLAGS-PT_DS, %esp /* point esp at pt_regs->flags */ + btr $X86_EFLAGS_IF_BIT, (%esp) + popfl + + /* * Return back to the vDSO, which will pop ecx and edx. * Don't bother with DS and ES (they already contain __USER_DS). */