netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] vhost_task: Fix a bug where KVM wakes an exited task
@ 2025-08-27 19:41 Sean Christopherson
  2025-08-27 19:41 ` [PATCH v2 1/3] vhost_task: Don't wake KVM x86's recovery thread if vhost task was killed Sean Christopherson
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Sean Christopherson @ 2025-08-27 19:41 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Michael S. Tsirkin,
	Jason Wang
  Cc: kvm, virtualization, netdev, linux-kernel,
	Sebastian Andrzej Siewior

Michael,

Do you want to take this through the vhost tree?  It technically fixes a KVM
bug, but this obviously touches far more vhost code than KVM code, and the
patch that needs to go into 6.17 doesn't touch KVM at all.


Fix a bug where KVM attempts to wake a vhost task that has already exited in
response to a fatal signal, and tack on a few cleanups to harden against
introducing similar bugs in the future.

The issue is firmly a KVM problem, but I opted to fix the bug by making
vhost_task_wake() safe against an exited task as doing so is far simpler and
cleaner than implementing the same functionality in KVM, and I suspect that
if there are other users of vhost_tasks in the future, then there's a good
chance they will want/expect vhost_task to handle that detail.

Note, this only started causing problems when commit 56180dd20c19 ("futex:
Use RCU-based per-CPU reference counting instead of rcuref_t") landed, so
the explosions are "new" in 6.17, but the bug has existed since KVM switched
to vhost_task back in 6.13.

v2:
 - Drop the "safe" postfix variant and make the "default" vhost_task_wake()
   safe. [Michael].
 - Use vhost_task_wake() and __vhost_task_wake() for the public APIs, and
   vhost_task_wake_up_process() for the local helper. [Michael]
 - Drag the signalas back from their Spanish holiday. [Sebastian]

v1: https://lore.kernel.org/all/20250826004012.3835150-1-seanjc@google.com

Sean Christopherson (3):
  vhost_task: Don't wake KVM x86's recovery thread if vhost task was
    killed
  vhost_task: Allow caller to omit handle_sigkill() callback
  KVM: x86/mmu: Don't register a sigkill callback for NX hugepage
    recovery tasks

 arch/x86/kvm/mmu/mmu.c           |  7 +---
 drivers/vhost/vhost.c            |  2 +-
 include/linux/sched/vhost_task.h |  1 +
 kernel/vhost_task.c              | 62 +++++++++++++++++++++++++++-----
 4 files changed, 56 insertions(+), 16 deletions(-)


base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00
-- 
2.51.0.268.g9569e192d0-goog


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-08-28  6:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27 19:41 [PATCH v2 0/3] vhost_task: Fix a bug where KVM wakes an exited task Sean Christopherson
2025-08-27 19:41 ` [PATCH v2 1/3] vhost_task: Don't wake KVM x86's recovery thread if vhost task was killed Sean Christopherson
2025-08-27 19:41 ` [PATCH v2 2/3] vhost_task: Allow caller to omit handle_sigkill() callback Sean Christopherson
2025-08-27 19:41 ` [PATCH v2 3/3] KVM: x86/mmu: Don't register a sigkill callback for NX hugepage recovery tasks Sean Christopherson
2025-08-27 20:10 ` [PATCH v2 0/3] vhost_task: Fix a bug where KVM wakes an exited task Sebastian Andrzej Siewior
2025-08-28  0:16   ` Sean Christopherson
2025-08-28  6:48     ` Sebastian Andrzej Siewior
2025-08-28  2:42   ` Lei Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).