From 0d4ec614c0af7adafc14031f6f6aff7e19096da7 Mon Sep 17 00:00:00 2001 From: Spencer Jackson Date: Tue, 12 May 2026 12:46:20 -0700 Subject: [PATCH] SERVER-125835 Simplify Fuzzer build options (#53552) GitOrigin-RevId: f55bc770d4562167414322841a5af2b443a55baf --- .bazelrc | 5 +++++ .../cc/mongo_linux/mongo_linux_cc_toolchain_config.bzl | 9 +-------- etc/ubsan.denylist | 5 ++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.bazelrc b/.bazelrc index 8b8616d9009..03a12de89e6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -634,6 +634,11 @@ common:fission --remote_download_regex=.*\.dwo$ --config=fuzztest common:fuzztest --no@fuzztest//fuzztest:use_riegeli common:fuzztest --@fuzztest//fuzztest:centipede_integration=True +common:fuzztest --//bazel/config:fsan=True +common:fuzztest --//bazel/config:ubsan=True +common:fuzztest --//bazel/config:opt=debug +common:fuzztest --//bazel/config:allocator=system +common:fuzztest --compiler_type=clang # Avoid failing builds when BES metadata fails to upload. common --bes_upload_mode=fully_async diff --git a/bazel/toolchains/cc/mongo_linux/mongo_linux_cc_toolchain_config.bzl b/bazel/toolchains/cc/mongo_linux/mongo_linux_cc_toolchain_config.bzl index 624190a7909..1fb0ad7fe7d 100644 --- a/bazel/toolchains/cc/mongo_linux/mongo_linux_cc_toolchain_config.bzl +++ b/bazel/toolchains/cc/mongo_linux/mongo_linux_cc_toolchain_config.bzl @@ -1766,11 +1766,6 @@ def _impl(ctx): ], ) - # By default, undefined behavior sanitizer doesn't stop on the first error. Make - # it so. Newer versions of clang have renamed the flag. However, this flag - # cannot be included when using the fuzzer sanitizer if we want to suppress - # errors to uncover new ones. - # In dynamic builds, the `vptr` sanitizer check can require additional # dependency edges. That is very inconvenient, because such builds can't use # z,defs. The result is a very fragile link graph, where refactoring the link @@ -1779,9 +1774,7 @@ def _impl(ctx): # approaches in SERVER-49798 of adding a new descriptor type, but that didn't # address the fundamental issue that the correct link graph for a dynamic+ubsan # build isn't the same as the correct link graph for a regular dynamic build. - ubsan_compile_flags = [] - if not ctx.attr.fsan_enabled: - ubsan_compile_flags += ["-fno-sanitize-recover"] + ubsan_compile_flags = ["-fno-sanitize-recover"] if not ctx.attr.linkstatic: ubsan_compile_flags += ["-fno-sanitize=vptr"] ubsan_feature = feature( diff --git a/etc/ubsan.denylist b/etc/ubsan.denylist index fec255cb409..21dcca83770 100644 --- a/etc/ubsan.denylist +++ b/etc/ubsan.denylist @@ -9,10 +9,13 @@ fun:_ZN8S2CellId14FromFaceIJWrapEiii src:src/third_party/abseil-cpp/dist/absl/numeric/int128_have_intrinsic.inc +# fuzztest calls memcpy with a null dst when deserializing empty byte-vector corpus entries. +src:external/fuzztest~/* + # SERVER-62972 # libunwind has some UB when doing stack unwinding [alignment] fun:access_mem # TODO SERVER-102630 warns of unaligned access on code whose purpose is to prevent unaligned access. -src:src/third_party/gperftools/dist/src/base/basictypes.h +src:src/third_party/gperftools/dist/src/base/basictypes.h \ No newline at end of file