Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753105AbcD2Ku4 (ORCPT ); Fri, 29 Apr 2016 06:50:56 -0400 Received: from terminus.zytor.com ([198.137.202.10]:54666 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753059AbcD2Kuy (ORCPT ); Fri, 29 Apr 2016 06:50:54 -0400 Date: Fri, 29 Apr 2016 03:49:53 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: bp@alien8.de, tglx@linutronix.de, dvlasenk@redhat.com, mingo@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, peterz@infradead.org, luto@kernel.org, luto@amacapital.net, brgerst@gmail.com, hpa@zytor.com Reply-To: luto@kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, bp@alien8.de, tglx@linutronix.de, mingo@kernel.org, dvlasenk@redhat.com, hpa@zytor.com, luto@amacapital.net, brgerst@gmail.com In-Reply-To: <1a6c4d3a8a4e7be79ba448b42685e0321d50c14c.1461698311.git.luto@kernel.org> References: <1a6c4d3a8a4e7be79ba448b42685e0321d50c14c.1461698311.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/segments/64: When load_gs_index fails, clear the base Git-Commit-ID: b038c842b385f1470f991078e71b7c5b084a7341 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 Content-Length: 1562 Lines: 44 Commit-ID: b038c842b385f1470f991078e71b7c5b084a7341 Gitweb: http://git.kernel.org/tip/b038c842b385f1470f991078e71b7c5b084a7341 Author: Andy Lutomirski AuthorDate: Tue, 26 Apr 2016 12:23:27 -0700 Committer: Ingo Molnar CommitDate: Fri, 29 Apr 2016 11:56:41 +0200 x86/segments/64: When load_gs_index fails, clear the base On AMD CPUs, a failed load_gs_base currently may not clear the FS base. Fix it. 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/1a6c4d3a8a4e7be79ba448b42685e0321d50c14c.1461698311.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/entry/entry_64.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 1693c17..6344629 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -794,6 +794,12 @@ END(native_load_gs_index) /* running with kernelgs */ bad_gs: SWAPGS /* switch back to user gs */ +.macro ZAP_GS + /* This can't be a string because the preprocessor needs to see it. */ + movl $__USER_DS, %eax + movl %eax, %gs +.endm + ALTERNATIVE "", "ZAP_GS", X86_BUG_NULL_SEG xorl %eax, %eax movl %eax, %gs jmp 2b