diff --git a/infra/base-images/base-builder/indexer/dwarf_info_diff.py b/infra/base-images/base-builder/indexer/dwarf_info_diff.py deleted file mode 100644 index 8e3e492f7cfb..000000000000 --- a/infra/base-images/base-builder/indexer/dwarf_info_diff.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2026 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Diffs compile commands generated via DWARF info and compilation databases.""" - -import collections -from collections.abc import Sequence -import json -import pathlib -from absl import app -from absl import flags -from absl import logging -import dwarf_info - -_BINARY_PATH = flags.DEFINE_string( - "binary_path", None, "Path to the binary file.", required=True -) - -_COMPILE_COMMANDS_PATH = flags.DEFINE_string( - "compile_commands_path", - None, - "Path to the compile commands file.", - required=True, -) - - -def main(argv: Sequence[str]) -> None: - if len(argv) > 1: - raise app.UsageError("Too many command-line arguments.") - - binary_path = pathlib.Path(_BINARY_PATH.value) - compilation_units = dwarf_info.get_all_compilation_units(binary_path) - logging.info("Found %d compilation units.", len(compilation_units)) - - # Question 1: Do we have repeated CU names in the binary? - cu_files = collections.Counter([cu.name for cu in compilation_units]) - logging.info("Most Common CU names: %s", cu_files.most_common(1)) - - libs = binary_path.parent / "lib" - for lib in libs.iterdir(): - new_cus = dwarf_info.get_all_compilation_units(lib) - logging.info("Found %d compilation units in %s", len(new_cus), lib) - compilation_units.extend(new_cus) - - with open(_COMPILE_COMMANDS_PATH.value, "r") as f: - compile_commands = json.load(f) - - # Question 2: Do we have repeated files in the compile commands? - cc_files = collections.Counter([cc["file"] for cc in compile_commands]) - logging.info("Most Common commands files: %s", cc_files.most_common(1)) - - cc_files = set(cc_files) - cu_files = set(cu_files) - - for file in cc_files - cu_files: - logging.info("File not found in CU: %s", file) - - for file in cu_files - cc_files: - logging.info("File not found in CC: %s", file) - - for file in cu_files.intersection(cc_files): - logging.info("File found in both: %s", file) - - -if __name__ == "__main__": - app.run(main) diff --git a/projects/s2geometry/build.sh b/projects/s2geometry/build.sh index 2d8f6efa251a..cfdc54f15961 100755 --- a/projects/s2geometry/build.sh +++ b/projects/s2geometry/build.sh @@ -18,7 +18,13 @@ cp $SRC/s2_fuzzer.cc $SRC/s2geometry/src/ cd $SRC/ -git clone --depth=1 --branch 20260107.1 https://github.com/abseil/abseil-cpp +# Keep this tag in sync with the abseil version s2geometry itself pins in its +# CMakeLists.txt FETCH_ABSEIL block, which is what upstream CI builds against. +# s2geometry now includes "absl/base/throw_delegate.h" (via +# src/s2/util/gtl/compact_array.h), a header that only exists from abseil +# 20260526.0 onwards -- with the older 20260107.1 pin every s2 translation unit +# failed with "'absl/base/throw_delegate.h' file not found". +git clone --depth=1 --branch 20260526.0 https://github.com/abseil/abseil-cpp cd abseil-cpp mkdir build && cd build cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON ../ && make && make install diff --git a/projects/tinyusb/build.sh b/projects/tinyusb/build.sh index 3bc62310fd17..3f72f1f62e5e 100755 --- a/projects/tinyusb/build.sh +++ b/projects/tinyusb/build.sh @@ -26,12 +26,49 @@ for f in test/fuzz/device/*/Makefile; do sed -i '/^[[:space:]]\+src[[:space:]]/s|src|$(abspath src)|' "$f" done +# test/fuzz/make.mk bakes a fixed instrumentation choice into CFLAGS: +# COVERAGE_FLAGS ?= -fsanitize-coverage=trace-pc-guard +# SANITIZER_FLAGS ?= -fsanitize=fuzzer -fsanitize=address +# Those are the right defaults for a developer running the harnesses by hand, +# but under OSS-Fuzz the engine and the sanitizer are chosen for us and are +# already present in $CFLAGS/$LIB_FUZZING_ENGINE. Both are "?=", so clearing +# them in the environment hands that choice back to OSS-Fuzz and stops, for +# example, an msan build from also being asked for -fsanitize=address. +export COVERAGE_FLAGS="" +export SANITIZER_FLAGS="" + fuzz_harness=$(ls -d test/fuzz/device/*/) for h in $fuzz_harness do + name=$(basename $h) make -C $h get-deps - make -C $h all - cp $h/_build/$(basename $h) $OUT/ + + if [ "$name" = "net_ncm" ]; then + # net_ncm is the one harness that does not include the shared + # make.mk/rules.mk. It is a standalone single-file harness whose Makefile + # sets its own flags outright: + # CFLAGS += $(addprefix -I,$(INC)) -g -O1 -fsanitize=address + # FUZZ_FLAGS := -fsanitize=fuzzer + # so it never consults $LIB_FUZZING_ENGINE and linked libFuzzer's main() no + # matter which engine was requested. Under centipede the resulting binary + # cannot dump a PC table, so check_build reported net_ncm as a broken target + # ("Could not get PCTable") and failed the whole project; the hardcoded + # -fsanitize=address would likewise collide with an msan build. + # + # Override both on the command line, which takes precedence over the "+=" + # and ":=" in the Makefile, and re-supply the two include paths that the + # overridden CFLAGS line would otherwise have contributed ($(TOP)/src and + # the harness directory, which holds tusb_config.h). -lc++ is needed because + # this harness links with $CC rather than $CXX while the engine archive is + # C++. + make -C $h all \ + CFLAGS="$CFLAGS -I$SRC/tinyusb/src -I." \ + FUZZ_FLAGS="$LIB_FUZZING_ENGINE -lc++" + else + make -C $h all + fi + + cp $h/_build/$name $OUT/ corpus=$h/$(basename $h)_seed_corpus.zip if test -f $corpus; then cp $corpus $OUT/