Skip to content

Commit e70316d

Browse files
tlendackybp3tk0v
authored andcommitted
x86/sev: Check for MWAITX and MONITORX opcodes in the #VC handler
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 <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/453d5a7cfb4b9fe818b6fb67f93ae25468bc9e23.1713793161.git.thomas.lendacky@amd.com
1 parent ed30a4a commit e70316d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/kernel/sev-shared.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,12 +1203,14 @@ static enum es_result vc_check_opcode_bytes(struct es_em_ctxt *ctxt,
12031203
break;
12041204

12051205
case SVM_EXIT_MONITOR:
1206-
if (opcode == 0x010f && modrm == 0xc8)
1206+
/* MONITOR and MONITORX instructions generate the same error code */
1207+
if (opcode == 0x010f && (modrm == 0xc8 || modrm == 0xfa))
12071208
return ES_OK;
12081209
break;
12091210

12101211
case SVM_EXIT_MWAIT:
1211-
if (opcode == 0x010f && modrm == 0xc9)
1212+
/* MWAIT and MWAITX instructions generate the same error code */
1213+
if (opcode == 0x010f && (modrm == 0xc9 || modrm == 0xfb))
12121214
return ES_OK;
12131215
break;
12141216

0 commit comments

Comments
 (0)