lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240102123018.GBZZQB2gLjDs9QknQS@fat_crate.local>
Date: Tue, 2 Jan 2024 13:30:18 +0100
From: Borislav Petkov <bp@...en8.de>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: Tom Lendacky <thomas.lendacky@....com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	linux-coco@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/coco, x86/sev: Use cpu_feature_enabled() to detect
 SEV guest flavor

On Tue, Jan 02, 2024 at 03:22:33PM +0300, Kirill A. Shutemov wrote:
> On Tue, Dec 05, 2023 at 09:33:37PM +0100, Borislav Petkov wrote:
> > On Tue, Dec 05, 2023 at 07:52:41PM +0100, Borislav Petkov wrote:
> > > So yes, we will fix your issue, no worries. I'm figuring out the
> > > details as we speak.
> > 
> > So you can do for the short term:
> > 
> > ---
> > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> > index c461c1a4b6af..f8999f6d1b00 100644
> > --- a/arch/x86/kernel/kvm.c
> > +++ b/arch/x86/kernel/kvm.c
> > @@ -434,7 +434,7 @@ 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) {
> > ---
> > 
> > until we've sorted out the bigger picture.
> 
> So, there seems no movement on the issue.
> 
> Borislav, could you share your view on the bigger picture. I can try to
> implement it.

cc_platform_has() gets used in arch-agnostic code.

x86 code can use cc_platform_has() or X86_FEATURE as TDX already does.
In the AMD case, cc_platform_has() makes more sense because we need
sev_status which is much earlier there than X86_FEATURE.

So the only thing to "implement" is to check vendor in
sev_map_percpu_data() as mentioned above.

Thx.

-- 
Regards/Gruss,
    Boris.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ