-
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
Bazel dependency check for asan_blacklist.txt with clang-10 #10510
Comments
-- 330051e00cd57ee516b4eaf656965656ffbcd0bc by Abseil Team <absl-team@google.com>: Fix indentation in comment. PiperOrigin-RevId: 287997504 -- 35fb1a893e708031ba4fc0db460875eb0d31820e by Abseil Team <absl-team@google.com>: Enable compile-time enforcement that absl::Substitute patterns to not contain unescaped $ symbols. absl::Substitute already considers unescaped $ symbols undefined behavior and crashes when it's passed them in debug builds. Some code isn't ever built in debug mode, though, and inadvertently used some unescaped $ symbols, which led to surprising results. This change will prevent that problem from happening in the future. PiperOrigin-RevId: 287906643 -- c5762833ebde6d7110bf68041a823b571c238e9e by Gennadiy Rozental <rogeeff@google.com>: Move all the flag data into a single place instead of being split between handle and flag object. After this change CommandLineFlag will not hold any data anymore. And we also do not need to pass the CommandLineFlag around in Abseil Flag implementation to report flag name and location. PiperOrigin-RevId: 287899076 -- 8b5fb644f1e3d9267b7a75106fe9a72c886db786 by Derek Mauro <dmauro@google.com>: Upgrade CI testing to Bazel 2.0.0 and Clang 407ac2eb5f13 -fno-sanitize-blacklist is to workaround bazelbuild/bazel#10510 PiperOrigin-RevId: 287875363 -- a20cc1d58895de2babc3748a6c79d1d6813734ef by Abseil Team <absl-team@google.com>: Make ABSL_RETIRED_FLAG behave consistently with ABSL_FLAG. Before the change: ABSL_RETIRED_FLAG does not compile when there are competing ctors in the type, even when ABSL_FLAG does. After the change: ABSL_RETIRED_FLAG compiles when ABSL_FLAG does. PiperOrigin-RevId: 286483183 -- 1cff7e67329d2be9e50bee1f2e76ef9ffd2edde5 by Abseil Team <absl-team@google.com>: Support C++20 erase_if API in unordered associative containers See [unord.set.erasure]: https://eel.is/c++draft/unord.set.erasure See [unord.map.erasure]: https://eel.is/c++draft/unord.map.erasure PiperOrigin-RevId: 286461140 GitOrigin-RevId: 330051e00cd57ee516b4eaf656965656ffbcd0bc Change-Id: I5513110b41c2af08a44da54612cff341ac5c6607
This is breaking Chrome OS fuzzer builds when building tensorflow (https://bugs.chromium.org/p/chromium/issues/detail?id=1042874) |
Note any sanitizer blacklist, not just asan must be handled: |
@dslomov Hey Dmitry, quick ping on this. It would really help us to unblock our fuzzer builds and view our coverage. Thank you! |
ping @oquenchil @lberki |
I will take a look at this on Monday. |
I tried to reproduce by building the image here https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-clang/Dockerfile. I tried to build Bazel within the container but I keep bumping into missing tools that aren't in the image. Can you please provide me with an image that makes it easy for me to reproduce which also has the version of clang that causes the issue? |
We have this image where we can build Bazel. gcr.io/bazel-untrusted/ubuntu1404:java8 / If you tell me how to install clang-10 there and which target I should try to build from which repo in order to reproduce, that would be helpful. |
I think you were missing tools because we build bazel and Envoy in the base-builder, which is built on top of base-clang (bazel is built here https://github.com/asraa/oss-fuzz/blob/a155cb25879ce825299fad3eb8b189a7c332e7e5/projects/envoy/Dockerfile). I just reproduced in OSS-Fuzz directory by running
|
Thank you Asra. I can reproduce now. |
So that is an error because we see it in the .d file because the file path doesn't match any of the declared include dirs. We get the include dirs from bazel/tools/cpp/unix_cc_configure.bzl Line 125 in 469d855
This is where the check happens: bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java Line 1080 in 469d855
This will require clang adding a section in the output of |
The sanitizer files are part of clang resource directory in the /share location.$ clang -print-resource-dir |
So just to test that this would fix the problem, I tried adding the following lines to bazel/tools/cpp/unix_cc_configure.bzl Line 143 in 469d855
where RESOURCE_DIR is whatever clang --print-resource-dir prints and the blacklist.txt error disappeared. I then started getting errors with virtual include hdrs from protobuf not being found:
And later after restarting the container but without changing anything, the error changed to:
I have been trying to debug this for a while and I cannot get rid of those errors which seem unrelated. If you could modify the unix_cc_configure.bzl file adding the resource_dir, build Bazel from head and tell me if that fixes your problem, that would be great. Also ideally if you know why I was getting those other errors I can try again myself. |
|
I'm running the following command from within the container created by
I copied that Bazel command from the error I get when running the Python scripts. When running the Bazel command myself inside the OSS-Fuzz container, it says that it cannot find -lFuzzingEngine. I see OSS-Fuzz related files all over the container but not the library. No libFuzzingEngine.a or libFuzzingEngine.so anywhere. Also isn't it weird that the command line has |
Hm few things. Did you run The error should come up with just a The reason why there's a |
Alright, double checked. This is how I repro'd without any fuzz related configurations:
I outputted:
|
Thank you again for the repro instructions Asra. I got past the black.txt error in #10510 (comment). I was trying to get the whole build to complete. First I got some protobuf headers not found errors, then the FuzzingEngine error and now (with just --config=asan), I'm getting this:
In any case, the blacklist.txt error is gone with my patched version of Bazel. I tested it by creating a custom example in your docker container with clang-10 using just a single cc_library and passing the flag --config=asan. I would like to see this all the way through to make sure that Envoy builds properly but I'm going to need the right set of flags to avoid errors. I know that --config=asan is not enough because I built the image without your diff and that bazel command (which with release bazel doesn't give the blacklist.txt error) gives the same error in locality.h. So ideally, without using your diff, you can start the docker container and find a bazel command that won't give any errors at all. After that I will try the same command in the container with your diff and using my patched bazel. |
You're right, I was able to repro your error with the working image. I think there's something a little different about the OSS-Fuzz environment, I'm testing a working command in the clang-9 container for you to test. Will update |
in retrospect, I should have realized this. The hash related errors are from I again went to the shell that had the working version of clang, and this succeeds all the way through: |
Is there a workaround for bazel 2.2.0 until the next version is released? Also, when is the next version going to be released? |
The documentation at https://docs.bazel.build/versions/2.2.0/bazel-container.html is currently broken because of this. "Build the project with sanitizers by adding the –config=<asan/tsan/msan> build flag" does not work. |
I can't think of a workaround. The built in include directories get written to a file, there are no environment variables to write additional includes to that file. I also can't think of a command line flag that will skip these checks. |
-- 330051e00cd57ee516b4eaf656965656ffbcd0bc by Abseil Team <absl-team@google.com>: Fix indentation in comment. PiperOrigin-RevId: 287997504 -- 35fb1a893e708031ba4fc0db460875eb0d31820e by Abseil Team <absl-team@google.com>: Enable compile-time enforcement that absl::Substitute patterns to not contain unescaped $ symbols. absl::Substitute already considers unescaped $ symbols undefined behavior and crashes when it's passed them in debug builds. Some code isn't ever built in debug mode, though, and inadvertently used some unescaped $ symbols, which led to surprising results. This change will prevent that problem from happening in the future. PiperOrigin-RevId: 287906643 -- c5762833ebde6d7110bf68041a823b571c238e9e by Gennadiy Rozental <rogeeff@google.com>: Move all the flag data into a single place instead of being split between handle and flag object. After this change CommandLineFlag will not hold any data anymore. And we also do not need to pass the CommandLineFlag around in Abseil Flag implementation to report flag name and location. PiperOrigin-RevId: 287899076 -- 8b5fb644f1e3d9267b7a75106fe9a72c886db786 by Derek Mauro <dmauro@google.com>: Upgrade CI testing to Bazel 2.0.0 and Clang 407ac2eb5f13 -fno-sanitize-blacklist is to workaround bazelbuild/bazel#10510 PiperOrigin-RevId: 287875363 -- a20cc1d58895de2babc3748a6c79d1d6813734ef by Abseil Team <absl-team@google.com>: Make ABSL_RETIRED_FLAG behave consistently with ABSL_FLAG. Before the change: ABSL_RETIRED_FLAG does not compile when there are competing ctors in the type, even when ABSL_FLAG does. After the change: ABSL_RETIRED_FLAG compiles when ABSL_FLAG does. PiperOrigin-RevId: 286483183 -- 1cff7e67329d2be9e50bee1f2e76ef9ffd2edde5 by Abseil Team <absl-team@google.com>: Support C++20 erase_if API in unordered associative containers See [unord.set.erasure]: https://eel.is/c++draft/unord.set.erasure See [unord.map.erasure]: https://eel.is/c++draft/unord.map.erasure PiperOrigin-RevId: 286461140 GitOrigin-RevId: 330051e00cd57ee516b4eaf656965656ffbcd0bc Change-Id: I5513110b41c2af08a44da54612cff341ac5c6607
Referencing this issue on bazelbuild/bazel: bazelbuild/bazel#10510 The output of `clang --print-resource-dir` needs to be used to determine the share directory to be added to the include path. Since we can predict the path, we don't need to run clang to figure it out, but we do need to add it to cxx_builtin_include_directories.
Referencing this issue on bazelbuild/bazel: bazelbuild/bazel#10510 The output of `clang --print-resource-dir` needs to be used to determine the share directory to be added to the include path. Since we can predict the path, we don't need to run clang to figure it out, but we do need to add it to cxx_builtin_include_directories.
Referencing this issue on bazelbuild/bazel: bazelbuild/bazel#10510 The output of `clang --print-resource-dir` needs to be used to determine the share directory to be added to the include path. Since we can predict the path, we don't need to run clang to figure it out, but we do need to add it to cxx_builtin_include_directories.
-- 330051e00cd57ee516b4eaf656965656ffbcd0bc by Abseil Team <absl-team@google.com>: Fix indentation in comment. PiperOrigin-RevId: 287997504 -- 35fb1a893e708031ba4fc0db460875eb0d31820e by Abseil Team <absl-team@google.com>: Enable compile-time enforcement that absl::Substitute patterns to not contain unescaped $ symbols. absl::Substitute already considers unescaped $ symbols undefined behavior and crashes when it's passed them in debug builds. Some code isn't ever built in debug mode, though, and inadvertently used some unescaped $ symbols, which led to surprising results. This change will prevent that problem from happening in the future. PiperOrigin-RevId: 287906643 -- c5762833ebde6d7110bf68041a823b571c238e9e by Gennadiy Rozental <rogeeff@google.com>: Move all the flag data into a single place instead of being split between handle and flag object. After this change CommandLineFlag will not hold any data anymore. And we also do not need to pass the CommandLineFlag around in Abseil Flag implementation to report flag name and location. PiperOrigin-RevId: 287899076 -- 8b5fb644f1e3d9267b7a75106fe9a72c886db786 by Derek Mauro <dmauro@google.com>: Upgrade CI testing to Bazel 2.0.0 and Clang 407ac2eb5f13 -fno-sanitize-blacklist is to workaround bazelbuild/bazel#10510 PiperOrigin-RevId: 287875363 -- a20cc1d58895de2babc3748a6c79d1d6813734ef by Abseil Team <absl-team@google.com>: Make ABSL_RETIRED_FLAG behave consistently with ABSL_FLAG. Before the change: ABSL_RETIRED_FLAG does not compile when there are competing ctors in the type, even when ABSL_FLAG does. After the change: ABSL_RETIRED_FLAG compiles when ABSL_FLAG does. PiperOrigin-RevId: 286483183 -- 1cff7e67329d2be9e50bee1f2e76ef9ffd2edde5 by Abseil Team <absl-team@google.com>: Support C++20 erase_if API in unordered associative containers See [unord.set.erasure]: https://eel.is/c++draft/unord.set.erasure See [unord.map.erasure]: https://eel.is/c++draft/unord.map.erasure PiperOrigin-RevId: 286461140 GitOrigin-RevId: 330051e00cd57ee516b4eaf656965656ffbcd0bc Change-Id: I5513110b41c2af08a44da54612cff341ac5c6607
Description of the problem / feature request:
Envoy (and other bazel projects) are failing asan builds with clang-10 due to a dependency check. The exact error message:
Tracking issue on OSS-Fuzz : google/oss-fuzz#3093
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Install clang-10 and build a bazel project (eg Envoy) with asan. OSS-Fuzz's docker image runs with this. The clang-10 installation in the docker environment was reverted in google/oss-fuzz#3093, building before this commit will reproduce the error.
The issue was solved by using Clang-9 release version.
What operating system are you running Bazel on?
Linux
What's the output of
bazel info release
?2.0.0
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?Have you found anything relevant by searching the web?
The patch that may have caused this issue is llvm/llvm-project@03b84e4#diff-e2fe4c5daa679eec2fe3bad655f14dc0
Comment from Pete Collingbourne:
The text was updated successfully, but these errors were encountered: