summaryrefslogtreecommitdiff
path: root/fs/exec.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2002-12-14 19:44:20 -0800
committerIngo Molnar <mingo@elte.hu>2002-12-14 19:44:20 -0800
commitb9daa0066d792983da59154af3ae486eff9b9aa1 (patch)
treec571dbad3d99584edbfdcc5dbe9d751f0c224c28 /fs/exec.c
parentf3ce0064cbb6bbada20942729aa439cfd33da301 (diff)
[PATCH] threaded coredumps, tcore-fixes-2.5.51-A0
This fixes one more threaded-coredumps detail reported by the glibc people: all threads taken down by the coredump code should report the proper exit code. We can do this rather easily via the group_exit mechanism. 'Other' threads used to report SIGKILL, which was highly confusing as the shell often displayed the 'Killed' message instead of a 'Segmentation fault' message. Another missing bit was the 0x80 bit set in the exit status for all threads, if the coredump was successful. (it's safe to set this bit in ->sig->group_exit_code in an unlocked way because all threads are artificially descheduled by the coredump code.)
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 4c0937c43144..1699f5bdf92e 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1268,7 +1268,7 @@ static void coredump_wait(struct mm_struct *mm)
BUG_ON(mm->core_waiters);
}
-int do_coredump(long signr, struct pt_regs * regs)
+int do_coredump(long signr, int exit_code, struct pt_regs * regs)
{
char corename[CORENAME_MAX_SIZE + 1];
struct mm_struct *mm = current->mm;
@@ -1288,6 +1288,8 @@ int do_coredump(long signr, struct pt_regs * regs)
}
mm->dumpable = 0;
init_completion(&mm->core_done);
+ current->sig->group_exit = 1;
+ current->sig->group_exit_code = exit_code;
coredump_wait(mm);
if (current->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
@@ -1314,6 +1316,7 @@ int do_coredump(long signr, struct pt_regs * regs)
retval = binfmt->core_dump(signr, regs, file);
+ current->sig->group_exit_code |= 0x80;
close_fail:
filp_close(file, NULL);
fail_unlock: