<para>Most of these settings are unset, which means the resource limits are inherited from the kernel or, if
invoked in a container, from the container manager. However, the following have defaults:</para>
<itemizedlist>
- <listitem><para><varname>DefaultLimitNOFILE=</varname> defaults to <literal>1024:&HIGH_RLIMIT_NOFILE;</literal>.
+ <listitem><para><varname>DefaultLimitNOFILE=</varname> defaults to 1024:&HIGH_RLIMIT_NOFILE;.
</para></listitem>
+ <listitem><para><varname>DefaultLimitMEMLOCK=</varname> defaults to 8M.</para></listitem>
+
<listitem><para><varname>DefaultLimitCORE=</varname> does not have a default but it is worth mentioning that
<varname>RLIMIT_CORE</varname> is set to <literal>infinity</literal> by PID 1 which is inherited by its
children.</para></listitem>
-
- <listitem><para>Note that the service manager internally increases <varname>RLIMIT_MEMLOCK</varname> for
- itself, however the limit is reverted to the original value for child processes forked off.</para></listitem>
</itemizedlist>
+ <para>Note that the service manager internally in PID 1 bumps <varname>RLIMIT_NOFILE</varname> and
+ <varname>RLIMIT_MEMLOCK</varname> to higher values, however the limit is reverted to the mentioned
+ defaults for all child processes forked off.</para>
</listitem>
</varlistentry>
}
static int initialize_rlimits(void) {
- /* The default resource limits the kernel passes to PID 1, as per kernel 4.16. Let's pass our container payload
+ /* The default resource limits the kernel passes to PID 1, as per kernel 5.16. Let's pass our container payload
* the same values as the kernel originally passed to PID 1, in order to minimize differences between host and
* container execution environments. */
static const struct rlimit kernel_defaults[_RLIMIT_MAX] = {
- [RLIMIT_AS] = { RLIM_INFINITY, RLIM_INFINITY },
- [RLIMIT_CORE] = { 0, RLIM_INFINITY },
- [RLIMIT_CPU] = { RLIM_INFINITY, RLIM_INFINITY },
- [RLIMIT_DATA] = { RLIM_INFINITY, RLIM_INFINITY },
- [RLIMIT_FSIZE] = { RLIM_INFINITY, RLIM_INFINITY },
- [RLIMIT_LOCKS] = { RLIM_INFINITY, RLIM_INFINITY },
- [RLIMIT_MEMLOCK] = { 65536, 65536 },
- [RLIMIT_MSGQUEUE] = { 819200, 819200 },
- [RLIMIT_NICE] = { 0, 0 },
- [RLIMIT_NOFILE] = { 1024, 4096 },
- [RLIMIT_RSS] = { RLIM_INFINITY, RLIM_INFINITY },
- [RLIMIT_RTPRIO] = { 0, 0 },
- [RLIMIT_RTTIME] = { RLIM_INFINITY, RLIM_INFINITY },
- [RLIMIT_STACK] = { 8388608, RLIM_INFINITY },
+ [RLIMIT_AS] = { RLIM_INFINITY, RLIM_INFINITY },
+ [RLIMIT_CORE] = { 0, RLIM_INFINITY },
+ [RLIMIT_CPU] = { RLIM_INFINITY, RLIM_INFINITY },
+ [RLIMIT_DATA] = { RLIM_INFINITY, RLIM_INFINITY },
+ [RLIMIT_FSIZE] = { RLIM_INFINITY, RLIM_INFINITY },
+ [RLIMIT_LOCKS] = { RLIM_INFINITY, RLIM_INFINITY },
+ [RLIMIT_MEMLOCK] = { DEFAULT_RLIMIT_MEMLOCK, DEFAULT_RLIMIT_MEMLOCK },
+ [RLIMIT_MSGQUEUE] = { 819200, 819200 },
+ [RLIMIT_NICE] = { 0, 0 },
+ [RLIMIT_NOFILE] = { 1024, 4096 },
+ [RLIMIT_RSS] = { RLIM_INFINITY, RLIM_INFINITY },
+ [RLIMIT_RTPRIO] = { 0, 0 },
+ [RLIMIT_RTTIME] = { RLIM_INFINITY, RLIM_INFINITY },
+ [RLIMIT_STACK] = { 8388608, RLIM_INFINITY },
/* The kernel scales the default for RLIMIT_NPROC and RLIMIT_SIGPENDING based on the system's amount of
* RAM. To provide best compatibility we'll read these limits off PID 1 instead of hardcoding them