<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 29, 2016 at 7:10 PM, Kostya Serebryany 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"><div dir="ltr">For some reason I can not reproduce the problem you have with Function.cpp:<div>cmake -GNinja  -DCMAKE_BUILD_TYPE=Debug   -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++  -DLLVM_USE_SANITIZER=Address $HOME/llvm<br></div><div>ninja opt</div><div><br></div><div><builds fine></div><div><br></div><div>If you still see it, may I ask you to file a bug with preprocessed Function.cpp and exact clang command line? </div></div></blockquote><div><br></div><div><br></div><div>Reid recently fixed this in r258897 and related commits.</div><div><br></div><div>-- Sean Silva</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><br></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Jan 25, 2016 at 7:05 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">BTW,<span style="font-size:12.8px"> -DCMAKE_BUILD_TYPE=Debug</span> builds <span style="font-size:12.8px">llvm/lib/IR/Function.cpp with -O1 and it hangs (or at least compile time is more that 40 min). On -DCMAKE_BUILD_TYPE=Release it is -O2 compilation and it works fine.</span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 25, 2016 at 2:15 PM, Yury Gribov <span dir="ltr"><<a href="mailto:y.gribov@samsung.com" target="_blank">y.gribov@samsung.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"><span>On 01/25/2016 12:16 PM, Dmitry Polukhin via cfe-dev 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">
Thank you for the link, debugger tips in<br>
<a href="https://github.com/google/sanitizers/wiki/AddressSanitizerAndDebugger" rel="noreferrer" target="_blank">https://github.com/google/sanitizers/wiki/AddressSanitizerAndDebugger</a> are<br>
very useful but partially outdated. For example, it seems that AsanDie<br>
mentioned there is now  __sanitizer::Die. </blockquote></span></blockquote></div></div></div></div></blockquote><div><br></div></span><div>Wiki fixed, thanks!</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><div><div class="gmail_extra"><div class="gmail_quote"><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"><span><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">That is why it would be much<br>
easier if asan detects attached debugger and does<br>
ASAN_OPTIONS=abort_on_error=1 under debugger. I think it will be user<br>
friendly behavior and would lower adoption bar :)<br></blockquote></span></blockquote></div></div></div></div></blockquote><div><br></div></span><div><div>It's a bit non-trivial to implement, especially for multiple platforms, and there are several very simple workarounds (see the wiki above),</div><div>so we've never done that. </div></div><div>If someone feels strong, I'd be happy to review a patch.</div><div>(BTW, can we distinguish gdb and e.g. strace?)</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><div><div class="gmail_extra"><div class="gmail_quote"><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"><span><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">
</blockquote>
<br></span>
I once asked for something like this in ASan group but folks weren't interested. You can take a look at <a href="https://github.com/yugr/libdebugme" rel="noreferrer" target="_blank">https://github.com/yugr/libdebugme</a><div><div><br></div></div></blockquote></div></div></div></div></blockquote><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><div><div class="gmail_extra"><div class="gmail_quote"><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><div>
<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">
On Sat, Jan 23, 2016 at 10:04 AM, Kostya Serebryany <<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>> wrote:<br>
<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">
<br>
<br>
On Fri, Jan 22, 2016 at 10:18 PM, Dmitry Polukhin <<br>
<a href="mailto:dmitry.polukhin@gmail.com" target="_blank">dmitry.polukhin@gmail.com</a>> wrote:<br>
<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">
Yes, it was due to using Debug build. With Release build I was able to<br>
build self build without hang on IR/Function.cpp. It was not a problem<br>
of using make vs ninja<br>
<br>
</blockquote>
<br>
My recommendation to use ninja is unrelated to your problem. It's just a<br>
better build tool, imho.<br>
<br>
<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">
  because I got clang command line and run it manually with the same<br>
result. I do prefer Debug build to be able to run debugger properly<br>
on sanitized binaries.<br>
<br>
</blockquote>
<br>
Understood. You can probably build Function.cpp with -O2 manually and then<br>
build the rest with -O0.<br>
<br>
<br>
<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">
Running GDB on asanified release binaries I found that debug info is weak<br>
<br>
</blockquote>
<br>
Yep.<br>
<br>
<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">
and stepping over source code very often jumps to the begging on the<br>
function so it means that some instructions have no source info but I don't<br>
know was it instructions inserted by asan instrumentation or not. Also<br>
it is very inconvenient that asan terminates execution when finds a problem<br>
instead of breaking into the debugger - it is my kind feature request :)<br>
<br>
</blockquote>
<br>
<br>
See <a href="https://github.com/google/sanitizers/wiki/AddressSanitizerAndDebugger" rel="noreferrer" target="_blank">https://github.com/google/sanitizers/wiki/AddressSanitizerAndDebugger</a><br>
(I personally almost never use gdb with asan, so can't share any more<br>
useful tricks)<br>
<br>
--kcc<br>
<br>
<br>
<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">
<br>
<br>
On Sat, Jan 23, 2016 at 12:56 AM, Kostya Serebryany <<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>><br>
wrote:<br>
<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">
<br>
<br>
On Fri, Jan 22, 2016 at 6:00 AM, Dmitry Polukhin <<br>
<a href="mailto:dmitry.polukhin@gmail.com" target="_blank">dmitry.polukhin@gmail.com</a>> wrote:<br>
<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">
Hi Kostya,<br>
<br>
I would like to repro and fix some of the issues that fuzzed found<br>
<br>
</blockquote>
<br>
Nice!<br>
<br>
<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">
but I don't have system Clang on my machine but I do have Clang sources<br>
so I need to make Clang to have ASan and after that use that Clang to build<br>
Clang one more time but with ASan enabled. It looks like in Clang doc there<br>
is no info how to do it.<br>
<br>
</blockquote>
<br>
Mmmm.<br>
These pages have some related discussions, but you probably don't need<br>
them...<br>
<br>
<a href="https://github.com/google/sanitizers/wiki/MemorySanitizerBootstrappingClang" rel="noreferrer" target="_blank">https://github.com/google/sanitizers/wiki/MemorySanitizerBootstrappingClang</a><br>
<a href="https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild" rel="noreferrer" target="_blank">https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild</a><br>
<br>
<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">
I only found LLVM_USE_SANITIZER so I did it like this:<br>
<br>
cd $ROOT<br>
mkdir release<br>
cd release<br>
cmake ../llvm -DCMAKE_BUILD_TYPE=Release<br>
make<br>
cd ..<br>
mkdir build<br>
cd build<br>
CC=$ROOT/release/bin/clang CXX=$ROOT/release/bin/clang++ cmake ../llvm<br>
-DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_SANITIZER=Address<br>
make<br>
<br>
Last build seems to hang on compilation of llvm/lib/IR/Function.cpp.<br>
<br>
</blockquote>
<br>
I routinely build clang with clang+asan.<br>
llvm/lib/IR/Function.cpp indeed takes lots of time, an order of 3<br>
minutes,<br>
but not even close to what you see.<br>
Mostly likely the difference is that you use -DCMAKE_BUILD_TYPE=Debug<br>
and I use -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON<br>
(in other words, I use -O2).<br>
In general, we almost never use asan with -O0 because it'll be too slow.<br>
<br>
BTW, I encourage you to switch from "make" to "ninja" -- works much<br>
faster and nicer<br>
<br>
<br>
<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">
I break it after about 30min and 25G RAM consumed.<br>
Without -fsanitize=address compilation takes about 30 sec. Do you have bot<br>
that checks self build with ASan?<br>
<br>
</blockquote>
<br>
Yes.<br>
<a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap</a><br>
You can check the exact commands e.g. here:<br>
<br>
<a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10702/steps/build%20clang%2Fasan/logs/stdio" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10702/steps/build%20clang%2Fasan/logs/stdio</a><br>
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON ...<br>
<br>
<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">
Is it known issue?<br>
<br>
</blockquote>
<br>
I would guess what you see is a manifestation of<br>
<a href="https://llvm.org/bugs/show_bug.cgi?id=17409" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=17409</a>,<br>
which has been bothering us for years, but I have not checked this<br>
particular case.<br>
<br>
Thanks for doing this!<br>
<br>
--kcc<br>
<br>
<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">
Thanks,<br>
Dmitry<br>
--<br>
Software Engineer<br>
Intel Compiler Team<br>
<br>
On Tue, Jan 5, 2016 at 1:46 PM, Andrey Bokhanko via cfe-dev <<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
<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>
<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>
<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">
Hi Clang devs,<br>
<br>
In the new year I would like to ask you all to consider fixing clang<br>
</blockquote>
bugs<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">
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<br>
</blockquote>
fixed for<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">
months.<br>
E.g.<br>
<br>
</blockquote>
<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>
<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">
This precludes us from treating these bugs as errors and make the<br>
</blockquote>
bot red on<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">
regressions.<br>
<br>
Also, these shallow bugs prevent us from finding deeper bugs with<br>
</blockquote>
potential<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">
security implications, and there are some such.<br>
E.g. the bug below means that no one can safely host clang as a web<br>
</blockquote>
service.<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">
<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<br>
</blockquote>
0x7ffdbdcb2de8<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">
<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<br>
</blockquote>
include/llvm/ADT/SmallVector.h:374:7<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">
     #2 0xa838c02 in<br>
<br>
</blockquote>
clang::Parser::ParseCXXAmbiguousParenExpression(clang::Parser::ParenParseOption&,<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">
clang::OpaquePtr<clang::QualType>&, clang::Bala<br>
     #3 0xa7ac905 in<br>
<br>
</blockquote>
clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool,<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">
bool, clang::OpaquePtr<clang::QualType>&, clang::Sour<br>
     #4 0xa794e83 in clang::Parser::ParseCastExpression(bool, bool,<br>
</blockquote>
bool&,<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">
clang::Parser::TypeCastState)<br>
</blockquote>
tools/clang/lib/Parse/ParseExpr.cpp:709:11<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">
     #5 0xa77c21c in ParseCastExpression<br>
tools/clang/lib/Parse/ParseExpr.cpp:465:20<br>
<br>
<br>
--kcc<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>
<br>
</blockquote>
_______________________________________________<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>
</blockquote>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
<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>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">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></blockquote></div><br></div></div>