[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aAwiCTNoQoV2nDfP@google.com>
Date: Fri, 25 Apr 2025 17:00:09 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Ashish Kalra <ashish.kalra@....com>
Cc: pbonzini@...hat.com, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, hpa@...or.com, herbert@...dor.apana.org.au,
x86@...nel.org, john.allen@....com, davem@...emloft.net,
thomas.lendacky@....com, michael.roth@....com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org
Subject: Re: [PATCH v3 4/4] KVM: SVM: Add SEV-SNP CipherTextHiding support
On Fri, Apr 25, 2025, Ashish Kalra wrote:
> On 4/23/2025 4:15 PM, Sean Christopherson wrote:
>
> >
> > if (boot_cpu_has(X86_FEATURE_SEV_ES)) {
> > if (snp_max_snp_asid >= (min_sev_asid - 1))
> > sev_es_supported = false;
>
> SEV-ES is disabled if SNP is using all ASIDs upto min_sev_asid - 1.
>
> > pr_info("SEV-ES %s (ASIDs %u - %u)\n",
> > str_enabled_disabled(sev_es_supported),
> > min_sev_asid > 1 ? snp_max_snp_asid ? snp_max_snp_asid + 1 : 1 :
> > 0, min_sev_asid - 1);
> > }
> >
> > A non-zero snp_max_snp_asid shouldn't break SEV-ES if CipherTextHiding isn't supported.
>
> I don't see above where SEV-ES is broken if snp_max_snp_asid is non-zero and
> CTH is enabled ?
Please read what I wrote. I did not say it's broken if CTH is enabled. I said
it's broken if CTH isn't supported, i.e. is disabled.
snp_max_snp_asid isn't sanitized if CTH is unsupported or disabled by userspace,
and so KVM will compute the wrong min_sev_asid if snp_max_snp_asid is non-zero,
even though snp_max_snp_asid has no bearing on reality.
> >> + */
> >> + if (snp_cipher_text_hiding && sev->es_active) {
> >> + if (vm_type == KVM_X86_SNP_VM)
> >> + max_asid = snp_max_snp_asid;
> >> + else
> >> + min_asid = snp_max_snp_asid + 1;
> >> + }
> >
> > Irrespective of the module params, I would much prefer to have a max_snp_asid
> > param that is kept up-to-date regardless of whether or not CipherTextHiding is
> > enabled.
>
> param ?
Sorry, s/param/variable. Doesn't need to be user visible.
Powered by blists - more mailing lists