From: Muchun Song <muchun.song@linux.dev>
To: Zhengchuan Liang <zcliangcn@gmail.com>
Cc: Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
David Hildenbrand <david@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Davidlohr Bueso <davidlohr@hp.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/hugetlb: stop hashing address_space pointers for fault mutexes
Date: Sun, 6 Dec 2026 10:53:21 +0800 [thread overview]
Message-ID: <1CFD7635-D3A6-42F6-9901-9E03FD43D2EB@linux.dev> (raw)
In-Reply-To: <20261206004239.3250411-1-zcliangcn@gmail.com>
> On Dec 6, 2026, at 08:42, Zhengchuan Liang <zcliangcn@gmail.com> wrote:
>
> hugetlb_fault_mutex_hash() hashes an address_space pointer and huge page
> index to select a mutex from a global table. An unprivileged process can
> exercise it by faulting a HugeTLB memfd mapped with MAP_NORESERVE. The
> mutex is selected before allocation, so the hash remains reachable when
> no huge pages are available and the fault returns SIGBUS.
>
> Fault timing under contention reveals whether chosen indices share a
> bucket. These collisions allow exact recovery of the mapping pointer over
> the allocator-valid address range. Since address_space is embedded at a
> fixed offset in struct hugetlbfs_inode_info, the leak also identifies the
> containing hugetlbfs_inode_cache object and replacement objects if its
> slab page is later reused.
>
> Hash only the page index and use mapping->host->i_ino as the seed.
> hugetlbfs assigns each inode a nonzero 32-bit value from get_next_ino()
> before exposing the inode, and the value remains stable for the inode's
> lifetime. jhash2() mixes the inode number before reducing the result to
> the mutex table size; the seed does not need to be unique, random, or
> secret. This keeps the same mapping and index on the same mutex while
> varying bucket selection by inode, without encoding a kernel address.
>
> Fixes: 8382d914ebf7 ("mm, hugetlb: improve page-fault scalability")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zhengchuan Liang <zcliangcn@gmail.com>
Acked-by: Muchun Song (ByteDance) <muchun.song@linux.dev>
Thanks.
prev parent reply other threads:[~2026-12-06 2:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 0:42 [PATCH v2] mm/hugetlb: stop hashing address_space pointers for fault mutexes Zhengchuan Liang
2026-12-06 2:53 ` Muchun Song [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=1CFD7635-D3A6-42F6-9901-9E03FD43D2EB@linux.dev \
--to=muchun.song@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=davidlohr@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
--cc=zcliangcn@gmail.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 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.