From: sashiko-bot@kernel.org
To: chenglong.ma <longpareto@gmail.com>
Cc: virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH] vduse: don't set VM_IO on the domain file mapping
Date: Wed, 25 Nov 2026 15:42:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-233668@kernel.org> (raw)
In-Reply-To: <20261125152800.485-1-longpareto@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] vduse: cross-domain file cycle leak via
vduse_domain_set_map()
--
commit f6d46c11d1a5c1adc989b443940eecb07ed23967
Author: chenglong.ma <longpareto@gmail.com>
vduse: don't set VM_IO on the domain file mapping
This commit removes VM_IO from the VMA flags set in vduse_domain_mmap()
so that mapping a VDUSE domain file does not fail mm validation.
> diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c
> index 28a977248a0d3..3c6fa18703b46 100644
> --- a/drivers/vdpa/vdpa_user/iova_domain.c
> +++ b/drivers/vdpa/vdpa_user/iova_domain.c
> @@ -588,7 +588,7 @@ static int vduse_domain_mmap(struct file *file, struct vm_area_struct *vma)
> {
> struct vduse_iova_domain *domain = file->private_data;
>
> - vm_flags_set(vma, VM_IO | VM_DONTDUMP | VM_DONTEXPAND);
> + vm_flags_set(vma, VM_DONTDUMP | VM_DONTEXPAND);
> vma->vm_private_data = domain;
> vma->vm_ops = &vduse_domain_mmap_ops;
[Severity: Medium]
Can removing VM_IO allow two VDUSE domains to pin each other's domain
file in domain->iotlb and permanently leak both domains?
Without VM_IO, vhost_vdpa_va_map() no longer skips MAP_SHARED mappings of
a VDUSE domain file, and vduse_domain_set_map() only rejects mappings of
the target domain's own file:
drivers/vdpa/vdpa_user/iova_domain.c:vduse_domain_set_map() {
...
map_file = (struct vdpa_map_file *)map->opaque;
if (!map_file || map_file->file == domain->file) {
ret = -EINVAL;
goto err;
}
ret = vduse_iotlb_add_range(domain, map->start, map->last,
map->addr, map->perm,
map_file->file,
map_file->offset);
...
}
If two VDUSE domains (for example, two address spaces on a device with
nas >= 2) import mappings of each other's domain file via vhost-vdpa,
each domain's iotlb holds a get_file() reference to the other domain's
file. Because imported entries in domain->iotlb are only freed in
vduse_domain_release() when domain->file's refcount reaches zero, and
vduse_domain_destroy() only calls fput(domain->file), neither file is
ever released.
Should vduse_domain_set_map() reject any file with
map_file->file->f_op == &vduse_domain_fops instead of only
map_file->file == domain->file?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125152800.485-1-longpareto@gmail.com?part=1
next prev parent reply other threads:[~2026-11-25 15:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 15:28 [PATCH] vduse: don't set VM_IO on the domain file mapping chenglong.ma
2026-11-25 15:39 ` Lorenzo Stoakes (ARM)
2026-11-25 15:42 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-25 16:01 chenglong.ma
2026-11-25 16:12 ` sashiko-bot
2026-11-25 16:38 ` Lorenzo Stoakes (ARM)
2026-11-25 18:05 ` Michael S. Tsirkin
2026-11-25 18:34 ` Lorenzo Stoakes (ARM)
2026-11-25 18:06 ` Michael S. Tsirkin
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-233668@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eperezma@redhat.com \
--cc=longpareto@gmail.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--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