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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240508195842.GIZjvZcpRz0bdkiPWA@fat_crate.local>
Date: Wed, 8 May 2024 21:58:42 +0200
From: Borislav Petkov <bp@...en8.de>
To: Tom Lendacky <thomas.lendacky@....com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
	linux-coco@...ts.linux.dev, svsm-devel@...onut-svsm.dev,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...or.com>, Andy Lutomirski <luto@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Dan Williams <dan.j.williams@...el.com>,
	Michael Roth <michael.roth@....com>,
	Ashish Kalra <ashish.kalra@....com>
Subject: Re: [PATCH v4 05/15] x86/sev: Use kernel provided SVSM Calling Areas

On Wed, May 08, 2024 at 02:13:17PM -0500, Tom Lendacky wrote:
> ok, maybe __perform_svsm_msr_protocol or such.

We'll bikeshed it in the coming weeks.

> There's quite a bit of interaction so I'll make sure to prefix everything.

Ack.

> The paravirt versions of local_irq_save and local_irq_restore can't be used
> as early as this routine is called.

tglx says you should do native_local_irq_save()/.._restore() helpers
just like the arch_local_irq_save()/..._restore() ones but use only
native_ functions without the paravirt gunk.

In a prepatch pls.

> > > +	struct svsm_call call = {};
> > > +	int ret;
> > > +	u64 pa;
> > > +
> > > +	/*
> > > +	 * Record the SVSM Calling Area address (CAA) if the guest is not
> > > +	 * running at VMPL0. The CA will be used to communicate with the
> > > +	 * SVSM to perform the SVSM services.
> > > +	 */
> > > +	setup_svsm_ca(cc_info);
> > > +
> > > +	/* Nothing to do if not running under an SVSM. */
> > > +	if (!vmpl)
> > > +		return;
> > 
> > You set up stuff above and now you bail out?
> 
> setup_svsm_ca() is what sets the vmpl variable. So nothing will have been
> setup if the VMPL is zero, in which case we don't continue on.

You still assign

        /*
         * The CA is identity mapped when this routine is called, both by the
         * decompressor code and the early kernel code.
         */
        boot_svsm_caa = (struct svsm_ca *)caa;
        boot_svsm_caa_pa = caa;

regardless of vmpl.

I think you should assign those only when vmpl != 0.

Otherwise the code is confusing.

> > Judging by setup_svsm_ca() you don't really need that vmpl var but you
> > can check
> > 
> > 	if (!boot_svsm_caa)
> > 		return;
> > 
> > to determine whether a SVSM was detected.
> 
> Yes, but the vmpl var will be used for attestation requests, sysfs, etc.

I guess that comes later in the patchset...

> > Huh, setup_svsm_ca() already assigned those...
> 
> setup_svsm_ca() assigned the ones from the secrets page. The kernel now
> switches to using its own CA.

Comment pls.

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