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

Mike Aizatsky via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 11:31:29 PDT 2016


I'll roll back the CL since we haven't heard from Kuba for a day.

On Mon, May 16, 2016 at 10:18 AM Kostya Serebryany <kcc at google.com> wrote:

> 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
>>
>
> --
Mike
Sent from phone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160517/a4101cb1/attachment.html>


More information about the llvm-commits mailing list