[compiler-rt] [hwasan] Fix DCHECK with COMPILER_RT_DEBUG=ON (PR #84612)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 23:57:49 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Alexander Richardson (arichardson)
<details>
<summary>Changes</summary>
It appears this assertion should actually be checking that the pointer
is aligned to `sz` bytes rather than the shadow alignment, since
otherwise the `(ptr & (kShadowAlignment - 1))` mask would always be 0.
---
Full diff: https://github.com/llvm/llvm-project/pull/84612.diff
1 Files Affected:
- (modified) compiler-rt/lib/hwasan/hwasan_checks.h (+1-1)
``````````diff
diff --git a/compiler-rt/lib/hwasan/hwasan_checks.h b/compiler-rt/lib/hwasan/hwasan_checks.h
index 0911af30dcb8fc..7067e7140e7bef 100644
--- a/compiler-rt/lib/hwasan/hwasan_checks.h
+++ b/compiler-rt/lib/hwasan/hwasan_checks.h
@@ -140,7 +140,7 @@ __attribute__((always_inline, nodebug)) static inline uptr ShortTagSize(
__attribute__((always_inline, nodebug)) static inline bool
PossiblyShortTagMatches(tag_t mem_tag, uptr ptr, uptr sz) {
- DCHECK(IsAligned(ptr, kShadowAlignment));
+ DCHECK(IsAligned(ptr, sz));
tag_t ptr_tag = GetTagFromPointer(ptr);
if (ptr_tag == mem_tag)
return true;
``````````
</details>
https://github.com/llvm/llvm-project/pull/84612
More information about the llvm-commits
mailing list