This small series fills in two pre-existing TODOs in the x86 SEV selftests. Both are test-only changes; there is no functional change to the kernel.
Patch 1 adds negative coverage to sev_init2_tests: when the platform does not support a given SEV VM type (SEV-ES or SEV-SNP), it verifies that KVM_CREATE_VM rejects that type with -EINVAL. Previously the test only exercised the VM types that were supported, so a mismatch between KVM_CAP_VM_TYPES and the actual KVM_CREATE_VM enforcement would have gone unnoticed. Patch 2 makes sev_smoke_test capture the launch measurement returned by KVM_SEV_LAUNCH_MEASURE for SEV and SEV-ES guests and asserts that it is not all zeros, instead of discarding it. A full attestation-style validation is not possible from the selftest (userspace does not hold the transport keys used to derive the measurement), but a non-zero check catches a PSP/plumbing failure that silently leaves the buffer untouched. SEV-SNP uses a different launch flow and is skipped. Testing: built and run on an AMD EPYC 9755 (Turin) host running this tree (7.2.0-rc2), with sev/sev_es/sev_snp all enabled. Both tests pass. The new rejection path was additionally exercised by reloading kvm_amd with sev_snp=0 so the unsupported types are rejected: under strace, KVM_CREATE_VM for the SEV-ES and SNP types both return -EINVAL and the test passes. checkpatch --strict is clean on both patches. Changes in v2: - Patch 1: fix unreachable fd cleanup in test_create_invalid_type(). TEST_ASSERT() aborts on failure, so the trailing "if (fd >= 0) close(fd)" could never run; close the fd (and latch errno) before the assert instead, so an unexpectedly-created VM is not leaked. Reported-by: Sashiko AI review. - Trimmed the added in-code comments to short high-level notes and moved the detailed rationale into the commit messages. - No functional change to patch 2. v1: https://lore.kernel.org/all/[email protected]/ Hemanth Selam (2): KVM: selftests: SEV: Verify unsupported VM types are rejected at creation KVM: selftests: SEV: Sanity check the launch measurement .../selftests/kvm/x86/sev_init2_tests.c | 27 +++++++++++++++++-- .../selftests/kvm/x86/sev_smoke_test.c | 23 +++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) -- 2.43.7

