Skip to content

Commit a8f7e08

Browse files
pgondasuryasaimadhu
authored andcommitted
x86/sev-es: Fix SEV-ES OUT/IN immediate opcode vc handling
The IN and OUT instructions with port address as an immediate operand only use an 8-bit immediate (imm8). The current VC handler uses the entire 32-bit immediate value but these instructions only set the first bytes. Cast the operand to an u8 for that. [ bp: Massage commit message. ] Fixes: 25189d0 ("x86/sev-es: Add support for handling IOIO exceptions") Signed-off-by: Peter Gonda <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: David Rientjes <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent d1c5246 commit a8f7e08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kernel/sev-es-shared.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,14 @@ static enum es_result vc_ioio_exitinfo(struct es_em_ctxt *ctxt, u64 *exitinfo)
305305
case 0xe4:
306306
case 0xe5:
307307
*exitinfo |= IOIO_TYPE_IN;
308-
*exitinfo |= (u64)insn->immediate.value << 16;
308+
*exitinfo |= (u8)insn->immediate.value << 16;
309309
break;
310310

311311
/* OUT immediate opcodes */
312312
case 0xe6:
313313
case 0xe7:
314314
*exitinfo |= IOIO_TYPE_OUT;
315-
*exitinfo |= (u64)insn->immediate.value << 16;
315+
*exitinfo |= (u8)insn->immediate.value << 16;
316316
break;
317317

318318
/* IN register opcodes */

0 commit comments

Comments
 (0)