Commit 53aae957 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

restore: unset dumpable flag for zombies (v2)

We have already tried to prevent generating core files for zombies:

commit 6da52216
Author: Andrey Vagin <avagin@openvz.org>
Date:   Fri Jul 12 18:14:23 2013 +0400

    restore: set the zero limit for RLIMIT_CORE

But it doesn't work if a core file is sent into a pipe.
This functionality is used by the abrt daemon for example.

This patch uses more direct way, it unsets the dumpable flag with help
of PR_SET_DUMPABLE.

v2: remove the previous hack
Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e2c6abcb
......@@ -19,6 +19,7 @@
#include <sys/file.h>
#include <sys/shm.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sched.h>
......@@ -749,12 +750,11 @@ static int restore_one_zombie(int pid, CoreEntry *core)
}
if (exit_code & 0x7f) {
struct rlimit rlim = {0, 0};
int signr;
/* prevent generating core files */
if (setrlimit(RLIMIT_CORE, &rlim))
pr_perror("Can't set the zero limit for core files");
if (prctl(PR_SET_DUMPABLE, 0, 0, 0, 0))
pr_perror("Can't drop the dumpable flag");
signr = exit_code & 0x7F;
if (!sig_fatal(signr)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment