[PATCH] D63360: hwasan: Use bits [3..11) of the ring buffer entry address as the base stack tag.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 16:21:14 PDT 2019


pcc added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1007
+    // The base tag will be a multiple of 8, so we should avoid using tags with
+    // lower bits clear so that we don't end up with a final tag of 0.
+    ++TagOffset;
----------------
eugenis wrote:
> We are losing a lot of entropy by allowing these zero bits in the base tag. Single-alloca functions, for example, will only have 32 different tags.
> 
> How about using bits 3 .. 11 ?
Done. Now tag 0 is as likely as any other tag.

To fix the tests that were assuming that they would never get tag 0, I've added a call to a helper function that bumps the base tag to 128 to the tests that would otherwise fail.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63360





More information about the llvm-commits mailing list