x86/sev: Fix SEV check in sev_map_percpu_data()
Subsystems (3)
PATCH 1/1 x86/sev: 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]>
--- arch/x86/kernel/kvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/kvm.c +2 -1
@@ -434,7 +434,8 @@ static void __init sev_map_percpu_data(void) {int cpu; -if (!cc_platform_has (CC_ATTR_GUEST_MEM_ENCRYPT )) +if (cc_vendor !=CC_VENDOR_AMD || + !cc_platform_has (CC_ATTR_GUEST_MEM_ENCRYPT ))return ;for_each_possible_cpu (cpu) {
Signature · 1 line
2.41.0
Borislav Petkov
maintainerQuoted 7 lines · Kirill A. Shutemov
The function
sev_map_percpu_data()checks if it is running on an SEV platform by checking theCC_ATTR_GUEST_MEM_ENCRYPTattribute. However, this attribute is also defined for TDX.To avoid false positives, add a
cc_vendorcheck.Signed-off-by Kirill A. Shutemov <[email protected]>
Fixes 4d96f9109109 ("x86/sev: Replace occurrences of sev_active() with cc_platform_has()")
Suggested-by Borislav Petkov (AMD) <[email protected]>
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 7 lines · Kirill A. Shutemov
The function
sev_map_percpu_data()checks if it is running on an SEV platform by checking theCC_ATTR_GUEST_MEM_ENCRYPTattribute. However, this attribute is also defined for TDX.To avoid false positives, add a
cc_vendorcheck.Signed-off-by Kirill A. Shutemov <[email protected]>
Acked-by David Rientjes <[email protected]>