[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <762e3471-834c-ad7f-337e-292394e6dc19@amd.com>
Date: Tue, 15 Aug 2023 10:52:28 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: pgonda@...gle.com, seanjc@...gle.com, theflow@...gle.com,
vkuznets@...hat.com
Subject: Re: [PATCH 3/3] KVM: SEV: remove ghcb variable declarations
On 8/4/23 12:33, Paolo Bonzini wrote:
> To avoid possible time-of-check/time-of-use issues, the GHCB should
> almost never be accessed outside dump_ghcb, sev_es_sync_to_ghcb
> and sev_es_sync_from_ghcb. The only legitimate uses are to set the
> exitinfo fields and to find the address of the scratch area embedded
> in the ghcb. Accessing ghcb_usage also goes through svm->sev_es.ghcb
> in sev_es_validate_vmgexit(), but that is because anyway the value is
> not used.
>
> Removing a shortcut variable that contains the value of svm->sev_es.ghcb
> makes these cases a bit more verbose, but it limits the chance of someone
> reading the ghcb by mistake.
>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
> ---
> arch/x86/kvm/svm/sev.c | 30 ++++++++++++------------------
> 1 file changed, 12 insertions(+), 18 deletions(-)
>
Powered by blists - more mailing lists