Skip to content

Commit

Permalink
stacktrace: Protect clear_stackmap with hook_guard
Browse files Browse the repository at this point in the history
This patch is to prevent from unexpected crash when clearing stackmap.

Signed-off-by: Honggyu Kim <[email protected]>
  • Loading branch information
honggyukim authored and Bojun-Seo committed Dec 3, 2022
1 parent 18c2b05 commit 18bf46f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stacktrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,12 @@ void dump_stackmap(enum alloc_sort_order order, bool flamegraph)
void clear_stackmap(void)
{
std::lock_guard<std::recursive_mutex> lock(container_mutex);
auto* tfs = &thread_flags;

tfs->hook_guard = true;

stackmap.clear();
addrmap.clear();

tfs->hook_guard = false;
}

0 comments on commit 18bf46f

Please sign in to comment.