From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,will@kernel.org,vivek.kasireddy@intel.com,
vbabka@kernel.org,svens@linux.ibm.com,surenb@google.com,
stable@vger.kernel.org,skhan@linuxfoundation.org,rppt@kernel.org,
riel@surriel.com,rdunlap@infradead.org,peterz@infradead.org,
peterx@redhat.com,osalvador@suse.de,osalvador@kernel.org,npiggin@gmail.com,
nao.horiguchi@gmail.com,muchun.song@linux.dev,mhocko@suse.com,
mgorman@suse.de,mason@kernel.org,luojiajun3@huawei.com,ljs@kernel.org,
linmiaohe@huawei.com,liam@infradead.org,leitao@debian.org,kraxel@redhat.com,
jgg@ziepe.ca,hughd@google.com,hca@linux.ibm.com,gourry@gourry.net,
gor@linux.ibm.com,david@kernel.org,corbet@lwn.net,borntraeger@linux.ibm.com,
baolin.wang@linux.alibaba.com,arnd@arndb.de,apw@canonical.com,
aneesh.kumar@kernel.org,airlied@redhat.com,agordeev@linux.ibm.com,
ackerleytng@google.com,4ncienth@gmail.com,josef@toxicpanda.com,
akpm@linux-foundation.org
Subject: [merged mm-hotfixes-stable] hugetlbfs-fix-unmapping-folios-from-private-vmas.patch removed from -mm tree
Date: Sun, 22 Nov 2026 22:25:29 -0800 [thread overview]
Message-ID: <20261123062530.5730B1F000C0@smtp.kernel.org> (raw)
In-Reply-To: <20261116-fixes_hugetlb-v2-7-4dd9e94ea9ac@kernel.org>
The quilt patch titled
Subject: hugetlbfs: fix unmapping folios from private VMAs
has been removed from the -mm tree. Its filename was
hugetlbfs-fix-unmapping-folios-from-private-vmas.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Josef Bacik <josef@toxicpanda.com>
Subject: hugetlbfs: fix unmapping folios from private VMAs
Date: Mon, 16 Nov 2026 19:29:28 +0100
hugetlb_unmap_file_folio() assumes vm_private_data points to a struct
hugetlb_vma_lock when hugetlb_vma_trylock_write() fails. Since hugetlb VMA
locking was extended to private VMAs, this can also happen when
vm_private_data contains a resv_map pointer; treating it as a
hugetlb_vma_lock corrupts memory and can cause crashes or hangs.
Only take the VMA lock when a shareable lock exists, as additional locking
is only needed for PMD table sharing. The fault mutex and i_mmap_rwsem
already provide the required protection for private VMAs.
Fix generated by an LLM and sent by Josef Bacik in private.
[david@kernel.org: simplify description and comment]
Link: https://patch.msgid.link/20261116-fixes_hugetlb-v2-7-4dd9e94ea9ac@kernel.org
Fixes: bf4916922c60 ("hugetlbfs: extend hugetlb_vma_lock to private VMAs")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Tested-by: Daehyeon Ko <4ncienth@gmail.com>
Link: https://lore.kernel.org/20261116-fixes_hugetlb-v2-7-4dd9e94ea9ac@kernel.org
Acked-by: Muchun Song <muchun.song@linux.dev>
Tested-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://lore.kernel.org/179490430300.482102.17633361840450824485.b4-reply@b4
Acked-by: Oscar Salvador (SUSE) <osalvador@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Breno Leitao <leitao@debian.org>
Cc: Will Deacon <will@kernel.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Chris Mason <mason@kernel.org>
Cc: luojiajun <luojiajun3@huawei.com>
Cc: Ackerley Tng <ackerleytng@google.com>
Cc: <stable@vger.kernel.org>
fs/hugetlbfs/inode.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/fs/hugetlbfs/inode.c~hugetlbfs-fix-unmapping-folios-from-private-vmas
+++ a/fs/hugetlbfs/inode.c
@@ -401,6 +401,16 @@ retry:
if (!hugetlb_vma_maps_pfn(vma, v_start, pfn))
continue;
+ /*
+ * We only need additional VMA locking here for PMD table
+ * sharing, which synchronizes on the shareable lock.
+ */
+ if (!__vma_shareable_lock(vma)) {
+ unmap_hugepage_range(vma, v_start, v_end, NULL,
+ ZAP_FLAG_DROP_MARKER);
+ continue;
+ }
+
if (!hugetlb_vma_trylock_write(vma)) {
vma_lock = vma->vm_private_data;
/*
_
Patches currently in -mm which might be from josef@toxicpanda.com are
mm-zswap-drop-the-stale-zswap-entry-of-a-zero-folio.patch
mm-swap-account-synchronous-swap-reads-as-memory-stall.patch
mm-mremap-fix-hugetlb-reservation-leak-on-partial-move.patch
selftests-mm-test-a-partial-mremap-of-hugetlb-memory.patch
mm-mremap-reaccount-on-unmap-failure-only-if-accounted.patch
mm-mremap-restore-vma_account_bit-if-the-unmap-fails.patch
selftests-mm-test-mremap-with-an-old-size-of-0.patch
zram-lz4-lz4hc-accept-dictionaries-of-more-than-64-kib.patch
mm-hugetlb-keep-surplus-folios-when-the-pool-shrinks.patch
parent reply other threads:[~2026-11-23 6:25 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20261116-fixes_hugetlb-v2-7-4dd9e94ea9ac@kernel.org>]
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=20261123062530.5730B1F000C0@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=4ncienth@gmail.com \
--cc=ackerleytng@google.com \
--cc=agordeev@linux.ibm.com \
--cc=airlied@redhat.com \
--cc=aneesh.kumar@kernel.org \
--cc=apw@canonical.com \
--cc=arnd@arndb.de \
--cc=baolin.wang@linux.alibaba.com \
--cc=borntraeger@linux.ibm.com \
--cc=corbet@lwn.net \
--cc=david@kernel.org \
--cc=gor@linux.ibm.com \
--cc=gourry@gourry.net \
--cc=hca@linux.ibm.com \
--cc=hughd@google.com \
--cc=jgg@ziepe.ca \
--cc=josef@toxicpanda.com \
--cc=kraxel@redhat.com \
--cc=leitao@debian.org \
--cc=liam@infradead.org \
--cc=linmiaohe@huawei.com \
--cc=ljs@kernel.org \
--cc=luojiajun3@huawei.com \
--cc=mason@kernel.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=mm-commits@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=nao.horiguchi@gmail.com \
--cc=npiggin@gmail.com \
--cc=osalvador@kernel.org \
--cc=osalvador@suse.de \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=svens@linux.ibm.com \
--cc=vbabka@kernel.org \
--cc=vivek.kasireddy@intel.com \
--cc=will@kernel.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