mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	 "Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>
Cc: kvm@vger.kernel.org, virtualization@lists.linux.dev,
	 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH v2 0/3] vhost_task: Fix a bug where KVM wakes an exited task
Date: Wed, 27 Aug 2025 12:41:04 -0700	[thread overview]
Message-ID: <20250827194107.4142164-1-seanjc@google.com> (raw)

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


             reply	other threads:[~2025-08-27 19:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27 19:41 Sean Christopherson [this message]
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-09-15 22:23     ` Michael S. Tsirkin
2025-08-28  2:42   ` Lei Yang
2025-09-18 15:09   ` Michael S. Tsirkin
2025-09-18 15:48     ` Sebastian Andrzej Siewior
2025-09-18 16:04       ` Sean Christopherson
2025-09-18 16:08         ` Michael S. Tsirkin
2025-09-18 16:52           ` Sean Christopherson
2025-09-18 17:40             ` Michael S. Tsirkin
2025-09-18 17:58               ` Sean Christopherson
2025-09-18 16:06       ` Michael S. Tsirkin
2025-09-18 18:11         ` [PATCH] vhost: Take a reference on the task that is reference in struct vhost_task Sebastian Andrzej Siewior
2025-09-19 21:15           ` Sean Christopherson
2025-09-21 20:56           ` Michael S. Tsirkin
2025-09-21 21:40             ` Michael S. Tsirkin
2025-09-15 21:03 ` [PATCH v2 0/3] vhost_task: Fix a bug where KVM wakes an exited task Sean Christopherson
2025-09-15 22:20   ` Michael S. Tsirkin
2025-09-15 22:22     ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250827194107.4142164-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=bigeasy@linutronix.de \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®