Re: ld.so behavior with $ORIGIN

2015-12-12 Thread Aurélien Vallée
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

Re: ld.so behavior with $ORIGIN

2015-12-12 Thread Aurélien Vallée
g 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

Re: ld.so behavior with $ORIGIN

2015-12-12 Thread Aurélien Vallée
ching go into a lot of detail about > steps and procedures, but what I think you really need is something > cruder. I don't know where to point you for that, though - perhaps > such things have been lost to the mists of history? > > Good luck, > > -- > Raul -- Aurélien Vallée Phone +33 9 77 19 85 61

Re: ld.so behavior with $ORIGIN

2015-12-12 Thread Aurélien Vallée
wrote: >> > It would be that or >> > have the kernel store the whole path for the life of the process for >> > obtaining with sysctl() >> >> That would be great. ps and top would be able to display the path too, >> pretty handy. > > How did people get

Re: ld.so behavior with $ORIGIN

2015-12-11 Thread Aurélien Vallée
IN is used? It would be that or > have the kernel store the whole path for the life of the process for > obtaining with sysctl(). Right now it only stores the last component > of the (resolved) original path in p_comm. > > > Philip Guenther > > > ** i.e, not marked as 'secure', their sorta-similar-to-issetugid-but-not-really -- Aurélien Vallée Phone +33 9 77 19 85 61

Re: ld.so behavior with $ORIGIN

2015-12-11 Thread Aurélien Vallée
$ORIGIN/../lib new_path /tmp/dummy/working/directory/../lib $ LD_DEBUG=1 $(which python) ... orig_path $ORIGIN/../lib new_path /home/avallee/bin/../lib On Fri, Dec 11, 2015 at 5:04 PM, Aurélien Vallée wrote: > Hello, > > I have troubles understanding the interpretation of $ORIGIN on >

ld.so behavior with $ORIGIN

2015-12-11 Thread Aurélien Vallée
Hello, I have troubles understanding the interpretation of $ORIGIN on OpenBSD. I'm switching to OpenBSD from Linux, so I may be biased in my assumptions. I built a program (python in this example) with the following ld parameters: -Wl,origin,z -Wl,rpath,'$ORIGIN/../lib' I can then check that th