[NFC] [HWASan] document why we tag Size but untag AlignedSize.

This commit is contained in:
Florian Mayer 2022-03-09 16:16:24 -08:00
parent 0123d2a9fe
commit 0f770f4d00
1 changed files with 4 additions and 0 deletions

View File

@ -1350,6 +1350,10 @@ bool HWAddressSanitizer::instrumentStack(
auto TagEnd = [&](Instruction *Node) {
IRB.SetInsertPoint(Node);
Value *UARTag = getUARTag(IRB, StackTag);
// When untagging, use the `AlignedSize` because we need to set the tags
// for the entire alloca to zero. If we used `Size` here, we would
// keep the last granule tagged, and store zero in the last byte of the
// last granule, due to how short granules are implemented.
tagAlloca(IRB, AI, UARTag, AlignedSize);
};
// Calls to functions that may return twice (e.g. setjmp) confuse the