[libcxxabi] r313215 - Reland "When built with ASan, __cxa_throw calls __asan_handle_no_return"

Kostya Serebryany via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 10:42:58 PDT 2017


The bot is unhappy:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/7880/steps/build%20libcxx%2Fasan/logs/stdio

1/6] Building CXX object
projects/libcxxabi/src/CMakeFiles/cxxabi_objects.dir/cxa_exception.cpp.o
FAILED: projects/libcxxabi/src/CMakeFiles/cxxabi_objects.dir/cxa_exception.cpp.o
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build0/bin/clang++
  -DHAVE___CXA_THREAD_ATEXIT_IMPL -D_DEBUG -D_GNU_SOURCE
-D_LIBCPP_DISABLE_EXTERN_TEMPLATE -D_LIBCXXABI_BUILDING_LIBRARY
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Iprojects/libcxxabi/src
-I/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/projects/libcxxabi/src
-I/usr/include/libxml2 -Iinclude
-I/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include
-I/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/projects/libcxxabi/include
-I/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/projects/libcxx/include
-fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall
-W -Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor
-Wstring-conversion -fno-omit-frame-pointer -gline-tables-only
-fsanitize=address -fsanitize-address-use-after-scope
-fcolor-diagnostics -ffunction-sections -fdata-sections  -O3  -fPIC
-UNDEBUG -nostdinc++ -Werror=return-type -W -Wall -Wchar-subscripts
-Wconversion -Wmismatched-tags -Wmissing-braces -Wnewline-eof
-Wunused-function -Wshadow -Wshorten-64-to-32 -Wsign-compare
-Wsign-conversion -Wstrict-aliasing=2 -Wstrict-overflow=4
-Wunused-parameter -Wunused-variable -Wwrite-strings -Wundef
-Wno-error -pedantic -fstrict-aliasing -funwind-tables -D_DEBUG
-UNDEBUG -std=c++11 -MD -MT
projects/libcxxabi/src/CMakeFiles/cxxabi_objects.dir/cxa_exception.cpp.o
-MF projects/libcxxabi/src/CMakeFiles/cxxabi_objects.dir/cxa_exception.cpp.o.d
-o projects/libcxxabi/src/CMakeFiles/cxxabi_objects.dir/cxa_exception.cpp.o
-c /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/projects/libcxxabi/src/cxa_exception.cpp
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/projects/libcxxabi/src/cxa_exception.cpp:227:5:
error: use of undeclared identifier '__asan_handle_no_return'
    __asan_handle_no_return();
    ^


On Wed, Sep 13, 2017 at 4:35 PM, Petr Hosek via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: phosek
> Date: Wed Sep 13 16:35:07 2017
> New Revision: 313215
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313215&view=rev
> Log:
> Reland "When built with ASan, __cxa_throw calls __asan_handle_no_return"
>
> The ASan runtime on many systems intercepts cxa_throw just so it
> can call asan_handle_no_return first. Some newer systems such as
> Fuchsia don't use interceptors on standard library functions at all,
> but instead use sanitizer-instrumented versions of the standard
> libraries. When libc++abi is built with ASan, cxa_throw can just
> call asan_handle_no_return itself so no interceptor is required.
>
> Patch by Roland McGrath
>
> Differential Revision: https://reviews.llvm.org/D37229
>
> Modified:
>     libcxxabi/trunk/src/cxa_exception.cpp
>
> Modified: libcxxabi/trunk/src/cxa_exception.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/
> cxa_exception.cpp?rev=313215&r1=313214&r2=313215&view=diff
> ============================================================
> ==================
> --- libcxxabi/trunk/src/cxa_exception.cpp (original)
> +++ libcxxabi/trunk/src/cxa_exception.cpp Wed Sep 13 16:35:07 2017
> @@ -19,6 +19,10 @@
>  #include "cxa_handlers.hpp"
>  #include "fallback_malloc.h"
>
> +#if __has_feature(address_sanitizer)
> +#include <sanitizer/asan_interface.h>
> +#endif
> +
>  // +---------------------------+-----------------------------+-
> --------------+
>  // | __cxa_exception           | _Unwind_Exception CLNGC++\0 | thrown
> object |
>  // +---------------------------+-----------------------------+-
> --------------+
> @@ -217,6 +221,12 @@ __cxa_throw(void *thrown_object, std::ty
>      globals->uncaughtExceptions += 1;   // Not atomically, since globals
> are thread-local
>
>      exception_header->unwindHeader.exception_cleanup =
> exception_cleanup_func;
> +
> +#if __has_feature(address_sanitizer)
> +    // Inform the ASan runtime that now might be a good time to clean
> stuff up.
> +    __asan_handle_no_return();
> +#endif
> +
>  #ifdef __USING_SJLJ_EXCEPTIONS__
>      _Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
>  #else
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170914/71855cbe/attachment.html>


More information about the cfe-commits mailing list