tech-toolchain archive

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

Re: $ORIGIN



On Sun, 26 Jan 2014, matthew green wrote:
Aren't the majority of exec's done with a pathname? Why not cache that name if the image has DF_ORIGIN set?

why do you think this?

i almost never call something via a pathname, and besides maybe build.sh, most builds call "gcc" etc directly.

If the user or any parent program runs a child program using an unqualified name, then the PATH will be searched to resolve the unqualified program name to a full pathname. This usually happens in the users's shell, or in libc's exec*p* functions, or in similar features in other languages, and it happens before the request reaches the kernel's execve(2) syscall.

Exceptions are when the program is explicitly called using a relative path (e.g. "./foo"), or when the PATH contains "." or similar relative components, or when fexecve(2) is used instead of execve(2).

I don't have measurements, but I expect that full pathnames will be available to the kernel in the majority of cases, even if users or calling programs specify full pathnames in a minority of cases.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index