Re: [PATCH 05/16] hugetlbfs: enforce F_SEAL_EXEC in setattr
From: Zi Yan
Date: Mon Oct 26 2026 - 15:08:53 EST
On 26 Oct 2026, at 5:40, David Hildenbrand (Arm) wrote:
> From: Eva Kurchatova <eva.kurchatova@xxxxxxxxxxxxx>
>
> F_SEAL_EXEC is enforced by shmem_setattr(), but hugetlbfs_setattr() does
> not check it. As a result, fchmod() can change the execute bits of a
> sealed hugetlbfs memfd.
>
> Use memfd_check_seals_mode() in hugetlbfs_setattr() to reject changes
> to execute bits when F_SEAL_EXEC is set.
>
> This also fixes the memfd_test hugetlbfs SEAL-EXEC subtest, where
> fchmod() incorrectly succeeded after applying F_SEAL_EXEC.
>
> LLM assistance was used to reuse the helper and revise the description.
>
> Fixes: 6fd7353829ca ("mm/memfd: add F_SEAL_EXEC")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Eva Kurchatova <eva.kurchatova@xxxxxxxxxxxxx>
> Link: https://patch.msgid.link/20260629180247.2343229-1-eva.kurchatova@xxxxxxxxxxxxx
> [ david: use common helper; fixup Fixes: ]
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> ---
> fs/hugetlbfs/inode.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
Acked-by: Zi Yan <ziy@xxxxxxxxxx>
Best Regards,
Yan, Zi