* [PATCH] userfaultfd: fix deadlock warning when locking src and dst VMAs
@ 2024-03-21 23:58 Lokesh Gidra
2024-03-22 0:47 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Lokesh Gidra @ 2024-03-21 23:58 UTC (permalink / raw
To: akpm
Cc: linux-mm, linux-kernel, surenb, kernel-team, aarcange, peterx,
david, axelrasmussen, bgeffon, jannh, kaleshsingh, ngeoffray,
rppt, hdanton, Lokesh Gidra, syzbot+49056626fe41e01f2ba7
Use down_read_nested() to avoid the warning.
Reported-by: syzbot+49056626fe41e01f2ba7@syzkaller.appspotmail.com
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
---
mm/userfaultfd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index 712160cd41ec..3c3539c573e7 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -1444,7 +1444,8 @@ static int uffd_move_lock(struct mm_struct *mm,
*/
down_read(&(*dst_vmap)->vm_lock->lock);
if (*dst_vmap != *src_vmap)
- down_read(&(*src_vmap)->vm_lock->lock);
+ down_read_nested(&(*src_vmap)->vm_lock->lock,
+ SINGLE_DEPTH_NESTING);
}
mmap_read_unlock(mm);
return err;
--
2.44.0.396.g6e790dbe36-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] userfaultfd: fix deadlock warning when locking src and dst VMAs
2024-03-21 23:58 [PATCH] userfaultfd: fix deadlock warning when locking src and dst VMAs Lokesh Gidra
@ 2024-03-22 0:47 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2024-03-22 0:47 UTC (permalink / raw
To: Lokesh Gidra
Cc: linux-mm, linux-kernel, surenb, kernel-team, aarcange, peterx,
david, axelrasmussen, bgeffon, jannh, kaleshsingh, ngeoffray,
rppt, hdanton, syzbot+49056626fe41e01f2ba7
On Thu, 21 Mar 2024 16:58:18 -0700 Lokesh Gidra <lokeshgidra@google.com> wrote:
> Use down_read_nested() to avoid the warning.
>
> --- a/mm/userfaultfd.c
> +++ b/mm/userfaultfd.c
> @@ -1444,7 +1444,8 @@ static int uffd_move_lock(struct mm_struct *mm,
> */
> down_read(&(*dst_vmap)->vm_lock->lock);
> if (*dst_vmap != *src_vmap)
> - down_read(&(*src_vmap)->vm_lock->lock);
> + down_read_nested(&(*src_vmap)->vm_lock->lock,
> + SINGLE_DEPTH_NESTING);
> }
> mmap_read_unlock(mm);
> return err;
Thanks, I added
Fixes: 867a43a34ff8a ("userfaultfd: use per-vma locks in userfaultfd operations")
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-22 0:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-21 23:58 [PATCH] userfaultfd: fix deadlock warning when locking src and dst VMAs Lokesh Gidra
2024-03-22 0:47 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.