malloc_debug: reset TrackData mutex after fork
Add a pthread_atfork handler to malloc_debug to lock the TrackData mutex
during fork and reset it in the child. Ensures that the TrackData is
consistent when forking from a multi-threaded process, and that the
mutex is in a defined state in the child.
Change-Id: I0dfed30045a28551217ceac227d33b2e18894932
diff --git a/libc/malloc_debug/DebugData.h b/libc/malloc_debug/DebugData.h
index 40978db..4600b33 100644
--- a/libc/malloc_debug/DebugData.h
+++ b/libc/malloc_debug/DebugData.h
@@ -82,6 +82,10 @@
bool need_header() { return need_header_; }
size_t extra_bytes() { return extra_bytes_; }
+ void PrepareFork();
+ void PostForkParent();
+ void PostForkChild();
+
std::unique_ptr<BacktraceData> backtrace;
std::unique_ptr<TrackData> track;
std::unique_ptr<FrontGuardData> front_guard;