[Bug dynamic-link/25263] ldd and ld.so fail to resolve $ORIGIN with cross dir symlink

geofft at ldpreload dot com sourceware-bugzilla@sourceware.org
Tue Feb 18 20:39:53 GMT 2025


https://sourceware.org/bugzilla/show_bug.cgi?id=25263

--- Comment #11 from Geoffrey Thomas <geofft at ldpreload dot com> ---
Created attachment 15966
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15966&action=edit
Patch to canonicalize the argument to ld.so

Here's a patch to fix the behavior inside ld.so by taking advantage of the fact
that the kernel does canonicalization for readlink("/proc/self/fd/...") in the
same way it canonicalizes readlink("/proc/self/exe"). We already have a file
descriptor open in order to load the main executable, and this avoids having to
pull a realpath() implementation into ld.so. From some basic testing it seems
to work. I've also pushed the patch to branch "ldso-realpath" of
https://github.com/geofft/glibc if that is easier to look at.

If this patch isn't suitable, would it be possible to merge the $(realpath) fix
to ldd for now? This is still unfixed in 2.41 and I'd really like to see the
effective behavior fixed in 2.42 in some fashion... we got falsely blamed with
"do people using rust know anything about build systems at all" over this bug
even though no Rust is involved :)
https://github.com/Nuitka/Nuitka/issues/3325#issuecomment-2630643678

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list