[PATCH V3] fs: generalize anon_inode_make_secure_inode() and fix secretmem LSM bypass
Ira Weiny
ira.weiny at intel.com
Fri Jun 27 18:21:17 UTC 2025
Shivank Garg wrote:
> Extend anon_inode_make_secure_inode() to take superblock parameter and
> make it available via fs.h. This allows other subsystems to create
> anonymous inodes with proper security context.
>
> Use this function in secretmem to fix a security regression, where
> S_PRIVATE flag wasn't cleared after alloc_anon_inode(), causing
> LSM/SELinux checks to be skipped.
>
> Using anon_inode_make_secure_inode() ensures proper security context
> initialization through security_inode_init_security_anon().
>
> Fixes: 2bfe15c52612 ("mm: create security context for memfd_secret inodes")
> Suggested-by: David Hildenbrand <david at redhat.com>
> Suggested-by: Mike Rapoport (Microsoft) <rppt at kernel.org>
> Reviewed-by: David Hildenbrand <david at redhat.com>
Reviewed-by: Ira Weiny <ira.weiny at intel.com>
[snip]
More information about the Linux-security-module-archive
mailing list