3 ms·
> Some years ago I worked on adding `$ORIGIN` rpath support in OpenBSD and looked at how Linux did it. Mind you, the dynamic linker (ldlinux.so) grabs the runni
by o11c 3y ago
> Some years ago I worked on adding `$ORIGIN` rpath support in OpenBSD and looked at how Linux did it. Mind you, the dynamic linker (ldlinux.so) grabs the running executable path from /proc...
`getauxval(AT_EXECFN)` is "better" but there are weird edge cases with `fexecve` where you only get `AT_EXECFD`, even ignoring the inevitable TOCTOU.
- Galanwe 3y agoI am a bit blurry on the details because I worked on that almost 10 years ago to support a program that used (and abused) `$ORIGIN`. I ended up pushing the executable filename through the aux vector to the dynamic linker, which is simar to what you mention AFAIU. Never managed to get that merged upstream though. Glad to know there's now a _standard_ way.