[ASAN] Make sure we are only processing lifetime markers with offset 0 to alloca
authorXun Li <xun@fb.com>
Tue, 13 Oct 2020 17:21:45 +0000 (10:21 -0700)
committerXun Li <xun@fb.com>
Tue, 13 Oct 2020 17:21:45 +0000 (10:21 -0700)
commit0ccf9263cceb462a5f3b823becf7e9471e5fb212
tree73c1ff18b71280ed5fe62c0ceeaf836f4cf8d4a4
parent6713332fddb796f5b14fcb6a7e5d36979676e4ab
[ASAN] Make sure we are only processing lifetime markers with offset 0 to alloca

This patch addresses https://bugs.llvm.org/show_bug.cgi?id=47787 (and hence https://bugs.llvm.org/show_bug.cgi?id=47767 as well).
In latter instrumentation code, we always use the beginning of the alloca as the base for instrumentation, ignoring any offset into the alloca.
Because of that, we should only instrument a lifetime marker if it's actually pointing to the beginning of the alloca.

Differential Revision: https://reviews.llvm.org/D89191
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/test/Instrumentation/AddressSanitizer/alloca-offset-lifetime.ll [new file with mode: 0644]