linux/security/tomoyo
Tetsuo Handa ada1986d07 tomoyo: fallback to realpath if symlink's pathname does not exist
Alfred Agrell found that TOMOYO cannot handle execveat(AT_EMPTY_PATH)
inside chroot environment where /dev and /proc are not mounted, for
commit 51f39a1f0c ("syscalls: implement execveat() system call") missed
that TOMOYO tries to canonicalize argv[0] when the filename fed to the
executed program as argv[0] is supplied using potentially nonexistent
pathname.

Since "/dev/fd/<fd>" already lost symlink information used for obtaining
that <fd>, it is too late to reconstruct symlink's pathname. Although
<filename> part of "/dev/fd/<fd>/<filename>" might not be canonicalized,
TOMOYO cannot use tomoyo_realpath_nofollow() when /dev or /proc is not
mounted. Therefore, fallback to tomoyo_realpath_from_path() when
tomoyo_realpath_nofollow() failed.

Reported-by: Alfred Agrell <blubban@gmail.com>
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082001
Fixes: 51f39a1f0c ("syscalls: implement execveat() system call")
Cc: stable@vger.kernel.org # v3.19+
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
2024-09-25 22:30:59 +09:00
..
policy
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
audit.c tomoyo: replace tomoyo_round2() with kmalloc_size_roundup() 2023-03-01 23:46:12 +09:00
common.c tomoyo: allow building as a loadable LSM module 2024-09-24 22:35:30 +09:00
common.h tomoyo: allow building as a loadable LSM module 2024-09-24 22:35:30 +09:00
condition.c tomoyo: Fix typo in comments. 2020-12-06 13:44:57 +09:00
domain.c tomoyo: fallback to realpath if symlink's pathname does not exist 2024-09-25 22:30:59 +09:00
environ.c
file.c tomoyo: struct path it might get from LSM callers won't have NULL dentry or mnt 2022-08-21 11:50:42 -04:00
gc.c tomoyo: preparation step for building as a loadable LSM module 2024-09-23 19:00:21 +09:00
group.c tomoyo: Suppress RCU warning at list_for_each_entry_rcu(). 2019-12-16 23:02:27 +09:00
hooks.h tomoyo: preparation step for building as a loadable LSM module 2024-09-23 19:00:21 +09:00
init.c tomoyo: allow building as a loadable LSM module 2024-09-24 22:35:30 +09:00
Kconfig tomoyo: allow building as a loadable LSM module 2024-09-24 22:35:30 +09:00
load_policy.c tomoyo: allow building as a loadable LSM module 2024-09-24 22:35:30 +09:00
Makefile tomoyo: allow building as a loadable LSM module 2024-09-24 22:35:30 +09:00
memory.c tomoyo: Fix null pointer check 2020-11-27 19:36:11 +09:00
mount.c
network.c tomoyo: don't special case PF_IO_WORKER for PF_KTHREAD 2021-03-28 13:11:29 +09:00
proxy.c tomoyo: allow building as a loadable LSM module 2024-09-24 22:35:30 +09:00
realpath.c tomoyo: struct path it might get from LSM callers won't have NULL dentry or mnt 2022-08-21 11:50:42 -04:00
securityfs_if.c tomoyo: allow building as a loadable LSM module 2024-09-24 22:35:30 +09:00
util.c tomoyo: preparation step for building as a loadable LSM module 2024-09-23 19:00:21 +09:00