• Ingo Molnar's avatar
    [PATCH] thread-aware coredumps, 2.5.43-C3 · d89f3847
    Ingo Molnar authored
    This is the second iteration of thread-aware coredumps.
    
    Changes:
    
    - Ulrich Drepper has reviewed the data structures and checked actual
      coredumps via readelf - everything looks fine and according to the spec.
    
    - a serious bug has been fixed in the thread-state dumping code - it was
      still based on the 2.4 assumption that the task struct points to the
      kernel stack - it's task->thread_info in 2.5. This bug caused bogus
      register info to be filled in for threads.
    
    - properly wait for all threads that share the same MM to serialize with
      the coredumping thread. This is CLONE_VM based, not tied to
      CLONE_THREAD and/or signal semantics, ie. old-style (or different-style)
      threaded apps will be properly stopped as well.
    
      The locking might look a bit complex, but i wanted to keep the
      __exit_mm() overhead as low as possible. It's not quite trivial to get
      these bits right, because 'sharing the MM' is detached from signals
      semantics, so we cannot rely on broadcast-kill catching all threads. So
      zap_threads() iterates through every thread and zaps those which were
      left out. (There's a minimal race left in where a newly forked child
      might escape the attention of zap_threads() - this race is fixed by the
      OOM fixes in the mmap-speedup patch.)
    
    - fill_psinfo() is now called with the thread group leader, for the
      coredump to get 'process' state.
    
     - initialize the elf_thread_status structure with zeroes.
    
    the IA64 ELF bits are not included, yet, to reduce complexity of the
    patch. The patch has been tested on x86 UP and SMP.
    d89f3847
process.c 17 KB