* + mm-fix-vma_start_write_killable-signal-handling.patch added to mm-unstable branch
@ 2025-11-28 18:41 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-11-28 18:41 UTC (permalink / raw)
To: mm-commits, vbabka, surenb, lorenzo.stoakes, Liam.Howlett, willy,
akpm
The patch titled
Subject: mm: fix vma_start_write_killable() signal handling
has been added to the -mm mm-unstable branch. Its filename is
mm-fix-vma_start_write_killable-signal-handling.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fix-vma_start_write_killable-signal-handling.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: mm: fix vma_start_write_killable() signal handling
Date: Fri, 28 Nov 2025 04:00:58 +0000
If we get a signal, we need to restore the vm_refcnt. We don't think that
the refcount can actually be decremented to zero here as it requires the
VMA to be detached, and the vma_mark_detached() uses TASK_UNINTERRUPTIBLE.
However, that's a bit subtle, so handle it as if the refcount was zero at
the start of this function.
Link: https://lkml.kernel.org/r/20251128040100.3022561-1-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reported-by: syzbot+5b19bad23ac7f44bf8b8@syzkaller.appspotmail.com
Fixes: 2197bb60f890 ("mm: add vma_start_write_killable()")
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mmap_lock.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/mm/mmap_lock.c~mm-fix-vma_start_write_killable-signal-handling
+++ a/mm/mmap_lock.c
@@ -74,6 +74,14 @@ static inline int __vma_enter_locked(str
refcount_read(&vma->vm_refcnt) == tgt_refcnt,
state);
if (err) {
+ if (refcount_sub_and_test(VMA_LOCK_OFFSET, &vma->vm_refcnt)) {
+ /*
+ * The wait failed, but the last reader went away
+ * as well. Tell the caller the VMA is detached.
+ */
+ WARN_ON_ONCE(!detaching);
+ err = 0;
+ }
rwsem_release(&vma->vmlock_dep_map, _RET_IP_);
return err;
}
_
Patches currently in -mm which might be from willy@infradead.org are
mm-fix-vma_start_write_killable-signal-handling.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-11-28 18:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-28 18:41 + mm-fix-vma_start_write_killable-signal-handling.patch added to mm-unstable branch 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.