Re: [PATCH] x86/coco, x86/sev: Use cpu_feature_enabled() to detect SEV guest flavor

From: Borislav Petkov
Date: Tue Dec 05 2023 - 09:46:38 EST


On Tue, Dec 05, 2023 at 05:37:38PM +0300, Kirill A. Shutemov wrote:
> The SEV code uses cc_platform_has() checks to detect the SEV flavor.
> However, these checks can sometimes produce false positives depending on
> the context.
>
> For example, sev_map_percpu_data() uses CC_ATTR_GUEST_MEM_ENCRYPT to
> detect SEV guest, but this check will also pass for TDX guests.

Well, a function prefixed with "sev_" should check cc_vendor first...

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette