]> git.baikalelectronics.ru Git - kernel.git/commit
x86/sev-es: Invalidate the GHCB after completing VMGEXIT
authorTom Lendacky <thomas.lendacky@amd.com>
Mon, 17 May 2021 17:42:33 +0000 (12:42 -0500)
committerBorislav Petkov <bp@suse.de>
Tue, 18 May 2021 05:06:29 +0000 (07:06 +0200)
commit1b4a9dd6fa1dcf1006091cff44699c383fea4486
tree33476d97e3d310cc9b00ff9c8f1b7b639daad30e
parent3680fb81a6e4d0f41f0554e4a22fd6c4fd6d6c94
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: 6caf56f2db409 ("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
arch/x86/kernel/sev-shared.c
arch/x86/kernel/sev.c