diff options
| author | Petr Hosek <phosek@chromium.org> | 2017-08-28 00:45:12 +0000 |
|---|---|---|
| committer | Petr Hosek <phosek@chromium.org> | 2017-08-28 00:45:12 +0000 |
| commit | 00b760ed48234e8884dc05eff321df203060b6da (patch) | |
| tree | 6cfc7240e80227cacf05dc977993ff7be598875b | |
| parent | 8b633447dae1c4f3eca785c71eaffcc071e0c608 (diff) | |
| download | bcm5719-llvm-00b760ed48234e8884dc05eff321df203060b6da.tar.gz bcm5719-llvm-00b760ed48234e8884dc05eff321df203060b6da.zip | |
[asan] Move __asan_handle_no_return to public header
Heretofore asan_handle_no_return was used only by interceptors,
i.e. code private to the ASan runtime. However, on systems without
interceptors, code like libc++abi is built with -fsanitize=address
itself and should call asan_handle_no_return directly from
__cxa_throw so that no interceptor is required.
Patch by Roland McGrath
Differential Revision: https://reviews.llvm.org/D36811
llvm-svn: 311869
| -rw-r--r-- | compiler-rt/include/sanitizer/asan_interface.h | 4 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/tests/asan_interface_test.cc | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/compiler-rt/include/sanitizer/asan_interface.h b/compiler-rt/include/sanitizer/asan_interface.h index 97ba0ceb0b2..e689a730e2c 100644 --- a/compiler-rt/include/sanitizer/asan_interface.h +++ b/compiler-rt/include/sanitizer/asan_interface.h @@ -144,6 +144,10 @@ extern "C" { void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg, void **end); + // Performs cleanup before a [[noreturn]] function. Must be called + // before things like _exit and execl to avoid false positives on stack. + void __asan_handle_no_return(void); + #ifdef __cplusplus } // extern "C" #endif diff --git a/compiler-rt/lib/asan/tests/asan_interface_test.cc b/compiler-rt/lib/asan/tests/asan_interface_test.cc index 7d3e520d81a..03351e02b2f 100644 --- a/compiler-rt/lib/asan/tests/asan_interface_test.cc +++ b/compiler-rt/lib/asan/tests/asan_interface_test.cc @@ -423,3 +423,11 @@ TEST(AddressSanitizerInterface, GetOwnershipStressTest) { free(pointers[i]); } +TEST(AddressSanitizerInterface, HandleNoReturnTest) { + char array[40]; + __asan_poison_memory_region(array, sizeof(array)); + BAD_ACCESS(array, 20); + __asan_handle_no_return(); + // It unpoisons the whole thread stack. + GOOD_ACCESS(array, 20); +} |

