* [PATCH] x86/sev: Fix SEV check in sev_map_percpu_data()
@ 2024-01-02 13:37 Kirill A. Shutemov
2024-01-02 14:31 ` Borislav Petkov
2024-01-02 18:27 ` David Rientjes
0 siblings, 2 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2024-01-02 13:37 UTC (permalink / raw)
To: Paolo Bonzini, Wanpeng Li, Vitaly Kuznetsov, Sean Christopherson,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
Tom Lendacky
Cc: x86, kvm, linux-kernel, Kirill A. Shutemov
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 <kirill.shutemov@linux.intel.com>
---
arch/x86/kernel/kvm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 0ddb3bd0f1aa..5b495cfc79bc 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -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) {
--
2.41.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/sev: Fix SEV check in sev_map_percpu_data()
2024-01-02 13:37 [PATCH] x86/sev: Fix SEV check in sev_map_percpu_data() Kirill A. Shutemov
@ 2024-01-02 14:31 ` Borislav Petkov
2024-01-02 18:27 ` David Rientjes
1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2024-01-02 14:31 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Paolo Bonzini, Wanpeng Li, Vitaly Kuznetsov, Sean Christopherson,
Thomas Gleixner, Ingo Molnar, Dave Hansen, Tom Lendacky, x86,
kvm, linux-kernel
On Tue, Jan 02, 2024 at 04:37:47PM +0300, Kirill A. Shutemov wrote:
> 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 <kirill.shutemov@linux.intel.com>
Fixes: 4d96f9109109 ("x86/sev: Replace occurrences of sev_active() with cc_platform_has()")
Suggested-by: Borislav Petkov (AMD) <bp@alien8.de>
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/sev: Fix SEV check in sev_map_percpu_data()
2024-01-02 13:37 [PATCH] x86/sev: Fix SEV check in sev_map_percpu_data() Kirill A. Shutemov
2024-01-02 14:31 ` Borislav Petkov
@ 2024-01-02 18:27 ` David Rientjes
1 sibling, 0 replies; 3+ messages in thread
From: David Rientjes @ 2024-01-02 18:27 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Paolo Bonzini, Wanpeng Li, Vitaly Kuznetsov, Sean Christopherson,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
Tom Lendacky, x86, kvm, linux-kernel
On Tue, 2 Jan 2024, Kirill A. Shutemov wrote:
> 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 <kirill.shutemov@linux.intel.com>
Acked-by: David Rientjes <rientjes@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-02 18:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 13:37 [PATCH] x86/sev: Fix SEV check in sev_map_percpu_data() Kirill A. Shutemov
2024-01-02 14:31 ` Borislav Petkov
2024-01-02 18:27 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®