Skip to content

Commit

Permalink
[sancov][sanitizer-common] Correct sanitizer coverage point
Browse files Browse the repository at this point in the history
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
  • Loading branch information
XiaodongLoong authored and benshi001 committed Feb 24, 2022
1 parent 46f6c83 commit 56b5f00
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -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"

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 56b5f00

Please sign in to comment.