aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2021-05-23 20:41:57 -0700
committerShoaib Meenai <smeenai@fb.com>2021-05-26 09:31:39 -0700
commitadf1561d6ce8af057127c65af863b3f0e1c77e60 (patch)
treeaf372a2ac108f13144431e5bc1f0a360cd4c72e0 /llvm/lib/Transforms/Utils/Local.cpp
parentd28bc54ff44aad7b080177ef85764d7c5444f031 (diff)
downloadllvm-adf1561d6ce8af057127c65af863b3f0e1c77e60.zip
llvm-adf1561d6ce8af057127c65af863b3f0e1c77e60.tar.gz
llvm-adf1561d6ce8af057127c65af863b3f0e1c77e60.tar.bz2
[libunwind] Inform ASan that resumption is noreturn
If you're building libunwind instrumented with ASan, `_Unwind_RaiseException` will poison the stack and then transfer control in a manner which isn't understood by ASan, so the stack will remain poisoned. This can cause false positives, e.g. if you call an uninstrumented function (so it doesn't re-poison the stack) after catching an exception. Add a call to `__asan_handle_no_return` inside `__unw_resume` to get ASan to unpoison the stack and avoid this. `__unw_resume` seems like the appropriate place to make this call, since it's used for resumption by all unwind implementations except SJLJ. SJLJ uses `__builtin_longjmp` to handle resumption, which is already recognized as noreturn (and therefore ASan adds the `__asan_handle_no_return` call itself), so it doesn't need any special handling. PR32434 is somewhat similar (in particular needing a component built without ASan to trigger the bug), and rG781ef03e1012, the fix for that bug, adds an interceptor for `_Unwind_RaiseException`. This interceptor won't always be triggered though, e.g. if you statically link the unwinder into libc++abi in a way that prevents interposing the unwinder functions (e.g. marking the symbols as hidden, using `--exclude-libs`, or using `-Bsymbolic`). rG53335d6d86d5 makes `__cxa_throw` call `__asan_handle_no_return` explicitly, to similarly avoid relying on interception. Reviewed By: #libunwind, compnerd Differential Revision: https://reviews.llvm.org/D103002
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
0 files changed, 0 insertions, 0 deletions