<div dir="ltr">Thanks! <div>Hopefully fixed by r192990.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 18, 2013 at 8:39 PM, Alexander Potapenko <span dir="ltr"><<a href="mailto:glider@google.com" target="_blank">glider@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">GCD tests are failing when trying to print the thread creation stack.<br>
Perhaps you're dereferencing NULL somewhere (not sure we're keeping<br>
the creation stack for GCD workers):<br>
<br>
[ OK ] AddressSanitizerMac.CFAllocatorMallocDoubleFree (746 ms)<br>
[ RUN ] AddressSanitizerMac.GCDDispatchAsync<br>
/Users/buildbot/src/llvm-buildbot/slave/mac10.8-cmake/build/llvm/projects/compiler-rt/lib/asan/tests/asan_mac_test.cc:92:<br>
Failure<br>
Death test: TestGCDDispatchAsync()<br>
Result: died but not with expected error.<br>
Expected: Shadow byte legend<br>
Actual msg:<br>
[ DEATH ] =================================================================<br>
[ DEATH ] ==44993==ERROR: AddressSanitizer: heap-buffer-overflow on<br>
address 0x61900002fc80 at pc 0x10eacfd2f bp 0x112528560 sp 0x112528558<br>
[ DEATH ] WRITE of size 1 at 0x61900002fc80 thread T1<br>
[ DEATH ] #0 0x10eacfd2e<br>
(/Users/buildbot/src/llvm-buildbot/slave/mac10.8-cmake/build/./llvm_build64/projects/compiler-rt/lib/asan/tests/Asan-x86_64-Test+0x100204d2e)<br>
[ DEATH ] #1 0x10ead0507<br>
(/Users/buildbot/src/llvm-buildbot/slave/mac10.8-cmake/build/./llvm_build64/projects/compiler-rt/lib/asan/tests/Asan-x86_64-Test+0x100205507)<br>
[ DEATH ] #2 0x10ecbfad3<br>
(/Users/buildbot/src/llvm-buildbot/slave/mac10.8-cmake/build/llvm_build64/lib/clang/3.4/lib/darwin/libclang_rt.asan_osx_dynamic.dylib+0x1aad3)<br>
[ DEATH ] #3 0x7fff8f0f0f00 (/usr/lib/system/libdispatch.dylib+0x5f00)<br>
[ DEATH ] #4 0x7fff8f0ed0b5 (/usr/lib/system/libdispatch.dylib+0x20b5)<br>
[ DEATH ] #5 0x7fff8f0ee1f9 (/usr/lib/system/libdispatch.dylib+0x31f9)<br>
[ DEATH ] #6 0x7fff94a3bcda (/usr/lib/system/libsystem_c.dylib+0x16cda)<br>
[ DEATH ] #7 0x7fff94a26190 (/usr/lib/system/libsystem_c.dylib+0x1190)<br>
[ DEATH ] 0x61900002fc80 is located 0 bytes to the right of<br>
1024-byte region [0x61900002f880,0x61900002fc80)<br>
[ DEATH ] allocated by thread T1 here:<br>
[ DEATH ] #0 0x10ecc04c5<br>
(/Users/buildbot/src/llvm-buildbot/slave/mac10.8-cmake/build/llvm_build64/lib/clang/3.4/lib/darwin/libclang_rt.asan_osx_dynamic.dylib+0x1b4c5)<br>
[ DEATH ] #1 0x10ead04d8<br>
(/Users/buildbot/src/llvm-buildbot/slave/mac10.8-cmake/build/./llvm_build64/projects/compiler-rt/lib/asan/tests/Asan-x86_64-Test+0x1002054d8)<br>
[ DEATH ] #2 0x10ecbfad3<br>
(/Users/buildbot/src/llvm-buildbot/slave/mac10.8-cmake/build/llvm_build64/lib/clang/3.4/lib/darwin/libclang_rt.asan_osx_dynamic.dylib+0x1aad3)<br>
[ DEATH ] #3 0x7fff8f0f0f00 (/usr/lib/system/libdispatch.dylib+0x5f00)<br>
[ DEATH ] #4 0x7fff8f0ed0b5 (/usr/lib/system/libdispatch.dylib+0x20b5)<br>
[ DEATH ] #5 0x7fff8f0ee1f9 (/usr/lib/system/libdispatch.dylib+0x31f9)<br>
[ DEATH ] #6 0x7fff94a3bcda (/usr/lib/system/libsystem_c.dylib+0x16cda)<br>
[ DEATH ] #7 0x7fff94a26190 (/usr/lib/system/libsystem_c.dylib+0x1190)<br>
[ DEATH ] Thread T1 created by T0 here:<br>
[ DEATH ] ASAN:SIGSEGV<br>
[ DEATH ] ==44993==AddressSanitizer: while reporting a bug found<br>
another one.Ignoring.<br>
[ DEATH ]<br>
[ FAILED ] AddressSanitizerMac.GCDDispatchAsync (743 ms)<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Oct 18, 2013 at 8:37 PM, Alexander Potapenko <<a href="mailto:glider@google.com">glider@google.com</a>> wrote:<br>
> Either 192979 or 192980 broke the Mac build.<br>
><br>
> On Fri, Oct 18, 2013 at 6:50 PM, Kostya Serebryany <<a href="mailto:kcc@google.com">kcc@google.com</a>> wrote:<br>
>> Author: kcc<br>
>> Date: Fri Oct 18 09:50:44 2013<br>
>> New Revision: 192979<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=192979&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=192979&view=rev</a><br>
>> Log:<br>
>> [asan] reduce the size of AsanThreadContext by storing the stack trace in the stack depot<br>
>><br>
>> Modified:<br>
>> compiler-rt/trunk/lib/asan/asan_report.cc<br>
>> compiler-rt/trunk/lib/asan/asan_stack.cc<br>
>> compiler-rt/trunk/lib/asan/asan_stack.h<br>
>> compiler-rt/trunk/lib/asan/asan_thread.cc<br>
>> compiler-rt/trunk/lib/asan/asan_thread.h<br>
>><br>
>> Modified: compiler-rt/trunk/lib/asan/asan_report.cc<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=192979&r1=192978&r2=192979&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=192979&r1=192978&r2=192979&view=diff</a><br>
>> ==============================================================================<br>
>> --- compiler-rt/trunk/lib/asan/asan_report.cc (original)<br>
>> +++ compiler-rt/trunk/lib/asan/asan_report.cc Fri Oct 18 09:50:44 2013<br>
>> @@ -20,6 +20,7 @@<br>
>> #include "sanitizer_common/sanitizer_common.h"<br>
>> #include "sanitizer_common/sanitizer_flags.h"<br>
>> #include "sanitizer_common/sanitizer_report_decorator.h"<br>
>> +#include "sanitizer_common/sanitizer_stackdepot.h"<br>
>> #include "sanitizer_common/sanitizer_symbolizer.h"<br>
>><br>
>> namespace __asan {<br>
>> @@ -485,7 +486,9 @@ void DescribeThread(AsanThreadContext *c<br>
>> context->parent_tid,<br>
>> ThreadNameWithParenthesis(context->parent_tid,<br>
>> tname, sizeof(tname)));<br>
>> - PrintStack(&context->stack);<br>
>> + uptr stack_size;<br>
>> + const uptr *stack_trace = StackDepotGet(context->stack_id, &stack_size);<br>
>> + PrintStack(stack_trace, stack_size);<br>
>> // Recursively described parent thread if needed.<br>
>> if (flags()->print_full_thread_history) {<br>
>> AsanThreadContext *parent_context =<br>
>><br>
>> Modified: compiler-rt/trunk/lib/asan/asan_stack.cc<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.cc?rev=192979&r1=192978&r2=192979&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.cc?rev=192979&r1=192978&r2=192979&view=diff</a><br>
>> ==============================================================================<br>
>> --- compiler-rt/trunk/lib/asan/asan_stack.cc (original)<br>
>> +++ compiler-rt/trunk/lib/asan/asan_stack.cc Fri Oct 18 09:50:44 2013<br>
>> @@ -24,10 +24,13 @@ static bool MaybeCallAsanSymbolize(const<br>
>> : false;<br>
>> }<br>
>><br>
>> -void PrintStack(StackTrace *stack) {<br>
>> - StackTrace::PrintStack(stack->trace, stack->size, common_flags()->symbolize,<br>
>> +void PrintStack(const uptr *trace, uptr size) {<br>
>> + StackTrace::PrintStack(trace, size, common_flags()->symbolize,<br>
>> MaybeCallAsanSymbolize);<br>
>> }<br>
>> +void PrintStack(StackTrace *stack) {<br>
>> + PrintStack(stack->trace, stack->size);<br>
>> +}<br>
>><br>
>> } // namespace __asan<br>
>><br>
>><br>
>> Modified: compiler-rt/trunk/lib/asan/asan_stack.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.h?rev=192979&r1=192978&r2=192979&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.h?rev=192979&r1=192978&r2=192979&view=diff</a><br>
>> ==============================================================================<br>
>> --- compiler-rt/trunk/lib/asan/asan_stack.h (original)<br>
>> +++ compiler-rt/trunk/lib/asan/asan_stack.h Fri Oct 18 09:50:44 2013<br>
>> @@ -22,6 +22,7 @@<br>
>> namespace __asan {<br>
>><br>
>> void PrintStack(StackTrace *stack);<br>
>> +void PrintStack(const uptr *trace, uptr size);<br>
>><br>
>> } // namespace __asan<br>
>><br>
>><br>
>> Modified: compiler-rt/trunk/lib/asan/asan_thread.cc<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.cc?rev=192979&r1=192978&r2=192979&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.cc?rev=192979&r1=192978&r2=192979&view=diff</a><br>
>> ==============================================================================<br>
>> --- compiler-rt/trunk/lib/asan/asan_thread.cc (original)<br>
>> +++ compiler-rt/trunk/lib/asan/asan_thread.cc Fri Oct 18 09:50:44 2013<br>
>> @@ -19,6 +19,7 @@<br>
>> #include "asan_mapping.h"<br>
>> #include "sanitizer_common/sanitizer_common.h"<br>
>> #include "sanitizer_common/sanitizer_placement_new.h"<br>
>> +#include "sanitizer_common/sanitizer_stackdepot.h"<br>
>> #include "lsan/lsan_common.h"<br>
>><br>
>> namespace __asan {<br>
>> @@ -27,9 +28,8 @@ namespace __asan {<br>
>><br>
>> void AsanThreadContext::OnCreated(void *arg) {<br>
>> CreateThreadContextArgs *args = static_cast<CreateThreadContextArgs*>(arg);<br>
>> - if (args->stack) {<br>
>> - internal_memcpy(&stack, args->stack, sizeof(stack));<br>
>> - }<br>
>> + if (args->stack)<br>
>> + stack_id = StackDepotPut(args->stack->trace, args->stack->size);<br>
>> thread = args->thread;<br>
>> thread->set_context(this);<br>
>> }<br>
>><br>
>> Modified: compiler-rt/trunk/lib/asan/asan_thread.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.h?rev=192979&r1=192978&r2=192979&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.h?rev=192979&r1=192978&r2=192979&view=diff</a><br>
>> ==============================================================================<br>
>> --- compiler-rt/trunk/lib/asan/asan_thread.h (original)<br>
>> +++ compiler-rt/trunk/lib/asan/asan_thread.h Fri Oct 18 09:50:44 2013<br>
>> @@ -38,12 +38,12 @@ class AsanThreadContext : public ThreadC<br>
>> : ThreadContextBase(tid),<br>
>> announced(false),<br>
>> destructor_iterations(kPthreadDestructorIterations),<br>
>> + stack_id(0),<br>
>> thread(0) {<br>
>> - internal_memset(&stack, 0, sizeof(stack));<br>
>> }<br>
>> bool announced;<br>
>> - int destructor_iterations;<br>
>> - StackTrace stack;<br>
>> + u8 destructor_iterations;<br>
>> + u32 stack_id;<br>
>> AsanThread *thread;<br>
>><br>
>> void OnCreated(void *arg);<br>
>> @@ -51,7 +51,7 @@ class AsanThreadContext : public ThreadC<br>
>> };<br>
>><br>
>> // AsanThreadContext objects are never freed, so we need many of them.<br>
>> -COMPILER_CHECK(sizeof(AsanThreadContext) <= 4096);<br>
>> +COMPILER_CHECK(sizeof(AsanThreadContext) <= 256);<br>
>><br>
>> // AsanThread are stored in TSD and destroyed when the thread dies.<br>
>> class AsanThread {<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
><br>
> --<br>
> Alexander Potapenko<br>
> Software Engineer<br>
> Google Moscow<br>
<br>
<br>
<br>
--<br>
Alexander Potapenko<br>
Software Engineer<br>
Google Moscow<br>
</div></div></blockquote></div><br></div>