Make sure that BufferedStackTrace in malloc interceptors has top frame
calculated with GET_CALLER_PC.
Replace GET_CURRENT_PC_BP_SP with GET_CURRENT_BP_SP and make code use
GET_CALLER_PC.
Paths
| Differential D28173
[asan] Use exact comparison in BufferedStackTrace::LocatePcInTrace Changes PlannedPublic Authored by vitalybuka on Dec 29 2016, 9:19 PM.
Details
Summary Make sure that BufferedStackTrace in malloc interceptors has top frame Replace GET_CURRENT_PC_BP_SP with GET_CURRENT_BP_SP and make code use
Diff Detail
Event Timelinevitalybuka retitled this revision from to [asan] Use exact comparison in BufferedStackTrace::LocatePcInTrace. vitalybuka updated this object. Comment Actions What if we used GET_CALLER_PC in the interceptor functions instead of GET_CURRENT_PC_BP_SP? That would provide an address in the user code, which MatchPc could match exactly and take one step back to get the interceptor frame? Comment Actions Sorry, I still don't like this. As I see it, the problem is not really with the stack trace itself. We are replacing it with a better trace later anyway. The problem is to keep enough information to trim the new trace at the right point. When malloc_context_size > 1, exact matching trace[1] and then stepping back should work strictly better than the current code. When malloc_context_size<=1, we can keep the current behavior, or add a new field to store caller-pc from the interceptor PoV.
Revision Contents
Diff 83181 lib/asan/asan_allocator.h
lib/asan/asan_allocator.cc
lib/asan/asan_interceptors.cc
lib/asan/asan_malloc_linux.cc
lib/asan/asan_malloc_win.cc
lib/asan/asan_poisoning.cc
lib/asan/asan_stack.h
lib/asan/asan_stack.cc
lib/asan/tests/asan_interface_test.cc
lib/asan/tests/asan_noinst_test.cc
lib/sanitizer_common/sanitizer_internal_defs.h
lib/sanitizer_common/sanitizer_stacktrace.h
lib/sanitizer_common/sanitizer_stacktrace.cc
|
Please rename to GetStackTraceWithCurrentPcBpAndContext, or something like that