[PATCH] [compiler-rt] Implement AddressSanitizer suppressions

Kuba Brecka kuba.brecka at gmail.com
Fri Dec 5 10:46:41 PST 2014


I have tried this patch on Linux and I've seen this test failure:

	FAIL: AddressSanitizer64 :: TestCases/strncpy-overflow.cc (1 of 1)
	...
	/tmp/llvm/projects/compiler-rt/test/asan/TestCases/strncpy-overflow.cc:20:12: error: expected string not found in input
	// CHECK: {{ #1 0x.* in main .*strncpy-overflow.cc:}}[[@LINE-4]]

The reason for that is that the printed stack trace looks like this:

    #0 0x44caf2 in strncpy /tmp/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:637
    #1 0x44cd31 in strncpy /tmp/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:637
    #2 0x4cdfdb in main (/tmp/llvm-cmake-debug/projects/compiler-rt/test/asan/64bitConfig/TestCases/Output/strncpy-overflow.cc.tmp+0x4cdfdb)
    #3 0x7f05b89eee64  (/lib64/libc.so.6+0x24e64)
    #4 0x417b08 in _start (/tmp/llvm-cmake-debug/projects/compiler-rt/test/asan/64bitConfig/TestCases/Output/strncpy-overflow.cc.tmp+0x417b08)

The doubled strncpy is the issue. To fix that, I moved the GET_CURRENT_PC_BP_SP line in ACCESS_MEMORY_RANGE right to the call to __asan_report_error.

http://reviews.llvm.org/D6280

Files:
  lib/asan/CMakeLists.txt
  lib/asan/asan_interceptors.cc
  lib/asan/asan_rtl.cc
  lib/asan/asan_suppressions.cc
  lib/asan/asan_suppressions.h
  lib/sanitizer_common/sanitizer_suppressions.cc
  lib/sanitizer_common/sanitizer_suppressions.h
  lib/sanitizer_common/tests/sanitizer_suppressions_test.cc
  test/asan/TestCases/Darwin/suppressions-darwin.cc
  test/asan/TestCases/suppressions-function.cc
  test/asan/TestCases/suppressions-interceptor.cc
  test/asan/TestCases/suppressions-library.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6280.16989.patch
Type: text/x-patch
Size: 32223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141205/edf50fac/attachment.bin>


More information about the llvm-commits mailing list