fexecve.3: If 'fd' is a close-on-exec file descriptor for a script, fexecve() fails

See https://bugzilla.kernel.org/show_bug.cgi?id=74481

Reported-by: Steven Stewart-Gallus <sstewartgallus00@mylangara.bc.ca>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2014-04-20 07:10:13 +02:00
parent 0dbfbe8e71
commit 62bd7742ff
1 changed files with 14 additions and 1 deletions

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH FEXECVE 3 2013-10-25 "Linux" "Linux Programmer's Manual"
.TH FEXECVE 3 2014-04-20 "Linux" "Linux Programmer's Manual"
.SH NAME
fexecve \- execute program specified via file descriptor
.SH SYNOPSIS
@ -105,6 +105,19 @@ filesystem, so
.I /proc
needs to be mounted and available at the time of the call.
If
.I fd
is a file descriptor that refers to an interpreter script
and has been marked as close-on-exec (see the discussion of the
.BR FD_CLOEXEC
in
.BR fcntl (2)),
.BR fexecve ()
will fail to execute the script, since,
by the time the script interpreter tries to access the script file,
.I fd
has already been closed.
The idea behind
.BR fexecve ()
is to allow the caller to verify (checksum) the contents of