On Fri, Sep 9, 2016 at 1:01 AM, Markus Zimmermann <zimm...@gmail.com> wrote:
>
> I am trying to integrate -msan for testing into
> https://github.com/go-clang/bootstrap using Go 1.7.1 and LLVM 3.9.0 inside
> an Ubuntu Trusty 64bit VM. The Kernel is 3.13.0.
>
> I am executing a test using the following command:
>
>> CC=clang CGO_LDFLAGS="-L`llvm-config --libdir` -fsanitize=memory"
>> CGO_CPPFLAGS='-fsanitize=memory -fsanitize-memory-track-origins
>> -fno-omit-frame-pointer' go test -timeout 60s -v -msan
>> -test.run=TestBasicParsing
>
>
> And the address sanitizer detects a problem for this test giving me the
> following output:
>
>> Uninitialized bytes in __interceptor_memchr at offset 6 inside
>> [0x70800000bf58, 7)
>> ==32156==WARNING: MemorySanitizer: use-of-uninitialized-value
>>     #0 0x7fdbcc7e3c85
>> (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x653c85)
>>     #1 0x7fdbcc7f40a7
>> (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x6640a7)
>>     #2 0x7fdbd0723bbe
>> (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0xc05bbe)
>>     #3 0x7fdbd07334ca
>> (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0xc154ca)
>>     #4 0x7fdbcffaef39
>> (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0x490f39)
>>     #5 0x7fdbcff8c504
>> (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0x46e504)
>>     #6 0x7fdbcfd8178e
>> (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0x26378e)
>>     #7 0x7fdbcc7be314
>> (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x62e314)
>>     #8 0x7fdbcc7be393
>> (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x62e393)
>>     #9 0x7fdbcc8214bc
>> (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x6914bc)
>>     #10 0x7fdbcf908183  (/lib/x86_64-linux-gnu/libpthread.so.0+0x8183)
>>     #11 0x7fdbced0d37c  (/lib/x86_64-linux-gnu/libc.so.6+0xfa37c)
>>
>>   Uninitialized value was stored to memory at
>>     #0 0x42d0d5
>> (/tmp/go-build816629300/github.com/go-clang/bootstrap/clang/_test/clang.test+0x42d0d5)
>>     #1 0x7fdbcbf479bd  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xbb9bd)
>>
>>   Uninitialized value was stored to memory at
>>     #0 0x42d0d5
>> (/tmp/go-build816629300/github.com/go-clang/bootstrap/clang/_test/clang.test+0x42d0d5)
>>     #1 0x7fdbcbf46e2f  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xbae2f)
>>
>>   Uninitialized value was created by a heap allocation
>>     #0 0x42b6d9
>> (/tmp/go-build816629300/github.com/go-clang/bootstrap/clang/_test/clang.test+0x42b6d9)
>>     #1 0x7fdbcbeeadac  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x5edac)
>>
>> SUMMARY: MemorySanitizer: use-of-uninitialized-value
>> (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x653c85)
>
>
>
> I have the following questions concerning the usage of the -msan flag:
> a.) Are these the preferred arguments to use the -msan flag?

Looks OK to me.

> b.) Why are there no line numbers in the traces?

I don't know.  Try adding -g to CGO_CPPFLAGS to see if it makes a difference.

> c.) Any advice on how I can debug such problems?

If -g doesn't help then I think you'll have to use objdump or gdb or
lldb to look at the code at the failing address.  Those tools should
at least let you map that address back to a source line.  Note that
the problem does not seem to be in Go code, which of course is
unsurprising.

> d.) What are the official minimum requirements for the -msan flag? (LLVM >=
> 3.8? ...?)

Yes, on GNU/Linux you need at least LLVM 3.8.  I don't know of any
other requirements.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to