about summary refs log tree commit diff
path: root/src/stdio/fopen.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-04 09:29:39 -0500
commit7a81fe3710be0128d29071e76c5acbea3d84277b (patch)
tree1ba3a7b2433dc4671a5b516996ee9051044cc622 /src/stdio/fopen.c
parent56fbaa3bbe73f12af2bfbbcf2adb196e6f9fe264 (diff)
downloadmusl-7a81fe3710be0128d29071e76c5acbea3d84277b.tar.gz
musl-7a81fe3710be0128d29071e76c5acbea3d84277b.tar.xz
musl-7a81fe3710be0128d29071e76c5acbea3d84277b.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.
Diffstat (limited to 'src/stdio/fopen.c')
0 files changed, 0 insertions, 0 deletions