================ @@ -31,6 +31,30 @@ 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) { + uint8_t tag = ~__hwasan_get_tag_from_pointer(p); + if (!tag) { + // Nothing wrong with tag zero, but non-zero tags help to detect never + // tagged memory. + tag = 1; + } + __hwasan_tag_memory(p, , s); + // With missaligned `p` or short granules we can't guaranlee tag mismatch. ---------------- thurstond wrote:
Nits: "misaligned", "guaranlee" https://github.com/llvm/llvm-project/pull/75280 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits