Joerg Roedel a5a645
From: Joerg Roedel <jroedel@suse.de>
Joerg Roedel a5a645
Date: Thu, 21 Oct 2021 10:08:32 +0200
Joerg Roedel a5a645
Subject: x86/sev: Fix stack type check in vc_switch_off_ist()
Joerg Roedel a5a645
Git-commit: 5681981fb788281b09a4ea14d310d30b2bd89132
Joerg Roedel a5a645
Patch-mainline: v5.16-rc1
Joerg Roedel a5a645
References: git-fixes
Joerg Roedel a5a645
Joerg Roedel a5a645
The value of STACK_TYPE_EXCEPTION_LAST points to the last _valid_
Joerg Roedel a5a645
exception stack. Reflect that in the check done in the
Joerg Roedel a5a645
vc_switch_off_ist() function.
Joerg Roedel a5a645
Joerg Roedel a5a645
Fixes: a13644f3a53de ("x86/entry/64: Add entry code for #VC handler")
Joerg Roedel a5a645
Reported-by: Tom Lendacky <thomas.lendacky@amd.com>
Joerg Roedel a5a645
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Joerg Roedel a5a645
Signed-off-by: Borislav Petkov <bp@suse.de>
Joerg Roedel a5a645
Link: https://lkml.kernel.org/r/20211021080833.30875-2-joro@8bytes.org
Joerg Roedel a5a645
---
Joerg Roedel a5a645
 arch/x86/kernel/traps.c |    2 +-
Joerg Roedel a5a645
 1 file changed, 1 insertion(+), 1 deletion(-)
Joerg Roedel a5a645
Joerg Roedel a5a645
--- a/arch/x86/kernel/traps.c
Joerg Roedel a5a645
+++ b/arch/x86/kernel/traps.c
Joerg Roedel a5a645
@@ -674,7 +674,7 @@ asmlinkage __visible struct pt_regs *vc_
Joerg Roedel a5a645
 	stack = (unsigned long *)sp;
Joerg Roedel a5a645
 
Joerg Roedel a5a645
 	if (!get_stack_info_noinstr(stack, current, &info) || info.type == STACK_TYPE_ENTRY ||
Joerg Roedel a5a645
-	    info.type >= STACK_TYPE_EXCEPTION_LAST)
Joerg Roedel a5a645
+	    info.type > STACK_TYPE_EXCEPTION_LAST)
Joerg Roedel a5a645
 		sp = __this_cpu_ist_top_va(VC2);
Joerg Roedel a5a645
 
Joerg Roedel a5a645
 sync: