glibc/malloc
Florian Weimer 29d794863c malloc: Run fork handler as late as possible [BZ #19431]
Previously, a thread M invoking fork would acquire locks in this order:

  (M1) malloc arena locks (in the registered fork handler)
  (M2) libio list lock

A thread F invoking flush (NULL) would acquire locks in this order:

  (F1) libio list lock
  (F2) individual _IO_FILE locks

A thread G running getdelim would use this order:

  (G1) _IO_FILE lock
  (G2) malloc arena lock

After executing (M1), (F1), (G1), none of the threads can make progress.

This commit changes the fork lock order to:

  (M'1) libio list lock
  (M'2) malloc arena locks

It explicitly encodes the lock order in the implementations of fork,
and does not rely on the registration order, thus avoiding the deadlock.
2016-04-14 09:17:02 +02:00
..
arena.c malloc: Run fork handler as late as possible [BZ #19431] 2016-04-14 09:17:02 +02:00
Depend Update. 1999-10-04 22:59:43 +00:00
hooks.c malloc: Remove max_total_mem member form struct malloc_par 2016-02-19 17:07:04 +01:00
Makefile malloc: Run fork handler as late as possible [BZ #19431] 2016-04-14 09:17:02 +02:00
malloc-internal.h malloc: Run fork handler as late as possible [BZ #19431] 2016-04-14 09:17:02 +02:00
malloc.c malloc: Run fork handler as late as possible [BZ #19431] 2016-04-14 09:17:02 +02:00
malloc.h malloc: Remove max_total_mem member form struct malloc_par 2016-02-19 17:07:04 +01:00
mallocbug.c Reformat malloc to gnu style. 2014-01-02 09:40:10 +01:00
mcheck-init.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mcheck.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mcheck.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memusage.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memusage.sh Update copyright dates not handled by scripts/update-copyrights. 2016-01-04 16:26:30 +00:00
memusagestat.c Update copyright dates not handled by scripts/update-copyrights. 2016-01-04 16:26:30 +00:00
morecore.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mtrace.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mtrace.pl Update copyright dates not handled by scripts/update-copyrights. 2016-01-04 16:26:30 +00:00
obstack.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
obstack.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
scratch_buffer_grow_preserve.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
scratch_buffer_grow.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
scratch_buffer_set_array_size.c scratch_buffer_set_array_size: Include <limits.h> 2016-04-07 13:46:28 +02:00
set-freeres.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
thread-freeres.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-calloc.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-malloc-backtrace.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-malloc-fork-deadlock.c malloc: Run fork handler as late as possible [BZ #19431] 2016-04-14 09:17:02 +02:00
tst-malloc-thread-exit.c tst-malloc-thread-exit: Use fewer system resources 2016-02-19 14:12:56 +01:00
tst-malloc-thread-fail.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-malloc-usable.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-malloc.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-mallocfork.c * malloc/tst-mallocfork.c (do_test): Make sure sa_flags is 2005-12-06 00:50:15 +00:00
tst-mallocstate.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-mallopt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-mcheck.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-memalign.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-mtrace.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-mtrace.sh Make shebang interpreter directives consistent 2016-01-07 04:03:21 -05:00
tst-obstack.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-posix_memalign.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-pvalloc.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-realloc.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-scratch_buffer.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-trim1.c * malloc/tst-trim1.c: New file. 2007-12-16 22:57:57 +00:00
tst-valloc.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Versions Add struct scratch_buffer and its internal helper functions 2015-04-07 11:03:43 +02:00