On Tue, 09 Jan 2024 16:42:39 -0800, Sean Christopherson wrote: > When handling the end of an mmu_notifier invalidation, WARN if > mn_active_invalidate_count is already 0 do not decrement it further, i.e. > avoid causing mn_active_invalidate_count to underflow/wrap. In the worst > case scenario, effectively corrupting mn_active_invalidate_count could > cause kvm_swap_active_memslots() to hang indefinitely. > > end() calls are *supposed* to be paired with start(), i.e. underflow can > only happen if there is a bug elsewhere in the kernel, but due to lack of > lockdep assertions in the mmu_notifier helpers, it's all too easy for a > bug to go unnoticed for some time, e.g. see the recently introduced > PAGEMAP_SCAN ioctl(). > > [...] Applied to kvm-x86 generic, thanks! [1/1] KVM: Harden against unpaired kvm_mmu_notifier_invalidate_range_end() calls https://github.com/kvm-x86/linux/commit/d489ec956583 -- https://github.com/kvm-x86/linux/tree/next