[PATCH] smack: do not override the subject label in overlayfs hooks

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Oct 29 16:09:26 UTC 2026


> Overlayfs performs operations on the upper, lower and work directories
> with the credentials of the mounter and uses the inode_copy_up() and
> dentry_create_files_as() hooks only to let the LSM choose the label of
> the inode it is about to create. Smack implemented both hooks by
> replacing smk_task in the override credentials, so the label of the
> copied file, or of the transmuting directory, became the subject of all
> access checks done in the underlying filesystems on behalf of overlayfs:
> the lookup and creation of the temporary inode in the workdir, the
> rename into the upper directory, setting the overlay xattrs.
> 
> Unless that label happens to have access to the workdir and upper
> directories, or is allowed to use CAP_MAC_OVERRIDE, these operations
> fail with EACCES:
> 
>   lsm=SMACK fn=smack_inode_permission action=denied subject="somelabel"
> [ ... ]
> Outside overlayfs smk_create is never set, so there is no behaviour
> change there.
> 
> Fixes: d6d80cb57be4 ("Smack: Base support for overlayfs")
> Signed-off-by: Mateusz Moscicki <m.moscicki2 at samsung.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261029155422.578322-1-m.moscicki2@samsung.com?part=1




More information about the Linux-security-module-archive mailing list