glibc/sysdeps
Geoffrey Thomas 372c632ce7 elf: Canonicalize $ORIGIN in an explicit ld.so invocation [BZ 25263]
When an executable is invoked directly, we calculate $ORIGIN by calling
readlink on /proc/self/exe, which the Linux kernel resolves to the
target of any symlinks.  However, if an executable is run through ld.so,
we cannot use /proc/self/exe and instead use the path given as an
argument. This leads to a different calculation of $ORIGIN, which is
most notable in that it causes ldd to behave differently (e.g., by not
finding a library) from directly running the program.

To make the behavior consistent, take advantage of the fact that the
kernel also resolves /proc/self/fd/ symlinks to the target of any
symlinks in the same manner, so once we have opened the main executable
in order to load it, replace the user-provided path with the result of
calling readlink("/proc/self/fd/N").

(On non-Linux platforms this resolution does not happen and so no
behavior change is needed.)

Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-03 17:05:21 -03:00
..
aarch64 AArch64: Remove LP64 and ILP32 ifdefs 2025-02-24 14:20:29 +00:00
alpha
arc math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
arm math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
csky
generic elf: Canonicalize $ORIGIN in an explicit ld.so invocation [BZ 25263] 2025-03-03 17:05:21 -03:00
gnu
hppa math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
htl htl: don't export __pthread_default_rwlockattr anymore. 2025-02-16 23:43:04 +01:00
hurd
i386 math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
ieee754 sysdeps/ieee754: Fix remainder sign of zero for FE_DOWNWARD (BZ ) 2025-02-26 17:17:25 -03:00
loongarch math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
m68k
mach elf: Canonicalize $ORIGIN in an explicit ld.so invocation [BZ 25263] 2025-03-03 17:05:21 -03:00
microblaze
mips math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
nptl nptl: clear the whole rseq area before registration 2025-02-21 22:21:25 +00:00
or1k math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
posix Fix underallocation of abort_msg_s struct (CVE-2025-0395) 2025-01-22 08:17:17 -05:00
powerpc math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
pthread htl: move pthread_setcancelstate into libc. 2025-02-01 11:24:14 +01:00
riscv RISC-V: Fix IFUNC resolver cannot access gp pointer 2025-02-25 13:08:53 +01:00
s390 math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
sh sh: Fix tst-guard1 build 2025-01-31 09:34:36 -03:00
sparc math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00
unix elf: Canonicalize $ORIGIN in an explicit ld.so invocation [BZ 25263] 2025-03-03 17:05:21 -03:00
wordsize-32
wordsize-64
x86 math: Fix `unknown type name '__float128'` for clang 3.4 to 3.8.1 (bug 32694) 2025-02-23 11:47:11 +08:00
x86_64 math: Use tanpif from CORE-MATH 2025-02-12 16:31:57 -03:00