core dump for multithreaded apps (2.2 kernels)

From: Patrick Wildi (usenet@wildi.com)
Date: Tue Mar 14 2000 - 19:04:19 EST


Hello,

I have been frustrated by the way core dumps work for
multithreaded applications under linux (2.2 series).
Instead of dummping the process that caused the
exception, the current implementation dumps the
last one to exit. Unfortunatley that one is useless
in getting any traceback off where the exception
happened.

The patch below changes the behaviour and dumps
the first one (the one causing the exception).
I am "abusing" a reserved bit in mm->def_flags.

This patch seems to work for me. But I would
welcome feedback.

Patrick

diff -u linux-2.2.13/fs/binfmt_elf.c linux/fs/binfmt_elf.c
--- linux-2.2.13/fs/binfmt_elf.c Sun Jun 13 10:50:04 1999
+++ linux/fs/binfmt_elf.c Tue Mar 14 15:13:42 2000
@@ -1073,7 +1073,7 @@
 
        if (!current->dumpable ||
            limit < ELF_EXEC_PAGESIZE ||
- atomic_read(&current->mm->count) != 1)
+ test_and_set_bit(31, &current->mm->def_flags) != 0)
                return 0;
        current->dumpable = 0;
 

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



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:29 EST