public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Alexey Kardashevskiy <aik@amd.com>
Cc: stable@vger.kernel.org, Nikunj A Dadhania <nikunj@amd.com>
Subject: Re: [PATCH 6.13.y] virt: sev-guest: Move SNP Guest Request data pages handling under snp_cmd_mutex
Date: Mon, 10 Mar 2025 11:35:49 +0100	[thread overview]
Message-ID: <2025031026-entrap-repeal-cec0@gregkh> (raw)
In-Reply-To: <da8e554d-12b2-4e22-a76d-7ddd8cc8a8a6@amd.com>

On Mon, Mar 10, 2025 at 09:13:11PM +1100, Alexey Kardashevskiy wrote:
> 
> 
> On 10/3/25 21:00, Alexey Kardashevskiy wrote:
> > Compared to the SNP Guest Request, the "Extended" version adds data pages
> > for receiving certificates. If not enough pages provided, the HV can
> > report to the VM how much is needed so the VM can reallocate and repeat.
> > 
> > Commit ae596615d93d ("virt: sev-guest: Reduce the scope of SNP command
> > mutex") moved handling of the allocated/desired pages number out of scope
> > of said mutex and create a possibility for a race (multiple instances
> > trying to trigger Extended request in a VM) as there is just one instance
> > of snp_msg_desc per /dev/sev-guest and no locking other than snp_cmd_mutex.
> > 
> > Fix the issue by moving the data blob/size and the GHCB input struct
> > (snp_req_data) into snp_guest_req which is allocated on stack now
> > and accessed by the GHCB caller under that mutex.
> > 
> > Stop allocating SEV_FW_BLOB_MAX_SIZE in snp_msg_alloc() as only one of
> > four callers needs it. Free the received blob in get_ext_report() right
> > after it is copied to the userspace. Possible future users of
> > snp_send_guest_request() are likely to have different ideas about
> > the buffer size anyways.
> > 
> > Fixes: ae596615d93d ("virt: sev-guest: Reduce the scope of SNP command mutex")
> > Cc: stable@vger.kernel.org # 6.13
> > Cc: Nikunj A Dadhania <nikunj@amd.com>
> > Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
> 
> Missed:
> 
> (cherry picked from commit 3e385c0d6ce88ac9916dcf84267bd5855d830748)
> 
> I first cherrypicked and sent, then I read about "cherry-oick -x", sorry for
> the noise. thanks,

Please resend with this in the commit so that our tools pick it up
properly.

thanks,

greg k-h

  reply	other threads:[~2025-03-10 10:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-09 10:29 FAILED: patch "[PATCH] virt: sev-guest: Move SNP Guest Request data pages handling" failed to apply to 6.13-stable tree gregkh
2025-03-10 10:00 ` [PATCH 6.13.y] virt: sev-guest: Move SNP Guest Request data pages handling under snp_cmd_mutex Alexey Kardashevskiy
2025-03-10 10:13   ` Alexey Kardashevskiy
2025-03-10 10:35     ` Greg KH [this message]
2025-03-13  9:01   ` Sasha Levin
2025-03-10 15:35 ` FAILED: patch "[PATCH] virt: sev-guest: Move SNP Guest Request data pages handling" failed to apply to 6.13-stable tree Borislav Petkov
2025-03-11  7:36 ` [PATCH 6.13.y] virt: sev-guest: Move SNP Guest Request data pages handling under snp_cmd_mutex Alexey Kardashevskiy
2025-03-13  9:08   ` Sasha Levin
2025-03-13 11:09     ` Alexey Kardashevskiy
2025-03-13 11:34       ` Greg KH
2025-03-13 12:32         ` Alexey Kardashevskiy

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=2025031026-entrap-repeal-cec0@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=aik@amd.com \
    --cc=nikunj@amd.com \
    --cc=stable@vger.kernel.org \
    /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