Thread (12 messages) 12 messages, 3 authors, 2021-05-26

Re: [PATCH 2/6] mm/userfaultfd: Fix uffd-wp special cases for fork()

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2021-05-26 03:04:36
Also in: lkml

On Tue, 25 May 2021 20:36:18 -0400 Peter Xu [off-list ref] wrote:
On Tue, May 25, 2021 at 05:15:58PM -0700, Andrew Morton wrote:
quoted
This run afoul of Alistair's "mm: Device exclusive memory access",
https://lkml.kernel.org/r/20210524132725.12697-8-apopple@nvidia.com

`vma' is now undeclared.  I think this?
--- a/mm/memory.c~mm-userfaultfd-fix-uffd-wp-special-cases-for-fork-fix
+++ a/mm/memory.c
@@ -850,8 +850,8 @@ copy_nonpresent_pte(struct mm_struct *ds
 		 * exclusive entries currently only support private writable
 		 * (ie. COW) mappings.
 		 */
-		VM_BUG_ON(!is_cow_mapping(vma->vm_flags));
-		if (try_restore_exclusive_pte(src_mm, src_pte, vma, addr))
+		VM_BUG_ON(!is_cow_mapping(dst_vma->vm_flags));
This one looks good, as both src_vma/dst_vma should have the same flags related
to is_cow.
quoted
+		if (try_restore_exclusive_pte(src_mm, src_pte, dst_vma, addr))
Should this be s/dst_vma/src_vma/ perhaps?  Alistairs please correct me
otherwise, as it tries to restore the pte for src mm not dst (the child).

I haven't yet got time to look at the new series, planning to do it tomorrow
maybe.. but I see that it's already queued in -mm.  Andrew, we do have chance
to go back if necessary, right?
Sure.
I haven't looked at the rest, but I think try_restore_exclusive_pte() can at
least drop the *mm pointer as it's never used (even if we need, we've got
vma->vm_mm too)..
OK, thanks.  I just released a tree into linux-next (hopefully this
blooper won't cause too much damage).  Please send a suitable fixup.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help