kernel_samsung_a53x/security/tomoyo
Tetsuo Handa 8d86e29a54 tomoyo: fallback to realpath if symlink's pathname does not exist
commit ada1986d07976d60bed5017aa38b7f7cf27883f7 upstream.

Alfred Agrell found that TOMOYO cannot handle execveat(AT_EMPTY_PATH)
inside chroot environment where /dev and /proc are not mounted, for
commit 51f39a1f0cea ("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: 51f39a1f0cea ("syscalls: implement execveat() system call")
Cc: stable@vger.kernel.org # v3.19+
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:21:45 +01:00
..
policy Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
audit.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
common.c tomoyo: fix UAF write bug in tomoyo_write_control() 2024-11-18 23:18:29 +01:00
common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
condition.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
domain.c tomoyo: fallback to realpath if symlink's pathname does not exist 2024-11-23 23:21:45 +01:00
environ.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
group.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
load_policy.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
memory.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mount.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
network.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
realpath.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
securityfs_if.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tomoyo.c lsm: new security_file_ioctl_compat() hook 2024-11-18 12:12:58 +01:00
util.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00