Just as an update: I just spent some time reading NetBSD source code to understand how they are doing it. They seem to do exactly what Philip suggested: pack the execname from kern_exec in the elf auxiliary vector, and dirname() that on ld.so.
On Sat, Dec 12, 2015 at 4:08 PM, Aurélien Vallée <vallee.aurel...@gmail.com> wrote: >> I asked a question, and you didn't answer it. > > I did my best to try to find this out, but all I was able to dig are these > release notes of ELF gABI. > I will try to find how that was supposed to be solved at the time, but > I fear these details are lost in time, and not available on much online > documents I could get a hand on. > >> We could come up with a hack. > > If you don't mind detailing the hack you're thinking of, I could try to make > a patch implementing it. > > On Sat, Dec 12, 2015 at 3:23 PM, Theo de Raadt <dera...@cvs.openbsd.org> wrote: >>> Allow me to rephrase it with a clearer wording then: >>> We need the path that was provided to execve(), and thus contained - >>> at that time - the >>> ELF that was loaded". >> >> And once again, I am saying Unix doesn't have a standardized way of >> doing this. >> >> We could come up with a hack. > > > > -- > Aurélien Vallée > Phone +33 9 77 19 85 61 -- Aurélien Vallée Phone +33 9 77 19 85 61