[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D0RTQRSRDNAZ.LG7O2824KXOW@kernel.org>
Date: Wed, 24 Apr 2024 00:36:18 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Michael Roth" <michael.roth@....com>, <kvm@...r.kernel.org>
Cc: <linux-coco@...ts.linux.dev>, <linux-mm@...ck.org>,
<linux-crypto@...r.kernel.org>, <x86@...nel.org>,
<linux-kernel@...r.kernel.org>, <tglx@...utronix.de>, <mingo@...hat.com>,
<jroedel@...e.de>, <thomas.lendacky@....com>, <hpa@...or.com>,
<ardb@...nel.org>, <pbonzini@...hat.com>, <seanjc@...gle.com>,
<vkuznets@...hat.com>, <jmattson@...gle.com>, <luto@...nel.org>,
<dave.hansen@...ux.intel.com>, <slp@...hat.com>, <pgonda@...gle.com>,
<peterz@...radead.org>, <srinivas.pandruvada@...ux.intel.com>,
<rientjes@...gle.com>, <dovmurik@...ux.ibm.com>, <tobin@....com>,
<bp@...en8.de>, <vbabka@...e.cz>, <kirill@...temov.name>,
<ak@...ux.intel.com>, <tony.luck@...el.com>,
<sathyanarayanan.kuppuswamy@...ux.intel.com>, <alpergun@...gle.com>,
<ashish.kalra@....com>, <nikunj.dadhania@....com>, <pankaj.gupta@....com>,
<liam.merwick@...cle.com>
Subject: Re: [PATCH v14 28/22] [SQUASH] KVM: SEV: Provide support for
SNP_EXTENDED_GUEST_REQUEST NAE event
On Tue Apr 23, 2024 at 7:21 PM EEST, Michael Roth wrote:
> Ensure an error is returned if a non-SNP guest attempts to issue an
> Extended Guest Request. Also add input validation for RAX/RBX.
>
> Signed-off-by: Michael Roth <michael.roth@....com>
> ---
> arch/x86/kvm/svm/sev.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 2b30b3b0eec8..ff64ed8df301 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -3297,6 +3297,11 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm)
> goto vmgexit_err;
> break;
> case SVM_VMGEXIT_EXT_GUEST_REQUEST:
> + if (!sev_snp_guest(vcpu->kvm))
> + goto vmgexit_err;
> + if (!kvm_ghcb_rax_is_valid(svm) ||
> + !kvm_ghcb_rbx_is_valid(svm))
> + goto vmgexit_err;
Hmm... maybe I'm ignoring something but why this is not just:
if (!sev_snp_guest(vcpu->kvm) ||
!kvm_ghcb_rax_is_valid(svm) ||
!kvm_ghcb_rbx_is_valid(svm)))
since they branch to the same location.
BR, Jarkko
Powered by blists - more mailing lists