Re: [PATCH v2 25/35] hugetlbfs: zero all hugetlbfs-specific fields of new inodes
From: Jose A. Perez de Azpillaga
Date: Fri Dec 04 2026 - 06:29:30 EST
On 12/3/26 12:37 PM, David Hildenbrand (Arm) wrote:
> hugetlbfs_get_inode() initializes the seals of new hugetlbfs inodes, and
> the hugetlbfs inode tracepoints record them.
>
> However, we don't initialize the seals in two cases:
>
> (1) For the root inode through hugetlbfs_get_root()
>
> (2) For an inode that alloc_inode() destroys right away because
> inode_init_always() failed.
>
> Consequently, when such an inode is evicted or destroyed with the
> tracepoints enabled, we record stale seals, and KMSAN reports an
> uninit-value.
>
> Reproduced by closing a hugetlb memfd with seals, and mounting and
> unmounting hugetlbfs with the hugetlbfs_evict_inode tracepoint enabled:
> the root inode reports the seals of the memfd.
>
> Let's fix it by zeroing all hugetlbfs-specific inode fields when
> allocating the inode in hugetlbfs_alloc_inode().
>
> We can now drop the manual initialization of resv_map in
> hugetlbfs_get_root().
>
> This has low urgency, as it only affects the tracepoints. No need to CC
> stable.
>
> Fixes: 318580ad7f28 ("hugetlbfs: support tracepoint")
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
LGTM:
Reviewed-by: Jose A. Perez de Azpillaga <azpijr@xxxxxxxxx>
--
cheers,
jose a. p-a