llvm-project/libunwind
Shoaib Meenai adf1561d6c [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
2021-05-26 09:31:39 -07:00
..
cmake [SystemZ][ZOS] Prefer -nostdlib++ as opposed to -nodefaultlibs when building c++ libraries 2021-02-16 18:42:14 +00:00
docs [NFC][libunbind] Fix Sphinx error during CMake invocation 2021-02-11 06:52:24 +05:30
include [libunwind] This adds support in libunwind for rv32 hard float 2021-03-02 06:58:24 +05:30
src [libunwind] Inform ASan that resumption is noreturn 2021-05-26 09:31:39 -07:00
test [libc++] Move handling of the target triple to the DSL 2021-05-08 11:10:53 -04:00
.clang-format
CMakeLists.txt [libcxx] Stop using use c++ subdirectory for libc++ library 2021-04-21 15:39:03 -07:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00