[PATCH 1/2] landlock: Fix landlock_restrict_self() failure on long executable paths

sashiko-bot at kernel.org sashiko-bot at kernel.org
Wed Nov 11 04:59:21 UTC 2026


> From: Daejun Park <daejun7.park at samsung.com>
> 
> get_current_exe() treats a d_path() error on the current executable as
> a bug. But an absolute path is not bounded by PATH_MAX, and d_path()
> returns -ENAMETOOLONG when the path does not fit in the
> LANDLOCK_PATH_MAX_SIZE buffer.
> 
> An unprivileged task with such an executable triggers the
> WARN_ON_ONCE(), and its landlock_restrict_self() call fails with
> -ENAMETOOLONG.
> 
> The path is not used for enforcement. Record "<too_long>" instead, as
> audit_log_d_path() does, and create the domain.
> 
> Reported-by: Dwi Siswanto <me at dw1.io>
> Closes: https://lore.kernel.org/r/20261102022018.73143-1-me@dw1.io
> Suggested-by: Dwi Siswanto <me at dw1.io>
> Fixes: 1d636984e088 ("landlock: Add AUDIT_LANDLOCK_DOMAIN and log domain status")
> Cc: stable at vger.kernel.org
> Signed-off-by: Daejun Park <daejun7.park at samsung.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111-landlock-long-exe-v1-0-588cfd174a10@samsung.com?part=1




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