From: sashiko-bot@kernel.org
To: "Yaohan Li" <shunsheng1218@gmail.com>
Cc: virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH] vhost: synchronize worker freeing on vhost-net teardown
Date: Tue, 17 Nov 2026 15:22:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-219054@kernel.org> (raw)
In-Reply-To: <20261117145314.1092372-1-shunsheng1218@gmail.com>
> vhost_workers_free() only waits for RCU readers when sync is true. Both
> vhost-net teardown paths pass false, relying on the assumption recorded
> when the sync parameter was introduced (5efd97e6f0c7) that "net and scsi
> stop their virtqueues before the workers are freed".
>
> That assumption does not hold when a tap queue is detached while the
> socket is still attached. __tun_detach() runs tun_queue_purge() on the
> detaching thread, so skb_queue_purge() releases the zerocopy skbs and
> vhost_zerocopy_complete() -> vhost_poll_queue() runs there rather than on
> the vhost worker. The vhost_dev_flush() calls in vhost_net_flush() and
> vhost_dev_stop() only wait for the vhost workers, so the queueing can
> still be in flight when vhost_dev_cleanup() frees the worker, and
> vhost_worker_queue() then dereferences freed memory.
>
> Pass sync=true from vhost_net_release() and vhost_net_reset_owner() so a
> [ ... ]
> Both teardown paths reproduce the use-after-free on this base, and both
> are clean with this change while the injection is still taken. The same
> injection reproduced on the earlier base where the analysis was done.
>
> Signed-off-by: Yaohan Li <shunsheng1218@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117145314.1092372-1-shunsheng1218@gmail.com?part=1
prev parent reply other threads:[~2026-11-17 15:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 14:53 [PATCH] vhost: synchronize worker freeing on vhost-net teardown Yaohan Li
2026-11-17 15:22 ` sashiko-bot [this message]
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=sashiko-outbox-219054@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shunsheng1218@gmail.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