CHROMIUM: exec: abort core dump piping only due to a fatal signal
authorBen Chan <benchan@chromium.org>
Thu, 1 Mar 2012 07:14:44 +0000 (23:14 -0800)
committerOlof Johansson <olof@lixom.net>
Fri, 1 Jun 2012 06:53:32 +0000 (23:53 -0700)
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.

BUG=chromium-os:21559
TEST=Tested the following:
1. Modify /proc/sys/kernel/core_pattern to pipe core dump data to a
   modified crash reporter that waits for minutes before reading core
   dump data.
2. Run a program that crashes with SIGSEGV.
3. Send a SIGCHLD signal to the crashing process while its core dump
   data is being piped to the crash reporter. Verify that the core
   dump eventually finishes without being aborted.
4. Repeat 1-3 but send SIGKILL instead of SIGCHLD to the crashing
   process and verify that the core dump is aborted.

Change-Id: I71e52df0a936fd0f718a4bcb6777900032c0717d
Signed-off-by: Ben Chan <benchan@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/17128
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
fs/exec.c

index 364f659..a22cb16 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -2025,7 +2025,7 @@ 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);