]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #9017 from keszybz/man-coredump
authorLennart Poettering <lennart@poettering.net>
Thu, 17 May 2018 17:45:22 +0000 (10:45 -0700)
committerGitHub <noreply@github.com>
Thu, 17 May 2018 17:45:22 +0000 (10:45 -0700)
coredump documention enhancement

man/coredump.conf.xml
man/systemd-coredump.xml
src/coredump/coredump.c

index 048bbc36370af301a3bb05365b38cdfd04d01f02..49debb219a33244befbb72b8d6037f8a8d23b3ad 100644 (file)
@@ -74,7 +74,7 @@
 
         <listitem><para>Controls where to store cores. One of <literal>none</literal>,
         <literal>external</literal>, and <literal>journal</literal>. When
-        <literal>none</literal>, the core dumps will be logged (including the backtrace if
+        <literal>none</literal>, the core dumps may be logged (including the backtrace if
         possible), but not stored permanently. When <literal>external</literal> (the
         default), cores will be stored in <filename>/var/lib/systemd/coredump/</filename>.
         When <literal>journal</literal>, cores will be stored in the journal and rotated
 
         <listitem><para>The maximum size in bytes of a core
         which will be processed. Core dumps exceeding this size
-        will be logged, but the backtrace will not be generated
-        and the core will not be stored.</para></listitem>
+        may be stored, but the backtrace will not be generated.
+        </para>
+
+        <para>Setting <varname>Storage=none</varname> and <varname>ProcessSizeMax=0</varname>
+        disables all coredump handling except for a log entry.</para>
+        </listitem>
       </varlistentry>
 
       <varlistentry>
index 6c3078143f3b23556bb7c02f56a26f9b7940c3bc..6fba19c22352ec1b84f4bce5cd817cf57fd6ace0 100644 (file)
     core dumps and files can be set in files <filename>/etc/systemd/coredump.conf</filename> and snippets mentioned
     above. In addition the storage time of core dump files is restricted by <command>systemd-tmpfiles</command>,
     corresponding settings are by default in <filename>/usr/lib/tmpfiles.d/systemd.conf</filename>.</para>
+
+    <refsect2>
+      <title>Disabling coredump processing</title>
+
+      <para>To disable potentially resource-intensive processing by <command>systemd-coredump</command>,
+      set <programlisting>Storage=none
+ProcessSizeMax=0</programlisting> in
+      <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+      </para>
+    </refsect2>
   </refsect1>
 
   <refsect1>
index 423a1c21a415c107cf634ca772b305e6627939ad..c1f396b1ac762ee64c61f8498b71292ced8dfc44 100644 (file)
@@ -141,7 +141,12 @@ static int parse_config(void) {
 }
 
 static inline uint64_t storage_size_max(void) {
-        return arg_storage == COREDUMP_STORAGE_EXTERNAL ? arg_external_size_max : arg_journal_size_max;
+        if (arg_storage == COREDUMP_STORAGE_EXTERNAL)
+                return arg_external_size_max;
+        if (arg_storage == COREDUMP_STORAGE_JOURNAL)
+                return arg_journal_size_max;
+        assert(arg_storage == COREDUMP_STORAGE_NONE);
+        return 0;
 }
 
 static int fix_acl(int fd, uid_t uid) {
@@ -323,7 +328,7 @@ static int save_external_coredump(
 
         _cleanup_free_ char *fn = NULL, *tmp = NULL;
         _cleanup_close_ int fd = -1;
-        uint64_t rlimit, max_size;
+        uint64_t rlimit, process_limit, max_size;
         struct stat st;
         uid_t uid;
         int r;
@@ -350,8 +355,14 @@ static int save_external_coredump(
                 return -EBADSLT;
         }
 
+        process_limit = MAX(arg_process_size_max, storage_size_max());
+        if (process_limit == 0) {
+                log_debug("Limits for coredump processing and storage are both 0, not dumping core.");
+                return -EBADSLT;
+        }
+
         /* Never store more than the process configured, or than we actually shall keep or process */
-        max_size = MIN(rlimit, MAX(arg_process_size_max, storage_size_max()));
+        max_size = MIN(rlimit, process_limit);
 
         r = make_filename(context, &fn);
         if (r < 0)