From: Sean Christopherson Date: Fri, 16 May 2025 21:35:36 +0000 (-0700) Subject: KVM: Bail from the dirty ring reset flow if a signal is pending X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49005a2a3d2a2974db486e330dfb7c8bc85df17f;p=thirdparty%2Flinux.git KVM: Bail from the dirty ring reset flow if a signal is pending Abort a dirty ring reset if the current task has a pending signal, as the hard limit of INT_MAX entries doesn't ensure KVM will respond to a signal in a timely fashion. Fixes: fb04a1eddb1a ("KVM: X86: Implement ring-based dirty memory tracking") Reviewed-by: James Houghton Reviewed-by: Binbin Wu Reviewed-by: Yan Zhao Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20250516213540.2546077-3-seanjc@google.com Signed-off-by: Sean Christopherson --- diff --git a/virt/kvm/dirty_ring.c b/virt/kvm/dirty_ring.c index 77986f34eff84..e844e869e8c7f 100644 --- a/virt/kvm/dirty_ring.c +++ b/virt/kvm/dirty_ring.c @@ -118,6 +118,9 @@ int kvm_dirty_ring_reset(struct kvm *kvm, struct kvm_dirty_ring *ring, cur_slot = cur_offset = mask = 0; while (likely((*nr_entries_reset) < INT_MAX)) { + if (signal_pending(current)) + return -EINTR; + entry = &ring->dirty_gfns[ring->reset_index & (ring->size - 1)]; if (!kvm_dirty_gfn_harvested(entry))