New issue
Advanced search Search tips

Issue 866657 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 15
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug

Blocked on:
issue 863425



Sign in to add a comment

Skia ASAN Fuzzer build on Linux won't link after clang roll.

Project Member Reported by bunge...@chromium.org, Jul 23

Issue description

After the clang roll at https://chromium-review.googlesource.com/c/chromium/src/+/1143094 , my local build of Skia on Linux with ASAN has failed to link. In a local Skia checkout like

$ git clone https://skia.googlesource.com/skia
$ cd skia
$ tools/git-sync-deps
$ bin/fetch-gn

with an out/asan/args.gn which looks like

cc = "$HOME/src/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang"
cxx = "$HOME/src/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++"
sanitize = "ASAN"
is_debug = true

$ bin/gn gen out/asan

$ ninja -C out/asan/ fuzz
/usr/bin/ld: fuzz: hidden symbol `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEm' isn't defined

$ c++filt _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEm
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__recommend(unsigned long)

sure enough I can find this __recommend in libc++, but it doesn't seem to have changed in a while. My debug build of Skia (without 'sanitize = "ASAN"') links fine. If I locally revert this change in Chromium, run the hooks to get the 'old' clang, and then rebuild everything is fine.
 
Blockedon: 863425
Cc: thomasanderson@chromium.org r...@chromium.org
Components: Internals>Skia Build
Labels: Stability-Memory-AddressSanitizer clang OS-Linux
Owner: ----
Cc: kjlubick@chromium.org
The command to link looks like

$HOME/src/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++ -rdynamic -Wl,-rpath,\$ORIGIN -stdlib=libc++ -fsanitize=bool,float-cast-overflow,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift,signed-integer-overflow,unreachable,vla-bound,function,vptr,address @fuzz.rsp  -lpthread -ldl -lGL -lfreetype -lfontconfig -lGLU -lX11 -o fuzz

where @fuzz.rsp is pretty simple (just a bunch of .o and .a files listed out).

If I add a '-H' to the compile command for the fuzz.cpp I see that some of the stdc headers are coming from $HOME/src/chromium/src/third_party/llvm-build/Release+Asserts/lib/clang/7.0.0/include/ but stdc++ headers are all from local /usr/include/c++/v1/ which appear to be provided by package libc++-dev version 6.0-2 . I can see a symbol by the name of the one missing in my own /usr/lib/x86_64-linux-gnu/libc++.a as a hidden symbol, but I don't see it listed at all in /usr/lib/x86_64-linux-gnu/libc++.so.1.0 or under Release+Asserts.
Some folks on cfe-dev were asking about some libc++ vs. libfuzzer problems related to visibility, this might be that:
http://lists.llvm.org/pipermail/cfe-dev/2018-July/058460.html

The thread was titled "Is it really valid to discard externally instantiated functions from a TU when marked inline?"

I don't know what the conclusion was to the problem.
Is this fixed now? We've rolled clang a couple of times since.
Seems to still be an issue at CLANG_REVISION = '340925' (the reproduction in the initial report still reproduces on my machine). Note that the issue appears to be related to the libc++ being used. If I downgrade my local libc++ back to package version 3.5-2 (appears to be the current default) everything seems to work. Interestingly, I see no difference in how this verxion 3.5-2 __recommend is declared or used (there is an extra static_cast in the new definition).
Status: WontFix (was: Untriaged)
At this point I've mucked with my local libc++, can no longer reproduce, and this doesn't appear to be affecting anyone else.

Sign in to add a comment