[PATCH] D119233: [sancov][sanitizer-common] Correct sanitizer coverage point
Xiaodong Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 22 20:00:22 PST 2022
XiaodongLoong updated this revision to Diff 410699.
XiaodongLoong added a comment.
rebase code
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119233/new/
https://reviews.llvm.org/D119233
Files:
compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
llvm/tools/sancov/sancov.cpp
Index: llvm/tools/sancov/sancov.cpp
===================================================================
--- llvm/tools/sancov/sancov.cpp
+++ llvm/tools/sancov/sancov.cpp
@@ -694,7 +694,7 @@
Triple TheTriple) {
if (TheTriple.isARM())
return (PC - 3) & (~1);
- if (TheTriple.isMIPS())
+ if (TheTriple.isMIPS() || TheTriple.isSparc())
return PC - 8;
if (TheTriple.isRISCV())
return PC - 2;
Index: compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
+++ 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_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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119233.410699.patch
Type: text/x-patch
Size: 1398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220223/ee3a8bce/attachment.bin>
More information about the llvm-commits
mailing list