x86/sev: Return an error on a returned non-zero SW_EXITINFO1[31:0]
authorTom Lendacky <thomas.lendacky@amd.com>
Fri, 1 Oct 2021 04:42:01 +0000 (23:42 -0500)
committerBorislav Petkov <bp@suse.de>
Fri, 1 Oct 2021 09:14:41 +0000 (11:14 +0200)
After returning from a VMGEXIT NAE event, SW_EXITINFO1[31:0] is checked
for a value of 1, which indicates an error and that SW_EXITINFO2
contains exception information. However, future versions of the GHCB
specification may define new values for SW_EXITINFO1[31:0], so really
any non-zero value should be treated as an error.

Fixes: 597cfe48212a ("x86/boot/compressed/64: Setup a GHCB-based 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> # 5.10+
Link: https://lkml.kernel.org/r/efc772af831e9e7f517f0439b13b41f56bad8784.1633063321.git.thomas.lendacky@amd.com
arch/x86/kernel/sev-shared.c

index 9f90f460a28cc0f49b161188933dba804249acdf..bf1033a62e4806a64a430075fc5b06540f554010 100644 (file)
@@ -130,6 +130,8 @@ static enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb,
                } else {
                        ret = ES_VMM_ERROR;
                }
+       } else if (ghcb->save.sw_exit_info_1 & 0xffffffff) {
+               ret = ES_VMM_ERROR;
        } else {
                ret = ES_OK;
        }