diff options
author | Sean Christopherson <seanjc@google.com> | 2025-06-11 01:57:31 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2025-06-20 23:07:34 +0300 |
commit | 7fe0578041188d63207f17335e8c0d10e19c7515 (patch) | |
tree | 01a56a2cdc61e1c7080c6a4c8154c9179ab0e39d /arch/x86/kvm/svm/nested.c | |
parent | 5c9c084763637460acaeb3e22508c692a70b6905 (diff) | |
download | linux-7fe0578041188d63207f17335e8c0d10e19c7515.tar.xz |
KVM: SVM: Store MSRPM pointer as "void *" instead of "u32 *"
Store KVM's MSRPM pointers as "void *" instead of "u32 *" to guard against
directly accessing the bitmaps outside of code that is explicitly written
to access the bitmaps with a specific type.
Opportunistically use svm_vcpu_free_msrpm() in svm_vcpu_free() instead of
open coding an equivalent.
Link: https://lore.kernel.org/r/20250610225737.156318-27-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/svm/nested.c')
-rw-r--r-- | arch/x86/kvm/svm/nested.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 13de4f63a9c2..f9bda148273e 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -277,6 +277,8 @@ int __init nested_svm_init_msrpm_merge_offsets(void) static bool nested_svm_merge_msrpm(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); + u32 *msrpm02 = svm->nested.msrpm; + u32 *msrpm01 = svm->msrpm; int i; /* @@ -311,7 +313,7 @@ static bool nested_svm_merge_msrpm(struct kvm_vcpu *vcpu) if (kvm_vcpu_read_guest(vcpu, offset, &value, 4)) return false; - svm->nested.msrpm[p] = svm->msrpm[p] | value; + msrpm02[p] = msrpm01[p] | value; } svm->nested.force_msr_bitmap_recalc = false; |