Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: base/trace_event/heap_profiler_allocation_context_tracker.cc

Issue 1975393002: Check stack pointer to be inside stack when unwinding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix renderer deadlock on Linux Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/trace_event/heap_profiler_allocation_context_tracker.cc
diff --git a/base/trace_event/heap_profiler_allocation_context_tracker.cc b/base/trace_event/heap_profiler_allocation_context_tracker.cc
index fac4a8a7b437b4a8c6792631f252ad8a3e78c8e5..67e2b9998adb9b16763abd5a90579a6af0594bee 100644
--- a/base/trace_event/heap_profiler_allocation_context_tracker.cc
+++ b/base/trace_event/heap_profiler_allocation_context_tracker.cc
@@ -165,6 +165,9 @@ AllocationContext AllocationContextTracker::GetContextSnapshot() {
return ctx;
}
+ // Ignore reentrancy during the call.
+ ignore_scope_depth_++;
+
CaptureMode mode = static_cast<CaptureMode>(
subtle::NoBarrier_Load(&capture_mode_));
@@ -172,13 +175,9 @@ AllocationContext AllocationContextTracker::GetContextSnapshot() {
auto backtrace_end = std::end(ctx.backtrace.frames);
if (!thread_name_) {
- // Ignore the string allocation made by GetAndLeakThreadName to avoid
- // reentrancy.
- ignore_scope_depth_++;
thread_name_ = GetAndLeakThreadName();
ANNOTATE_LEAKING_OBJECT_PTR(thread_name_);
DCHECK(thread_name_);
- ignore_scope_depth_--;
}
// Add the thread name as the first entry in pseudo stack.
@@ -214,7 +213,8 @@ AllocationContext AllocationContextTracker::GetContextSnapshot() {
size_t frame_count = debug::TraceStackFramePointers(
frames,
arraysize(frames),
- 1 /* exclude this function from the trace */ );
+ 1 /* exclude this function from the trace */,
+ &stack_info_);
#else
size_t frame_count = 0;
NOTREACHED();
@@ -239,6 +239,7 @@ AllocationContext AllocationContextTracker::GetContextSnapshot() {
// (component name) in the heap profiler and not piggy back on the type name.
ctx.type_name = task_contexts_.empty() ? nullptr : task_contexts_.back();
+ ignore_scope_depth_--;
return ctx;
}

Powered by Google App Engine
This is Rietveld 408576698