<div dir="ltr"><a class="gmail_plusreply cremed" id="plusReplyChip-0" href="mailto:eugenis@google.com" tabindex="-1">+Evgenii Stepanov</a><br><div>sgtm</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 31, 2018 at 6:49 AM Brian Cain <<a href="mailto:brian.cain@gmail.com">brian.cain@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Aside: would it be useful to execute a build of the libc++/libc++abi with msan normally during release, and change the driver to look for these msan-built C++ libs when "-fsanitize=memory"?  That would drastically cut down on the complexity of using msan.<br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 31, 2018 at 5:43 AM Dean Michael Berris via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Vitaly and Peter,<br>
<br>
I went with a modified version of the instructions from <a href="https://github.com/google/sanitizers/wiki/MemorySanitizerBootstrappingClang" rel="noreferrer" target="_blank">https://github.com/google/sanitizers/wiki/MemorySanitizerBootstrappingClang</a> — that’s a very helpful set of instructions!<br>
<br>
Cheers<br>
<br>
> On 31 Aug 2018, at 02:55, Vitaly Buka <<a href="mailto:vitalybuka@google.com" target="_blank">vitalybuka@google.com</a>> wrote:<br>
> <br>
> Another option is just to run corresponding script from <a href="https://llvm.org/svn/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/" rel="noreferrer" target="_blank">https://llvm.org/svn/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/</a> in empty directory.<br>
> <br>
> On Thu, Aug 30, 2018 at 5:00 AM Peter Smith via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Hello Dean,<br>
> <br>
> I've not done this myself for a while, I seem to remember it taking a<br>
> while to get right. When I did I found the page:<br>
> <a href="https://github.com/google/sanitizers/wiki/MemorySanitizerBootstrappingClang" rel="noreferrer" target="_blank">https://github.com/google/sanitizers/wiki/MemorySanitizerBootstrappingClang</a><br>
> useful. The other thing that might work is following the individual<br>
> cmake steps from<br>
> <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-msan" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-msan</a><br>
> . These aren't in the same structure as the monorepo but they may be<br>
> adaptable.<br>
> <br>
> My apologies if you've tried these already.<br>
> <br>
> Peter<br>
> <br>
> On 30 August 2018 at 12:42, Dean Michael Berris via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> > Hi llvm-dev,<br>
> ><br>
> > I'm trying to reproduce an msan failure in one of the bots, but I<br>
> > can't seem to get the right incantation of building LLVM with msan.<br>
> > Here's what I've been doing:<br>
> ><br>
> > 1) Build the toolchain in one build directory, including `compiler-rt`.<br>
> ><br>
> > 2) Build the toolchain again with the just built toolchain in step 1,<br>
> > but this time with `-DLLVM_USE_SANITIZER=MemoryWithOrigins`.<br>
> ><br>
> > I get some msan errors, but of this kind instead of the one I'm expecting:<br>
> ><br>
> > ====<br>
> > $ ./unittests/XRay/XRayTests<br>
> > ==236769==WARNING: MemorySanitizer: use-of-uninitialized-value<br>
> >     #0 0x70eef8<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x70eef8)<br>
> >     #1 0x70d2dc<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x70d2dc)<br>
> >     #2 0x721044<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x721044)<br>
> >     #3 0x6e2a37<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x6e2a37)<br>
> >     #4 0x3722aa<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x3722aa)<br>
> >     #5 0x372868<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x372868)<br>
> >     #6 0x775a4c<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x775a4c)<br>
> >     #7 0x7f85b6c7e23f  (/lib/x86_64-linux-gnu/libc.so.6+0x2023f)<br>
> >     #8 0x2f4029<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x2f4029)<br>
> ><br>
> >   Uninitialized value was created by an allocation of 'ref.tmp' in the<br>
> > stack frame of function<br>
> > '_ZN7testing8internal12UnitTestImpl11AddTestInfoEPFvvES3_PNS_8TestInfoE'<br>
> >     #0 0x720f10<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x720f10)<br>
> ><br>
> > SUMMARY: MemorySanitizer: use-of-uninitialized-value<br>
> > (/usr/local/google/home/dberris/xray/llvm-project-build-msan/unittests/XRay/XRayTests+0x70eef8)<br>
> > Exiting<br>
> ><br>
> > ====<br>
> ><br>
> > Is there something else I'm missing here? I'm doing this on Linux. I<br>
> > tried building with libc++ from the first toolchain, but somehow the<br>
> > linker from the same toolchain in step 1 couldn't find the libc++ with<br>
> > msan instrumentation.<br>
> ><br>
> > Here's the CMake command I'm using:<br>
> ><br>
> > ====<br>
> > cmake -GNinja -DCMAKE_C_COMPILER=$HOME/xray/llvm-project-build/bin/clang<br>
> > -DCMAKE_CXX_COMPILER=$HOME/xray/llvm-project-build/bin/clang++<br>
> > -DCMAKE_BUILD_TYPE=Debug -DLLVM_OPTIMIZED_TABLEGEN=On<br>
> > -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_USE_SANITIZER=MemoryWithOrigins<br>
> > -DLLVM_ENABLE_LLD=On -DLLVM_INCLUDE_TESTS=On<br>
> > -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_LINK_FLAGS=-stdlib=libc++<br>
> > ../llvm-project/llvm<br>
> > ====<br>
> ><br>
> > And I'm running the tests like so:<br>
> ><br>
> > ====<br>
> > ninja check-llvm<br>
> > ====<br>
> ><br>
> > I'm doing this with the monorepo, if that's relevant.<br>
> ><br>
> > Help?<br>
> ><br>
> > --<br>
> > Dean<br>
> > _______________________________________________<br>
> > LLVM Developers mailing list<br>
> > <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
-- Dean<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="m_6045512471583027902gmail_signature" data-smartmail="gmail_signature">-Brian</div>
</blockquote></div>