summaryrefslogtreecommitdiff
path: root/libc/malloc_hooks/malloc_hooks.cpp
diff options
context:
space:
mode:
authorFlorian Mayer <fmayer@google.com>2020-03-02 18:25:46 -0800
committerFlorian Mayer <fmayer@google.com>2020-03-12 17:24:17 +0000
commit809da1f4e12d6c3d627465f352be7909b8aef619 (patch)
tree3655a950740bb4a2ebf093aa9119c8a554aadc70 /libc/malloc_hooks/malloc_hooks.cpp
parentbd4e0652227ee2aef7016480ea5451e498e20e28 (diff)
Add explicit state for heapprofd hooking.
The double hooking is currently controlled by two separate atomic booleans. In this state, it is very hard to guard against very subtle race conditions. Adding an explicit enum to encode the state makes it easier to reason about the behaviour of the program. Also introduce a MaybeModifyGlobals to consistently guard accesses to globals. We would sometimes modify them without swapping the gGlobalsMutating, introducing a window for race with HandleHeapprofdSignal. Test: while true; do atest HeapprofdCtsTest; done Test: flash blueline and manually test profile Bug: 150741354 This is a cherry-pick of fdd5eb1977712ee8a3bacde25a6d16efa7e6b452 Change-Id: I77102b0bd906b8ec2d6806bd43ba6cbf7191e37c Merged-In: I77102b0bd906b8ec2d6806bd43ba6cbf7191e37c
Diffstat (limited to 'libc/malloc_hooks/malloc_hooks.cpp')
0 files changed, 0 insertions, 0 deletions