* Re: [PATCH] mm: Fix mmap_assert_locked() in follow_pte()
@ 2024-07-12 12:17 Bert Karwatzki
0 siblings, 0 replies; 2+ messages in thread
From: Bert Karwatzki @ 2024-07-12 12:17 UTC (permalink / raw)
To: Pei Li
Cc: Bert Karwatzki, Andrew Morton, Shuah Khan, David Hildenbrand,
linux-mm, linux-kernel, linux-next, syzbot+35a4414f6e247f515443,
syzkaller-bugs, linux-kernel-mentees, senozhatsky
This is causing a deadlock for me, too. Since linux-next-20240712 I observe
a hang when starting the gui. I bisected this to commit a13252049629 and
reverting this commit in linux-next-20240712 fixes the issue for me.
I do not have any log messages to prove the dead lock, though, as I compiled
everything without CONFIG_LOCKDEP.
Bert Karwatzki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: Fix mmap_assert_locked() in follow_pte()
@ 2024-07-12 12:43 Bert Karwatzki
0 siblings, 0 replies; 2+ messages in thread
From: Bert Karwatzki @ 2024-07-12 12:43 UTC (permalink / raw)
To: Pei Li
Cc: Bert Karwatzki, Andrew Morton, Shuah Khan, David Hildenbrand,
linux-mm, linux-kernel, linux-next, syzbot+35a4414f6e247f515443,
syzkaller-bugs, linux-kernel-mentees, senozhatsky
diff --git a/mm/memory.c b/mm/memory.c
index 282203363177..2f4b4322ec0e 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1817,6 +1817,7 @@ static void unmap_single_vma(struct mmu_gather *tlb,
{
unsigned long start = max(vma->vm_start, start_addr);
unsigned long end;
+ bool mm_read_locked;
if (start >= vma->vm_end)
return;
@@ -1829,11 +1830,11 @@ static void unmap_single_vma(struct mmu_gather *tlb,
if (unlikely(vma->vm_flags & VM_PFNMAP)) {
if (!mm_wr_locked)
- mmap_read_lock(vma->vm_mm);
+ mm_read_locked = !mmap_read_trylock(vma->vm_mm);
untrack_pfn(vma, 0, 0, mm_wr_locked);
- if (!mm_wr_locked)
+ if (!mm_wr_locked && !mm_read_locked)
mmap_read_unlock(vma->vm_mm);
}
This seems to fix the issue without completely removing the locking.
Bert Karwatzki
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-12 12:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-12 12:43 [PATCH] mm: Fix mmap_assert_locked() in follow_pte() Bert Karwatzki
-- strict thread matches above, loose matches on Subject: below --
2024-07-12 12:17 Bert Karwatzki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).