OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>,
	andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v3 1/2] drivers/vhost: fix a use-after-free of VHOST_SET_NWORKERS workers
Date: Sun, 15 Nov 2026 13:50:25 +0000	[thread overview]
Message-ID: <010701a1df7937e7-68dd8a02-a404-484e-bed1-7f2ddecfe8fd-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261115133957.2803273-2-alexander.ivanov@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] vhost: Fixes tag cites commit not in this branch's history
--

commit bbef82128842543692a63a5ea711dc103da3faf0
Author: Alexander Ivanov <alexander.ivanov@virtuozzo.com>

drivers/vhost: fix a use-after-free of VHOST_SET_NWORKERS workers

The patch attaches the workers created by VHOST_SET_NWORKERS through
__vhost_vq_attach_worker() instead of storing them in vq->worker directly.
It also skips a source vq whose worker was killed, and rejects
VHOST_SET_NWORKERS on devices that do not use workers.

> drivers/vhost: fix a use-after-free of VHOST_SET_NWORKERS workers
>
> vhost_set_workers() and vhost_propagate_workers() store workers into
> vq->worker directly, bypassing __vhost_vq_attach_worker(). The workers
> they install keep attachment_cnt at 0, and the default worker keeps
> counting every vq. VHOST_FREE_WORKER then destroys a worker a virtqueue
> still points at, and the next vhost_vq_work_queue() on that vq is a
> use-after-free. VHOST_ATTACH_VRING_WORKER on such a vq drives
> attachment_cnt of its worker to -1. vhost-scsi already exposes both
> interfaces to the device owner.
>
> Attach the workers with __vhost_vq_attach_worker(), so VHOST_FREE_WORKER
> fails with -EBUSY while a vq uses the worker and both interfaces can
> coexist until userspace moves to the worker ioctls. Userspace issues
> VHOST_SET_NWORKERS before VHOST_SET_VRING_KICK, so the attach takes the
> path without synchronize_rcu() and VM startup is not slowed down.
>
> The attach dereferences the worker, so skip a source vq whose worker
> was killed, and reject VHOST_SET_NWORKERS on devices that do not use
> workers. On vhost-vdpa every vq->worker is NULL, and the workers
> vhost_set_workers() created there were never freed.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-107537
> Fixes: 1491588e71da ("drivers/vhost: add ioctl to increase the number of workers")
> Feature: vhost-blk: in-kernel accelerator for virtio-blk guests
>
> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>

[Severity: Low]
Is the Fixes: tag pointing at the right commit?

1491588e71da is not an ancestor of this branch. The commit with the same
subject that is in this branch's history is 705a4b3eefde ("drivers/vhost:
add ioctl to increase the number of workers"). It added vhost_set_workers(),
vhost_propagate_workers() and the VHOST_SET_NWORKERS case, and it is where
the direct vq->worker stores came from. Should the tag name that commit
instead, so backport tooling can resolve it on this branch?

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261115133957.2803273-1-alexander.ivanov@virtuozzo.com?part=1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-11-15 13:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 13:39 [Devel] [PATCH hci-8.1 v3 0/2] drivers/vhost/blk: add support for worker ioctls Alexander Ivanov
2026-11-15 13:39 ` [Devel] [PATCH hci-8.1 v3 1/2] drivers/vhost: fix a use-after-free of VHOST_SET_NWORKERS workers Alexander Ivanov
2026-11-15 13:50   ` no-reply [this message]
2026-11-16  8:42     ` Alexander Ivanov
2026-11-15 13:39 ` [Devel] [PATCH hci-8.1 v3 2/2] drivers/vhost/blk: add support for worker ioctls Alexander Ivanov
2026-11-15 13:45   ` no-reply

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=010701a1df7937e7-68dd8a02-a404-484e-bed1-7f2ddecfe8fd-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.org \
    /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