summaryrefslogtreecommitdiff
path: root/lib/msan/msan.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/msan/msan.cc')
-rw-r--r--lib/msan/msan.cc20
1 files changed, 2 insertions, 18 deletions
diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc
index 8b70027bf..3ba653ba4 100644
--- a/lib/msan/msan.cc
+++ b/lib/msan/msan.cc
@@ -16,6 +16,7 @@
#include "msan_chained_origin_depot.h"
#include "msan_origin.h"
#include "msan_thread.h"
+#include "msan_poisoning.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flags.h"
@@ -494,24 +495,7 @@ void __msan_load_unpoisoned(void *src, uptr size, void *dst) {
}
void __msan_set_origin(const void *a, uptr size, u32 origin) {
- // Origin mapping is 4 bytes per 4 bytes of application memory.
- // Here we extend the range such that its left and right bounds are both
- // 4 byte aligned.
- if (!__msan_get_track_origins()) return;
- uptr x = MEM_TO_ORIGIN((uptr)a);
- uptr beg = x & ~3UL; // align down.
- uptr end = (x + size + 3) & ~3UL; // align up.
- u64 origin64 = ((u64)origin << 32) | origin;
- // This is like memset, but the value is 32-bit. We unroll by 2 to write
- // 64 bits at once. May want to unroll further to get 128-bit stores.
- if (beg & 7ULL) {
- *(u32*)beg = origin;
- beg += 4;
- }
- for (uptr addr = beg; addr < (end & ~7UL); addr += 8)
- *(u64*)addr = origin64;
- if (end & 7ULL)
- *(u32*)(end - 4) = origin;
+ if (__msan_get_track_origins()) SetOrigin(a, size, origin);
}
// 'descr' is created at compile time and contains '----' in the beginning.