summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-07-25 19:03:43 +0200
committerEvgeny Vereshchagin <evvers@ya.ru>2016-07-25 20:03:43 +0300
commitc8091d92d5258afee017506ebac086da2f99ee91 (patch)
tree1ac7f7fcaaef7003e5de12769e03f11993d8ff58
parent3d391fa84f0b0f5708246848c713f2d52eaf92fe (diff)
coredump: turn off coredump collection only when PID 1 crashes, not when journald crashes (#3799)
As suggested: https://github.com/systemd/systemd/pull/3783/files/5157879b757bffce3da0a68ca207753569e8627d#r71906971
-rw-r--r--src/coredump/coredump.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index 043d785dd4..dcc09fcc6d 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -918,9 +918,6 @@ static int process_special_crash(const char *context[], int input_fd) {
log_notice("Detected coredump of the journal daemon or PID 1, diverted to %s.", filename);
- log_notice("Due to the special circumstances, coredump collection will now be turned off.");
- (void) write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
-
return 0;
}
@@ -980,6 +977,12 @@ static int process_kernel(int argc, char* argv[]) {
if (cg_pid_get_unit(pid, &t) >= 0) {
+ /* If this is PID 1 disable coredump collection, we'll unlikely be able to process it later on. */
+ if (streq(t, SPECIAL_INIT_SCOPE)) {
+ log_notice("Due to PID 1 having crashed coredump collection will now be turned off.");
+ (void) write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
+ }
+
/* Let's avoid dead-locks when processing journald and init crashes, as socket activation and logging
* are unlikely to work then. */
if (STR_IN_SET(t, SPECIAL_JOURNALD_SERVICE, SPECIAL_INIT_SCOPE)) {