[systemd-commits] 2 commits - src/journal

Harald Hoyer harald at kemper.freedesktop.org
Fri Sep 6 01:12:20 PDT 2013


 src/journal/coredump.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 92f2ff4415b43e3265da0a1f09b24635f0874d55
Author: Andrew Cook <ariscop at gmail.com>
Date:   Wed Sep 4 23:27:52 2013 +1000

    systemd-coredump: Log crashes without coredumps on failure
    
    Make a best-effort attempt to store information about crashes during
    failure, currently if these are encountered the crash is completely
    silenced.
    
    ideally coredumpctl would show if a coredump is available.

diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index a7d3c34..68c353f 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -241,7 +241,7 @@ int main(int argc, char* argv[]) {
         coredump_data = malloc(coredump_bufsize);
         if (!coredump_data) {
                 r = log_oom();
-                goto finish;
+                goto finalize;
         }
 
         memcpy(coredump_data, "COREDUMP=", 9);
@@ -261,12 +261,12 @@ int main(int argc, char* argv[]) {
 
                 if(coredump_size > COREDUMP_MAX) {
                         log_error("Coredump too large, ignoring");
-                        goto finish;
+                        goto finalize;
                 }
 
                 if (!GREEDY_REALLOC(coredump_data, coredump_bufsize, coredump_size + 1)) {
                         r = log_oom();
-                        goto finish;
+                        goto finalize;
                 }
         }
 
@@ -274,6 +274,7 @@ int main(int argc, char* argv[]) {
         iovec[j].iov_len = coredump_size;
         j++;
 
+finalize:
         r = sd_journal_sendv(iovec, j);
         if (r < 0)
                 log_error("Failed to send coredump: %s", strerror(-r));

commit ca0ceb6f3e7e8ffda57b18c2dfe72dfb9de08f35
Author: Andrew Cook <ariscop at gmail.com>
Date:   Wed Sep 4 23:27:40 2013 +1000

    systemd-coredump: Ignore coredumps larger than COREDUMP_MAX
    
    Currently this check happens when the coredump has been collected in
    it's entirety and being received by journald. this is not ideal
    behaviour when the crashing process is consuming significant percentage
    of physical memory such as a large instance of firefox or a java
    application.

diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index fd03e38..a7d3c34 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -41,7 +41,7 @@
 #define COREDUMP_MIN_START (3*1024*1024)
 /* Make sure to not make this larger than the maximum journal entry
  * size. See ENTRY_SIZE_MAX in journald-native.c. */
-#define COREDUMP_MAX (768*1024*1024)
+#define COREDUMP_MAX (767*1024*1024)
 
 enum {
         ARG_PID = 1,
@@ -258,6 +258,12 @@ int main(int argc, char* argv[]) {
                         break;
 
                 coredump_size += n;
+
+                if(coredump_size > COREDUMP_MAX) {
+                        log_error("Coredump too large, ignoring");
+                        goto finish;
+                }
+
                 if (!GREEDY_REALLOC(coredump_data, coredump_bufsize, coredump_size + 1)) {
                         r = log_oom();
                         goto finish;



More information about the systemd-commits mailing list