diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-04-18 12:15:24 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-04-18 12:15:24 +0000 |
commit | 06179ade2128832f1908f7dcd9db04e870799809 (patch) | |
tree | fa11e9618fb19d9b58c6749bf13a56c9c35f2e24 /lib/msan/msan.cc | |
parent | 9451ab7ed4a06b27c954860f281c5e351c72293f (diff) |
[msan] Add new MSan callbacks for instrumentation-with-calls mode.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan.cc')
-rw-r--r-- | lib/msan/msan.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc index f5d6bf457..db92a5f3c 100644 --- a/lib/msan/msan.cc +++ b/lib/msan/msan.cc @@ -249,6 +249,34 @@ u32 ChainOrigin(u32 id, StackTrace *stack) { using namespace __msan; +#define MSAN_MAYBE_WARNING(type, size) \ + void __msan_maybe_warning_##size(type s, u32 o) { \ + GET_CALLER_PC_BP_SP; \ + (void) sp; \ + if (UNLIKELY(s)) { \ + PrintWarningWithOrigin(pc, bp, o); \ + if (__msan::flags()->halt_on_error) { \ + Printf("Exiting\n"); \ + Die(); \ + } \ + } \ + } + +MSAN_MAYBE_WARNING(u8, 1) +MSAN_MAYBE_WARNING(u16, 2) +MSAN_MAYBE_WARNING(u32, 4) +MSAN_MAYBE_WARNING(u64, 8) + +#define MSAN_MAYBE_STORE_ORIGIN(type, size) \ + void __msan_maybe_store_origin_##size(type s, void *p, u32 o) { \ + if (UNLIKELY(s)) *(u32 *)MEM_TO_ORIGIN((uptr)p &~3UL) = o; \ + } + +MSAN_MAYBE_STORE_ORIGIN(u8, 1) +MSAN_MAYBE_STORE_ORIGIN(u16, 2) +MSAN_MAYBE_STORE_ORIGIN(u32, 4) +MSAN_MAYBE_STORE_ORIGIN(u64, 8) + void __msan_warning() { GET_CALLER_PC_BP_SP; (void)sp; |