diff options
author | Kostya Serebryany <kcc@google.com> | 2017-01-25 01:14:24 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2017-01-25 01:14:24 +0000 |
commit | a39f5f84558588b1422ec7fde1434f7b91caa16a (patch) | |
tree | dae52d539fa30cccea0e18adf1e89ce1e4883268 | |
parent | a94309f16172e365718baa5f7d24a2f46a9f951b (diff) |
[asan] fix __sanitizer_cov_with_check to get the correct caller PC. Before this fix the code relied on the fact that the other function (__sanitizer_cov) is inlined. This was true with clang builds on x86, but not true with gcc builds on x86 and on PPC. This caused bot redness after r292862
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292998 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/sanitizer_common/sanitizer_coverage_libcdep.cc | 3 | ||||
-rw-r--r-- | test/asan/TestCases/Posix/coverage-direct.cc | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc index 497bdcb88..73cb2f200 100644 --- a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc +++ b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc @@ -939,7 +939,8 @@ SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_with_check(u32 *guard) { atomic_uint32_t *atomic_guard = reinterpret_cast<atomic_uint32_t*>(guard); if (static_cast<s32>( __sanitizer::atomic_load(atomic_guard, memory_order_relaxed)) < 0) - __sanitizer_cov(guard); + coverage_data.Add(StackTrace::GetPreviousInstructionPc(GET_CALLER_PC()), + guard); } SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_indir_call16(uptr callee, uptr callee_cache16[]) { diff --git a/test/asan/TestCases/Posix/coverage-direct.cc b/test/asan/TestCases/Posix/coverage-direct.cc index e870e0aca..8caa9c553 100644 --- a/test/asan/TestCases/Posix/coverage-direct.cc +++ b/test/asan/TestCases/Posix/coverage-direct.cc @@ -35,7 +35,7 @@ // RUN: %sancov print *.sancov >out.txt // RUN: cd ../.. -// TEMPORARILY_DISABLED: diff -u coverage-direct/normal/out.txt coverage-direct/direct/out.txt +// RUN: diff -u coverage-direct/normal/out.txt coverage-direct/direct/out.txt // RUN: %clangxx_asan -fsanitize-coverage=edge -DSHARED %s -shared -o %dynamiclib -fPIC @@ -54,7 +54,7 @@ // RUN: %sancov print *.sancov >out.txt // RUN: cd ../.. -// TEMPORARILY_DISABLED: diff -u coverage-direct/normal/out.txt coverage-direct/direct/out.txt +// RUN: diff -u coverage-direct/normal/out.txt coverage-direct/direct/out.txt // XFAIL: android |