vduse: don't set VM_IO on the domain file mapping
PATCH 1/1 vduse: don't set VM_IO on the domain file mapping
Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path") set VM_IO on the domain file mapping so thatvhost_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.
---
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(-)
drivers/vdpa/vdpa_user/iova_domain.c +1 -1
@@ -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
Signature · 1 line
2.45.2.windows.1
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 15 lines
Commit
bb2e6f166547("vduse: fix VA/PA confusion in the coherent page fault path") setVM_IOon the domain file mapping so thatvhost_vdpa_va_map()would skip it. Since99fd6bf43d5d, mm refusesVM_IOon mm-managed mappings:mmap()of the domain file fails with aWARN_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_IOis not needed.vduse_domain_set_map()already rejects vhost-vdpa entries backed by the domain file, and the file check invduse_domain_get_coherent_page()keeps any other entry from being translated as a physical address. A self-referencing mapping now reachesvduse_domain_set_map()and is refused with-EINVAL.
Quoted 5 lines
Fixes bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")Reported-by Lorenzo Stoakes (ARM) <[email protected]>Suggested-by Lorenzo Stoakes (ARM) <[email protected]>Signed-off-by chenglong.ma <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
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.
Quoted 8 lines · chenglong.ma
Commit
bb2e6f166547("vduse: fix VA/PA confusion in the coherent page fault path") setVM_IOon the domain file mapping so thatvhost_vdpa_va_map()would skip it. Since99fd6bf43d5d, mm refusesVM_IOon mm-managed mappings:mmap()of the domain file fails with aWARN_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 ---.
Quoted 8 lines
VM_IOis not needed.vduse_domain_set_map()already rejects vhost-vdpa entries backed by the domain file, and the file check invduse_domain_get_coherent_page()keeps any other entry from being translated as a physical address. A self-referencing mapping now reachesvduse_domain_set_map()and is refused with-EINVAL.Fixes bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")
You shouldn't be using VM_IO anywhere.
Quoted 3 lines
You failed to propagate my Reviewed-by tag...
Quoted 1 line
Signed-off-by chenglong.ma <[email protected]>
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:
Quoted 33 lines
---
Notes:
Tested on v7.4-rc2 (commit7475ea8b58616b33c04afb976cf0fbaad9dd63fb).Control, without this patch:
mmap()of the VDUSE domain file fails, with theWARN_ON_ONCE()from99fd6bf43d5d.With this patch applied:
mmap()of the domain file succeeds, and importing that mapping through vhost-vdpa is refused byvduse_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(-)drivers/vdpa/vdpa_user/iova_domain.c +1
-1@@ -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;
Quoted 4 lines
base-commit:
44293796526f4343639f87b2acc53811c78b5d54--
2.45.2.windows.1
--
Cheers, Lorenzo
Michael S. Tsirkin
maintainerQuoted 28 lines · Lorenzo Stoakes (ARM)
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.
Quoted 8 lines · chenglong.ma
Commit
bb2e6f166547("vduse: fix VA/PA confusion in the coherent page fault path") setVM_IOon the domain file mapping so thatvhost_vdpa_va_map()would skip it. Since99fd6bf43d5d, mm refusesVM_IOon mm-managed mappings:mmap()of the domain file fails with aWARN_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 ---.
Quoted 7 lines
VM_IOis not needed.vduse_domain_set_map()already rejects vhost-vdpa entries backed by the domain file, and the file check invduse_domain_get_coherent_page()keeps any other entry from being translated as a physical address. A self-referencing mapping now reachesvduse_domain_set_map()and is refused with-EINVAL.
Quoted 3 lines
Quoted 1 line
Fixes bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path")Cc stable?
why cc stable did stable backport the buggy patch?
Quoted 61 lines
You shouldn't be using
VM_IOanywhere.Quoted 3 lines
You failed to propagate my Reviewed-by tag...
Quoted 1 line
Signed-off-by chenglong.ma <[email protected]>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) <[email protected]>Quoted 33 lines
---
Notes:
Tested on v7.4-rc2 (commit7475ea8b58616b33c04afb976cf0fbaad9dd63fb).Control, without this patch:
mmap()of the VDUSE domain file fails, with theWARN_ON_ONCE()from99fd6bf43d5d.With this patch applied:
mmap()of the domain file succeeds, and importing that mapping through vhost-vdpa is refused byvduse_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(-)drivers/vdpa/vdpa_user/iova_domain.c +1
-1@@ -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;Quoted 4 lines
base-commit:
44293796526f4343639f87b2acc53811c78b5d54--
2.45.2.windows.1--
Cheers, Lorenzo
Quoted 1 line · Michael S. Tsirkin
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
Michael S. Tsirkin
maintainerQuoted 40 lines · Lorenzo Stoakes (ARM)
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.
Quoted 8 lines · chenglong.ma
Commit
bb2e6f166547("vduse: fix VA/PA confusion in the coherent page fault path") setVM_IOon the domain file mapping so thatvhost_vdpa_va_map()would skip it. Since99fd6bf43d5d, mm refusesVM_IOon mm-managed mappings:mmap()of the domain file fails with aWARN_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 ---.
Quoted 8 lines
VM_IOis not needed.vduse_domain_set_map()already rejects vhost-vdpa entries backed by the domain file, and the file check invduse_domain_get_coherent_page()keeps any other entry from being translated as a physical address. A self-referencing mapping now reachesvduse_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_IOanywhere.Quoted 3 lines
You failed to propagate my Reviewed-by tag...
Quoted 8 lines
Quoted 1 line
Signed-off-by chenglong.ma <[email protected]>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.
Quoted 44 lines
For the patch itself:
Reviewed-by Lorenzo Stoakes (ARM) <[email protected]>Quoted 33 lines
---
Notes:
Tested on v7.4-rc2 (commit7475ea8b58616b33c04afb976cf0fbaad9dd63fb).Control, without this patch:
mmap()of the VDUSE domain file fails, with theWARN_ON_ONCE()from99fd6bf43d5d.With this patch applied:
mmap()of the domain file succeeds, and importing that mapping through vhost-vdpa is refused byvduse_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(-)drivers/vdpa/vdpa_user/iova_domain.c +1
-1@@ -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;Quoted 4 lines
base-commit:
44293796526f4343639f87b2acc53811c78b5d54--
2.45.2.windows.1--
Cheers, Lorenzo