[compiler-rt] r269291 - [sanitizer] Fix a crash when demangling Swift symbols, take 2

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 10:18:52 PDT 2016


H.J., thanks for bisecting.
The bot sees it too.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/23989/steps/check-lsan%20in%20gcc%20build/logs/stdio

On Sun, May 15, 2016 at 9:10 AM, H.J. Lu via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> On Thu, May 12, 2016 at 6:11 AM, Kuba Brecka via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Author: kuba.brecka
> > Date: Thu May 12 08:11:03 2016
> > New Revision: 269291
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=269291&view=rev
> > Log:
> > [sanitizer] Fix a crash when demangling Swift symbols, take 2
> >
> > To invoke the Swift demangler, we use dlsym to locate swift_demangle.
> However, dlsym malloc's storage and stores it in thread-local storage.
> Since allocations from the symbolizer are done with the system allocator
> (at least in TSan, interceptors are skipped when inside the symbolizer), we
> will crash when we try to deallocate later using the sanitizer allocator
> again.
> >
> > To fix this, let's just not call dlsym from the demangler, and call it
> during initialization. The dlsym function calls malloc, so it needs to be
> only used after our allocator is initialized. Adding a
> Symbolizer::LateInitialize call that is only invoked after all other
> initializations.
> >
> > Differential Revision: http://reviews.llvm.org/D20015
> >
> >
> > Modified:
> >     compiler-rt/trunk/lib/asan/asan_rtl.cc
> >     compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h
> >
>  compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
> >     compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc
> >     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
> >
>
> This caused:
>
> https://llvm.org/bugs/show_bug.cgi?id=27745
>
> --
> H.J.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160516/9ca558f7/attachment.html>


More information about the llvm-commits mailing list