From 57cab90c02532603a9ba0f2a87284b718cfd4100 Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Wed, 20 Feb 2013 13:15:59 +1100 Subject: [PATCH] coredump: abort core dump piping only due to a fatal signal Make wait_for_dump_helpers() not abort piping the core dump data when the crashing process has received a non-fatal signal. The abort still occurs in the case of 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 Signed-off-by: Mandeep Singh Baines Cc: Oleg Nesterov Cc: Tejun Heo Cc: Rafael J. Wysocki Cc: Ingo Molnar Signed-off-by: Andrew Morton --- fs/coredump.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/coredump.c b/fs/coredump.c index 57b9bd6da233..0a7838fa8eec 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -417,10 +418,13 @@ static void wait_for_dump_helpers(struct file *file) pipe->readers++; pipe->writers--; - while ((pipe->readers > 1) && (!signal_pending(current))) { + while ((pipe->readers > 1) && (!fatal_signal_pending(current))) { wake_up_interruptible_sync(&pipe->wait); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); pipe_wait(pipe); + pipe_unlock(pipe); + try_to_freeze(); + pipe_lock(pipe); } pipe->readers--; -- 2.39.5