aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm/nested.c
diff options
context:
space:
mode:
authorLi RongQing <[email protected]>2025-01-22 07:34:56 +0000
committerSean Christopherson <[email protected]>2025-02-12 18:16:26 +0000
commit82c470121c7ba970ad866a08a78eae067b523993 (patch)
tree2994fda8cd2e9020b935e49df0ed6d36eec705a5 /arch/x86/kvm/svm/nested.c
parentKVM: x86: Wake vCPU for PIC interrupt injection iff a valid IRQ was found (diff)
downloadkernel-82c470121c7ba970ad866a08a78eae067b523993.tar.gz
kernel-82c470121c7ba970ad866a08a78eae067b523993.zip
KVM: x86: Use kvfree_rcu() to free old optimized APIC map
Use kvfree_rcu() to free the old optimized APIC instead of open coding a rough equivalent via call_rcu() and a callback function. Note, there is a subtle function change as rcu_barrier() doesn't wait on kvfree_rcu(), but does wait on call_rcu(). Not forcing rcu_barrier() to wait is safe and desirable in this case, as KVM doesn't care when an old map is actually freed. In fact, using kvfree_rcu() fixes a largely theoretical use-after-free. Because KVM _doesn't_ do rcu_barrier() to wait for kvm_apic_map_free() to complete, if KVM-the-module is unloaded in the RCU grace period before kvm_apic_map_free() is invoked, KVM's callback could run after module unload. Signed-off-by: Li RongQing <[email protected]> Reviewed-by: Neeraj Upadhyay <[email protected]> Link: https://lore.kernel.org/r/[email protected] [sean: rework changelog, call out rcu_barrier() interaction] Signed-off-by: Sean Christopherson <[email protected]>
Diffstat (limited to 'arch/x86/kvm/svm/nested.c')
0 files changed, 0 insertions, 0 deletions