From: Hillf Danton <hdanton@sina.com>
To: Kartik Nair <contact.kartikn@gmail.com>
Cc: mhocko@suse.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
syzbot+bd6aaf99e8443d8a9034@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] mm/hugetlb: fix deadlock in __hugetlb_zap_begin() by using trylock
Date: Thu, 14 May 2026 10:42:41 +0800 [thread overview]
Message-ID: <20260514024242.658-1-hdanton@sina.com> (raw)
In-Reply-To: <20260513211927.4206-1-contact.kartikn@gmail.com>
On Thu, 14 May 2026 02:49:27 +0530 Kartik Nair wrote:
> syzbot reported a circular locking dependency involving
> resv_map->rw_sema and mmap_lock:
>
> CPU0 CPU1
> lock(&mm->mmap_lock)
> lock(sk_lock-AF_INET6)
> lock(&mm->mmap_lock)
> lock(&resv_map->rw_sema)
>
> __hugetlb_zap_begin() calls hugetlb_vma_lock_write() which does a
> blocking down_write() on either vma_lock->rw_sema or
> resv_map->rw_sema while mmap_lock is already held for write by the
> caller chain (vm_mmap_pgoff -> mmap_region -> __mmap_region ->
> unmap_region -> unmap_vmas -> hugetlb_zap_begin).
>
> Fix this by converting __hugetlb_zap_begin() to use
> hugetlb_vma_trylock_write() instead of hugetlb_vma_lock_write().
> If the trylock fails, return false to the callers so they can skip
> the zap operation safely. Update hugetlb_zap_begin() and its callers
> in unmap_vmas() and zap_vma_range_batched() accordingly.
>
Given q->q_usage_counter in the syzbot report [1] and the correct
locking order in ffa1e7ada456 ("block: Make request_queue lockdep
splats show up earlier"), I suspect change to hugetlb is needed.
[1] https://lore.kernel.org/lkml/6a02edcf.170a0220.7f9b3.000c.GAE@google.com/
prev parent reply other threads:[~2026-05-14 2:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 21:19 [PATCH] mm/hugetlb: fix deadlock in __hugetlb_zap_begin() by using trylock Kartik Nair
2026-05-14 2:42 ` Hillf Danton [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=20260514024242.658-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=contact.kartikn@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=syzbot+bd6aaf99e8443d8a9034@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