[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMkAt6qQmkufbuotzMA4bMJaA4uBFMdk8w7a3X+OH3JaOdFepA@mail.gmail.com>
Date: Wed, 16 Nov 2022 09:23:24 -0700
From: Peter Gonda <pgonda@...gle.com>
To: Borislav Petkov <bp@...e.de>
Cc: thomas.lendacky@....com, Dionna Glaze <dionnaglaze@...gle.com>,
Michael Roth <michael.roth@....com>,
Haowen Bai <baihaowen@...zu.com>,
Yang Yingliang <yangyingliang@...wei.com>,
Marc Orr <marcorr@...gle.com>,
David Rientjes <rientjes@...gle.com>,
Ashish Kalra <Ashish.Kalra@....com>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH V4] virt: sev: Prevent IV reuse in SNP guest driver
On Wed, Nov 16, 2022 at 5:20 AM Borislav Petkov <bp@...e.de> wrote:
>
> On Tue, Nov 15, 2022 at 02:47:31PM -0700, Peter Gonda wrote:
> > > > + * certificate data buffer retry the same guest request without the
> > > > + * extended data request.
> > > > + */
> > > > + if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST &&
> > > > + err == SNP_GUEST_REQ_INVALID_LEN) {
> > > > + const unsigned int certs_npages = snp_dev->input.data_npages;
> > > > +
> > > > + exit_code = SVM_VMGEXIT_GUEST_REQUEST;
> > > > + rc = snp_issue_guest_request(exit_code, &snp_dev->input, &err);
> > > > +
> > > > + err = SNP_GUEST_REQ_INVALID_LEN;
> > >
> > > Huh, why are we overwriting err here?
> >
> > I have added a comment for the next revision.
> >
> > We are overwriting err here so that userspace is alerted that they
> > supplied a buffer too small.
>
> Sure but you're not checking rc either. What if that reissue fails for
> whatever other reason? -EIO for example...
If we get any error here we have to wipe the VMPCK here so I thought
this always override @err was OK.
I can update this to only override @err if after the secondary
SVM_VMGEXIT_GUEST_REQUEST rc and err are OK. Thoughts?
>
> --
> Regards/Gruss,
> Boris.
>
> SUSE Software Solutions Germany GmbH
> GF: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman
> (HRB 36809, AG Nürnberg)
Powered by blists - more mailing lists