Hardened allocator designed for modern systems. It has integration into Android's Bionic libc and can be used externally with musl and glibc as a dynamic library for use on other Linux-based platforms. It will gain more portability / integration over time.
async_safe_fatal() calls abort() at the end, which can be intercepted by a custom SIGABRT handler.
In particular, crashlytics installs such a handler and tries to fork() after catching SIGABRT.
hardened_malloc uses pthread_atfork() to register fork handlers. These handlers try to lock internal hardened_malloc mutexes. If at least one of those mutexes is already locked, which is usually the case, thread that called fatai_error() gets deadlocked, while the other threads (if there are any) continue to run.
async_safe_fatal() calls abort() at the end, which can be intercepted by a custom SIGABRT handler.
In particular, crashlytics installs such a handler and tries to fork() after catching SIGABRT.
hardened_malloc uses pthread_atfork() to register fork handlers. These handlers try to lock internal hardened_malloc mutexes. If at least one of those mutexes is already locked, which is usually the case, thread that called fatai_error() gets deadlocked, while the other threads (if there are any) continue to run.
Depends on https://github.com/GrapheneOS/platform_bionic/pull/38