]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/env, ...: use getauxval(AT_SECURE) for SUID check
authorMax Kellermann <max.kellermann@ionos.com>
Sat, 10 May 2025 20:26:50 +0000 (22:26 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Sat, 10 May 2025 20:37:19 +0000 (22:37 +0200)
commitb36add06585acf77e1a50fc0d2c901a0129582a4
tree6aa81064bcd29c2adff815738671e6ab8b9b5ba8
parent4e417332f4154acb0e7a12c775696eb561a405aa
lib/env, ...: use getauxval(AT_SECURE) for SUID check

Comparing effective and real uid/gid is not a proper way to check for
SUID execution:

1. this does not consider file capabilities

2. this check breaks when NO_NEW_PRIVS is used as the Linux kernel
   resets effective ids during execve(); this means the check is
   false, but the process still has raised capabilities

For more details about the NO_NEW_PRIVS problem, check this post and
the surrounding thread:

 https://lore.kernel.org/lkml/20250509184105.840928-1-max.kellermann@ionos.com/

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
include/debug.h
lib/env.c
libmount/src/context.c
login-utils/chfn.c
login-utils/chsh.c
login-utils/su-common.c
sys-utils/swapon.c
term-utils/wall.c
text-utils/more.c