[hwasan] work around lifetime issue with setjmp.
authorFlorian Mayer <fmayer@google.com>
Mon, 31 Jan 2022 21:10:41 +0000 (13:10 -0800)
committerFlorian Mayer <fmayer@google.com>
Tue, 1 Feb 2022 20:14:20 +0000 (12:14 -0800)
commitaefb2e134dd715c2c48a7b826d2d56db51ce63ac
tree0210ecd87d7fbbd0322d3c258a11c4a88f68bc04
parentaab4263ad66c99da15cb9bda6aec8269d159b113
[hwasan] work around lifetime issue with setjmp.

setjmp can return twice, but PostDominatorTree is unaware of this. as
such, it overestimates postdominance, leaving some cases (see attached
compiler-rt) where memory does not get untagged on return. this causes
false positives later in the program execution.

this is a crude workaround to unblock use-after-scope for now, in the
longer term PostDominatorTree should bemade aware of returns_twice
function, as this may cause problems elsewhere.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D118647
compiler-rt/test/hwasan/TestCases/use-after-scope-setjmp.cpp [new file with mode: 0644]
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope-setjmp.ll [new file with mode: 0644]