[PATCH] D150742: [HWASan] Ignore shortgranules for global tag selection
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 16 17:54:31 PDT 2023
vitalybuka added a comment.
Can you update some test?
Maybe it will trigger some test without ClUseShortGranules
================
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;
----------------
================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1590
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
----------------
Tag &= TagMaskByte;
is effectively
Tag = Tag % (TagMaskByte + 1);
so to map them above 15:
Tag = 16 + Tag % (TagMaskByte + 1 - 16);
================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1595
+ Tag = 16;
+ } else if (Tag == 0) {
+ // Skip tag 0 in order to avoid collisions with untagged memory.
----------------
let's remove conditions and do that all the time
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