[PATCH 5/5] coredump: abort core dump piping only due to a fatal signal

From: Mandeep Singh Baines
Date: Thu Feb 14 2013 - 19:08:12 EST

From: Ben Chan <benchan@xxxxxxxxxxxx>

This patch makes wait_for_dump_helpers() not to abort piping the core
dump data when the crashing process has received any but a fatal signal
(SIGKILL). The rationale is that a crashing process may still receive
uninteresting signals such as SIGCHLD when its core dump data is being
redirected to a helper application. While it's necessary to allow
terminating the core dump piping via SIGKILL, it's practically more
useful for the purpose of debugging and crash reporting if the core dump
piping is not aborted due to other non-fatal signals.

Signed-off-by: Ben Chan <benchan@xxxxxxxxxxxx>
Signed-off-by: Mandeep Singh Baines <msb@xxxxxxxxxxxx>
CC: Oleg Nesterov <oleg@xxxxxxxxxx>
CC: Tejun Heo <tj@xxxxxxxxxx>
CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
CC: Rafael J. Wysocki <rjw@xxxxxxx>
CC: Ingo Molnar <mingo@xxxxxxxxxx>
fs/coredump.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 1774932..54e31a3 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -32,6 +32,7 @@
#include <linux/pipe_fs_i.h>
#include <linux/oom.h>
#include <linux/compat.h>
+#include <linux/freezer.h>

#include <asm/uaccess.h>
#include <asm/mmu_context.h>
@@ -417,10 +418,13 @@ static void wait_for_dump_helpers(struct file *file)

- while ((pipe->readers > 1) && (!signal_pending(current))) {
+ while ((pipe->readers > 1) && (!fatal_signal_pending(current))) {
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
+ pipe_unlock(pipe);
+ try_to_freeze();
+ pipe_lock(pipe);


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/