#, fuzzy msgid "" msgstr "" "Project-Id-Version: man-pages-l10n VERSION\n" "POT-Creation-Date: 2014-07-17 17:53+0900\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: man-pages/man2/execve.2:37 #, no-wrap msgid "EXECVE" msgstr "" #. type: TH #: man-pages/man2/execve.2:37 #, no-wrap msgid "2014-06-13" msgstr "" #. type: TH #: man-pages/man2/execve.2:37 #, no-wrap msgid "Linux" msgstr "" #. type: TH #: man-pages/man2/execve.2:37 #, no-wrap msgid "Linux Programmer's Manual" msgstr "" #. type: SH #: man-pages/man2/execve.2:38 #, no-wrap msgid "NAME" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:40 msgid "execve - execute program" msgstr "" #. type: SH #: man-pages/man2/execve.2:40 #, no-wrap msgid "SYNOPSIS" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:42 msgid "B<#include Eunistd.hE>" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:44 msgid "BIB<, char *const >IB<[], >" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:46 msgid "B< char *const >IB<[]);>" msgstr "" #. type: SH #: man-pages/man2/execve.2:46 #, no-wrap msgid "DESCRIPTION" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:51 msgid "" "B() executes the program pointed to by I. I " "must be either a binary executable, or a script starting with a line of the " "form:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:55 man-pages/man2/execve.2:267 #, no-wrap msgid "B<#!> I[optional-arg]\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:59 msgid "For details of the latter case, see \"Interpreter scripts\" below." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:68 msgid "" "I is an array of argument strings passed to the new program. By " "convention, the first of these strings should contain the filename " "associated with the file being executed. I is an array of strings, " "conventionally of the form B, which are passed as environment to " "the new program. Both I and I must be terminated by a null " "pointer. The argument vector and environment can be accessed by the called " "program's main function, when it is defined as:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:72 #, no-wrap msgid "int main(int argc, char *argv[], char *envp[])\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:79 msgid "" "B() does not return on success, and the text, data, bss, and stack " "of the calling process are overwritten by that of the program loaded." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:83 msgid "" "If the current program is being ptraced, a B is sent to it after a " "successful B()." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:98 msgid "" "If the set-user-ID bit is set on the program file pointed to by I, " "and the underlying filesystem is not mounted I (the B " "flag for B(2)), and the calling process is not being ptraced, then " "the effective user ID of the calling process is changed to that of the owner " "of the program file. Similarly, when the set-group-ID bit of the program " "file is set the effective group ID of the calling process is set to the " "group of the program file." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:103 msgid "" "The effective user ID of the process is copied to the saved set-user-ID; " "similarly, the effective group ID is copied to the saved set-group-ID. This " "copying takes place after any effective ID changes that occur because of the " "set-user-ID and set-group-ID permission bits." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:111 msgid "" "If the executable is an a.out dynamically linked binary executable " "containing shared-library stubs, the Linux dynamic linker B(8) is " "called at the start of execution to bring needed shared libraries into " "memory and link the executable with them." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:120 msgid "" "If the executable is a dynamically linked ELF executable, the interpreter " "named in the PT_INTERP segment is used to load the needed shared libraries. " "This interpreter is typically I for binaries linked with " "glibc 2. (For binaries linked with the old Linux libc5, the interpreter was " "typically I.)" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:124 msgid "" "All process attributes are preserved during an B(), except the " "following:" msgstr "" #. type: IP #: man-pages/man2/execve.2:124 man-pages/man2/execve.2:128 man-pages/man2/execve.2:131 man-pages/man2/execve.2:134 man-pages/man2/execve.2:137 man-pages/man2/execve.2:140 man-pages/man2/execve.2:143 man-pages/man2/execve.2:146 man-pages/man2/execve.2:149 man-pages/man2/execve.2:152 man-pages/man2/execve.2:156 man-pages/man2/execve.2:160 man-pages/man2/execve.2:169 man-pages/man2/execve.2:176 man-pages/man2/execve.2:181 man-pages/man2/execve.2:188 man-pages/man2/execve.2:195 man-pages/man2/execve.2:202 man-pages/man2/execve.2:209 man-pages/man2/execve.2:213 man-pages/man2/execve.2:216 man-pages/man2/execve.2:224 man-pages/man2/execve.2:228 man-pages/man2/execve.2:233 #, no-wrap msgid "*" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:128 msgid "" "The dispositions of any signals that are being caught are reset to the " "default (B(7))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:131 msgid "Any alternate signal stack is not preserved (B(2))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:134 msgid "Memory mappings are not preserved (B(2))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:137 msgid "Attached System\\ V shared memory segments are detached (B(2))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:140 msgid "POSIX shared memory regions are unmapped (B(3))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:143 msgid "Open POSIX message queue descriptors are closed (B(7))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:146 msgid "Any open POSIX named semaphores are closed (B(7))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:149 msgid "POSIX timers are not preserved (B(2))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:152 msgid "Any open directory streams are closed (B(3))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:156 msgid "Memory locks are not preserved (B(2), B(2))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:160 msgid "Exit handlers are not preserved (B(3), B(3))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:163 msgid "" "The floating-point environment is reset to the default (see B(3))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:169 msgid "" "The process attributes in the preceding list are all specified in POSIX.1-" "2001. The following Linux-specific process attributes are also not " "preserved during an B():" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:176 msgid "" "The B(2) B flag is set, unless a set-user-ID or set-" "group ID program is being executed, in which case it is cleared." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:181 msgid "The B(2) B flag is cleared." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:188 msgid "" "(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 B(2) " "B flag is cleared." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:195 msgid "" "The process name, as set by B(2) B (and displayed by " "I), is reset to the name of the new executable file." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:202 msgid "" "The B I flag is cleared. See " "B(7)." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:207 msgid "The termination signal is reset to B (see B(2))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:209 msgid "Note the following further points:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:213 msgid "" "All threads other than the calling thread are destroyed during an " "B(). Mutexes, condition variables, and other pthreads objects are " "not preserved." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:216 msgid "" "The equivalent of I is executed at program start-" "up." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:224 msgid "" "POSIX.1-2001 specifies that the dispositions of any signals that are ignored " "or set to the default are left unchanged. POSIX.1-2001 specifies one " "exception: if B is being ignored, then an implementation may leave " "the disposition unchanged or reset it to the default; Linux does the former." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:228 msgid "" "Any outstanding asynchronous I/O operations are canceled (B(3), " "B(3))." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:233 msgid "" "For the handling of capabilities during B(), see B(7)." msgstr "" #. On Linux it appears that these file descriptors are #. always open after an execve(), and it looks like #. Solaris 8 and FreeBSD 6.1 are the same. -- mtk, 30 Apr 2007 #. type: Plain text #: man-pages/man2/execve.2:260 msgid "" "By default, file descriptors remain open across an B(). File " "descriptors that are marked close-on-exec are closed; see the description of " "B in B(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 B(2) for details.) POSIX.1-2001 says that if " "file descriptors 0, 1, and 2 would otherwise be closed after a successful " "B(), and the process would gain privilege because the set-user_ID or " "set-group_ID permission bit was set on the executed file, then the system " "may open an unspecified file for each of these file descriptors. As a " "general principle, no portable program, whether privileged or not, can " "assume that these three file descriptors will remain closed across an " "B()." msgstr "" #. type: SS #: man-pages/man2/execve.2:260 man-pages/man2/execve.2:530 #, no-wrap msgid "Interpreter scripts" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:263 msgid "" "An interpreter script is a text file that has execute permission enabled and " "whose first line is of the form:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:281 msgid "" "The I must be a valid pathname for an executable which is not " "itself a script. If the I argument of B() specifies an " "interpreter script, then I will be invoked with the following " "arguments:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:285 #, no-wrap msgid "I [optional-arg] I arg...\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:296 msgid "" "where I is the series of words pointed to by the I argument of " "B(), starting at I[1]." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:301 msgid "" "For portable use, I should either be absent, or be specified " "as a single word (i.e., it should not contain white space); see NOTES below." msgstr "" #. type: SS #: man-pages/man2/execve.2:301 #, no-wrap msgid "Limits on size of arguments and environment" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:314 msgid "" "Most UNIX implementations impose some limit on the total size of the command-" "line argument (I) and environment (I) strings that may be " "passed to a new program. POSIX.1 allows an implementation to advertise this " "limit using the B constant (either defined in Ilimits.hE> " "or available at run time using the call I)." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:321 msgid "" "On Linux prior to kernel 2.6.23, the memory used to store the environment " "and argument strings was limited to 32 pages (defined by the kernel constant " "B). On architectures with a 4-kB page size, this yields a " "maximum size of 128 kB." msgstr "" #. For some background on the changes to ARG_MAX in kernels 2.6.23 and #. 2.6.25, see: #. http://sourceware.org/bugzilla/show_bug.cgi?id=5786 #. http://bugzilla.kernel.org/show_bug.cgi?id=10095 #. http://thread.gmane.org/gmane.linux.kernel/646709/focus=648101, #. checked into 2.6.25 as commit a64e715fc74b1a7dcc5944f848acc38b2c4d4ee2. #. Ollie: That doesn't include the lists of pointers, though, #. so the actual usage is a bit higher (1 pointer per argument). #. type: Plain text #: man-pages/man2/execve.2:357 msgid "" "On kernel 2.6.23 and later, most architectures support a size limit derived " "from the soft B resource limit (see B(2)) that is " "in force at the time of the B() call. (Architectures with no " "memory management unit are excepted: they maintain the limit that was in " "effect before kernel 2.6.23.) This change allows programs to have a much " "larger argument and/or environment list. For these architectures, the total " "size is limited to 1/4 of the allowed stack size. (Imposing the 1/4-limit " "ensures that the new program always has some stack space.) Since Linux 2.6." "25, the kernel places a floor of 32 pages on this size limit, so that, even " "when B is set very low, applications are guaranteed to have at " "least as much argument and environment space as was provided by Linux 2.6.23 " "and earlier. (This guarantee was not provided in Linux 2.6.23 and 2.6.24.) " "Additionally, the limit per string is 32 pages (the kernel constant " "B), and the maximum number of strings is 0x7FFFFFFF." msgstr "" #. type: SH #: man-pages/man2/execve.2:357 #, no-wrap msgid "RETURN VALUE" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:363 msgid "" "On success, B() does not return, on error -1 is returned, and " "I is set appropriately." msgstr "" #. type: SH #: man-pages/man2/execve.2:363 #, no-wrap msgid "ERRORS" msgstr "" #. type: TP #: man-pages/man2/execve.2:364 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:371 msgid "" "The total number of bytes in the environment (I) and argument list " "(I) is too large." msgstr "" #. type: TP #: man-pages/man2/execve.2:371 man-pages/man2/execve.2:378 man-pages/man2/execve.2:381 man-pages/man2/execve.2:384 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:378 msgid "" "Search permission is denied on a component of the path prefix of I " "or the name of a script interpreter. (See also B(7).)" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:381 msgid "The file or a script interpreter is not a regular file." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:384 msgid "" "Execute permission is denied for the file or a script or ELF interpreter." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:388 msgid "The filesystem is mounted I." msgstr "" #. type: TP #: man-pages/man2/execve.2:388 #, no-wrap msgid "B (since Linux 3.1)" msgstr "" #. commit 72fa59970f8698023045ab0713d66f3f4f96945c #. type: Plain text #: man-pages/man2/execve.2:398 msgid "" "Having changed its real UID using one of the B() calls, the caller " "was\\(emand is now still\\(emabove its B resource limit (see " "B(2)). For a more detailed explanation of this error, see NOTES." msgstr "" #. type: TP #: man-pages/man2/execve.2:398 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:406 msgid "" "I or one of the pointers in the vectors I or I points " "outside your accessible address space." msgstr "" #. type: TP #: man-pages/man2/execve.2:406 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:410 msgid "" "An ELF executable had more than one PT_INTERP segment (i.e., tried to name " "more than one interpreter)." msgstr "" #. type: TP #: man-pages/man2/execve.2:410 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:413 msgid "An I/O error occurred." msgstr "" #. type: TP #: man-pages/man2/execve.2:413 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:416 msgid "An ELF interpreter was a directory." msgstr "" #. type: TP #: man-pages/man2/execve.2:416 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:419 msgid "An ELF interpreter was not in a recognized format." msgstr "" #. type: TP #: man-pages/man2/execve.2:419 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:424 msgid "" "Too many symbolic links were encountered in resolving I or the " "name of a script or ELF interpreter." msgstr "" #. type: TP #: man-pages/man2/execve.2:424 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:427 msgid "The process has the maximum number of files open." msgstr "" #. type: TP #: man-pages/man2/execve.2:427 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:431 msgid "I is too long." msgstr "" #. type: TP #: man-pages/man2/execve.2:431 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:434 msgid "The system limit on the total number of open files has been reached." msgstr "" #. type: TP #: man-pages/man2/execve.2:434 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:440 msgid "" "The file I or a script or ELF interpreter does not exist, or a " "shared library needed for file or interpreter cannot be found." msgstr "" #. type: TP #: man-pages/man2/execve.2:440 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:445 msgid "" "An executable is not in a recognized format, is for the wrong architecture, " "or has some other format error that means it cannot be executed." msgstr "" #. type: TP #: man-pages/man2/execve.2:445 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:448 msgid "Insufficient kernel memory was available." msgstr "" #. type: TP #: man-pages/man2/execve.2:448 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:453 msgid "" "A component of the path prefix of I or a script or ELF interpreter " "is not a directory." msgstr "" #. type: TP #: man-pages/man2/execve.2:453 man-pages/man2/execve.2:459 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:459 msgid "" "The filesystem is mounted I, the user is not the superuser, and the " "file has the set-user-ID or set-group-ID bit set." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:463 msgid "" "The process is being traced, the user is not the superuser and the file has " "the set-user-ID or set-group-ID bit set." msgstr "" #. type: TP #: man-pages/man2/execve.2:463 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:466 msgid "Executable was open for writing by one or more processes." msgstr "" #. type: SH #: man-pages/man2/execve.2:466 #, no-wrap msgid "CONFORMING TO" msgstr "" #. SVr4 documents additional error #. conditions EAGAIN, EINTR, ELIBACC, ENOLINK, EMULTIHOP; POSIX does not #. document ETXTBSY, EPERM, EFAULT, ELOOP, EIO, ENFILE, EMFILE, EINVAL, #. EISDIR or ELIBBAD error conditions. #. type: Plain text #: man-pages/man2/execve.2:474 msgid "" "SVr4, 4.3BSD, POSIX.1-2001. POSIX.1-2001 does not document the #! behavior " "but is otherwise compatible." msgstr "" #. type: SH #: man-pages/man2/execve.2:474 #, no-wrap msgid "NOTES" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:477 msgid "Set-user-ID and set-group-ID processes can not be B(2)d." msgstr "" #. e.g., EFAULT on Solaris 8 and FreeBSD 6.1; but #. HP-UX 11 is like Linux -- mtk, Apr 2007 #. Bug filed 30 Apr 2007: http://bugzilla.kernel.org/show_bug.cgi?id=8408 #. Bug rejected (because fix would constitute an ABI change). #. type: Plain text #: man-pages/man2/execve.2:504 msgid "" "The result of mounting a filesystem I varies across Linux kernel " "versions: some will refuse execution of set-user-ID and set-group-ID " "executables when this would give the user powers she did not have already " "(and return B), some will just ignore the set-user-ID and set-group-" "ID bits and B() successfully. On Linux, I and I can be " "specified as NULL. In both cases, this has the same effect as specifying " "the argument as a pointer to a list containing a single null pointer. B It is nonstandard and nonportable: " "on most other UNIX systems doing this will result in an error (B)." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:515 msgid "" "POSIX.1-2001 says that values returned by B(3) should be invariant " "over the lifetime of a process. However, since Linux 2.6.23, if the " "B resource limit changes, then the value reported by " "B<_SC_ARG_MAX> will also change, to reflect the fact that the limit on space " "for holding command-line arguments and environment variables has changed." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:530 msgid "" "In most cases where B() fails, control returns to the original " "executable image, and the caller of B() can then handle the error. " "However, in (rare) cases (typically caused by resource exhaustion), failure " "may occur past the point of no return: the original executable image has " "been torn down, but the new image could not be completely built. In such " "cases, the kernel kills the process with a B signal." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:533 msgid "" "A maximum line length of 127 characters is allowed for the first line in an " "interpreter scripts." msgstr "" #. e.g., Solaris 8 #. e.g., FreeBSD before 6.0, but not FreeBSD 6.0 onward #. type: Plain text #: man-pages/man2/execve.2:552 msgid "" "The semantics of the I argument of an interpreter script vary " "across implementations. On Linux, the entire string following the " "I name is passed as a single argument to the interpreter, and " "this string can include white space. However, behavior differs on some " "other systems. Some systems use the first white space to terminate " "I. On some systems, an interpreter script can have multiple " "arguments, and white spaces in I are used to delimit the " "arguments." msgstr "" #. .SH BUGS #. Some Linux versions have failed to check permissions on ELF #. interpreters. This is a security hole, because it allows users to #. open any file, such as a rewinding tape device, for reading. Some #. Linux versions have also had other security holes in #. .BR execve () #. that could be exploited for denial of service by a suitably crafted #. ELF binary. There are no known problems with 2.0.34 or 2.2.15. #. type: Plain text #: man-pages/man2/execve.2:563 msgid "Linux ignores the set-user-ID and set-group-ID bits on scripts." msgstr "" #. type: SS #: man-pages/man2/execve.2:563 #, no-wrap msgid "execve() and EAGAIN" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:569 msgid "" "A more detailed explanation of the B error that can occur (since " "Linux 3.1) when calling B() is as follows." msgstr "" #. commit 909cc4ae86f3380152a18e2a3c44523893ee11c4 #. type: Plain text #: man-pages/man2/execve.2:591 msgid "" "The B error can occur when a I call to B(2), " "B(2), or B(2) caused the real user ID of the process " "to change, and that change caused the process to exceed its B " "resource limit (i.e., the number of processes belonging to the new real UID " "exceeds the resource limit). From Linux 2.6.0 to 3.0, this caused the " "B() call to fail. (Prior to 2.6, the resource limit was not " "imposed on processes that changed their user IDs.)" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:622 msgid "" "Since Linux 3.1, the scenario just described no longer causes the " "B() call to fail, because it too often led to security holes where " "buggy applications didn't check the return status and assumed that\\(emif " "the caller had root privileges\\(emthe call would always succeed. Instead, " "the B() calls now successfully change the real UID, but the kernel " "sets an internal flag, named B, to note that the " "B resource limit has been exceeded. If the " "B flag is set and the resource limit is still exceeded at " "the time of a subsequent B() call, that call fails with the error " "B. This kernel logic ensures that the B resource " "limit is still enforced for the common privileged daemon " "workflow\\(emnamely, B(2) + B() + B()." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:638 msgid "" "If the resource limit was not still exceeded at the time of the B() " "call (because other processes belonging to this real UID terminated between " "the B call and the B() call), then the B() call " "succeeds and the kernel clears the B process flag. The " "flag is also cleared if a subsequent call to B(2) by this process " "succeeds." msgstr "" #. type: SS #: man-pages/man2/execve.2:638 #, no-wrap msgid "Historical" msgstr "" #. .SH BUGS #. Some Linux versions have failed to check permissions on ELF #. interpreters. This is a security hole, because it allows users to #. open any file, such as a rewinding tape device, for reading. Some #. Linux versions have also had other security holes in #. .BR execve () #. that could be exploited for denial of service by a suitably crafted #. ELF binary. There are no known problems with 2.0.34 or 2.2.15. #. type: Plain text #: man-pages/man2/execve.2:658 msgid "" "With UNIX\\ V6, the argument list of an B() call was ended by 0, " "while the argument list of I
was ended by -1. Thus, this argument " "list was not directly usable in a further B() call. Since UNIX\\ V7, " "both are NULL." msgstr "" #. type: SH #: man-pages/man2/execve.2:658 #, no-wrap msgid "EXAMPLE" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:661 msgid "" "The following program is designed to be execed by the second program below. " "It just echoes its command-line arguments, one per line." msgstr "" #. type: Plain text #: man-pages/man2/execve.2:665 #, no-wrap msgid "/* myecho.c */\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:668 #, no-wrap msgid "#include Estdio.hE\n" "#include Estdlib.hE\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:673 #, no-wrap msgid "int\n" "main(int argc, char *argv[])\n" "{\n" " int j;\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:676 #, no-wrap msgid "" " for (j = 0; j E argc; j++)\n" " printf(\"argv[%d]: %s\\en\", j, argv[j]);\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:679 #, no-wrap msgid " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:684 msgid "" "This program can be used to exec the program named in its command-line " "argument:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:688 #, no-wrap msgid "/* execve.c */\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:692 #, no-wrap msgid "" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:698 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " char *newargv[] = { NULL, \"hello\", \"world\", NULL };\n" " char *newenviron[] = { NULL };\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:703 #, no-wrap msgid "" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s Efile-to-execE\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:705 #, no-wrap msgid " newargv[0] = argv[1];\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:710 #, no-wrap msgid "" " execve(argv[1], newargv, newenviron);\n" " perror(\"execve\"); /* execve() only returns on error */\n" " exit(EXIT_FAILURE);\n" "}\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:714 msgid "We can use the second program to exec the first as follows:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:723 #, no-wrap msgid "" "$B< cc myecho.c -o myecho>\n" "$B< cc execve.c -o execve>\n" "$B< ./execve ./myecho>\n" "argv[0]: ./myecho\n" "argv[1]: hello\n" "argv[2]: world\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:731 msgid "" "We can also use these programs to demonstrate the use of a script " "interpreter. To do this we create a script whose \"interpreter\" is our " "I program:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:738 #, no-wrap msgid "" "$B< cat E script.sh>\n" "B<#! ./myecho script-arg>\n" "B<^D>\n" "$B< chmod +x script.sh>\n" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:742 msgid "We can then use our program to exec the script:" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:751 #, no-wrap msgid "" "$B< ./execve ./script.sh>\n" "argv[0]: ./myecho\n" "argv[1]: script-arg\n" "argv[2]: ./script.sh\n" "argv[3]: hello\n" "argv[4]: world\n" msgstr "" #. type: SH #: man-pages/man2/execve.2:753 #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:764 msgid "" "B(2), B(2), B(2), B(3), B(3), " "B(3), B(7), B(7), B(7), B(8)" msgstr "" #. type: SH #: man-pages/man2/execve.2:764 #, no-wrap msgid "COLOPHON" msgstr "" #. type: Plain text #: man-pages/man2/execve.2:772 msgid "" "This page is part of release 3.70 of the Linux I project. A " "description of the project, information about reporting bugs, and the latest " "version of this page, can be found at \\%http://www.kernel.org/doc/man-pages/" "." msgstr ""