KVM: selftests: Provide valid inputs for MONITOR/MWAIT regs
Provide valid inputs for RAX, RCX, and RDX when testing whether or not
KVM injects a #UD on MONITOR/MWAIT. SVM has a virtualization hole and
checks for _all_ faults before checking for intercepts, e.g. MONITOR with
an unsupported RCX will #GP before KVM gets a chance to intercept and
emulate.
Fixes: 2325d4dd73
("KVM: selftests: Add MONITOR/MWAIT quirk test")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20220711225753.1073989-3-seanjc@google.com
This commit is contained in:
Родитель
874190fd4e
Коммит
b624ae3541
|
@ -28,13 +28,17 @@ static void guest_monitor_wait(int testcase)
|
|||
|
||||
GUEST_SYNC(testcase);
|
||||
|
||||
vector = kvm_asm_safe("monitor");
|
||||
/*
|
||||
* Arbitrarily MONITOR this function, SVM performs fault checks before
|
||||
* intercept checks, so the inputs for MONITOR and MWAIT must be valid.
|
||||
*/
|
||||
vector = kvm_asm_safe("monitor", "a"(guest_monitor_wait), "c"(0), "d"(0));
|
||||
if (fault_wanted)
|
||||
GUEST_ASSERT_2(vector == UD_VECTOR, testcase, vector);
|
||||
else
|
||||
GUEST_ASSERT_2(!vector, testcase, vector);
|
||||
|
||||
vector = kvm_asm_safe("mwait");
|
||||
vector = kvm_asm_safe("mwait", "a"(guest_monitor_wait), "c"(0), "d"(0));
|
||||
if (fault_wanted)
|
||||
GUEST_ASSERT_2(vector == UD_VECTOR, testcase, vector);
|
||||
else
|
||||
|
|
Загрузка…
Ссылка в новой задаче