Skip to content

Commit a9ef277

Browse files
kirylbonzini
authored andcommitted
x86/kvm: Fix SEV check in sev_map_percpu_data()
The function sev_map_percpu_data() checks if it is running on an SEV platform by checking the CC_ATTR_GUEST_MEM_ENCRYPT attribute. However, this attribute is also defined for TDX. To avoid false positives, add a cc_vendor check. Signed-off-by: Kirill A. Shutemov <[email protected]> Fixes: 4d96f91 ("x86/sev: Replace occurrences of sev_active() with cc_platform_has()") Suggested-by: Borislav Petkov (AMD) <[email protected]> Acked-by: David Rientjes <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent d52734d commit a9ef277

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kernel/kvm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ static void __init sev_map_percpu_data(void)
434434
{
435435
int cpu;
436436

437-
if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
437+
if (cc_vendor != CC_VENDOR_AMD ||
438+
!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
438439
return;
439440

440441
for_each_possible_cpu(cpu) {

0 commit comments

Comments
 (0)