gitlab.arm.com will be in the maintainance mode on Wednesday June 29th 01:00 - 10:00 (UTC+1). Repositories is read only during the maintainance.

Commit cfe95239 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini
Browse files

x86: Add one-off test to verify setting LA57 fails when it's unsupported



Add an i386-only test to check that setting CR4.LA57 fails when 5-level
paging is not exposed to the guest.  Old versions of KVM don't intercept
LA57 by default on VMX, which means a clever guest could set LA57
without it being detected by KVM.

This test is i386-only because toggling CR4.LA57 in long mode is
illegal, i.e. won't verify the desired KVM behavior.
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200930043436.29270-1-sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent caa03b51
......@@ -6,6 +6,6 @@ COMMON_CFLAGS += -mno-sse -mno-sse2
cflatobjs += lib/x86/setjmp32.o
tests = $(TEST_DIR)/taskswitch.flat $(TEST_DIR)/taskswitch2.flat \
$(TEST_DIR)/cmpxchg8b.flat
$(TEST_DIR)/cmpxchg8b.flat $(TEST_DIR)/la57.flat
include $(SRCDIR)/$(TEST_DIR)/Makefile.common
#include "libcflat.h"
#include "processor.h"
#include "desc.h"
int main(int ac, char **av)
{
int vector = write_cr4_checking(read_cr4() | X86_CR4_LA57);
int expected = this_cpu_has(X86_FEATURE_LA57) ? 0 : 13;
report(vector == expected, "%s when CR4.LA57 %ssupported",
expected ? "#GP" : "No fault", expected ? "un" : "");
return report_summary();
}
......@@ -253,6 +253,10 @@ arch = x86_64
file = umip.flat
extra_params = -cpu qemu64,+umip
[la57]
file = la57.flat
arch = i386
[vmx]
file = vmx.flat
extra_params = -cpu host,+vmx -append "-exit_monitor_from_l2_test -ept_access* -vmx_smp* -vmx_vmcs_shadow_test -atomic_switch_overflow_msrs_test -vmx_init_signal_test -vmx_apic_passthrough_tpr_threshold_test"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment