Fix fork deadlock issues.
Fix a case where there is a stats lock only on 32 bit that was not properly
handled during a fork.
Reorder the three extents locks so that postfork function release in the
opposite order they are acquired.
Add an extent_postfork_child function that resets some extent locks. Due
to the complex nature of the jemalloc locking scheme, these locks can
wind up being locked outside of any other locks. But when that happens,
it should not result in corruption since these locks are only doing an
independent operation such as allocating an object. Other locks need to
be acquired to change the real global state, and the normal prefork calls
do that locking properly.
Bug: 337349003
Test: Ran bionic-unit-tests --gtest_filter=gwp_asan_integration.malloc_tests_under_torture
Test: a thousand times with no deadlock.
Test: Ran the above test for 32 bit and 64 bit.
Test: Ran the above test in both the low memory config and the
Test: normal config.
Test: All bionic unit tests pass.
Change-Id: Ifd15f53d477787839784c0ce812936edcb198c58
6 files changed