From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org,
syzbot+5b19bad23ac7f44bf8b8@syzkaller.appspotmail.com,
Suren Baghdasaryan <surenb@google.com>,
Vlastimil Babka <vbabka@suse.cz>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Subject: Re: [PATCH v3] mm: fix vma_start_write_killable() signal handling
Date: Fri, 28 Nov 2025 08:34:55 -0500 [thread overview]
Message-ID: <ozziddwdsar7y6yby65t4jbgvf6rupxuk6phd5umsyr56szmsi@c2ubpgypvcmb> (raw)
In-Reply-To: <20251128040100.3022561-1-willy@infradead.org>
* Matthew Wilcox (Oracle) <willy@infradead.org> [251127 23:01]:
> 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.
>
> Reported-by: syzbot+5b19bad23ac7f44bf8b8@syzkaller.appspotmail.com
> Fixes: 2197bb60f890 ("mm: add vma_start_write_killable()")
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Reviewed-by: Suren Baghdasaryan <surenb@google.com>
> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> ---
> mm/mmap_lock.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
> index e6e5570d1ec7..7421b7ea8001 100644
> --- a/mm/mmap_lock.c
> +++ b/mm/mmap_lock.c
> @@ -74,6 +74,14 @@ 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)) {
> + /*
> + * 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;
> }
> --
> 2.47.2
>
prev parent reply other threads:[~2025-11-28 13:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 4:00 Matthew Wilcox (Oracle)
2025-11-28 13:34 ` Liam R. Howlett [this message]
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=ozziddwdsar7y6yby65t4jbgvf6rupxuk6phd5umsyr56szmsi@c2ubpgypvcmb \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=surenb@google.com \
--cc=syzbot+5b19bad23ac7f44bf8b8@syzkaller.appspotmail.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/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