aboutsummaryrefslogtreecommitdiff
path: root/argp
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2018-09-12 10:32:05 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2018-11-30 18:42:05 -0200
commit14d0e87d9b8caaa2eca7ca81f1189596671fe4fb (patch)
tree64cb57415f4e10d9ab42f067a43182e060217bab /argp
parente5d262effe3a87164308a3f37e61b32d0348692a (diff)
downloadglibc-14d0e87d9b8caaa2eca7ca81f1189596671fe4fb.zip
glibc-14d0e87d9b8caaa2eca7ca81f1189596671fe4fb.tar.gz
glibc-14d0e87d9b8caaa2eca7ca81f1189596671fe4fb.tar.bz2
posix: Use posix_spawn on popen
This patch uses posix_spawn on popen instead of fork and execl. On Linux this has the advantage of much lower memory consumption (usually 32 Kb minimum for the mmap stack area). Two issues are also fixed with this change: * BZ#17490: although POSIX pthread_atfork description only list 'fork' as the function that should execute the atfork handlers, popen description states that: '[...] shall be *as if* a child process were created within the popen() call using the fork() function [...]' Other libc/system seems to follow the idea atfork handlers should not be executed for popen: libc/system | run atfork handles | notes ------------|----------------------|--------------------------------------- Freebsd | no | uses vfork Solaris 11 | no | MacOSX 11 | no | implemented through posix_spawn syscall ------------|----------------------|---------------------------------------- Similar to posix_spawn and system, popen idea is to spawn a different binary so all the POSIX rationale to run the atfork handlers to avoid internal process inconsistency is not really required and in some cases might be unsafe. * BZ#22834: the described scenario, where the forked process might access invalid memory due an inconsistent state in multithreaded environment, should not happen because posix_spawn does not access the affected data structure (proc_file_chain). Checked on x86_64-linux-gnu and i686-linux-gnu. [BZ #22834] [BZ #17490] * NEWS: Add new semantic for atfork with popen and system. * libio/iopopen.c (_IO_new_proc_open): use posix_spawn instead of fork and execl.
Diffstat (limited to 'argp')
0 files changed, 0 insertions, 0 deletions