diff options
| author | Sean Christopherson <[email protected]> | 2025-01-18 00:34:53 +0000 |
|---|---|---|
| committer | Sean Christopherson <[email protected]> | 2025-02-12 16:53:59 +0000 |
| commit | cd5a0c2f0faeb4a3fab3b78f6693a2d55ee51efa (patch) | |
| tree | 7d87a24c6bfe70e0cff7e76a2327e61d3f7d1fe6 /tools/testing/selftests/kvm/x86/nested_exceptions_test.c | |
| parent | KVM: selftests: Mark test_hv_cpuid_e2big() static in Hyper-V CPUID test (diff) | |
| download | kernel-cd5a0c2f0faeb4a3fab3b78f6693a2d55ee51efa.tar.gz kernel-cd5a0c2f0faeb4a3fab3b78f6693a2d55ee51efa.zip | |
KVM: selftests: Manage CPUID array in Hyper-V CPUID test's core helper
Allocate, get, and free the CPUID array in the Hyper-V CPUID test in the
test's core helper, instead of copy+pasting code at each call site. In
addition to deduplicating a small amount of code, restricting visibility
of the array to a single invocation of the core test prevents "leaking" an
array across test cases. Passing in @vcpu to the helper will also allow
pivoting on VM-scoped information without needing to pass more booleans,
e.g. to conditionally assert on features that require an in-kernel APIC.
To avoid use-after-free bugs due to overzealous and careless developers,
opportunstically add a comment to explain that the system-scoped helper
caches the Hyper-V CPUID entries, i.e. that the caller is not responsible
for freeing the memory.
Cc: Vitaly Kuznetsov <[email protected]>
Reviewed-by: Vitaly Kuznetsov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
Diffstat (limited to 'tools/testing/selftests/kvm/x86/nested_exceptions_test.c')
0 files changed, 0 insertions, 0 deletions
