From: Bert Karwatzki <spasswolf@web.de>
To: Pei Li <peili.dev@gmail.com>
Cc: Bert Karwatzki <spasswolf@web.de>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <skhan@linuxfoundation.org>,
David Hildenbrand <david@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-next@vger.kernel.org,
syzbot+35a4414f6e247f515443@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com,
linux-kernel-mentees@lists.linuxfoundation.org,
senozhatsky@chromium.org
Subject: Re: [PATCH] mm: Fix mmap_assert_locked() in follow_pte()
Date: Fri, 12 Jul 2024 14:43:57 +0200 [thread overview]
Message-ID: <20240712124359.3199-1-spasswolf@web.de> (raw)
In-Reply-To: 20240712121800.3049-1-spasswolf@web.de
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
next reply other threads:[~2024-07-12 12:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 12:43 Bert Karwatzki [this message]
[not found] <ZpBhCHsG39wIVnQN@x1n>
2024-07-12 13:19 ` [PATCH] mm: Fix mmap_assert_locked() in follow_pte() David Wang
-- strict thread matches above, loose matches on Subject: below --
2024-07-12 12:17 Bert Karwatzki
2024-07-11 5:13 Pei Li
2024-07-11 21:22 ` Andrew Morton
2024-07-11 21:33 ` David Hildenbrand
2024-07-11 21:45 ` David Hildenbrand
2024-07-11 21:51 ` David Hildenbrand
2024-07-12 8:04 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240712124359.3199-1-spasswolf@web.de \
--to=spasswolf@web.de \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=peili.dev@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+35a4414f6e247f515443@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).