about summary refs log tree commit diff
path: root/crt/crti.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-03-04 09:29:39 -0500
committerRich Felker <dalias@aerifal.cx>2015-03-30 01:55:19 -0400
commit99c10bf85f4ed893a6712e31da382a58afcbd1ea (patch)
tree7e785740a41b3b43accaabb4554e7c65f1f4a5e2 /crt/crti.c
parentfdc39fac106fdb0df66c6fbc686b1b52159cc7df (diff)
downloadmusl-99c10bf85f4ed893a6712e31da382a58afcbd1ea.tar.gz
musl-99c10bf85f4ed893a6712e31da382a58afcbd1ea.tar.xz
musl-99c10bf85f4ed893a6712e31da382a58afcbd1ea.zip
fix init race that could lead to deadlock in malloc init code
the malloc init code provided its own version of pthread_once type
logic, including the exact same bug that was fixed in pthread_once in
commit 0d0c2f40344640a2a6942dda156509593f51db5d.

since this code is called adjacent to expand_heap, which takes a lock,
there is no reason to have pthread_once-type initialization. simply
moving the init code into the interval where expand_heap already holds
its lock on the brk achieves the same result with much less
synchronization logic, and allows the buggy code to be eliminated
rather than just fixed.

(cherry picked from commit 7a81fe3710be0128d29071e76c5acbea3d84277b)
Diffstat (limited to 'crt/crti.c')
0 files changed, 0 insertions, 0 deletions