[PATCH] D150742: [HWASan] Ignore shortgranules for global tag selection

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 17:05:04 PDT 2023


hctim marked 3 inline comments as done.
hctim added a comment.

In D150742#4348379 <https://reviews.llvm.org/D150742#4348379>, @vitalybuka wrote:

> Can you update some test?

Added a new test.



================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1588-1600
   for (GlobalVariable *GV : Globals) {
     Tag &= TagMaskByte;
-    // Skip tag 0 in order to avoid collisions with untagged memory.
-    if (Tag == 0)
+    if (ClUseShortGranules && Tag < 16) {
+      // Don't allow globals to be tagged with something that looks like a
+      // short-granule tag, otherwise we lose inter-granule overflow detection,
+      // as the fast path shadow-vs-address check succeeds.
+      Tag = 16;
----------------
vitalybuka wrote:
> 
I think I've got a simpler approach:

```
    if (Tag < 16 || Tag > TagMaskByte)
      Tag = 16;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150742/new/

https://reviews.llvm.org/D150742



More information about the llvm-commits mailing list