Re: small multi-threaded coredump patch

Alexander Viro (viro@math.psu.edu)
Wed, 3 Nov 1999 15:36:10 -0500 (EST)


On Wed, 3 Nov 1999 cvarner@corp.spinway.com wrote:

> Hello,
>
> Here is a short patch to coredump a segfaulting thread in a
> linux-threads program. Rather than dumping to core.pid() or other
> more complicated scheme, I added a flag to the mm_struct to mark
> whether the corefile has been generated. The patch assumes that the
> process/thread which caused the segfault will be the first to dump.
> I've done some testing on single and dual cpu boxes, and this always
> seems to work.
>
> As the patch is really short, here it is. My changes were made (and
> tested with) the 2.3.18 kernel, but the patch will also apply against
> the most recent kernel(2.3.25).

And if the thread that dumps core will race with another thread (still
alive, running on a different CPU and using ->mm)? You will something much
more heavy for coredumps on shared mm. Notice that simple grabbing the
mmap_sem will not fly - you will have to change the elf_core_dump() to
avoid deadlocks (think what will happen upon page-in).

-
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/