Hi,
We found another mismatch in KVM depending on whether EPT is enabled.
The test case executes a "OR %AX,%SP" / "OR %EAX,%ESP' (09 c4)
instruction that ignores the top 16-bits of ESP when EPT=0 but not when
EPT=1. The test case (https://pastebin.com/h2q509PV) initializes the VM
with RAX=0xf0000001, RFLAGS=0x2, RIP=0x0, and RSP=0xc0000000.
These are the mismatched final results:
sudo insmod kvm-intel.ko
sudo ./reproduce-or_eax_esp_incorrect
Executing KVM_RUN
KVM_RUN exited (exit_reason: 5, KVM_EXIT_HLT)
RAX: 0xf0000001
RSP: 0xf0000001
EFLAGS: 0x82
RIP: 0x3
sudo insmod kvm-intel.ko ept=0
sudo ./reproduce-or_eax_esp_incorrect
Executing KVM_RUN
KVM_RUN exited (exit_reason: 5, KVM_EXIT_HLT)
RAX: 0xf0000001
RSP: 0xc0000001
EFLAGS: 0x2
RIP: 0x3
Thanks,
Pedro