* [PATCH] vduse: don't set VM_IO on the domain file mapping
@ 2026-11-25 16:01 chenglong.ma
2026-11-25 16:12 ` sashiko-bot
2026-11-25 16:38 ` Lorenzo Stoakes (ARM)
0 siblings, 2 replies; 9+ messages in thread
From: chenglong.ma @ 2026-11-25 16:01 UTC (permalink / raw)
To: Michael S . Tsirkin
Cc: Jason Wang, Eugenio Pérez, Xuan Zhuo, Lorenzo Stoakes,
Xie Yongji, virtualization, linux-kernel
Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
set VM_IO on the domain file mapping so that
vhost_vdpa_va_map() would skip it. Since 99fd6bf43d5d, mm refuses VM_IO
on mm-managed mappings: mmap() of the domain file fails with a
WARN_ON_ONCE() and -EINVAL, which breaks VDUSE userspace.
VDUSE is currently broken in 7.4 because of this. Please treat this as
a hotfix for 7.4.
VM_IO is not needed. vduse_domain_set_map() already rejects vhost-vdpa
entries backed by the domain file, and the file check in
vduse_domain_get_coherent_page() keeps any other entry from being
translated as a physical address. A self-referencing mapping now
reaches vduse_domain_set_map() and is refused with -EINVAL.
Fixes: bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
Reported-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Closes: https://lore.kernel.org/r/awWOpS3HR_2FTN3I@gremlin
Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: chenglong.ma <longpareto@gmail.com>
---
Notes:
Tested on v7.4-rc2 (commit 7475ea8b58616b33c04afb976cf0fbaad9dd63fb).
Control, without this patch: mmap() of the VDUSE domain file fails,
with the WARN_ON_ONCE() from 99fd6bf43d5d.
With this patch applied: mmap() of the domain file succeeds, and
importing that mapping through vhost-vdpa is refused by
vduse_domain_set_map() with -EINVAL.
Dynamic tests also confirmed that vduse_domain_get_coherent_page()
refuses to translate entries backed by any file other than the domain
file, and that legitimate coherent vring mappings are still translated.
drivers/vdpa/vdpa_user/iova_domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c
index 28a977248a0d..3c6fa18703b4 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;
base-commit: 44293796526f4343639f87b2acc53811c78b5d54
--
2.45.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] vduse: don't set VM_IO on the domain file mapping
2026-11-25 16:01 [PATCH] vduse: don't set VM_IO on the domain file mapping chenglong.ma
@ 2026-11-25 16:12 ` sashiko-bot
2026-11-25 16:38 ` Lorenzo Stoakes (ARM)
1 sibling, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-25 16:12 UTC (permalink / raw)
To: chenglong.ma; +Cc: virtualization, Michael S. Tsirkin, Eugenio Perez
> Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
> set VM_IO on the domain file mapping so that
> vhost_vdpa_va_map() would skip it. Since 99fd6bf43d5d, mm refuses VM_IO
> on mm-managed mappings: mmap() of the domain file fails with a
> WARN_ON_ONCE() and -EINVAL, which breaks VDUSE userspace.
>
> VDUSE is currently broken in 7.4 because of this. Please treat this as
> a hotfix for 7.4.
>
> VM_IO is not needed. vduse_domain_set_map() already rejects vhost-vdpa
> entries backed by the domain file, and the file check in
> vduse_domain_get_coherent_page() keeps any other entry from being
> translated as a physical address. A self-referencing mapping now
> reaches vduse_domain_set_map() and is refused with -EINVAL.
>
> Fixes: bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
> Reported-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Closes: https://lore.kernel.org/r/awWOpS3HR_2FTN3I@gremlin
> Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Signed-off-by: chenglong.ma <longpareto@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125160128.796-1-longpareto@gmail.com?part=1
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] vduse: don't set VM_IO on the domain file mapping
2026-11-25 16:01 [PATCH] vduse: don't set VM_IO on the domain file mapping 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:06 ` Michael S. Tsirkin
1 sibling, 2 replies; 9+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-25 16:38 UTC (permalink / raw)
To: chenglong.ma
Cc: Michael S . Tsirkin, Jason Wang, Eugenio Pérez, Xuan Zhuo,
Xie Yongji, virtualization, linux-kernel
This isn't how you send patches in the kernel...
See https://docs.kernel.org/process/submitting-patches.html
This is a v2 of the original patch. It should say [PATCH v2].
You shouldn't send a respin so quickly.
On Thu, Nov 26, 2026 at 12:01:28AM +0800, chenglong.ma wrote:
> Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
> set VM_IO on the domain file mapping so that
> vhost_vdpa_va_map() would skip it. Since 99fd6bf43d5d, mm refuses VM_IO
> on mm-managed mappings: mmap() of the domain file fails with a
> WARN_ON_ONCE() and -EINVAL, which breaks VDUSE userspace.
>
> VDUSE is currently broken in 7.4 because of this. Please treat this as
> a hotfix for 7.4.
You should say that it's broken and the patch fixes it in the commit message,
and leave commentary about it being a hotfix for below the ---.
>
> VM_IO is not needed. vduse_domain_set_map() already rejects vhost-vdpa
> entries backed by the domain file, and the file check in
> vduse_domain_get_coherent_page() keeps any other entry from being
> translated as a physical address. A self-referencing mapping now
> reaches vduse_domain_set_map() and is refused with -EINVAL.
>
> Fixes: bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
Cc: stable?
You shouldn't be using VM_IO anywhere.
> Reported-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Closes: https://lore.kernel.org/r/awWOpS3HR_2FTN3I@gremlin
> Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
You failed to propagate my Reviewed-by tag...
> Signed-off-by: chenglong.ma <longpareto@gmail.com>
This Signed-off-by seems invalid, there shouldn't be a '.' there I don't think?
(Also gmail isn't really recommended for kernel stuff either, they drop a lot of
kernel mail).
Anyway, I assume Michael can pick this up and fix it up a bit?
For the patch itself:
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
>
> Notes:
> Tested on v7.4-rc2 (commit 7475ea8b58616b33c04afb976cf0fbaad9dd63fb).
>
> Control, without this patch: mmap() of the VDUSE domain file fails,
> with the WARN_ON_ONCE() from 99fd6bf43d5d.
>
> With this patch applied: mmap() of the domain file succeeds, and
> importing that mapping through vhost-vdpa is refused by
> vduse_domain_set_map() with -EINVAL.
>
> Dynamic tests also confirmed that vduse_domain_get_coherent_page()
> refuses to translate entries backed by any file other than the domain
> file, and that legitimate coherent vring mappings are still translated.
>
> drivers/vdpa/vdpa_user/iova_domain.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c
> index 28a977248a0d..3c6fa18703b4 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;
>
>
> base-commit: 44293796526f4343639f87b2acc53811c78b5d54
> --
> 2.45.2.windows.1
>
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] vduse: don't set VM_IO on the domain file mapping
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
1 sibling, 1 reply; 9+ messages in thread
From: Michael S. Tsirkin @ 2026-11-25 18:05 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM)
Cc: chenglong.ma, Jason Wang, Eugenio Pérez, Xuan Zhuo,
Xie Yongji, virtualization, linux-kernel
On Wed, Nov 25, 2026 at 04:38:51PM +0000, Lorenzo Stoakes (ARM) wrote:
> This isn't how you send patches in the kernel...
>
> See https://docs.kernel.org/process/submitting-patches.html
>
> This is a v2 of the original patch. It should say [PATCH v2].
>
> You shouldn't send a respin so quickly.
>
> On Thu, Nov 26, 2026 at 12:01:28AM +0800, chenglong.ma wrote:
> > Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
> > set VM_IO on the domain file mapping so that
> > vhost_vdpa_va_map() would skip it. Since 99fd6bf43d5d, mm refuses VM_IO
> > on mm-managed mappings: mmap() of the domain file fails with a
> > WARN_ON_ONCE() and -EINVAL, which breaks VDUSE userspace.
> >
> > VDUSE is currently broken in 7.4 because of this. Please treat this as
> > a hotfix for 7.4.
>
> You should say that it's broken and the patch fixes it in the commit message,
> and leave commentary about it being a hotfix for below the ---.
>
> >
> > VM_IO is not needed. vduse_domain_set_map() already rejects vhost-vdpa
> > entries backed by the domain file, and the file check in
> > vduse_domain_get_coherent_page() keeps any other entry from being
> > translated as a physical address. A self-referencing mapping now
> > reaches vduse_domain_set_map() and is refused with -EINVAL.
> >
> > Fixes: bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
>
> Cc: stable?
why cc stable did stable backport the buggy patch?
> You shouldn't be using VM_IO anywhere.
>
> > Reported-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > Closes: https://lore.kernel.org/r/awWOpS3HR_2FTN3I@gremlin
> > Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
>
> You failed to propagate my Reviewed-by tag...
>
> > Signed-off-by: chenglong.ma <longpareto@gmail.com>
>
> This Signed-off-by seems invalid, there shouldn't be a '.' there I don't think?
>
> (Also gmail isn't really recommended for kernel stuff either, they drop a lot of
> kernel mail).
>
> Anyway, I assume Michael can pick this up and fix it up a bit?
>
> For the patch itself:
>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
>
> > ---
> >
> > Notes:
> > Tested on v7.4-rc2 (commit 7475ea8b58616b33c04afb976cf0fbaad9dd63fb).
> >
> > Control, without this patch: mmap() of the VDUSE domain file fails,
> > with the WARN_ON_ONCE() from 99fd6bf43d5d.
> >
> > With this patch applied: mmap() of the domain file succeeds, and
> > importing that mapping through vhost-vdpa is refused by
> > vduse_domain_set_map() with -EINVAL.
> >
> > Dynamic tests also confirmed that vduse_domain_get_coherent_page()
> > refuses to translate entries backed by any file other than the domain
> > file, and that legitimate coherent vring mappings are still translated.
> >
> > drivers/vdpa/vdpa_user/iova_domain.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c
> > index 28a977248a0d..3c6fa18703b4 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;
> >
> >
> > base-commit: 44293796526f4343639f87b2acc53811c78b5d54
> > --
> > 2.45.2.windows.1
> >
>
> --
> Cheers, Lorenzo
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] vduse: don't set VM_IO on the domain file mapping
2026-11-25 18:05 ` Michael S. Tsirkin
@ 2026-11-25 18:34 ` Lorenzo Stoakes (ARM)
0 siblings, 0 replies; 9+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-25 18:34 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: chenglong.ma, Jason Wang, Eugenio Pérez, Xuan Zhuo,
Xie Yongji, virtualization, linux-kernel
On Wed, Nov 25, 2026 at 01:05:37PM -0500, Michael S. Tsirkin wrote:
> why cc stable did stable backport the buggy patch?
That patch itself is cc: stable so this will need to be too to propagate it.
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] vduse: don't set VM_IO on the domain file mapping
2026-11-25 16:38 ` Lorenzo Stoakes (ARM)
2026-11-25 18:05 ` Michael S. Tsirkin
@ 2026-11-25 18:06 ` Michael S. Tsirkin
1 sibling, 0 replies; 9+ messages in thread
From: Michael S. Tsirkin @ 2026-11-25 18:06 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM)
Cc: chenglong.ma, Jason Wang, Eugenio Pérez, Xuan Zhuo,
Xie Yongji, virtualization, linux-kernel
On Wed, Nov 25, 2026 at 04:38:51PM +0000, Lorenzo Stoakes (ARM) wrote:
> This isn't how you send patches in the kernel...
>
> See https://docs.kernel.org/process/submitting-patches.html
>
> This is a v2 of the original patch. It should say [PATCH v2].
>
> You shouldn't send a respin so quickly.
>
> On Thu, Nov 26, 2026 at 12:01:28AM +0800, chenglong.ma wrote:
> > Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
> > set VM_IO on the domain file mapping so that
> > vhost_vdpa_va_map() would skip it. Since 99fd6bf43d5d, mm refuses VM_IO
> > on mm-managed mappings: mmap() of the domain file fails with a
> > WARN_ON_ONCE() and -EINVAL, which breaks VDUSE userspace.
> >
> > VDUSE is currently broken in 7.4 because of this. Please treat this as
> > a hotfix for 7.4.
>
> You should say that it's broken and the patch fixes it in the commit message,
> and leave commentary about it being a hotfix for below the ---.
>
> >
> > VM_IO is not needed. vduse_domain_set_map() already rejects vhost-vdpa
> > entries backed by the domain file, and the file check in
> > vduse_domain_get_coherent_page() keeps any other entry from being
> > translated as a physical address. A self-referencing mapping now
> > reaches vduse_domain_set_map() and is refused with -EINVAL.
> >
> > Fixes: bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
>
> Cc: stable?
>
> You shouldn't be using VM_IO anywhere.
>
> > Reported-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > Closes: https://lore.kernel.org/r/awWOpS3HR_2FTN3I@gremlin
> > Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
>
> You failed to propagate my Reviewed-by tag...
>
> > Signed-off-by: chenglong.ma <longpareto@gmail.com>
>
> This Signed-off-by seems invalid, there shouldn't be a '.' there I don't think?
>
> (Also gmail isn't really recommended for kernel stuff either, they drop a lot of
> kernel mail).
>
> Anyway, I assume Michael can pick this up and fix it up a bit?
I'd rather see a fixed up patch on list.
> For the patch itself:
>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
>
> > ---
> >
> > Notes:
> > Tested on v7.4-rc2 (commit 7475ea8b58616b33c04afb976cf0fbaad9dd63fb).
> >
> > Control, without this patch: mmap() of the VDUSE domain file fails,
> > with the WARN_ON_ONCE() from 99fd6bf43d5d.
> >
> > With this patch applied: mmap() of the domain file succeeds, and
> > importing that mapping through vhost-vdpa is refused by
> > vduse_domain_set_map() with -EINVAL.
> >
> > Dynamic tests also confirmed that vduse_domain_get_coherent_page()
> > refuses to translate entries backed by any file other than the domain
> > file, and that legitimate coherent vring mappings are still translated.
> >
> > drivers/vdpa/vdpa_user/iova_domain.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c
> > index 28a977248a0d..3c6fa18703b4 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;
> >
> >
> > base-commit: 44293796526f4343639f87b2acc53811c78b5d54
> > --
> > 2.45.2.windows.1
> >
>
> --
> Cheers, Lorenzo
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] vduse: don't set VM_IO on the domain file mapping
@ 2026-11-25 15:28 chenglong.ma
2026-11-25 15:39 ` Lorenzo Stoakes (ARM)
2026-11-25 15:42 ` sashiko-bot
0 siblings, 2 replies; 9+ messages in thread
From: chenglong.ma @ 2026-11-25 15:28 UTC (permalink / raw)
To: Michael S . Tsirkin
Cc: Jason Wang, Eugenio Pérez, Xuan Zhuo, Lorenzo Stoakes,
Xie Yongji, virtualization, linux-kernel
Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
set VM_IO on the domain file mapping so that
vhost_vdpa_va_map() would skip it. Since 99fd6bf43d5d, mm refuses VM_IO
on mm-managed mappings: mmap() of the domain file fails with a
WARN_ON_ONCE() and -EINVAL, which breaks VDUSE userspace.
VM_IO is not needed. vduse_domain_set_map() already rejects vhost-vdpa
entries backed by the domain file, and the file check in
vduse_domain_get_coherent_page() keeps any other entry from being
translated as a physical address. A self-referencing mapping now
reaches vduse_domain_set_map() and is refused with -EINVAL.
Fixes: bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
Reported-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Closes: https://lore.kernel.org/r/awWOpS3HR_2FTN3I@gremlin
Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: chenglong.ma <longpareto@gmail.com>
---
Notes:
Tested on v7.4-rc2 (commit 7475ea8b58616b33c04afb976cf0fbaad9dd63fb).
Control, without this patch: mmap() of the VDUSE domain file fails,
with the WARN_ON_ONCE() from 99fd6bf43d5d.
With this patch applied: mmap() of the domain file succeeds, and
importing that mapping through vhost-vdpa is refused by
vduse_domain_set_map() with -EINVAL.
Dynamic tests also confirmed that vduse_domain_get_coherent_page()
refuses to translate entries backed by any file other than the domain
file, and that legitimate coherent vring mappings are still translated.
drivers/vdpa/vdpa_user/iova_domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c
index 28a977248a0d..3c6fa18703b4 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;
base-commit: 44293796526f4343639f87b2acc53811c78b5d54
--
2.45.2.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] vduse: don't set VM_IO on the domain file mapping
2026-11-25 15:28 chenglong.ma
@ 2026-11-25 15:39 ` Lorenzo Stoakes (ARM)
2026-11-25 15:42 ` sashiko-bot
1 sibling, 0 replies; 9+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-25 15:39 UTC (permalink / raw)
To: chenglong.ma
Cc: Michael S . Tsirkin, Jason Wang, Eugenio Pérez, Xuan Zhuo,
Xie Yongji, virtualization, linux-kernel
On Wed, Nov 25, 2026 at 11:28:00PM +0800, chenglong.ma wrote:
> Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
> set VM_IO on the domain file mapping so that
> vhost_vdpa_va_map() would skip it. Since 99fd6bf43d5d, mm refuses VM_IO
> on mm-managed mappings: mmap() of the domain file fails with a
> WARN_ON_ONCE() and -EINVAL, which breaks VDUSE userspace.
>
> VM_IO is not needed. vduse_domain_set_map() already rejects vhost-vdpa
> entries backed by the domain file, and the file check in
> vduse_domain_get_coherent_page() keeps any other entry from being
> translated as a physical address. A self-referencing mapping now
> reaches vduse_domain_set_map() and is refused with -EINVAL.
You should probably point out that the driver is _literally broken right now_ in
7.4. This is kinda urgent for those who use it :)
>
> Fixes: bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
> Reported-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Closes: https://lore.kernel.org/r/awWOpS3HR_2FTN3I@gremlin
> Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This tag is invalid. See the process on this [0]
[0]: https://docs.kernel.org/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
> Signed-off-by: chenglong.ma <longpareto@gmail.com>
Patch looks right though.
This is pretty urgent, so should be sent as a hotfix.
With the tag/commit msg bits addressed:
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
>
> Notes:
> Tested on v7.4-rc2 (commit 7475ea8b58616b33c04afb976cf0fbaad9dd63fb).
>
> Control, without this patch: mmap() of the VDUSE domain file fails,
> with the WARN_ON_ONCE() from 99fd6bf43d5d.
>
> With this patch applied: mmap() of the domain file succeeds, and
> importing that mapping through vhost-vdpa is refused by
> vduse_domain_set_map() with -EINVAL.
>
> Dynamic tests also confirmed that vduse_domain_get_coherent_page()
> refuses to translate entries backed by any file other than the domain
> file, and that legitimate coherent vring mappings are still translated.
>
> drivers/vdpa/vdpa_user/iova_domain.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c
> index 28a977248a0d..3c6fa18703b4 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;
>
>
> base-commit: 44293796526f4343639f87b2acc53811c78b5d54
> --
> 2.45.2.windows.1
>
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] vduse: don't set VM_IO on the domain file mapping
2026-11-25 15:28 chenglong.ma
2026-11-25 15:39 ` Lorenzo Stoakes (ARM)
@ 2026-11-25 15:42 ` sashiko-bot
1 sibling, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-25 15:42 UTC (permalink / raw)
To: chenglong.ma; +Cc: virtualization, Michael S. Tsirkin, Eugenio Perez
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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-25 18:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 16:01 [PATCH] vduse: don't set VM_IO on the domain file mapping 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
-- strict thread matches above, loose matches on Subject: below --
2026-11-25 15:28 chenglong.ma
2026-11-25 15:39 ` Lorenzo Stoakes (ARM)
2026-11-25 15:42 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox