Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754012AbcCBLUO (ORCPT ); Wed, 2 Mar 2016 06:20:14 -0500 Received: from mail.skyhub.de ([78.46.96.112]:38875 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751361AbcCBLUM (ORCPT ); Wed, 2 Mar 2016 06:20:12 -0500 From: Borislav Petkov To: "H. Peter Anvin" Cc: X86 ML , LKML , Tom Lendacky Subject: [RFC PATCH] x86: Make sure verify_cpu has a good stack Date: Wed, 2 Mar 2016 12:20:06 +0100 Message-Id: <1456917606-4979-1-git-send-email-bp@alien8.de> X-Mailer: git-send-email 2.3.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1022 Lines: 36 From: Borislav Petkov 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 Signed-off-by: Borislav Petkov --- 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