On 01/10/2024 8:11 am, Jan Beulich wrote: > On 30.09.2024 18:18, Andrew Cooper wrote: >> @@ -190,10 +192,12 @@ static bool guest_io_okay(unsigned int port, unsigned >> int bytes, >> toggle_guest_pt(v); >> >> if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 ) >> - return true; >> + return X86EMUL_OKAY; >> } >> >> - return false; >> + x86_emul_hw_exception(X86_EXC_GP, 0, ctxt); > do_general_protection() has > > /* Pass on GPF as is. */ > pv_inject_hw_exception(X86_EXC_GP, regs->error_code); > > which may make a difference in case the insn changes under our feet.
It would make a difference if we chose to raise #GP[non-0]. But, see how the call to pv_emulate_privileged_op() is guarded on error_code == 0. Prior X86EMUL_UNHANDLEABLE can't ever have raised anything other than #GP[0], (excusing cases of memory corruption in regs->error_code). So, there is not a change in behaviour, even if the reason why is less-than-obvious. ~Andrew
