glibc/sysdeps/unix/sysv/linux/aarch64
Adhemerval Zanella 882d6e17bc posix: Add posix_spawn_file_actions_addclosefrom_np
This patch adds a way to close a range of file descriptors on
posix_spawn as a new file action.  The API is similar to the one
provided by Solaris 11 [1], where the file action causes the all open
file descriptors greater than or equal to input on to be closed when
the new process is spawned.

The function posix_spawn_file_actions_addclosefrom_np is safe to be
implemented by iterating over /proc/self/fd, since the Linux spawni.c
helper process does not use CLONE_FILES, so its has own file descriptor
table and any failure (in /proc operation) aborts the process creation
and returns an error to the caller.

I am aware that this file action might be redundant to the current
approach of POSIX in promoting O_CLOEXEC in more interfaces. However
O_CLOEXEC is still not the default and for some specific usages, the
caller needs to close all possible file descriptors to avoid them
leaking.  Some examples are CPython (discussed in BZ#10353) and OpenJDK
jspawnhelper [2] (where OpenJDK spawns a helper process to exactly
closes all file descriptors).  Most likely any environment which calls
functions that might open file descriptor under the hood and aim to use
posix_spawn might face the same requirement.

Checked on x86_64-linux-gnu and i686-linux-gnu on kernel 5.11 and 4.15.

[1] https://docs.oracle.com/cd/E36784_01/html/E36874/posix-spawn-file-actions-addclosefrom-np-3c.html
[2] https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjava/childproc.c#L82
2021-07-08 14:08:15 -03:00
..
bits Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sys aarch64: Fix sys/ptrace.h if linux headers are included 2021-02-15 13:42:01 +00:00
arch-syscall.h Update syscall lists for Linux 5.13 2021-07-01 17:37:36 +00:00
c++-types.data AArch64: Consolidate nptl/ subdirectories under linux/... 2014-06-26 09:29:24 -07:00
clone.S aarch64: align stack in clone [BZ #27939] 2021-06-01 09:47:48 +01:00
configure LIBC_SLIBDIR_RTLDDIR: substitute arguments in single quotes 2018-01-25 17:20:28 +01:00
configure.ac Refactor handling of /lib64 etc. cases, move out of sysdeps/gnu/configure.ac. 2014-07-17 14:35:48 +00:00
cpu-features.c aarch64: Added optimized memcpy and memmove for A64FX 2021-05-27 09:47:53 +01:00
cpu-features.h aarch64: Added optimized memcpy and memmove for A64FX 2021-05-27 09:47:53 +01:00
dl-cache.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-procinfo.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-procinfo.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
getcontext.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
gettimeofday.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Implies NPTL is no longer an add-on! 2014-07-07 09:29:06 -07:00
ioctl.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
jmp_buf-macros.h Add jmp_buf-macros.h 2017-11-09 05:10:03 -08:00
kernel_rt_sigframe.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
kernel-features.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ld.abilist ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] 2020-02-15 11:01:23 +01:00
ldconfig.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
libanl.abilist resolv: Move libanl into libc (if libpthread is in libc) 2021-07-02 11:45:00 +02:00
libBrokenLocale.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libc_sigaction.c signal: Add __libc_sigaction 2021-03-18 15:54:39 -03:00
libc-start.c Use hidden visibility for early static PIE code 2021-01-21 15:55:01 +00:00
libc.abilist posix: Add posix_spawn_file_actions_addclosefrom_np 2021-07-08 14:08:15 -03:00
libcrypt.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libdl.abilist dlfcn: Move dlopen into libc 2021-06-03 08:26:04 +02:00
libm.abilist New exp10f version without SVID compat wrapper 2020-06-19 12:08:47 -03:00
libnsl.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libpthread.abilist nptl: Remove remaining code from libpthread 2021-05-21 22:35:01 +02:00
libresolv.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
librt.abilist Linux: Move timer_settime, __timer_settime64 from librt to libc 2021-06-28 09:51:01 +02:00
libthread_db.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libutil.abilist login: Move libutil into libc 2021-06-30 08:43:37 +02:00
localplt.data aarch64: Accept PLT calls to __getauxval within libc.so 2020-05-12 12:51:10 +02:00
makecontext.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile aarch64: Remove _dl_var_init 2021-05-17 10:07:44 +02:00
readelflib.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
send.c nptl: Remove send from libpthread 2021-03-26 13:36:17 -03:00
setcontext.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
shlib-versions Remove configuration name patterns from shlib-versions. 2014-09-12 12:28:47 +00:00
sigcontextinfo.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
swapcontext.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
syscall.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysconf.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysdep.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysdep.h nptl: Remove send from libpthread 2021-03-26 13:36:17 -03:00
ucontext_i.sym aarch64: Revert the change of the __reserved member of mcontext_t 2018-01-24 11:53:30 +00:00
ucontext-internal.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Versions aarch64: Remove _dl_var_init 2021-05-17 10:07:44 +02:00
vfork.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
vltest.py aarch64: Added Vector Length Set test helper script 2021-05-26 12:01:06 +01:00