[PATCH] D150306: [HWASan] add assert about TagMaskByte

Florian Mayer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 14:10:14 PDT 2023


fmayer created this revision.
Herald added subscribers: Enna1, hiraditya.
Herald added a project: All.
fmayer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150306

Files:
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp


Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1585,6 +1585,9 @@
   Hasher.final(Hash);
   uint8_t Tag = Hash[0];
 
+  // TagMaskByte must be one less than a power of two for the logic below to
+  // work reliably.
+  assert((TagMaskByte & (TagMaskByte + 1)) == 0);
   for (GlobalVariable *GV : Globals) {
     Tag &= TagMaskByte;
     // Skip tag 0 in order to avoid collisions with untagged memory.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150306.521101.patch
Type: text/x-patch
Size: 618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230510/db3775af/attachment.bin>


More information about the llvm-commits mailing list