Skip to content

Commit

Permalink
x86/sev: Check for MWAITX and MONITORX opcodes in the #VC handler
Browse files Browse the repository at this point in the history
The MWAITX and MONITORX instructions generate the same #VC error code as
the MWAIT and MONITOR instructions, respectively. Update the #VC handler
opcode checking to also support the MWAITX and MONITORX opcodes.

Fixes: e3ef461 ("x86/sev: Harden #VC instruction emulation somewhat")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/453d5a7cfb4b9fe818b6fb67f93ae25468bc9e23.1713793161.git.thomas.lendacky@amd.com
  • Loading branch information
Tom Lendacky authored and Borislav Petkov (AMD) committed Apr 22, 2024
1 parent ed30a4a commit e70316d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/x86/kernel/sev-shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,12 +1203,14 @@ static enum es_result vc_check_opcode_bytes(struct es_em_ctxt *ctxt,
break;

case SVM_EXIT_MONITOR:
if (opcode == 0x010f && modrm == 0xc8)
/* MONITOR and MONITORX instructions generate the same error code */
if (opcode == 0x010f && (modrm == 0xc8 || modrm == 0xfa))
return ES_OK;
break;

case SVM_EXIT_MWAIT:
if (opcode == 0x010f && modrm == 0xc9)
/* MWAIT and MWAITX instructions generate the same error code */
if (opcode == 0x010f && (modrm == 0xc9 || modrm == 0xfb))
return ES_OK;
break;

Expand Down

0 comments on commit e70316d

Please sign in to comment.