]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/libsystemd/sd-bus/bus-socket.c
tree-wide: invoke rlimit_nofile_safe() before various exec{v,ve,l}() invocations
authorLennart Poettering <lennart@poettering.net>
Mon, 26 Nov 2018 15:06:26 +0000 (16:06 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 1 Dec 2018 11:50:45 +0000 (12:50 +0100)
commit595225af7a4f663788d26b8720e994fed71f9410
treeca656b1aaa5655b0697472e7165272db02bc8a22
parent909106ebdf9a128627cd5974d4d388c71d694464
tree-wide: invoke rlimit_nofile_safe() before various exec{v,ve,l}() invocations

Whenever we invoke external, foreign code from code that has
RLIMIT_NOFILE's soft limit bumped to high values, revert it to 1024
first. This is a safety precaution for compatibility with programs using
select() which cannot operate with fds > 1024.

This commit adds the call to rlimit_nofile_safe() to all invocations of
exec{v,ve,l}() and friends that either are in code that we know runs
with RLIMIT_NOFILE bumped up (which is PID 1 and all journal code for
starters) or that is part of shared code that might end up there.

The calls are placed as early as we can in processes invoking a flavour
of execve(), but after the last time we do fd manipulations, so that we
can still take benefit of the high fd limits for that.
12 files changed:
src/basic/process-util.c
src/core/main.c
src/core/shutdown.c
src/fsck/fsck.c
src/import/pull-common.c
src/journal-remote/journal-remote-main.c
src/libsystemd/sd-bus/bus-socket.c
src/nspawn/nspawn-setuid.c
src/shared/exec-util.c
src/shared/pager.c
src/systemctl/systemctl.c
src/udev/udev-event.c