summaryrefslogtreecommitdiffstats
path: root/man2/execve.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/execve.2')
-rw-r--r--man2/execve.2134
1 files changed, 73 insertions, 61 deletions
diff --git a/man2/execve.2 b/man2/execve.2
index 03dfdcdcf..37e62edfa 100644
--- a/man2/execve.2
+++ b/man2/execve.2
@@ -72,7 +72,7 @@ standardised variants of this function provided by libc,
including ones that search the
.B PATH
environment variable, see
-.BR exec (3).
+.MR exec 3 .
.P
The argument vector and environment can be accessed by the
new program's main function, when it is defined as:
@@ -87,7 +87,7 @@ Note, however, that the use of a third argument to the main function
is not specified in POSIX.1;
according to POSIX.1,
the environment should be accessed via the external variable
-.BR environ (7).
+.MR environ 7 .
.P
.BR execve ()
does not return on success, and the text, initialized data,
@@ -114,20 +114,20 @@ if any of the following is true:
the
.I no_new_privs
attribute is set for the calling thread (see
-.BR prctl (2));
+.MR prctl 2 );
.IP \[bu]
the underlying filesystem is mounted
.I nosuid
(the
.B MS_NOSUID
flag for
-.BR mount (2));
+.MR mount 2 );
or
.IP \[bu]
the calling process is being ptraced.
.P
The capabilities of the program file (see
-.BR capabilities (7))
+.MR capabilities 7 )
are also ignored if any of the above are true.
.P
The effective user ID of the process is copied to the saved set-user-ID;
@@ -142,7 +142,7 @@ are unchanged by a call to
If the executable is an a.out dynamically linked
binary executable containing
shared-library stubs, the Linux dynamic linker
-.BR ld.so (8)
+.MR ld.so 8
is called at the start of execution to bring
needed shared objects into memory
and link the executable with them.
@@ -153,7 +153,7 @@ shared objects.
This interpreter is typically
.I /lib/ld\-linux.so.2
for binaries linked with glibc (see
-.BR ld\-linux.so (8)).
+.MR ld\-linux.so 8 ).
.\"
.SS Effect on process attributes
All process attributes are preserved during an
@@ -162,42 +162,53 @@ except the following:
.IP \[bu] 3
The dispositions of any signals that are being caught are
reset to the default
-.RB ( signal (7)).
+\%(\c
+.MR signal 7 ).
.IP \[bu]
Any alternate signal stack is not preserved
-.RB ( sigaltstack (2)).
+\%(\c
+.MR sigaltstack 2 ).
.IP \[bu]
Memory mappings are not preserved
-.RB ( mmap (2)).
+\%(\c
+.MR mmap 2 ).
.IP \[bu]
Attached System\ V shared memory segments are detached
-.RB ( shmat (2)).
+\%(\c
+.MR shmat 2 ).
.IP \[bu]
POSIX shared memory regions are unmapped
-.RB ( shm_open (3)).
+\%(\c
+.MR shm_open 3 ).
.IP \[bu]
Open POSIX message queue descriptors are closed
-.RB ( mq_overview (7)).
+\%(\c
+.MR mq_overview 7 ).
.IP \[bu]
Any open POSIX named semaphores are closed
-.RB ( sem_overview (7)).
+\%(\c
+.MR sem_overview 7 ).
.IP \[bu]
POSIX timers are not preserved
-.RB ( timer_create (2)).
+\%(\c
+.MR timer_create 2 ).
.IP \[bu]
Any open directory streams are closed
-.RB ( opendir (3)).
+\%(\c
+.MR opendir 3 ).
.IP \[bu]
Memory locks are not preserved
-.RB ( mlock (2),
-.BR mlockall (2)).
+\%(\c
+.MR mlock 2 ,
+.MR mlockall 2 ).
.IP \[bu]
Exit handlers are not preserved
-.RB ( atexit (3),
-.BR on_exit (3)).
+\%(\c
+.MR atexit 3 ,
+.MR on_exit 3 ).
.IP \[bu]
The floating-point environment is reset to the default (see
-.BR fenv (3)).
+.MR fenv 3 ).
.P
The process attributes in the preceding list are all specified
in POSIX.1.
@@ -213,29 +224,29 @@ in which case the dumpable flag may instead be reset to the value in
in the circumstances described under
.B PR_SET_DUMPABLE
in
-.BR prctl (2).
+.MR prctl 2 .
Note that changes to the "dumpable" attribute may cause ownership
of files in the process's
.IR /proc/ pid
directory to change to
.IR root:root ,
as described in
-.BR proc (5).
+.MR proc 5 .
.IP \[bu]
The
-.BR prctl (2)
+.MR prctl 2
.B PR_SET_KEEPCAPS
flag is cleared.
.IP \[bu]
(Since Linux 2.4.36 / 2.6.23)
If a set-user-ID or set-group-ID program is being executed,
then the parent death signal set by
-.BR prctl (2)
+.MR prctl 2
.B PR_SET_PDEATHSIG
flag is cleared.
.IP \[bu]
The process name, as set by
-.BR prctl (2)
+.MR prctl 2
.B PR_SET_NAME
(and displayed by
.IR "ps\ \-o comm" ),
@@ -246,17 +257,17 @@ The
.I securebits
flag is cleared.
See
-.BR capabilities (7).
+.MR capabilities 7 .
.IP \[bu]
The termination signal is reset to
.B SIGCHLD
(see
-.BR clone (2)).
+.MR clone 2 ).
.IP \[bu]
The file descriptor table is unshared, undoing the effect of the
.B CLONE_FILES
flag of
-.BR clone (2).
+.MR clone 2 .
.P
Note the following further points:
.IP \[bu] 3
@@ -276,13 +287,14 @@ then an implementation may leave the disposition unchanged or
reset it to the default; Linux does the former.
.IP \[bu]
Any outstanding asynchronous I/O operations are canceled
-.RB ( aio_read (3),
-.BR aio_write (3)).
+\%(\c
+.MR aio_read 3 ,
+.MR aio_write 3 ).
.IP \[bu]
For the handling of capabilities during
.BR execve (),
see
-.BR capabilities (7).
+.MR capabilities 7 .
.IP \[bu]
By default, file descriptors remain open across an
.BR execve ().
@@ -290,11 +302,11 @@ File descriptors that are marked close-on-exec are closed;
see the description of
.B FD_CLOEXEC
in
-.BR fcntl (2).
+.MR fcntl 2 .
(If a file descriptor is closed, this will cause the release
of all record locks obtained on the underlying file by this process.
See
-.BR fcntl (2)
+.MR fcntl 2
for details.)
POSIX.1 says that if file descriptors 0, 1, and 2 would
otherwise be closed after a successful
@@ -395,7 +407,7 @@ On Linux 2.6.23 and later, most architectures support a size limit
derived from the soft
.B RLIMIT_STACK
resource limit (see
-.BR getrlimit (2))
+.MR getrlimit 2 )
that is in force at the time of the
.BR execve ()
call.
@@ -455,7 +467,7 @@ Search permission is denied on a component of the path prefix of
.I pathname
or the name of a script interpreter.
(See also
-.BR path_resolution (7).)
+.MR path_resolution 7 .)
.TP
.B EACCES
The file or a script interpreter is not a regular file.
@@ -474,7 +486,7 @@ Having changed its real UID using one of the
calls, the caller was\[em]and is now still\[em]above its
.B RLIMIT_NPROC
resource limit (see
-.BR setrlimit (2)).
+.MR setrlimit 2 ).
For a more detailed explanation of this error, see NOTES.
.TP
.B EFAULT
@@ -553,7 +565,7 @@ file has the set-user-ID or set-group-ID bit set.
A "capability-dumb" applications would not obtain the full set of
permitted capabilities granted by the executable file.
See
-.BR capabilities (7).
+.MR capabilities 7 .
.TP
.B ETXTBSY
The specified executable was open for writing by one or more processes.
@@ -584,7 +596,7 @@ case the same as Linux.
.\"
.P
POSIX.1 says that values returned by
-.BR sysconf (3)
+.MR sysconf 3
should be invariant over the lifetime of a process.
However, since Linux 2.6.23, if the
.B RLIMIT_STACK
@@ -647,7 +659,7 @@ Since UNIX\ V7, both are NULL.
One sometimes sees
.BR execve ()
(and the related functions described in
-.BR exec (3))
+.MR exec 3 )
described as "executing a
.I new
process" (or similar).
@@ -661,7 +673,7 @@ does is arrange for an existing process (the calling process)
to execute a new program.
.P
Set-user-ID and set-group-ID processes can not be
-.BR ptrace (2)d.
+.MR ptrace 2 d.
.P
The result of mounting a filesystem
.I nosuid
@@ -702,10 +714,10 @@ The
error can occur when a
.I preceding
call to
-.BR setuid (2),
-.BR setreuid (2),
+.MR setuid 2 ,
+.MR setreuid 2 ,
or
-.BR setresuid (2)
+.MR setresuid 2
caused the real user ID of the process to change,
and that change caused the process to exceed its
.B RLIMIT_NPROC
@@ -744,7 +756,7 @@ This kernel logic ensures that the
.B RLIMIT_NPROC
resource limit is still enforced for the
common privileged daemon workflow\[em]namely,
-.BR fork (2)
+.MR fork 2
+
.BR set*uid ()
+
@@ -763,7 +775,7 @@ call succeeds and the kernel clears the
.B PF_NPROC_EXCEEDED
process flag.
The flag is also cleared if a subsequent call to
-.BR fork (2)
+.MR fork 2
by this process succeeds.
.\"
.\" .SH BUGS
@@ -872,18 +884,18 @@ argv[4]: world
.EE
.in
.SH SEE ALSO
-.BR chmod (2),
-.BR execveat (2),
-.BR fork (2),
-.BR get_robust_list (2),
-.BR ptrace (2),
-.BR exec (3),
-.BR fexecve (3),
-.BR getauxval (3),
-.BR getopt (3),
-.BR system (3),
-.BR capabilities (7),
-.BR credentials (7),
-.BR environ (7),
-.BR path_resolution (7),
-.BR ld.so (8)
+.MR chmod 2 ,
+.MR execveat 2 ,
+.MR fork 2 ,
+.MR get_robust_list 2 ,
+.MR ptrace 2 ,
+.MR exec 3 ,
+.MR fexecve 3 ,
+.MR getauxval 3 ,
+.MR getopt 3 ,
+.MR system 3 ,
+.MR capabilities 7 ,
+.MR credentials 7 ,
+.MR environ 7 ,
+.MR path_resolution 7 ,
+.MR ld.so 8