From: Aki Tuomi Date: Thu, 8 Feb 2018 11:04:48 +0000 (+0200) Subject: old-stats: Set process dumpable during stats gathering X-Git-Tag: 2.3.9~2337 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c533d1c49f47b7919de72c794abe9d2e0660ebd;p=thirdparty%2Fdovecot%2Fcore.git old-stats: Set process dumpable during stats gathering /proc/self/io is not accessible otherwise --- diff --git a/src/plugins/old-stats/mail-stats-fill.c b/src/plugins/old-stats/mail-stats-fill.c index 395cece627..b29c800b6f 100644 --- a/src/plugins/old-stats/mail-stats-fill.c +++ b/src/plugins/old-stats/mail-stats-fill.c @@ -2,6 +2,7 @@ #include "lib.h" #include "time-util.h" +#include "restrict-access.h" #include "stats-plugin.h" #include "mail-stats.h" @@ -45,6 +46,10 @@ static int process_io_open(void) if (proc_io_disabled) return -1; + + bool dumpable = restrict_access_get_dumpable(); + if (!dumpable) + restrict_access_set_dumpable(TRUE); proc_io_fd = open(PROC_IO_PATH, O_RDONLY); if (proc_io_fd == -1 && errno == EACCES) { /* kludge: if we're running with permissions temporarily @@ -60,6 +65,8 @@ static int process_io_open(void) } errno = EACCES; } + if (!dumpable) + restrict_access_set_dumpable(FALSE); if (proc_io_fd == -1) { /* ignore access errors too, certain security options can prevent root access to this file when not owned by root */