tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: namei and path canonicalization

In article <>,
David Holland  <> 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 can do the getcwd call itself if necessary (if the
>string it finds doesn't begin with '/') when/if something uses

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

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

We provide the full path currently via AT_SUN_EXECNAME, sysctl, and

As far as canonicalizing the executable name, it is not required, but
perhaps nice to have.


Home | Main Index | Thread Index | Old Index