[kvm-unit-tests PATCH v3 00/17] x86: Improve CET tests

Sean Christopherson
2025-11-14T00:13:01Z

I didn't want to miss out on the fun :-)

v3:
- Run the test if only one of SHSTK or IBT is supported (e.g. to test
SHSTK on AMD).
- Rename the test from "intel_cet" to just "cet".
- Add an endbr64 in the user_mode trampoline (the test was getting false
passes without ever reaching cet_shstk_far_ret() due to getting the
expected #CP).
- Add testcases to verify KVM rejects emulation as expected.
- Add a comment explaining the SHSTK PTE magic (I forgot about the magic
and spent a long time trying to figure out how the user_mode trampoline
was succeeding if the SHSTK wasn't writable, *sigh*)

Chao Gao (7):
x86: cet: Remove unnecessary memory zeroing for shadow stack
x86: cet: Directly check for #CP exception in run_in_user()
x86: cet: Validate #CP error code
x86: cet: Use report_skip()
x86: cet: Drop unnecessary casting
x86: cet: Validate writing unaligned values to SSP MSR causes #GP
x86: cet: Validate CET states during VMX transitions

Mathias Krause (5):
x86: cet: Make shadow stack less fragile
x86: cet: Simplify IBT test
x86: cet: Use symbolic values for the #CP error codes
x86: cet: Test far returns too
x86: Avoid top-most page for vmalloc on x86-64

Sean Christopherson (4):
x86/run_in_user: Add an "end branch" marker on the user_mode
destination
x86/cet: Run SHSTK and IBT tests as appropriate if either feature is
supported
x86/cet: Drop the "intel_" prefix from the CET testcase
x86/cet: Add testcases to verify KVM rejects emulation of CET
instructions

Yang Weijiang (1):
x86: cet: Pass virtual addresses to invlpg

lib/x86/msr.h | 1 +
lib/x86/usermode.c | 7 ++
lib/x86/vm.c | 2 +
x86/cet.c | 272 +++++++++++++++++++++++++++++++++++----------
x86/lam.c | 10 +-
x86/unittests.cfg | 9 +-
x86/vmx.h | 8 +-
x86/vmx_tests.c | 81 ++++++++++++++
8 files changed, 326 insertions(+), 64 deletions(-)

base-commit: af582a4ebaf7828c200dc7150aa0dbccb60b08a7
--
2.52.0.rc1.455.g30608eb744-goog