public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] x86: Make sure verify_cpu has a good stack
@ 2016-03-02 11:20 Borislav Petkov
  2016-03-02 15:55 ` Mika Penttilä
  2016-03-02 16:22 ` Brian Gerst
  0 siblings, 2 replies; 34+ messages in thread
From: Borislav Petkov @ 2016-03-02 11:20 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: X86 ML, LKML, Tom Lendacky

From: Borislav Petkov <bp@suse.de>

04633df0c43d ("x86/cpu: Call verify_cpu() after having entered long mode too")
added the call to verify_cpu() for sanitizing CPU configuration.

The latter uses the stack minimally and it can happen that we land in
startup_64() directly from a 64-bit bootloader. Then we want to use our
own, known good stack.

Do that.

APs don't need this as the trampoline sets up a stack for them.

Reported-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/head_64.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 22fbf9df61bb..d60a044c2fdc 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -64,6 +64,10 @@ startup_64:
 	 * tables and then reload them.
 	 */
 
+	/* Setup a stack for verify_cpu */
+	movq    stack_start - __START_KERNEL_map, %rsp
+	subq	$__START_KERNEL_map, %rsp
+
 	/* Sanitize CPU configuration */
 	call verify_cpu
 
-- 
2.3.5

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

end of thread, other threads:[~2016-03-04  2:25 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-02 11:20 [RFC PATCH] x86: Make sure verify_cpu has a good stack Borislav Petkov
2016-03-02 15:55 ` Mika Penttilä
2016-03-02 16:15   ` Borislav Petkov
2016-03-02 16:38     ` Mika Penttilä
2016-03-02 16:55       ` Borislav Petkov
2016-03-02 17:44         ` Mika Penttilä
2016-03-02 16:22 ` Brian Gerst
2016-03-02 16:25   ` Borislav Petkov
2016-03-02 17:53     ` H. Peter Anvin
2016-03-02 18:15       ` Borislav Petkov
2016-03-02 18:25         ` H. Peter Anvin
2016-03-02 18:39         ` H. Peter Anvin
2016-03-02 19:50           ` Borislav Petkov
2016-03-02 20:46             ` Borislav Petkov
2016-03-02 21:35             ` H. Peter Anvin
2016-03-02 21:46               ` Borislav Petkov
2016-03-02 21:54                 ` H. Peter Anvin
2016-03-02 22:09                   ` Borislav Petkov
2016-03-02 22:11                     ` H. Peter Anvin
2016-03-02 22:28                       ` Borislav Petkov
2016-03-02 22:32                         ` H. Peter Anvin
2016-03-02 22:40                           ` Borislav Petkov
2016-03-03  0:13                           ` Yinghai Lu
2016-03-03  1:00                             ` Yinghai Lu
2016-03-03  2:50                               ` Yinghai Lu
2016-03-03 12:28                           ` Borislav Petkov
2016-03-03 15:26                             ` H. Peter Anvin
2016-03-03 16:29                               ` Borislav Petkov
2016-03-03 20:22                                 ` H. Peter Anvin
2016-03-03 20:54                                   ` Borislav Petkov
2016-03-03 21:22                                     ` H. Peter Anvin
2016-03-03 21:38                                       ` Borislav Petkov
2016-03-04  1:18                             ` Yinghai Lu
2016-03-04  2:25                             ` Yinghai Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox