[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-b038c842b385f1470f991078e71b7c5b084a7341@git.kernel.org>
Date: Fri, 29 Apr 2016 03:49:53 -0700
From: tip-bot for Andy Lutomirski <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: bp@...en8.de, tglx@...utronix.de, dvlasenk@...hat.com,
mingo@...nel.org, torvalds@...ux-foundation.org,
linux-kernel@...r.kernel.org, peterz@...radead.org,
luto@...nel.org, luto@...capital.net, brgerst@...il.com,
hpa@...or.com
Subject: [tip:x86/asm] x86/segments/64: When load_gs_index fails, clear the
base
Commit-ID: b038c842b385f1470f991078e71b7c5b084a7341
Gitweb: http://git.kernel.org/tip/b038c842b385f1470f991078e71b7c5b084a7341
Author: Andy Lutomirski <luto@...nel.org>
AuthorDate: Tue, 26 Apr 2016 12:23:27 -0700
Committer: Ingo Molnar <mingo@...nel.org>
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 <luto@...nel.org>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/1a6c4d3a8a4e7be79ba448b42685e0321d50c14c.1461698311.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
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
Powered by blists - more mailing lists