Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796324413; b=QFRvofrPss6FJ5v39lIjrW40MP1ujuRPrDX+BXOJd/nd3qrjzIZKrL0TBXh83lCG27L/ A3KcwRTjQ3AJrTZ3zRUQzLB1AEf7z+P/I3NvHCqNAd1NfX13uxPkEV4qVzABtQdMEEEv/ ZlFAAsN1RA4i7CrRW2Vq2TZrq0ltDHAzqU4DyPPFP7m+D4XyWg9CR8E3ixgLRDgmtf7Kr qMQGUbdmo+YyoYFMrP2+WeVmWKES0i1RA8enOn1MO78ujodOI6tF2JukPsrDlwRNkHPF/ 3XWacF+Zs1MkGCZkzMuD6/L6h/Lvy6K6R0LEak8DvRfbB3C3K68YcVpTzW+Q6jiuHUg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796324413; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=2IalatYC+J+qXzvUn4y8XTOkMdworARzeXbrBTZtY6M=; b=kGbYXjxYfYIh1gBbaTGCb6Jo1tZGGL5MDGx1z/gtzOG+O8gjhEFJTdwQM+APOrOWZmqc riVMqpF88phxbNPu6eCDP/aEFAVdeWCaV4kHrGi57irrN3kjBIKf7nLUFYfrvSTVo4K5o quZtc9DLW99/Ja74xM95MqaJxYllDbWFX5BSgIr0IWpUPDW4eSDI9hPWRZGpyl0FAKJ1H 25SHESx1bYP09iGfn4eGQwiv4YnTt4YckmvSoLkcbBXnFCZCXPiPxsOb194cYgz4o0et4 8t7xIh2yvH4efja2K/lvYK71Y7OmCUKBqcJFqJaJcFmvEbfx1uzA+lU/Ae1zTERuGsQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=ljmwSuEJ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E444606A33A for ; Thu, 3 Dec 2026 19:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=ljmwSuEJ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46C3F1F031F2; Thu, 3 Dec 2026 19:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796324413; bh=2IalatYC+J+qXzvUn4y8XTOkMdworARzeXbrBTZtY6M=; h=Date:To:From:In-Reply-To:References:Subject; b=ljmwSuEJZuOA4nh2jvPaMuZYk/As//vBJW2jMD10CTHWuHwgeHNSIKe2+MdQSsqyM x+8atNCdgogsUCLnvbq5Aob6AwGlcmOfio2H4NvP7QvDs7mFn+b2tW4TX2Lnq4Ji94 rPNGtt2px245CsFtDSP3d3KKZksEyxy2RLOhERds= Date: Thu, 03 Dec 2026 11:00:12 -0800 To: mm-commits@vger.kernel.org,mason@kernel.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261125-hugetlb_fixes_2-v1-17-db27fd2f71a8@kernel.org> References: <20261125-hugetlb_fixes_2-v1-17-db27fd2f71a8@kernel.org> Subject: [to-be-updated] hugetlbfs-seal-shm_hugetlb-files-against-growth.patch removed from -mm tree Message-Id: <20261203190013.46C3F1F031F2@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The quilt patch titled Subject: hugetlbfs: seal SHM_HUGETLB files against growth has been removed from the -mm tree. Its filename was hugetlbfs-seal-shm_hugetlb-files-against-growth.patch This patch was dropped because an updated version will be issued ------------------------------------------------------ From: Chris Mason Subject: hugetlbfs: seal SHM_HUGETLB files against growth Date: Wed, 25 Nov 2026 23:33:15 +0100 The size of a SysV shared memory segment is fixed at shmget(), and do_shmat() relies on that by mapping i_size bytes of the backing file. However, with SHM_HUGETLB, the hugetlbfs file can be grown through an fd obtained from /proc//map_files with ftruncate() or fallocate(). Also, remap_file_pages() with a pgoff beyond the segment can grow it, because hugetlbfs_file_mmap() grows the file to the end of a writable mapping: shmget(key, 4M, SHM_HUGETLB) i_size = 4M addr = shmat(id, NULL, 0) remap_file_pages(addr, 2M, 0, 6M >> PAGE_SHIFT, 0) i_size = 8M shmat(id, NULL, 0) maps 8M Later calls to shmat() will map the bigger size. Using /proc//map_files requires CAP_CHECKPOINT_RESTORE, but remap_file_pages() does not require any privileges, so we focus on the latter. Let's fix it by setting F_SEAL_GROW on the inode when creating it for a segment. remap_file_pages() beyond the segment still succeeds, like for shmem segments, but accessing pages there now correctly results in SIGBUS. This has low urgency, and likely nobody ever ran into this in practice. Let's not CC stable. [david@kernel.org: adjust description] Link: https://patch.msgid.link/20261125-hugetlb_fixes_2-v1-17-db27fd2f71a8@kernel.org Fixes: c8d78c1823f4 ("mm: replace remap_file_pages() syscall with emulation") Signed-off-by: Chris Mason Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Andrew Morton Cc: Muchun Song Cc: Oscar Salvador Cc: Jinmeng Zhou Cc: Hongfu Li Cc: Andrea Arcangeli Cc: Naoya Horiguchi Cc: Hugh Dickins Cc: Baolin Wang Cc: Dave Airlie Cc: Vivek Kasireddy Cc: Gerd Hoffmann Cc: Mike Rapoport Cc: Mel Gorman Cc: Dave McCracken Cc: Andy Whitcroft Cc: Adam Litke Cc: Lorenzo Stoakes Cc: Rik van Riel Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Harry Yoo Cc: Jann Horn Cc: Lance Yang Cc: James Houghton Cc: Yang Shi Cc: Suren Baghdasaryan Cc: Shakeel Butt Cc: Pedro Falcato Cc: Gregory Price Cc: Zi Yan Cc: Joshua Hahn Cc: Rakie Kim Cc: Ying Huang Cc: Matthew Brost Cc: Byungchul Park Cc: Alistair Popple Cc: Wanpeng Li Cc: Andi Kleen Cc: Kenneth W Chen Cc: Michal Hocko Cc: David Rientjes Cc: Joern Engel Cc: Jonathan Corbet Cc: Shuah Khan Cc: Randy Dunlap Cc: Aneesh Kumar K.V Cc: KAMEZAWA Hiroyuki Cc: Kiryl Shutsemau Cc: Sasha Levin Cc: Guillaume Morin Cc: Jason Gunthorpe Cc: luojiajun Cc: Josef Bacik Cc: Daehyeon Ko <4ncienth@gmail.com> Cc: Ackerley Tng Cc: Jiaqi Yan fs/hugetlbfs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/hugetlbfs/inode.c~hugetlbfs-seal-shm_hugetlb-files-against-growth +++ a/fs/hugetlbfs/inode.c @@ -1559,8 +1559,11 @@ struct file *hugetlb_file_setup(const ch S_IFREG | S_IRWXUGO, 0); if (!inode) goto out; - if (creat_flags == HUGETLB_SHMFS_INODE) + if (creat_flags == HUGETLB_SHMFS_INODE) { inode->i_flags |= S_PRIVATE; + /* The size of a segment is fixed at shmget(). */ + HUGETLBFS_I(inode)->seals |= F_SEAL_GROW; + } inode->i_size = size; clear_nlink(inode); _ Patches currently in -mm which might be from mason@kernel.org are mm-swap-fix-large-swap-in-across-swap-file-extents.patch hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch mm-hugetlb-keep-surplus-folios-that-are-reserved.patch mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch mm-cachestat-count-each-page-only-once.patch mm-cachestat-restart-the-walk-after-each-entry.patch percpu-queue-the-balance-work-on-an-unbound-workqueue.patch mm-vma-fix-uncharge-after-failed-stack-relocation.patch mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch mm-mremap-respect-guard-gaps-on-in-place-expansion.patch mm-vma-make-brk-mappings-non-executable-under-mdwe.patch kfence-use-a-nofault-store-to-zero-the-guard-page.patch mm-filemap-update-the-folio-order-range-atomically.patch mm-userfaultfd-account-memory-allocated-for-unmap-events.patch mm-userfaultfd-drop-fork-context-reference-outside-event_wqhlock.patch mm-madvise-dont-declare-oom-for-madv_willneed-swapin.patch mm-mprotect-fix-unpaired-notifier-start-at-address-0.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch mm-mglru-count-all-generations-as-evictable.patch mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch mm-mglru-report-root-reclaim-to-memorypressure_level.patch mm-hugetlb-resolve-protnone-faults-without-a-uffd-bit.patch a.patch