syscalls,x86,sparc: Add execveat() system call
Subsystems (11)
v8 cover syscalls,x86,sparc: Add execveat() system call
Sparc folks: the kbuild robots complained about sparc missing this syscall, so I've speculatively included an extra patch in this version for that.
However, I've not run it (only cross-compiled it), so it may be best to skip the [3/4] patch and let the experts deal with other architectures later -- I'm not sure what's the best practice for adding a new syscall.
.........
This patch set adds execveat(2) for x86, and is derived from Meredydd Luff's patch from Sept 2012 (https://lkml.org/lkml/2012/9/11/528).
The primary aim of adding an execveat syscall is to allow an implementation of fexecve(3) that does not rely on the /proc filesystem, at least for executables (rather than scripts). The current glibc version of fexecve(3) is implemented via /proc, which causes problems in sandboxed or otherwise restricted environments.
Given the desire for a /proc-free fexecve() implementation, HPA suggested (https://lkml.org/lkml/2006/7/11/556) that an execveat(2) syscall would be an appropriate generalization.
Also, having a new syscall means that it can take a flags argument without back-compatibility concerns. The current implementation just defines the AT_EMPTY_PATH and AT_SYMLINK_NOFOLLOW flags, but other flags could be added in future -- for example, flags for new namespaces (as suggested at https://lkml.org/lkml/2006/7/11/474).
Related history:
- https://lkml.org/lkml/2006/12/27/123 is an example of someone realizing that fexecve() is likely to fail in a chroot environment.
- http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514043 covered documenting the /proc requirement of fexecve(3) in its manpage, to "prevent other people from wasting their time".
- https://bugzilla.redhat.com/show_bug.cgi?id=241609 described a problem where a process that did setuid() could not fexecve() because it no longer had access to /proc/self/fd; this has since been fixed.
Changes since v7:
- Speculatively wire up sparc version of syscall (untested)
- Fix leak of pathbuf in mainline arm [Oleg Nesterov]
- Add rcu_dereference_raw() on fdt access [sparse kbuild robot]
- Realigned comment [Andrew Morton]
- Merged up to v3.18-rc4
Changes since v6:
- Remove special case for O_PATH file descriptors [Andy Lutomirski]
- Use kasprintf rather than error-prone arithmetic [Kees Cook]
- Add test for long name [Kees Cook]
- Add test for non-executable O_PATH fd [Andy Lutomirski]
Changes since v5:
- Set new flag in bprm->interp_flags for O_CLOEXEC fds, so that binfmts that invoke an interpreter fail the exec (as they will not be able to access the invoked file). [Andy Lutomirski]
- Don't truncate long paths. [Andy Lutomirski]
- Commonize code to open the executed file. [Eric W. Biederman]
- Mark O_PATH file descriptors so they cannot be fexecve()ed.
- Make self-test more helpful, and add additional cases:
- file offset non-zero
- binary file without execute bit
- O_CLOEXEC fds
Changes since v4, suggested by Eric W. Biederman:
- Use empty filename with AT_EMPTY_PATH flag rather than NULL pathname to request fexecve-like behaviour.
- Build pathname as "/dev/fd/<fd>/<filename>" (or "/dev/fd/<fd>") rather than using d_path().
- Patch against v3.17 (bfe01a5ba249)
Changes since Meredydd's v3 patch:
- Added a selftest.
- Added a man page.
- Left open_exec() signature untouched to reduce patch impact elsewhere (as suggested by Al Viro).
- Filled in bprm->filename with d_path() into a buffer, to avoid use of potentially-ephemeral dentry->d_name.
- Patch against v3.14 (455c6fdbd21916).
David Drysdale (3):
syscalls,x86: implement execveat() system call
syscalls,x86: add selftest for execveat(2)
sparc: Hook up execveat system call.
arch/sparc/include/uapi/asm/unistd.h | 3 +- arch/sparc/kernel/systbls_32.S | 1 + arch/sparc/kernel/systbls_64.S | 2 + arch/x86/ia32/audit.c | 1 + arch/x86/ia32/ia32entry.S | 1 + arch/x86/kernel/audit_64.c | 1 + arch/x86/kernel/entry_64.S | 28 +++ arch/x86/syscalls/syscall_32.tbl | 1 + arch/x86/syscalls/syscall_64.tbl | 2 + arch/x86/um/sys_call_table_64.c | 1 + fs/binfmt_em86.c | 4 + fs/binfmt_misc.c | 4 + fs/binfmt_script.c | 10 + fs/exec.c | 113 +++++++-- fs/namei.c | 2 +- include/linux/binfmts.h | 4 + include/linux/compat.h | 3 + include/linux/fs.h | 1 + include/linux/sched.h | 4 + include/linux/syscalls.h | 5 + include/uapi/asm-generic/unistd.h | 4 +- kernel/sys_ni.c | 3 + lib/audit.c | 3 + tools/testing/selftests/Makefile | 1 + tools/testing/selftests/exec/.gitignore | 9 + tools/testing/selftests/exec/Makefile | 25 ++ tools/testing/selftests/exec/execveat.c | 397 ++++++++++++++++++++++++++++++++ 27 files changed, 617 insertions(+), 16 deletions(-) create mode 100644 tools/testing/selftests/exec/.gitignore create mode 100644 tools/testing/selftests/exec/Makefile create mode 100644 tools/testing/selftests/exec/execveat.c
--
2.1.0.rc2.206.gedb03e5
PATCH v8 1/4 syscalls,x86: implement execveat() system call
Add a new execveat(2) system call. execveat() is to execve() as openat() is to open(): it takes a file descriptor that refers to a directory, and resolves the filename relative to that.
In addition, if the filename is empty and AT_EMPTY_PATH is specified, execveat() executes the file to which the file descriptor refers. This replicates the functionality of fexecve(), which is a system call in other UNIXen, but in Linux glibc it depends on opening "/proc/self/fd/<fd>" (and so relies on /proc being mounted).
The filename fed to the executed program as argv[0] (or the name of the script fed to a script interpreter) will be of the form "/dev/fd/<fd>" (for an empty filename) or "/dev/fd/<fd>/<filename>", effectively reflecting how the executable was found. This does however mean that execution of a script in a /proc-less environment won't work; also, script execution via an O_CLOEXEC file descriptor fails (as the file will not be accessible after exec).
Only x86-64, i386 and x32 ABIs are supported in this patch.
Based on patches by Meredydd Luff <[email protected]>
--- arch/x86/ia32/audit.c | 1 + arch/x86/ia32/ia32entry.S | 1 + arch/x86/kernel/audit_64.c | 1 + arch/x86/kernel/entry_64.S | 28 ++++++++++ arch/x86/syscalls/syscall_32.tbl | 1 + arch/x86/syscalls/syscall_64.tbl | 2 + arch/x86/um/sys_call_table_64.c | 1 + fs/binfmt_em86.c | 4 ++ fs/binfmt_misc.c | 4 ++ fs/binfmt_script.c | 10 ++++ fs/exec.c | 113 +++++++++++++++++++++++++++++++++----- fs/namei.c | 2 +- include/linux/binfmts.h | 4 ++ include/linux/compat.h | 3 + include/linux/fs.h | 1 + include/linux/sched.h | 4 ++ include/linux/syscalls.h | 5 ++ include/uapi/asm-generic/unistd.h | 4 +- kernel/sys_ni.c | 3 + lib/audit.c | 3 + 20 files changed, 180 insertions(+), 15 deletions(-)
arch/x86/ia32/audit.c +1 -0
@@ -35,6 +35,7 @@ int ia32_classify_syscall(unsigned syscall)case __NR_socketcall:return 4 ;case __NR_execve: +case __NR_execveat:return 5 ;default :return 1 ;
arch/x86/ia32/ia32entry.S +1 -0
@@ -480,6 +480,7 @@ GLOBAL(\label) PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn PTREGSCALL stub32_sigreturn, sys32_sigreturn PTREGSCALL stub32_execve, compat_sys_execve + PTREGSCALL stub32_execveat, compat_sys_execveat PTREGSCALL stub32_fork, sys_fork PTREGSCALL stub32_vfork, sys_vfork
arch/x86/kernel/audit_64.c +1 -0
@@ -50,6 +50,7 @@ int audit_classify_syscall(int abi, unsigned syscall)case __NR_openat:return 3 ;case __NR_execve: +case __NR_execveat:return 5 ;default :return 0 ;
arch/x86/kernel/entry_64.S +28 -0
@@ -652,6 +652,20 @@ ENTRY(stub_execve) CFI_ENDPROC END(stub_execve) +ENTRY(stub_execveat) + CFI_STARTPROC + addq $8, %rsp + PARTIAL_FRAME 0 + SAVE_REST + FIXUP_TOP_OF_STACK %r11 + call sys_execveat + RESTORE_TOP_OF_STACK %r11 + movq %rax,RAX(%rsp) + RESTORE_REST + jmp int_ret_from_sys_call + CFI_ENDPROC +END(stub_execveat) + /* * sigreturn is special because it needs to restore all registers on return. * This cannot be done with SYSRET, so use the IRET return path instead.
@@ -697,6 +711,20 @@ ENTRY(stub_x32_execve) CFI_ENDPROC END(stub_x32_execve) +ENTRY(stub_x32_execveat) + CFI_STARTPROC + addq $8, %rsp + PARTIAL_FRAME 0 + SAVE_REST + FIXUP_TOP_OF_STACK %r11 + call compat_sys_execveat + RESTORE_TOP_OF_STACK %r11 + movq %rax,RAX(%rsp) + RESTORE_REST + jmp int_ret_from_sys_call + CFI_ENDPROC +END(stub_x32_execveat) + #endif /*
arch/x86/syscalls/syscall_32.tbl +1 -0
@@ -364,3 +364,4 @@ 355 i386 getrandom sys_getrandom 356 i386 memfd_create sys_memfd_create 357 i386 bpf sys_bpf +358 i386 execveat sys_execveat stub32_execveat
arch/x86/syscalls/syscall_64.tbl +2 -0
@@ -328,6 +328,7 @@ 319 common memfd_create sys_memfd_create 320 common kexec_file_load sys_kexec_file_load 321 common bpf sys_bpf +322 64 execveat stub_execveat # # x32-specific system call numbers start at 512 to avoid cache impact
@@ -366,3 +367,4 @@ 542 x32 getsockopt compat_sys_getsockopt 543 x32 io_setup compat_sys_io_setup 544 x32 io_submit compat_sys_io_submit +545 x32 execveat stub_x32_execveat
arch/x86/um/sys_call_table_64.c +1 -0
@@ -31,6 +31,7 @@#define stub_fork sys_fork#define stub_vfork sys_vfork#define stub_execve sys_execve +#define stub_execveat sys_execveat#define stub_rt_sigreturn sys_rt_sigreturn#define __SYSCALL_COMMON (nr, sym, compat) __SYSCALL_64(nr, sym, compat)
fs/binfmt_em86.c +4 -0
@@ -42,6 +42,10 @@ static int load_em86(struct linux_binprm *bprm)return -ENOEXEC ; } +/* Need to be able to load the file after exec */ +if (bprm->interp_flags &BINPRM_FLAGS_PATH_INACCESSIBLE ) +return -ENOENT ; +allow_write_access (bprm->file);fput (bprm->file); bprm->file =NULL ;
fs/binfmt_misc.c +4 -0
@@ -142,6 +142,10 @@ static int load_misc_binary(struct linux_binprm *bprm)if (!fmt) goto _ret; +/* Need to be able to load the file after exec */ +if (bprm->interp_flags &BINPRM_FLAGS_PATH_INACCESSIBLE ) +return -ENOENT ; +if (!(fmt->flags &MISC_FMT_PRESERVE_ARGV0 )) { retval =remove_arg_zero (bprm);if (retval)
fs/binfmt_script.c +10 -0
@@ -24,6 +24,16 @@ static int load_script(struct linux_binprm *bprm)if ((bprm->buf[0 ] !='#' ) || (bprm->buf[1 ] !='!' ))return -ENOEXEC ; + +/* +* If the script filename will be inaccessible after exec, typically +* because it is a "/dev/fd/<fd>/.." path against an O_CLOEXEC fd, give +* up now (on the assumption that the interpreter will want to load +* this file). +*/ +if (bprm->interp_flags &BINPRM_FLAGS_PATH_INACCESSIBLE ) +return -ENOENT ; +/* * This section does the #! interpretation. * Sorta complicated, but hopefully it will work. -TYT
fs/exec.c +100 -13
197 lines not on this page · raw message
fs/namei.c +1 -1
@@ -130,7 +130,7 @@ void final_putname(struct filename *name)#define EMBEDDED_NAME_MAX (PATH_MAX - sizeof(struct filename)) -static struct filename * +struct filename *getname_flags (const char __user *filename,int flags,int *empty) {struct filename *result, *err;
include/linux/binfmts.h +4 -0
@@ -53,6 +53,10 @@ struct linux_binprm {#define BINPRM_FLAGS_EXECFD_BIT 1#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) +/* filename of the binary will be inaccessible after exec */ +#define BINPRM_FLAGS_PATH_INACCESSIBLE_BIT 2 +#define BINPRM_FLAGS_PATH_INACCESSIBLE (1 << BINPRM_FLAGS_PATH_INACCESSIBLE_BIT) +/* Function parameter for binfmt->coredump */ struct coredump_params {const siginfo_t *siginfo;
include/linux/compat.h +3 -0
@@ -357,6 +357,9 @@ asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);asmlinkage long compat_sys_execve (const char __user *filename,const compat_uptr_t __user *argv,const compat_uptr_t __user *envp); +asmlinkage long compat_sys_execveat (int dfd,const char __user *filename, +const compat_uptr_t __user *argv, +const compat_uptr_t __user *envp,int flags); asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp, compat_ulong_t __user *exp,
include/linux/fs.h +1 -0
@@ -2072,6 +2072,7 @@ extern int vfs_open(const struct path *, struct file *, const struct cred *);extern struct file *dentry_open (const struct path *,int ,const struct cred *);extern int filp_close (struct file *,fl_owner_t id); +extern struct filename *getname_flags (const char __user *,int ,int *);extern struct filename *getname (const char __user *);extern struct filename *getname_kernel (const char *);
include/linux/sched.h +4 -0
@@ -2441,6 +2441,10 @@ extern void do_group_exit(int);extern int do_execve (struct filename *,const char __user *const __user *,const char __user *const __user *); +extern int do_execveat (int ,struct filename *, +const char __user *const __user *, +const char __user *const __user *, +int );extern long do_fork (unsigned long ,unsigned long ,unsigned long ,int __user *,int __user *);struct task_struct *fork_idle (int );extern pid_t kernel_thread (int (*fn)(void *),void *arg,unsigned long flags);
include/linux/syscalls.h +5 -0
@@ -877,4 +877,9 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,asmlinkage long sys_getrandom (char __user *buf,size_t count,unsigned int flags);asmlinkage long sys_bpf (int cmd,union bpf_attr *attr,unsigned int size); + +asmlinkage long sys_execveat (int dfd,const char __user *filename, +const char __user *const __user *argv, +const char __user *const __user *envp,int flags); +#endif
include/uapi/asm-generic/unistd.h +3 -1
@@ -707,9 +707,11 @@ __SYSCALL(__NR_getrandom, sys_getrandom) __SYSCALL(__NR_memfd_create, sys_memfd_create)#define __NR_bpf 280 __SYSCALL(__NR_bpf, sys_bpf) +#define __NR_execveat 281 +__SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat)#undef __NR_syscalls -#define __NR_syscalls 281 +#define __NR_syscalls 282/* * All syscalls below here should go away really,
kernel/sys_ni.c +3 -0
@@ -224,3 +224,6 @@ cond_syscall(sys_seccomp);/* access BPF programs and maps */ cond_syscall (sys_bpf); + +/* execveat */ +cond_syscall (sys_execveat);
lib/audit.c +3 -0
@@ -54,6 +54,9 @@ int audit_classify_syscall(int abi, unsigned syscall)case __NR_socketcall:return 4 ;#endif +#ifdef __NR_execveat +case __NR_execveat: +#endif case __NR_execve:return 5 ;default :
--
2.1.0.rc2.206.gedb03e5
Re: [PATCHv8 1/4] syscalls,x86: implement execveat() system call
Quoted 1 line · David Drysdale
Only x86-64, i386 and x32 ABIs are supported in this patch.
Can you please split this into the core/fs changes and the actual x86 hookup?
Thanks,
tglx
PATCH v8 2/4 syscalls,x86: add selftest for execveat(2)
In reply to David Drysdale--- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/exec/.gitignore | 9 + tools/testing/selftests/exec/Makefile | 25 ++ tools/testing/selftests/exec/execveat.c | 397 ++++++++++++++++++++++++++++++++ 4 files changed, 432 insertions(+) create mode 100644 tools/testing/selftests/exec/.gitignore create mode 100644 tools/testing/selftests/exec/Makefile create mode 100644 tools/testing/selftests/exec/execveat.c
tools/testing/selftests/Makefile +1 -0
@@ -15,6 +15,7 @@ TARGETS += user TARGETS += sysctl TARGETS += firmware TARGETS += ftrace +TARGETS += exec TARGETS_HOTPLUG = cpu-hotplug TARGETS_HOTPLUG += memory-hotplug
tools/testing/selftests/exec/.gitignore new file +9 -0
@@ -0,0 +1,9 @@ +subdir* +script* +execveat +execveat.symlink +execveat.moved +execveat.path.ephemeral +execveat.ephemeral +execveat.denatured +xxxxxxxx*
tools/testing/selftests/exec/Makefile new file +25 -0
@@ -0,0 +1,25 @@ +CC = $(CROSS_COMPILE)gcc +CFLAGS = -Wall +BINARIES = execveat +DEPS = execveat.symlink execveat.denatured script subdir +all: $(BINARIES) $(DEPS) + +subdir: + mkdir -p $@ +script: + echo '#!/bin/sh' > $@ + echo 'exit $$*' >> $@ + chmod +x $@ +execveat.symlink: execveat + ln -s -f $< $@ +execveat.denatured: execveat + cp $< $@ + chmod -x $@ +%: %.c + $(CC) $(CFLAGS) -o $@ $^ + +run_tests: all + ./execveat + +clean: + rm -rf $(BINARIES) $(DEPS) subdir.moved execveat.moved xxxxx*
tools/testing/selftests/exec/execveat.c new file +397 -0
397 lines not on this page · raw message
--
2.1.0.rc2.206.gedb03e5
PATCH v8 3/4 sparc: Hook up execveat system call.
In reply to David Drysdale--- arch/sparc/include/uapi/asm/unistd.h | 3 ++- arch/sparc/kernel/systbls_32.S | 1 + arch/sparc/kernel/systbls_64.S | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-)
arch/sparc/include/uapi/asm/unistd.h +2 -1
@@ -415,8 +415,9 @@#define __NR_getrandom 347#define __NR_memfd_create 348#define __NR_bpf 349 +#define __NR_execveat 350 -#define NR_syscalls 350 +#define NR_syscalls 351/* Bitmask values returned from kern_features system call. */ #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
arch/sparc/kernel/systbls_32.S +1 -0
@@ -87,3 +87,4 @@ sys_call_table: /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf +/*350*/ .long sys_execveat
arch/sparc/kernel/systbls_64.S +2 -0
@@ -88,6 +88,7 @@ sys_call_table32: .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf +/*350*/ .word sys_execveat #endif /* CONFIG_COMPAT */
@@ -167,3 +168,4 @@ sys_call_table: .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf +/*350*/ .word sys_execveat
--
2.1.0.rc2.206.gedb03e5
Re: [PATCHv8 3/4] sparc: Hook up execveat system call.
From: David Drysdale <[email protected]>
Date: Fri, 14 Nov 2014 16:23:02 +0000
Quoted 1 line
Signed-off-by David Drysdale <[email protected]>
PATCH v8 4/4 execveat.2: initial man page for execveat(2)
In reply to David Drysdale--- man2/execveat.2 | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 man2/execveat.2
man2/execveat.2 new file +153 -0
@@ -0,0 +1,153 @@ +.\" Copyright (c) 2014 Google, Inc. +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" Permission is granted to make and distribute verbatim copies of this +.\" manual provided the copyright notice and this permission notice are +.\" preserved on all copies. +.\" +.\" Permission is granted to copy and distribute modified versions of this +.\" manual under the conditions for verbatim copying, provided that the +.\" entire resulting derived work is distributed under the terms of a +.\" permission notice identical to this one. +.\" +.\" Since the Linux kernel and libraries are constantly changing, this +.\" manual page may be incorrect or out-of-date. The author(s) assume no +.\" responsibility for errors or omissions, or for damages resulting from +.\" the use of the information contained herein. The author(s) may not +.\" have taken the same level of care in the production of this manual, +.\" which is licensed free of charge, as they might when working +.\" professionally. +.\" +.\" Formatted or processed versions of this manual, if unaccompanied by +.\" the source, must acknowledge the copyright and authors of this work. +.\" %%%LICENSE_END +.\" +.TH EXECVEAT 2 2014-04-02 "Linux" "Linux Programmer's Manual" +.SH NAME +execveat \- execute program relative to a directory file descriptor +.SH SYNOPSIS +.B #include <unistd.h> +.sp +.BI "int execveat(int " fd ", const char *" pathname "," +.br +.BI " char *const " argv "[], char *const " envp "[]," +.br +.BI " int " flags); +.SH DESCRIPTION +The +.BR execveat () +system call executes the program pointed to by the combination of \fIfd\fP and \fIpathname\fP. +The +.BR execveat () +system call operates in exactly the same way as +.BR execve (2), +except for the differences described in this manual page. + +If the pathname given in +.I pathname +is relative, then it is interpreted relative to the directory +referred to by the file descriptor +.I fd +(rather than relative to the current working directory of +the calling process, as is done by +.BR execve (2) +for a relative pathname). + +If +.I pathname +is relative and +.I fd +is the special value +.BR AT_FDCWD , +then +.I pathname +is interpreted relative to the current working +directory of the calling process (like +.BR execve (2)). + +If +.I pathname +is absolute, then +.I fd +is ignored. + +If +.I pathname +is an empty string and the +.BR AT_EMPTY_PATH +flag is specified, then the file descriptor +.I fd +specifies the file to be executed. + +.I flags +can either be 0, or include the following flags: +.TP +.BR AT_EMPTY_PATH +If +.I pathname +is an empty string, operate on the file referred to by +.IR fd +(which may have been obtained using the +.BR open (2) +.B O_PATH +flag). +.TP +.B AT_SYMLINK_NOFOLLOW +If the file identified by +.I fd +and a non-NULL +.I pathname +is a symbolic link, then the call fails with the error +.BR EINVAL . +.SH "RETURN VALUE" +On success, +.BR execveat () +does not return. On error \-1 is returned, and +.I errno +is set appropriately. +.SH ERRORS +The same errors that occur for +.BR execve (2) +can also occur for +.BR execveat (). +The following additional errors can occur for +.BR execveat (): +.TP +.B EBADF +.I fd +is not a valid file descriptor. +.TP +.B ENOENT +The program identified by \fIfd\fP and \fIpathname\fP requires the +use of an interpreter program (such as a script starting with +"#!") but the file descriptor +.I fd +was opened with the +.B O_CLOEXEC +flag and so the program file is inaccessible to the launched interpreter. +.TP +.B EINVAL +Invalid flag specified in +.IR flags . +.TP +.B ENOTDIR +.I pathname +is relative and +.I fd +is a file descriptor referring to a file other than a directory. +.SH VERSIONS +.BR execveat () +was added to Linux in kernel 3.???. +.SH NOTES +In addition to the reasons explained in +.BR openat (2), +the +.BR execveat () +system call is also needed to allow +.BR fexecve (3) +to be implemented on systems that do not have the +.I /proc +filesystem mounted. +.SH SEE ALSO +.BR execve (2), +.BR fexecve (3)
--
2.1.0.rc2.206.gedb03e5