diff options
author | Tom Lendacky <thomas.lendacky@amd.com> | 2021-05-17 20:42:33 +0300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2021-05-18 08:06:29 +0300 |
commit | a50c5bebc99c525e7fbc059988c6a5ab8680cb76 (patch) | |
tree | 33476d97e3d310cc9b00ff9c8f1b7b639daad30e /arch/x86/kernel/sev-shared.c | |
parent | fea63d54f7a3e74f8ab489a8b82413a29849a594 (diff) | |
download | linux-a50c5bebc99c525e7fbc059988c6a5ab8680cb76.tar.xz |
x86/sev-es: Invalidate the GHCB after completing VMGEXIT
Since the VMGEXIT instruction can be issued from userspace, invalidate
the GHCB after performing VMGEXIT processing in the kernel.
Invalidation is only required after userspace is available, so call
vc_ghcb_invalidate() from sev_es_put_ghcb(). Update vc_ghcb_invalidate()
to additionally clear the GHCB exit code so that it is always presented
as 0 when VMGEXIT has been issued by anything else besides the kernel.
Fixes: 0786138c78e79 ("x86/sev-es: Add a Runtime #VC Exception Handler")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/5a8130462e4f0057ee1184509cd056eedd78742b.1621273353.git.thomas.lendacky@amd.com
Diffstat (limited to 'arch/x86/kernel/sev-shared.c')
-rw-r--r-- | arch/x86/kernel/sev-shared.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c index 6ec8b3bfd76e..9f90f460a28c 100644 --- a/arch/x86/kernel/sev-shared.c +++ b/arch/x86/kernel/sev-shared.c @@ -63,6 +63,7 @@ static bool sev_es_negotiate_protocol(void) static __always_inline void vc_ghcb_invalidate(struct ghcb *ghcb) { + ghcb->save.sw_exit_code = 0; memset(ghcb->save.valid_bitmap, 0, sizeof(ghcb->save.valid_bitmap)); } |