Should /proc/self/exe preempt LD_ORIGIN_PATH ?
Paul Pluzhnikov
ppluzhnikov@google.com
Fri Mar 26 22:34:00 GMT 2010
Greetings,
http://www.kernel.org/doc/man-pages/online/pages/man8/ld.so.8.html
says this about LD_ORIGIN_PATH:
(glibc since 2.1) Path where the binary is found (for non-set-user-ID
programs). For security reasons, since glibc 2.4, LD_ORIGIN_PATH is
ignored for set-user-ID/set-group-ID binaries.
which makes me believe that setting LD_ORIGIN_PATH was intended to
affect '$ORIGIN' expansion.
It doesn't on Linux, because sysdeps/unix/sysv/linux/dl-origin.c uses
GLRO(dl_origin_path) only if readlink("/proc/self/exe") fails.
When an executable is invoked via symlink, the kernel expands
/proc/self/exe to the target of the link, and it is easy to construct
a case where this will cause executable to fail to find its NEEDED
shared libraries. I expected LD_ORIGIN_PATH to help in that case, but
it doesn't. Is that a bug?
AFAICT, manual/libc.texinfo doesn't mention LD_ORIGIN_PATH at all, and
I don't know what other documentation would be authoritative.
Thanks,
--
Paul Pluzhnikov
More information about the Libc-alpha
mailing list