diff options
author | kib <kib@FreeBSD.org> | 2008-08-26 10:53:32 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2008-08-26 10:53:32 +0000 |
commit | 2d990eae0580f74b2aee49da3c6434c6224e084c (patch) | |
tree | 47bfdf1c555705341fbc8c52a90b0103dae4c384 /lib/libc/sys | |
parent | 166aba1cac7a69c4dd3b699509db81eab23ac6f2 (diff) | |
download | FreeBSD-src-2d990eae0580f74b2aee49da3c6434c6224e084c.zip FreeBSD-src-2d990eae0580f74b2aee49da3c6434c6224e084c.tar.gz |
When calculating arguments to the interpreter for the shebang script
executed by fexecve(2), imgp->args->fname is NULL. Moreover, there is
no way to recover the path to the script being executed.
Do what some other U*ixes do unconditionally, namely supply /dev/fd/n
as the script path when called from fexecve(). Document requirement of
having fdescfs mounted as caveat.
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/execve.2 | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/libc/sys/execve.2 b/lib/libc/sys/execve.2 index c077008..8cb25bc 100644 --- a/lib/libc/sys/execve.2 +++ b/lib/libc/sys/execve.2 @@ -314,7 +314,7 @@ The .Fa fd argument is not a valid file descriptor open for executing. .El -.Sh CAVEAT +.Sh CAVEATS If a program is .Em setuid to a non-super-user, but is executed when @@ -322,6 +322,22 @@ the real .Em uid is ``root'', then the program has some of the powers of a super-user as well. +.Pp +When executing an interpreted program through +.Fn fexecve , +kernel supplies +.Pa /dev/fd/n +as a second argument to the interpreter, +where +.Ar n +is the file descriptor passed in the +.Fa fd +argument to +.Fn fexecve . +For this construction to work correctly, the +.Xr fdescfs 5 +filesystem shall be mounted on +.Pa /dev/fd . .Sh SEE ALSO .Xr ktrace 1 , .Xr _exit 2 , @@ -332,6 +348,7 @@ of a super-user as well. .Xr sysctl 3 , .Xr a.out 5 , .Xr elf 5 , +.Xr fdescfs 5 , .Xr environ 7 , .Xr mount 8 .Sh STANDARDS |