Skip to content

Commit c25bbdb

Browse files
joergroedelsuryasaimadhu
authored andcommitted
x86/sev-es: Forward page-faults which happen during emulation
When emulating guest instructions for MMIO or IOIO accesses, the #VC handler might get a page-fault and will not be able to complete. Forward the page-fault in this case to the correct handler instead of killing the machine. Fixes: 0786138 ("x86/sev-es: Add a Runtime #VC Exception Handler") Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: [email protected] # v5.10+ Link: https://lkml.kernel.org/r/[email protected]
1 parent b250f2f commit c25bbdb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/x86/kernel/sev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,10 @@ static __always_inline void vc_forward_exception(struct es_em_ctxt *ctxt)
12701270
case X86_TRAP_UD:
12711271
exc_invalid_op(ctxt->regs);
12721272
break;
1273+
case X86_TRAP_PF:
1274+
write_cr2(ctxt->fi.cr2);
1275+
exc_page_fault(ctxt->regs, error_code);
1276+
break;
12731277
case X86_TRAP_AC:
12741278
exc_alignment_check(ctxt->regs, error_code);
12751279
break;

0 commit comments

Comments
 (0)