Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: Peter Gonda <pgonda@google.com>
Cc: thomas.lendacky@amd.com, Dionna Glaze <dionnaglaze@google.com>,
	Michael Roth <michael.roth@amd.com>,
	Haowen Bai <baihaowen@meizu.com>,
	Yang Yingliang <yangyingliang@huawei.com>,
	Marc Orr <marcorr@google.com>,
	David Rientjes <rientjes@google.com>,
	Ashish Kalra <Ashish.Kalra@amd.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH V4] virt: sev: Prevent IV reuse in SNP guest driver
Date: Wed, 16 Nov 2022 13:20:00 +0100	[thread overview]
Message-ID: <Y3TVcJnQ/Ym6dGz2@zn.tnic> (raw)
In-Reply-To: <CAMkAt6o-jcG7u1=zw4jJp5evrO4sFJR-iG_ApF7LhT+7c55_Wg@mail.gmail.com>

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...

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman
(HRB 36809, AG Nürnberg)

  reply	other threads:[~2022-11-16 12:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 15:23 [PATCH V4] virt: sev: Prevent IV reuse in SNP guest driver Peter Gonda
2022-11-04 17:39 ` Tom Lendacky
2022-11-11 16:46 ` Borislav Petkov
2022-11-14 21:11   ` Peter Gonda
2022-11-15 21:36     ` Borislav Petkov
2022-11-15 21:48       ` Peter Gonda
2022-11-15 21:47   ` Peter Gonda
2022-11-16 12:20     ` Borislav Petkov [this message]
2022-11-16 16:23       ` Peter Gonda
2022-11-16 16:58         ` Tom Lendacky
2022-11-16 17:10           ` Peter Gonda
2022-11-16 17:28             ` Borislav Petkov
2022-11-16 17:57               ` Peter Gonda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3TVcJnQ/Ym6dGz2@zn.tnic \
    --to=bp@suse.de \
    --cc=Ashish.Kalra@amd.com \
    --cc=baihaowen@meizu.com \
    --cc=dionnaglaze@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcorr@google.com \
    --cc=michael.roth@amd.com \
    --cc=pgonda@google.com \
    --cc=rientjes@google.com \
    --cc=thomas.lendacky@amd.com \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox