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: <aL9srWU7gnKJzeig@google.com>
Date: Mon, 8 Sep 2025 16:54:21 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Tom Lendacky <thomas.lendacky@....com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Michael Roth <michael.roth@....com>
Subject: Re: [PATCH] KVM: SEV: Reject non-positive effective lengths during LAUNCH_UPDATE

On Mon, Sep 08, 2025, Tom Lendacky wrote:
> On 8/26/25 18:37, Sean Christopherson wrote:
> > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> > index f4381878a9e5..746a57bf1f71 100644
> > --- a/arch/x86/kvm/svm/sev.c
> > +++ b/arch/x86/kvm/svm/sev.c
> > @@ -2360,6 +2360,8 @@ static int snp_launch_update(struct kvm *kvm, struct kvm_sev_cmd *argp)
> >  		return -EINVAL;
> >  
> >  	npages = params.len / PAGE_SIZE;
> > +	if (npages <= 0)
> > +		return -EINVAL;
> 
> Would it make sense to include a !params.len in the giant if check just
> above this, e.g.:
> 
> 	if (!params.len || !PAGE_ALIGNED(params.len) || ...
> 
> ?
> 
> That way everything related to checking "params" remains in the one
> statement.

Oh, yeah, duh.  I overlooked that the only way for npages to be '0' is if
params.len is '0', because the PAGE_ALIGNED() check will handed len == 1-4095.

Will send a v2.  Thanks Tom!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ