aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm/nested.c
diff options
context:
space:
mode:
authorSean Christopherson <[email protected]>2025-06-10 22:57:31 +0000
committerSean Christopherson <[email protected]>2025-06-20 20:07:34 +0000
commit7fe0578041188d63207f17335e8c0d10e19c7515 (patch)
tree01a56a2cdc61e1c7080c6a4c8154c9179ab0e39d /arch/x86/kvm/svm/nested.c
parentKVM: SVM: Move svm_msrpm_offset() to nested.c (diff)
downloadkernel-7fe0578041188d63207f17335e8c0d10e19c7515.tar.gz
kernel-7fe0578041188d63207f17335e8c0d10e19c7515.zip
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/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
Diffstat (limited to 'arch/x86/kvm/svm/nested.c')
-rw-r--r--arch/x86/kvm/svm/nested.c4
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;