mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: pgonda@google.com, seanjc@google.com, theflow@google.com,
	vkuznets@redhat.com, stable@vger.kernel.org
Subject: Re: [PATCH 1/3] KVM: SEV: snapshot the GHCB before accessing it
Date: Tue, 15 Aug 2023 10:44:39 -0500	[thread overview]
Message-ID: <7e396697-afc8-51cc-07de-882499532b68@amd.com> (raw)
In-Reply-To: <20230804173355.51753-2-pbonzini@redhat.com>

On 8/4/23 12:33, Paolo Bonzini wrote:
> Validation of the GHCB is susceptible to time-of-check/time-of-use vulnerabilities.
> To avoid them, we would like to always snapshot the fields that are read in
> sev_es_validate_vmgexit(), and not use the GHCB anymore after it returns.
> 
> This means:
> 
> - invoking sev_es_sync_from_ghcb() before any GHCB access, including before
>    sev_es_validate_vmgexit()
> 
> - snapshotting all fields including the valid bitmap and the sw_scratch field,
>    which are currently not caching anywhere.
> 
> The valid bitmap is the first thing to be copied out of the GHCB; then,
> further accesses will use the copy in svm->sev_es.
> 
> Fixes: 291bd20d5d88 ("KVM: SVM: Add initial support for a VMGEXIT VMEXIT")
> Cc: stable@vger.kernel.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>   arch/x86/kvm/svm/sev.c | 69 +++++++++++++++++++++---------------------
>   arch/x86/kvm/svm/svm.h | 26 ++++++++++++++++
>   2 files changed, 61 insertions(+), 34 deletions(-)
> 

  reply	other threads:[~2023-08-15 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04 17:33 [PATCH 0/3] KVM: SEV: only access GHCB fields once Paolo Bonzini
2023-08-04 17:33 ` [PATCH 1/3] KVM: SEV: snapshot the GHCB before accessing it Paolo Bonzini
2023-08-15 15:44   ` Tom Lendacky [this message]
2023-08-04 17:33 ` [PATCH 2/3] KVM: SEV: only access GHCB fields once Paolo Bonzini
2023-08-15 15:51   ` Tom Lendacky
2023-08-04 17:33 ` [PATCH 3/3] KVM: SEV: remove ghcb variable declarations Paolo Bonzini
2023-08-15 15:52   ` Tom Lendacky
2023-08-09 14:38 ` [PATCH 0/3] KVM: SEV: only access GHCB fields once Peter Gonda
2023-08-14 12:58 ` Tom Lendacky

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=7e396697-afc8-51cc-07de-882499532b68@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=pgonda@google.com \
    --cc=seanjc@google.com \
    --cc=stable@vger.kernel.org \
    --cc=theflow@google.com \
    --cc=vkuznets@redhat.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

all inboxes | Powered by JetHome®