[compiler-rt] 56b5f00 - [sancov][sanitizer-common] Correct sanitizer coverage point
Ben Shi via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 24 01:17:17 PST 2022
Author: Xiaodong Liu
Date: 2022-02-24T17:16:45+08:00
New Revision: 56b5f001869664a1449e5e0fec677089153bf8c8
URL: https://github.com/llvm/llvm-project/commit/56b5f001869664a1449e5e0fec677089153bf8c8
DIFF: https://github.com/llvm/llvm-project/commit/56b5f001869664a1449e5e0fec677089153bf8c8.diff
LOG: [sancov][sanitizer-common] Correct sanitizer coverage point
Sanitizer coverage point should be the previous instruction PC of the
caller and the offset to the previous instruction might be different
on each CPU architecture.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D119233
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
index 6cf7cfb5722e3..3dcb39f32f6c2 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
@@ -14,6 +14,7 @@
# include "sanitizer_allocator_internal.h"
# include "sanitizer_atomic.h"
# include "sanitizer_common.h"
+# include "sanitizer_common/sanitizer_stacktrace.h"
# include "sanitizer_file.h"
# include "sanitizer_interface_internal.h"
@@ -222,7 +223,8 @@ SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_dump_coverage(const uptr* pcs,
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_pc_guard, u32* guard) {
if (!*guard) return;
- __sancov::pc_guard_controller.TracePcGuard(guard, GET_CALLER_PC() - 1);
+ __sancov::pc_guard_controller.TracePcGuard(
+ guard, StackTrace::GetPreviousInstructionPc(GET_CALLER_PC()));
}
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_pc_guard_init,
More information about the llvm-commits
mailing list