From: Matthew Wilcox <willy@infradead.org>
To: syzbot <syzbot+5b19bad23ac7f44bf8b8@syzkaller.appspotmail.com>
Cc: Liam.Howlett@oracle.com, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
lorenzo.stoakes@oracle.com, shakeel.butt@linux.dev,
surenb@google.com, syzkaller-bugs@googlegroups.com,
vbabka@suse.cz
Subject: Re: [syzbot] [mm?] WARNING: refcount bug in __vma_enter_locked
Date: Tue, 25 Nov 2025 04:27:20 +0000 [thread overview]
Message-ID: <aSUwKBP97nd4kpjP@casper.infradead.org> (raw)
In-Reply-To: <69252076.a70a0220.d98e3.009b.GAE@google.com>
On Mon, Nov 24, 2025 at 07:20:22PM -0800, syzbot wrote:
> refcount_t: saturated; leaking memory.
Umm. Something like this?
#syz test
diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
index e6e5570d1ec7..71af7f0a5fe1 100644
--- a/mm/mmap_lock.c
+++ b/mm/mmap_lock.c
@@ -74,9 +74,18 @@ static inline int __vma_enter_locked(struct vm_area_struct *vma,
refcount_read(&vma->vm_refcnt) == tgt_refcnt,
state);
if (err) {
+ if (refcount_sub_and_test(VMA_LOCK_OFFSET, &vma->vm_refcnt)) {
+ /* Oh cobblers. While we got a fatal signal, we
+ * raced with the last user. Pretend we didn't notice
+ * the signal
+ */
+ refcount_set(&vma->vm_refcnt, VMA_LOCK_OFFSET);
+ goto acquired;
+ }
rwsem_release(&vma->vmlock_dep_map, _RET_IP_);
return err;
}
+acquired:
lock_acquired(&vma->vmlock_dep_map, _RET_IP_);
return 1;
next prev parent reply other threads:[~2025-11-25 4:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 3:20 syzbot
2025-11-25 4:27 ` Matthew Wilcox [this message]
2025-11-25 4:55 ` syzbot
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=aSUwKBP97nd4kpjP@casper.infradead.org \
--to=willy@infradead.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=syzbot+5b19bad23ac7f44bf8b8@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=vbabka@suse.cz \
/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