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]
Date: Mon, 13 May 2024 16:18:21 -0500
From: Michael Roth <michael.roth@....com>
To: Paolo Bonzini <pbonzini@...hat.com>
CC: Nathan Chancellor <nathan@...nel.org>, <kvm@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, Sean Christopherson <seanjc@...gle.com>,
	<llvm@...ts.linux.dev>
Subject: Re: [PULL 18/19] KVM: SEV: Provide support for
 SNP_EXTENDED_GUEST_REQUEST NAE event

On Mon, May 13, 2024 at 12:05:35PM -0500, Michael Roth wrote:
> On Mon, May 13, 2024 at 06:53:24PM +0200, Paolo Bonzini wrote:
> > On 5/13/24 17:19, Nathan Chancellor wrote:
> > > > +static int snp_begin_ext_guest_req(struct kvm_vcpu *vcpu)
> > > > +{
> > > > +	int vmm_ret = SNP_GUEST_VMM_ERR_GENERIC;
> > > > +	struct vcpu_svm *svm = to_svm(vcpu);
> > > > +	unsigned long data_npages;
> > > > +	sev_ret_code fw_err;
> > > > +	gpa_t data_gpa;
> > > > +
> > > > +	if (!sev_snp_guest(vcpu->kvm))
> > > > +		goto abort_request;
> > > > +
> > > > +	data_gpa = vcpu->arch.regs[VCPU_REGS_RAX];
> > > > +	data_npages = vcpu->arch.regs[VCPU_REGS_RBX];
> > > > +
> > > > +	if (!IS_ALIGNED(data_gpa, PAGE_SIZE))
> > > > +		goto abort_request;
> > > 
> > > [...]
> > > 
> > > > +abort_request:
> > > > +	ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, SNP_GUEST_ERR(vmm_ret, fw_err));
> > > > +	return 1; /* resume guest */
> > > > +}
> > > 
> > > This patch is now in -next as commit 32fde9e18b3f ("KVM: SEV: Provide
> > > support for SNP_EXTENDED_GUEST_REQUEST NAE event"), where it causes a
> > > clang warning (or hard error when CONFIG_WERROR is enabled) [...]
> > > Seems legitimate to me. What was the intention here?
> > 
> > Mike, I think this should just be 0?
> 
> Hi Paolo,
> 
> Yes, I was just about to submit a patch that does just that:
> 
>   https://github.com/mdroth/linux/commit/df55e9c5b97542fe037f5b5293c11a49f7c658ef

Submitted a proper patch here:

  https://lore.kernel.org/kvm/20240513172704.718533-1-michael.roth@amd.com/

and also one for a separate warning:

  https://lore.kernel.org/kvm/20240513181928.720979-1-michael.roth@amd.com/

I saw my build environment had WARN=0 for the last round of changes, so I
re-tested various kernel configs with/without clang and haven't seen any
other issues. So I think that should be the last of it. I'll be sure to be
a lot more careful about this in the future.

Thanks,

Mike

> 
> Sorry for the breakage,
> 
> Mike
> 
> > 
> > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> > index c7a0971149f2..affb4fb47f91 100644
> > --- a/arch/x86/kvm/svm/sev.c
> > +++ b/arch/x86/kvm/svm/sev.c
> > @@ -3911,7 +3911,6 @@ static int snp_begin_ext_guest_req(struct kvm_vcpu *vcpu)
> >  	int vmm_ret = SNP_GUEST_VMM_ERR_GENERIC;
> >  	struct vcpu_svm *svm = to_svm(vcpu);
> >  	unsigned long data_npages;
> > -	sev_ret_code fw_err;
> >  	gpa_t data_gpa;
> >  	if (!sev_snp_guest(vcpu->kvm))
> > @@ -3938,7 +3937,7 @@ static int snp_begin_ext_guest_req(struct kvm_vcpu *vcpu)
> >  	return 0; /* forward request to userspace */
> >  abort_request:
> > -	ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, SNP_GUEST_ERR(vmm_ret, fw_err));
> > +	ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, SNP_GUEST_ERR(vmm_ret, 0));
> >  	return 1; /* resume guest */
> >  }
> > Paolo
> > 
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ