Skip to content

Commit

Permalink
Revert "Make FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION depend on optim…
Browse files Browse the repository at this point in the history
…ize_for_fuzzing GN arg."

This reverts commit 2b4c029.

FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION, introduced in r452783, is the
documented macro to be used by code that should behave differently when
targeting fuzzers. Since r562499, this macro is only defined when when
optimize_for_fuzzing=true is used. In r597184, optimize_for_fuzzing was
made impossible to use on Windows. As a result of all of this,
FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION doesn't work on Windows because
there is no build configuration that results in it being set.

This CL resolves the problem by making
FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION conditional only on
use_fuzzing_engine=true so that it is set for all builds that target
fuzzers.

Fixed: 1483560
Change-Id: I29a20f42e222b4547ed5191014289582dd058d86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4874264
Reviewed-by: Jonathan Metzman <[email protected]>
Commit-Queue: Greg Thompson <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1201378}
  • Loading branch information
GregTho authored and Chromium LUCI CQ committed Sep 26, 2023
1 parent 39e4058 commit 05d6817
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 4 additions & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import("//build/config/dcheck_always_on.gni")
import("//build/config/gclient_args.gni")
import("//build/config/host_byteorder.gni")
import("//build/config/rust.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//build/config/unwind.gni")
import("//build/toolchain/cc_wrapper.gni")
Expand Down Expand Up @@ -86,6 +85,10 @@ declare_args() {
# the needed gcov profiling data.
auto_profile_path = ""

# Optimize for coverage guided fuzzing (balance between speed and number of
# branches)
optimize_for_fuzzing = false

# Path to an AFDO profile to use while building with clang, if any. Empty
# implies none.
clang_sample_profile_path = ""
Expand Down
4 changes: 2 additions & 2 deletions build/config/sanitizers/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ config("asan_flags") {
# odr-violation errors in rust code, and link failures for cros/asan.
# Clang recently turned it on by default for all ELF targets (it was
# already on for Fuchsia). Pass the flag to turn it back off.
cflags += ["-fno-sanitize-address-globals-dead-stripping"]
cflags += [ "-fno-sanitize-address-globals-dead-stripping" ]
}
if (is_win) {
if (!defined(asan_win_blocklist_path)) {
Expand Down Expand Up @@ -550,7 +550,7 @@ config("ubsan_vptr_flags") {
}

config("fuzzing_build_mode") {
if (use_fuzzing_engine && optimize_for_fuzzing) {
if (use_fuzzing_engine) {
defines = [ "FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" ]
}
}
Expand Down
4 changes: 0 additions & 4 deletions build/config/sanitizers/sanitizers.gni
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ declare_args() {
# Not for client use.
disable_libfuzzer = false

# Optimize for coverage guided fuzzing (balance between speed and number of
# branches). Can be also used to remove non-determinism and other issues.
optimize_for_fuzzing = false

# Value for -fsanitize-coverage flag. Setting this causes
# use_sanitizer_coverage to be enabled.
# This flag is not used for libFuzzer (use_libfuzzer=true). Instead, we use:
Expand Down

0 comments on commit 05d6817

Please sign in to comment.