Skip to content

nVMX: Fix garbage "host addr size" tests

Sean Christopherson kvm 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7nVMX: Test CR4.PCIDE can be set for 64-bit host iff PCID is supportedx86/vmx_tests.c+6 -40 replies
2/7nVMX: Assert CR4.PAE is set when testing 64-bit hostx86/vmx_tests.c+6 -80 replies
3/7nVMX: Assert that the test is configured for 64-bit modex86/vmx_tests.c+34 -350 replies
4/7nVMX: Rename vmlaunch_succeeds() to vmlaunch()x86/vmx_tests.c+5 -50 replies
5/7nVMX: Shuffle test_host_addr_size() tests to "restore" CR4 and RIPx86/vmx_tests.c+17 -70 replies
6/7nVMX: Drop testcase that falsely claims to verify vmcs.HOST_RIP[63:32]x86/vmx_tests.c+0 -100 replies
7/7nVMX: Fix the noncanonical HOST_RIP testcasex86/vmx_tests.c+29 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [kvm-unit-tests PATCH 0/7] nVMX: Fix garbage "host addr size" tests

This started out as a "simple" fix for vCPUs without PCID, which thanks to a bug on Alderlake/Raptorlake, are suddenly quite prevelant. Then I got the bright idea to tidy up a bit, and lo and behold, test_host_addr_size() is full of garbage.

Patches 2 and 3 are cleanups to reduce indentation and help detect bogus setups.

Patch 4 renames vmlaunch_succeeds(), which has bugged me forever, and would get especially weird when the last patch adds a version that _must_ fail.

Patches 5-7 fix the HOST_RIP testcases. Unsurpisingly, vmlaunch() writes HOST_RIP to ensure the resulting VM-Exit doesn't go into the weeds, which means the tests that write HOST_RIP and expect meaningful test coverage are completely useless. Patch 5 deliberately introduces a test failure by exposing the underlying bugs related to the above.

I could have ordered the patches to not introduce the bug, but I'm more than a bit annoyed at the moment, and I want to highlight the issue, as not restoring/sanitizing state is a massive problem throughout KUT, and the nVMX tests in particular are a horrible mess in this regard.

Patch 6 rips out the HOST_RIP tests that provide no meaningful coverage and have no hope of passing.

Patch 7 fixes the noncanonical HOST_RIP testcase by using a bare VMLAUNCH.

Sean Christopherson (7):
nVMX: Test CR4.PCIDE can be set for 64-bit host iff PCID is supported
nVMX: Assert CR4.PAE is set when testing 64-bit host
nVMX: Assert that the test is configured for 64-bit mode
nVMX: Rename vmlaunch_succeeds() to vmlaunch()
nVMX: Shuffle test_host_addr_size() tests to "restore" CR4 and RIP
nVMX: Drop testcase that falsely claims to verify vmcs.HOST_RIP[63:32]
nVMX: Fix the noncanonical HOST_RIP testcase

 x86/vmx_tests.c | 122 ++++++++++++++++++++++++++++--------------------
 1 file changed, 71 insertions(+), 51 deletions(-)

base-commit: e8f8554f810821e37f05112a46ae9775a029b5d1

Signature · 1 line
2.42.0.283.g2d96d420d3-goog