New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 683445 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jan 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

compile failure on chromeos asan due to -fsanitize-address-use-after-scope

Project Member Reported by achuith@chromium.org, Jan 21 2017

Issue description

First failing build:
https://uberchromegw.corp.google.com/i/chromiumos.chromium/builders/amd64-generic-tot-asan-informational/builds/11590

Strong suspicion of this CL:
https://codereview.chromium.org/2451973004

Snippet from build log:
chromeos-chrome-58.0.2988.0_alpha-r1: FAILED: obj/base/base/activity_tracker.o 
chromeos-chrome-58.0.2988.0_alpha-r1: x86_64-cros-linux-gnu-clang++ -B/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51-gold -MMD -MF obj/base/base/activity_tracker.o.d -DSYSTEM_NATIVE_UTF8 -DUSE_SYMBOLIZE -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_ASH=1 -DUSE_AURA=1 -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -DNO_TCMALLOC -DMEMORY_TOOL_REPLACES_ALLOCATOR -DMEMORY_SANITIZER_INITIAL_SIZE -DADDRESS_SANITIZER -DENABLE_WAYLAND_SERVER=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DENABLE_MEDIA_ROUTER=1 -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=289944-2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DOS_CHROMEOS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBASE_IMPLEMENTATION -I../../../../../../../home/chrome-bot/chrome_root/src -Igen -fno-strict-aliasing -funwind-tables -fPIC -pipe -fcolor-diagnostics -fdebug-prefix-map=/home/chrome-bot/chrome_root/src=. -m64 -march=x86-64 -pthread -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-deprecated-register -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -fno-omit-frame-pointer -g2 --sysroot=../../../../../../../build/amd64-generic -gline-tables-only -gcolumn-info -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-blacklist=../../../../../../../home/chrome-bot/chrome_root/src/tools/memory/asan/blacklist.txt -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wno-char-subscripts -Wexit-time-destructors -Wexit-time-destructors -O2 -fno-ident -fdata-sections -ffunction-sections -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wno-reserved-user-defined-literal -fno-rtti -fno-exceptions -pipe -pipe -pipe -march=x86-64 -msse3 -D__google_stl_debug_vector=1 -Wno-unknown-warning-option  -c ../../../../../../../home/chrome-bot/chrome_root/src/base/debug/activity_tracker.cc -o obj/base/base/activity_tracker.o
chromeos-chrome-58.0.2988.0_alpha-r1: clang-3.9: error: unknown argument: '-fsanitize-address-use-after-scope'



 

Comment 1 by krasin@chromium.org, Jan 23 2017

Cc: kcc@chromium.org p...@chromium.org
(update: by this time, my CL was reverted and this is no longer breaking the build)

That's interesting. So, Chrome OS uses Clang, but not new enough to support the flag. Apparently, there's no way (is there?) in GN to know the version of Clang, and therefore I will have to exclude Chrome OS from this check when I reland the CL. Given that Chromium CQ does not have a single trybot configured this way, I expect more similar issues in the future, I we often use the latest Clang features (and often implement them).

Is there a plan on the Chrome OS side to match the toolchain to the one used in Chrome, or at least add some trybots which will guard against such regressions?

Cc: llozano@chromium.org
Luis, are you the right person to answer this question?
Cc: jamescook@chromium.org
James, please keep an eye out for the reland - this broke the chromeos ASAN builder last week.
we are actually updating Clang for ChromeOS today. Hopefully, it will stick. So, if you wait a couple of days, you will not have to do change your CL before re-landing.

I thought the informational builders was the mechanism used from the Chrome side to find issues that will happen on the ChromeOS side and it worked (it detected the problem).

We don't want to block chrome clang compiler updates. For a problem like this, we can fix it in the ChromeOS side by ignoring the option in the compiler wrapper until Clang is updated. 
It can also be fixed on the Chrome side by checking for "chromeos" before adding the particular option as a temporary fix. 
Probably easier to fix on the ChromeOS side. 

It would be nice if GN had a way to check for compiler versions or support for a specific option. 



Labels: Build-Toolchain

Comment 6 by krasin@chromium.org, Jan 23 2017

Hi Luis,

thank you for the news. It's great to hear that the Clang toolchain for ChromeOS will soon be updated. I will make sure to include you as a reviewer whenever I try to enable the use-after-scope check on Chrome OS.
Project Member

Comment 7 by bugdroid1@chromium.org, Jan 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a9461af221d3d56769f21b6755a8afbef00d6d7d

commit a9461af221d3d56769f21b6755a8afbef00d6d7d
Author: krasin <krasin@chromium.org>
Date: Tue Jan 24 17:17:58 2017

Enable use-after-scope check in ASAN configs.

This is a second attempt to land this change.
Previous attempts failed on some ChromeOS bots
using old version of Clang, on Clang-CL Win bots
and also there were a couple of webkit_tests failed
due to a real use-after-scope issue.

The use-after-scope issue is now fixed by
https://codereview.chromium.org/2649903005/, Windows and
ChromeOS are temporarily blacklisted.

BUG= 681136 , 683459 ,683966, 683445 

Review-Url: https://codereview.chromium.org/2654623002
Cr-Commit-Position: refs/heads/master@{#445747}

[modify] https://crrev.com/a9461af221d3d56769f21b6755a8afbef00d6d7d/build/config/sanitizers/BUILD.gn

Cc: warx@chromium.org
This builder started failing again starting here:

https://build.chromium.org/p/chromiumos.chromium/builders/amd64-generic-tot-asan-informational/builds/11650

But now it is a linker failure building librillo: "recompile with -fPIC":

libbrillo-0.0.1-r364: FAILED: lib/libinstallattributes-395517.so lib/libinstallattributes-395517.so.TOC 
libbrillo-0.0.1-r364: if [ ! -e lib/libinstallattributes-395517.so -o ! -e lib/libinstallattributes-395517.so.TOC ]; then flock linker.lock x86_64-cros-linux-gnu-clang++ -shared -Wl,-O1 -Wl,-O2 -Wl,--as-needed -fsanitize=address -fsanitize=alignment -fsanitize=shift -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,now -Wl,--as-needed --sysroot=/build/amd64-generic -pthread -o lib/libinstallattributes-395517.so -Wl,-soname=libinstallattributes-395517.so -Wl,--whole-archive obj/libbrillo/install_attributes/libinstallattributes-395517.libinstallattributes.o obj/common-mk/libinstall_attributes-proto.a  -Wl,--no-whole-archive -lbase-395517 -lprotobuf-lite -lpthread && { readelf -d lib/libinstallattributes-395517.so | grep SONAME ; nm -gD -f p lib/libinstallattributes-395517.so | cut -f1-2 -d' '; } > lib/libinstallattributes-395517.so.TOC; else flock linker.lock x86_64-cros-linux-gnu-clang++ -shared -Wl,-O1 -Wl,-O2 -Wl,--as-needed -fsanitize=address -fsanitize=alignment -fsanitize=shift -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,now -Wl,--as-needed --sysroot=/build/amd64-generic -pthread -o lib/libinstallattributes-395517.so -Wl,-soname=libinstallattributes-395517.so -Wl,--whole-archive obj/libbrillo/install_attributes/libinstallattributes-395517.libinstallattributes.o obj/common-mk/libinstall_attributes-proto.a  -Wl,--no-whole-archive -lbase-395517 -lprotobuf-lite -lpthread && { readelf -d lib/libinstallattributes-395517.so | grep SONAME ; nm -gD -f p lib/libinstallattributes-395517.so | cut -f1-2 -d' '; } > lib/libinstallattributes-395517.so.tmp && if ! cmp -s lib/libinstallattributes-395517.so.tmp lib/libinstallattributes-395517.so.TOC; then mv lib/libinstallattributes-395517.so.tmp lib/libinstallattributes-395517.so.TOC ; fi; fi
libbrillo-0.0.1-r364: /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real: error: obj/common-mk/libinstall_attributes-proto.a(obj/common-mk/gen/include/bindings/install_attributes-proto.install_attributes.pb.o): requires dynamic R_X86_64_PC32 reloc against '_ZSt9make_pairIRjbESt4pairINSt17__decay_and_stripIT_E6__typeENS2_IT0_E6__typeEEOS3_OS6_' which may overflow at runtime; recompile with -fPIC
libbrillo-0.0.1-r364: /usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51/ld.gold.real: error: obj/common-mk/libinstall_attributes-proto.a(obj/common-mk/gen/include/bindings/install_attributes-proto.install_attributes.pb.o): requires dynamic R_X86_64_PC32 reloc against '_ZSt4swapIPSsEvRT_S2_' which may overflow at runtime; recompile with -fPIC
libbrillo-0.0.1-r364: clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)




FYI - "recompile with -fPIC" is mentioned in issue 672158 about ThinLTO (?) and caching compiler flags.

Cc: rahulchaudhry@chromium.org
Split the linker failures into new  issue 685313 

Status: Fixed (was: Assigned)
re: #8: this is not related to -fsanitize-use-after-scope. My CL landed after the build was broken. It's more likely to be relaed to the ChromeOS toolchain update or something else.

My CL does not have any effect on ChromeOS, as it explicitly filters it out.
#8 does not have anything to do with this bug.

@krasin, you can remove the blacklisting for ChromeOS. New compiler has been rolled and it is working fine.

@llozano, awesome! Please, review: https://codereview.chromium.org/2654383002/
Project Member

Comment 15 by bugdroid1@chromium.org, Jan 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/539f64c0e54adc91ae1276948771a3538cf4261b

commit 539f64c0e54adc91ae1276948771a3538cf4261b
Author: krasin <krasin@chromium.org>
Date: Fri Jan 27 00:42:02 2017

Enable use-after-scope check on Chrome OS.

Now that Chrome OS uses a recent enough Clang toolchain,
it's possible to enable the check there too.

BUG= 683445 , 649897 

Review-Url: https://codereview.chromium.org/2654383002
Cr-Commit-Position: refs/heads/master@{#446503}

[modify] https://crrev.com/539f64c0e54adc91ae1276948771a3538cf4261b/build/config/sanitizers/BUILD.gn

Sign in to add a comment