A customer had a field problem with multi-threaded coredumps, and I think the fix is the exit race (already fixed in 2.6), but I also noticed a possible race between taking a coredump and fork(). If zap_threads() in fs/exec.c is called while a thread is in do_fork(), but before the newly created thread is in the thread list, it is possible to have a running thread during the coredump. This is bad, but not terribly bad. However, in this situation it is also possible in __exit_mm() that the final two threads check mm->core_waiters at the same time and then both decrement mm->core_waiters, causing it to go negative, and thus causing a BUG() in coredump_wait(). To fix this, I would like to propose the attached patch to 2.6. Signed-off-by: Corey Minyard