tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: namei and path canonicalization
In article <20171107222924.GE17761%netbsd.org@localhost>,
David Holland <dholland-tech%netbsd.org@localhost> wrote:
>
>Also it occurs to me that there's no reason for the kernel to do the
>getcwd call; it should just provide the argument given to exec in all
>cases, and ld.so can do the getcwd call itself if necessary (if the
>string it finds doesn't begin with '/') when/if something uses
>$ORIGIN.
The kernel does not need to do the getcwd() call, but someone (rtld) will
eventually do it for $ORIGIN, either lazily or always.
As for killing $ORIGIN for setuid programs, this is already in the ELF
specification:
http://web.archive.org/web/20041026003725/http://www.caldera.com/developers/gabi/2003-12-17/ch5.dynamic.html#substitution
There are other reasons that a program might want to know the full path
name it was executed from (java to re-execute itself for example) and
where burned-in paths are not desirable. I agree that saving (dvp, trailing
path component) is probably a nicer way than storing a resolved path.
OTOH relying on the reverse-namei-cache which was the way we did it until
the most recent commit is not a reliable solution and this is why people
complained.
We provide the full path currently via AT_SUN_EXECNAME, sysctl, and
procfs.
As far as canonicalizing the executable name, it is not required, but
perhaps nice to have.
christos
Home |
Main Index |
Thread Index |
Old Index