If the APIC is in x2APIC mode, accesses via MMIO are not working (APIC
behaves like disabled). If Jailhouse executes them, it can be tricked to
access x2APIC registers that are invalid, causing a hypervisor-side #GP.
Prevent this by bailing out early.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
struct mmio_instruction inst;
u32 val;
+ if (using_x2apic) {
+ panic_printk("FATAL: xAPIC access in x2APIC mode\n");
+ return 0;
+ }
+
inst = x86_mmio_parse(rip, pg_structs, is_write);
if (inst.inst_len == 0)
return 0;