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

Unified Diff: base/profiler/native_stack_sampler_win.cc

Issue 2495413002: Fix false-positive ASAN detection with the stack profiler on win64 (Closed)
Patch Set: minus build changes Created 4 years, 1 month 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
« no previous file with comments | « base/compiler_specific.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/profiler/native_stack_sampler_win.cc
diff --git a/base/profiler/native_stack_sampler_win.cc b/base/profiler/native_stack_sampler_win.cc
index 063374f19d5b1edfd7d758d98e4047a1b8d67bd6..283abdd4c6fbeedb11040c912eb4bcb9f2c18a1b 100644
--- a/base/profiler/native_stack_sampler_win.cc
+++ b/base/profiler/native_stack_sampler_win.cc
@@ -319,7 +319,7 @@ void SuspendThreadAndRecordStack(
void* stack_copy_buffer,
size_t stack_copy_buffer_size,
std::vector<RecordedFrame>* stack,
- NativeStackSamplerTestDelegate* test_delegate) {
+ NativeStackSamplerTestDelegate* test_delegate) NO_SANITIZE("address") {
DCHECK(stack->empty());
CONTEXT thread_context = {0};
@@ -353,8 +353,12 @@ void SuspendThreadAndRecordStack(
if (PointsToGuardPage(bottom))
return;
- std::memcpy(stack_copy_buffer, reinterpret_cast<const void*>(bottom),
Mark Mentovai 2016/11/15 16:52:04 Can we keep this if !defined(ADDRESS_SANITIZER)? S
etienneb 2016/11/15 16:55:41 I'm not against it. Typically we try to avoid ifde
- top - bottom);
+ // The following loop is an inlined version of memcpy. The code must be
+ // inlined to avoid instrumentation when using ASAN (memory sanitizer). The
+ // stack profiler is generating false positive when walking the stack.
+ for (size_t pos = 0; pos < top - bottom; ++pos)
+ reinterpret_cast<char*>(stack_copy_buffer)[pos] =
+ reinterpret_cast<const char*>(bottom)[pos];
}
if (test_delegate)
@@ -385,7 +389,7 @@ class NativeStackSamplerWin : public NativeStackSampler {
// reserved stack size is 1 MB and Chrome Windows threads currently always
// use the default, but this allows for expansion if it occurs. The size
// beyond the actual stack size consists of unallocated virtual memory pages
- // so carries little cost (just a bit of wated address space).
+ // so carries little cost (just a bit of wasted address space).
kStackCopyBufferSize = 2 * 1024 * 1024
};
« no previous file with comments | « base/compiler_specific.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698