<div dir="ltr">Yes, it was due to using Debug build. With Release build I was able to build self build without hang on <font color="#500050"><span style="font-size:12.8px">IR/Function.cpp. </span></font><span style="color:rgb(80,0,80);font-size:12.8px">It was not a problem of using make vs ninja because</span><span style="color:rgb(80,0,80);font-size:12.8px"> I got clang command line and run it manually with the same result. </span><font color="#500050"><span style="font-size:12.8px">I do prefer Debug build to be able to run debugger properly on sanitized binaries. Running GDB on asanified release binaries I found that debug info is weak and stepping over source code very often jumps to the begging on the function so it means that some instructions have no source info but I don't know was it instructions inserted by asan instrumentation or not. Also it is very inconvenient that asan terminates execution when finds a problem instead of breaking into the debugger - it is my kind feature request :)</span><br></font></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 23, 2016 at 12:56 AM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Jan 22, 2016 at 6:00 AM, Dmitry Polukhin <span dir="ltr"><<a href="mailto:dmitry.polukhin@gmail.com" target="_blank">dmitry.polukhin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Kostya,<br><br>I would like to repro and fix some of the issues that fuzzed found</div></blockquote><div><br></div></span><div>Nice! </div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"> but I don't have system Clang on my machine but I do have Clang sources so I need to make Clang to have ASan and after that use that Clang to build Clang one more time but with ASan enabled. It looks like in Clang doc there is no info how to do it.</div></blockquote><div><br></div></span><div>Mmmm.</div><div>These pages have some related discussions, but you probably don't need them...</div><div><a href="https://github.com/google/sanitizers/wiki/MemorySanitizerBootstrappingClang" target="_blank">https://github.com/google/sanitizers/wiki/MemorySanitizerBootstrappingClang</a><br></div><div><a href="https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild" target="_blank">https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild</a><br></div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"> I only found LLVM_USE_SANITIZER so I did it like this:<div><div><br></div><div>cd $ROOT</div><div>mkdir release<br></div><div>cd release</div><div>cmake ../llvm -DCMAKE_BUILD_TYPE=Release</div><div><div>make<br></div><div>cd ..</div><div>mkdir build</div><div>cd build</div><div>CC=$ROOT/release/bin/clang CXX=$ROOT/release/bin/clang++ cmake ../llvm -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_SANITIZER=Address</div><div>make<br></div><div><br></div><div>Last build seems to hang on compilation of llvm/lib/IR/Function.cpp. </div></div></div></div></blockquote><div><br></div></span><div>I routinely build clang with clang+asan. </div><div>llvm/lib/IR/Function.cpp indeed takes lots of time, an order of 3 minutes, <br></div><div>but not even close to what you see. </div><div>Mostly likely the difference is that you use -DCMAKE_BUILD_TYPE=Debug</div><div>and I use -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON</div><div>(in other words, I use -O2). </div><div>In general, we almost never use asan with -O0 because it'll be too slow. </div><div><br></div><div>BTW, I encourage you to switch from "make" to "ninja" -- works much faster and nicer</div><span class=""><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div>I break it after about 30min and 25G RAM consumed. Without -fsanitize=address compilation takes about 30 sec. Do you have bot that checks self build with ASan? </div></div></div></div></blockquote><div><br></div></span><div>Yes. </div><div><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap</a><br></div><div>You can check the exact commands e.g. here: </div><div><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10702/steps/build%20clang%2Fasan/logs/stdio" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10702/steps/build%20clang%2Fasan/logs/stdio</a><br></div>cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON ...<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div>Is it known issue?</div></div></div></div></blockquote><div><br></div><div>I would guess what you see is a manifestation of <a href="https://llvm.org/bugs/show_bug.cgi?id=17409" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=17409</a>, </div><div>which has been bothering us for years, but I have not checked this particular case. </div><div> </div><div>Thanks for doing this! </div><div><br></div><div>--kcc </div><div><div class="h5"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><br></div><div>Thanks,</div><div>Dmitry</div></div></div><div><span style="font-size:12.8px">--</span><span><br style="font-size:12.8px"><span style="font-size:12.8px">Software Engineer</span><br style="font-size:12.8px"><span style="font-size:12.8px">Intel Compiler Team</span><br></span></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 5, 2016 at 1:46 PM, Andrey Bokhanko via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">We (Intel clang team) will take a look and fix some of these.<br>
<br>
Yours,<br>
Andrey<br>
======<br>
Software Engineer<br>
Intel Compiler Team<br>
Intel<br>
<div><div><br>
<br>
On Mon, Jan 4, 2016 at 9:20 PM, Kostya Serebryany via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> Hi Clang devs,<br>
><br>
> In the new year I would like to ask you all to consider fixing clang bugs<br>
> found by fuzzing (that includes, but is not limited to,<br>
> <a href="https://llvm.org/bugs/show_bug.cgi?id=23057" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=23057</a>)<br>
><br>
> The existing fuzzer bot is reporting known bugs that are not being fixed for<br>
> months.<br>
> E.g.<br>
> <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/5328/steps/stage2%2Fasan%2Bassertions%20run%20clang-fuzzer/logs/stdio" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/5328/steps/stage2%2Fasan%2Bassertions%20run%20clang-fuzzer/logs/stdio</a><br>
> This precludes us from treating these bugs as errors and make the bot red on<br>
> regressions.<br>
><br>
> Also, these shallow bugs prevent us from finding deeper bugs with potential<br>
> security implications, and there are some such.<br>
> E.g. the bug below means that no one can safely host clang as a web service.<br>
><br>
> echo "* a ((int () (o W, *&])) 0" | ./bin/clang -x c++ -<br>
><br>
> ==13059==ERROR: AddressSanitizer: heap-use-after-free on address<br>
> 0x61500000e538 at pc 0x00000081df99 bp 0x7ffdbdcb3630 sp 0x7ffdbdcb2de8<br>
><br>
> READ of size 20 at 0x61500000e538 thread T0<br>
> #0 0x81df98 in __asan_memcpy<br>
> #1 0xedcd28f in clang::TokenLexer::Lex(clang::Token&)<br>
> tools/clang/lib/Lex/TokenLexer.cpp:441:7<br>
> #2 0xedb3c47 in clang::Preprocessor::Lex(clang::Token&)<br>
> tools/clang/lib/Lex/Preprocessor.cpp:731:23<br>
> #3 0xa5ad93a in ConsumeParen<br>
> tools/clang/include/clang/Parse/Parser.h:383:5<br>
> #4 0xa5ad93a in<br>
> clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>,<br>
> clang::Parser::SkipUntilFlags) tools/clang/lib/Parse/Parser.cpp:3<br>
> #5 0xa78bdb8 in SkipUntil<br>
> tools/clang/include/clang/Parse/Parser.h:864:12<br>
><br>
> 0x61500000e538 is located 312 bytes inside of 456-byte region<br>
> [0x61500000e400,0x61500000e5c8)<br>
> freed by thread T0 here:<br>
> #0 0x8350db in __interceptor_free<br>
> #1 0xa838c02 in ~SmallVectorImpl include/llvm/ADT/SmallVector.h:374:7<br>
> #2 0xa838c02 in<br>
> clang::Parser::ParseCXXAmbiguousParenExpression(clang::Parser::ParenParseOption&,<br>
> clang::OpaquePtr<clang::QualType>&, clang::Bala<br>
> #3 0xa7ac905 in<br>
> clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool,<br>
> bool, clang::OpaquePtr<clang::QualType>&, clang::Sour<br>
> #4 0xa794e83 in clang::Parser::ParseCastExpression(bool, bool, bool&,<br>
> clang::Parser::TypeCastState) tools/clang/lib/Parse/ParseExpr.cpp:709:11<br>
> #5 0xa77c21c in ParseCastExpression<br>
> tools/clang/lib/Parse/ParseExpr.cpp:465:20<br>
><br>
><br>
> --kcc<br>
><br>
</div></div>> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>