-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
osx: _FORTIFY_SOURCE=1 is always enabled, which breaks asan #6932
Comments
+1, We're using the following config. # Address sanitizer config.
# Add --config=asan to your bazel command.
build:asan --strip=never
build:asan --copt -Wno-macro-redefined # Asan sets _FORTIFY_SOURCE=0
build:asan --copt -DADDRESS_SANITIZER
build:asan --copt -D_LIBCPP_HAS_NO_ASAN
build:asan --copt -g
build:asan --copt -fno-omit-frame-pointer
build:asan --copt -fno-optimize-sibling-calls
build:asan --copt -fsanitize=address
build:asan --linkopt -fsanitize=address |
@jgavris from what I could read online, you might want to redefine |
Makes sense. I don't understand why we force _FORTIFY_SOURCE=1 in the public osx CROSSTOOL given that we don't do this in the internal one. I think we should keep _FORTIFY_SOURCE=1 only in opt mode. @mhlopko - you have looked at the osx CROSSTOOL before, what do you think? |
@tetromino actually I'm guessing the problem also exists on every OS, doesn't it ? also, what is the status on using sanitizers + blaze inside google ? |
On second thought, I think this is working as intended. Please try |
It seems that --features=asan isn't working for cc_binary on osx, but ideally, that's how we would want to support sanitizers, while still keeping a secure default. Duplicate of #4984. |
Duplicate of #4984 |
This adds support for asan, tsan, and ubsan on Apple platforms. Fixes bazelbuild#4984 and bazelbuild#6932
This adds support for asan, tsan, and ubsan on Apple platforms. Fixes bazelbuild#4984 and bazelbuild#6932
Description of the problem / feature request:
-D_FORTIFY_SOURCE=1
is enabled by default on OSX. This break when trying to use asan.When running a build with
-fsanitize=address
, the build outputs warnings with:However, according to https://github.com/google/sanitizers/wiki/AddressSanitizer,
_FORTIFY_SOURCE
should be disabled when using asan.However, adding the following options doesn't help either since it's defined in the CROSSTOOL it seems:
Feature requests: what underlying problem are you trying to solve with this feature?
Use asan on osx.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Run a C++ build with the following arg:
What operating system are you running Bazel on?
osx
What's the output of
bazel info release
?Have you found anything relevant by searching the web?
I can submit a PR if everybody approves me of removing it by default.
I'm also noticing it is enabled by default on linux.
We managed to get around using the following configuration:
The text was updated successfully, but these errors were encountered: