[llvm-branch-commits] [compiler-rt] [test][hwasan] Implement sanitizer_specific for HWASAN (PR #75280)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 12 19:49:24 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/75280.diff
1 Files Affected:
- (modified) compiler-rt/test/sanitizer_common/sanitizer_specific.h (+13)
``````````diff
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 898899f00e370..541af18a74979 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -31,6 +31,19 @@ static void make_mem_good(void *p, size_t s) {
static void make_mem_bad(void *p, size_t s) {
__asan_poison_memory_region(p, s);
}
+#elif __has_feature(hwaddress_sanitizer)
+# include <sanitizer/hwasan_interface.h>
+# include <stdlib.h>
+static void check_mem_is_good(void *p, size_t s) {
+ if (__hwasan_test_shadow(p, s) != -1)
+ abort();
+}
+static void make_mem_good(void *p, size_t s) {
+ __hwasan_tag_memory(p, __hwasan_get_tag_from_pointer(p), s);
+}
+static void make_mem_bad(void *p, size_t s) {
+ __hwasan_tag_memory(p, ~__hwasan_get_tag_from_pointer(p), s);
+}
#else
static void check_mem_is_good(void *p, size_t s) {}
static void make_mem_good(void *p, size_t s) {}
``````````
</details>
https://github.com/llvm/llvm-project/pull/75280
More information about the llvm-branch-commits
mailing list