__asan_memcpy是否因设计或意外而无法抑制?

时间:2018-02-01 00:33:45

标签: clang suppression address-sanitizer

我正在运行基于Linux x86_64的clang 4.0.0 asan。我使用clang ++ -fsanitize = address。

构建了我的代码

我无法抑制asan在我的代码之外报告的以下内存问题:(我已经删除了堆栈跟踪并修改了一些文件路径)

==104630==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200019367c at pc 0x2aaaaadc0d85 bp 0x7fffffff7e90 sp 0x7fffffff7640
READ of size 16 at 0x60200019367c thread T0
#0 0x2aaaaadc0d84 in __asan_memcpy /path/to/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_interceptors.cc:453
#1 0x5b74a8 in _ZNSt3__116allocator_traitsINS_9allocatorIiEEE20__construct_backwardIiEENS_9enable_ifIXaaoosr7is_sameIS2_NS1_IT_EEEE5valuentsr15__has_constructIS2_PS6_S6_EE5valuesr31is_trivially_move_constructibleIS6_EE5valueEvE4typeERS2_S8_S8_RS8_ /path/to/clang/clang-4.0.0/rawbin/../include/c++/v1/memory:1676:17
#2 0x5b74a8 in std::__1::vector<int, std::__1::allocator<int> >::__swap_out_circular_buffer(std::__1::__split_buffer<int, std::__1::allocator<int>&>&) /path/to/clang/clang-4.0.0/rawbin/../include/c++/v1/vector:886
#3 0x5b648a in void std::__1::vector<int, std::__1::allocator<int> >::__push_back_slow_path<int const&>(int const&) /path/to/clang/clang-4.0.0/rawbin/../include/c++/v1/vector:1574:5
#4 0x1d8d2ba in std::__1::vector<int, std::__1::allocator<int> >::push_back(int const&) /path/to/clang/clang-4.0.0/rawbin/../include/c++/v1/vector:1591:9
#5 0x1d8d2ba in bar::baz(a_type const*, int const*, std::__1::vector<int, std::__1::allocator<int> >&) /path/to/installed/3rd/party/library/that/i/did/not/build/foo.cc:394

我按照here的说明进行操作,并且通过在其中键入乱码并看到打印到我的终端的“AddressSanitizer:无法解析抑制”来验证我的.supp正在读取。我在compiler-rt-4.0.0.src / lib / asan / asan_interceptors.cc中查看了src的__asan_memcpy

452 void *__asan_memcpy(void *to, const void *from, uptr size) {
453   ASAN_MEMCPY_IMPL(nullptr, to, from, size);
454 }

我认为“nullptr”是我的问题。我按照宏观线索找到了这些线

 68       AsanInterceptorContext *_ctx = (AsanInterceptorContext *)ctx;     \
 69       bool suppressed = false;                                          \
 70       if (_ctx) {                                                       \
 71         suppressed = IsInterceptorSuppressed(_ctx->interceptor_name);   \
 72         if (!suppressed && HaveStackTraceBasedSuppressions()) {         \
 73           GET_STACK_TRACE_FATAL_HERE;                                   \
 74           suppressed = IsStackTraceSuppressed(&stack);                  \
 75         }                                                               \
 76       }                                                                 \
 77       if (!suppressed) {                                                \
 78         GET_CURRENT_PC_BP_SP;                                           \
 79         ReportGenericError(pc, bp, sp, __bad, isWrite, __size, 0, false);\
 80       } 

由于ctx总是“nullptr”,“if(_ctx)”总是计算为false,这意味着我将无法抑制内存错误。这是设计还是错误?

快速浏览我今天下载的最新编译器-rt src(git hash 286b899df64bb82a2da253114653adaf15da2fce,git-svn-id:https://llvm.org/svn/llvm-project/compiler-rt/trunk@323510 91177308-0d34-0410-b5e6-96231b3b80d8)显示了相同的情况最新的asan实现,所以我不认为更新到最新的asan rtl会有所帮助。

0 个答案:

没有答案