From c3e19c5d6c69dacf7f8afc05c9973a66ec287551 Mon Sep 17 00:00:00 2001 From: Keno Hassler <40292329+kenohassler@users.noreply.github.com> Date: Wed, 2 Sep 2026 15:14:36 +0200 Subject: [PATCH] spirv-cross: remove integration spirv-cross is not meant to be used with untrusted input (https://github.com/KhronosGroup/SPIRV-Cross/issues/2413) and maintainers generally do not regard fuzzer bug reports helpful in their threat model (https://github.com/KhronosGroup/SPIRV-Cross/issues/2667). They recommend pre-validating input with spirv-val, which is tested as part of the spirv-tools integration in oss-fuzz. Ergo, remove spirv-cross, as it is only wasting CPU cycles. --- projects/spirv-cross/Dockerfile | 27 -------------- projects/spirv-cross/build.sh | 49 -------------------------- projects/spirv-cross/parser_fuzzer.cpp | 44 ----------------------- projects/spirv-cross/patch.diff | 13 ------- projects/spirv-cross/project.yaml | 9 ----- projects/spirv-cross/run_tests.sh | 18 ---------- 6 files changed, 160 deletions(-) delete mode 100644 projects/spirv-cross/Dockerfile delete mode 100644 projects/spirv-cross/build.sh delete mode 100644 projects/spirv-cross/parser_fuzzer.cpp delete mode 100644 projects/spirv-cross/patch.diff delete mode 100644 projects/spirv-cross/project.yaml delete mode 100755 projects/spirv-cross/run_tests.sh diff --git a/projects/spirv-cross/Dockerfile b/projects/spirv-cross/Dockerfile deleted file mode 100644 index 46bdb6ac6012..000000000000 --- a/projects/spirv-cross/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2024 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. -# -################################################################################ - -FROM gcr.io/oss-fuzz-base/base-builder -RUN apt-get update && \ - apt-get install -y build-essential autoconf automake libtool pkg-config make \ - cmake - - -RUN git clone https://github.com/KhronosGroup/SPIRV-Cross spirv-cross -WORKDIR $SRC/spirv-cross - -COPY *_fuzzer.cpp *.diff *.sh $SRC/ - diff --git a/projects/spirv-cross/build.sh b/projects/spirv-cross/build.sh deleted file mode 100644 index dd945685ab35..000000000000 --- a/projects/spirv-cross/build.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -eu -# Copyright 2024 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. -# -################################################################################ - -# Apply the following patch for tests to succeed. -git apply --ignore-space-change --ignore-whitespace ../patch.diff - -# Update submodule -./checkout_glslang_spirv_tools.sh -NPROC="--parallel $(nproc)" ./build_glslang_spirv_tools.sh - -# Build spirv-cross binaries with debug options -cmake -S . -B build/ -D CMAKE_BUILD_TYPE=Debug \ - -D CMAKE_CXX_FLAGS="$CXXFLAGS -pthread -stdlib=libc++" -cmake --build build --config Debug --parallel $(nproc) - -# Copy built binaries of the spirv-cross project -for fuzzers in $(find $SRC -maxdepth 1 -name '*_fuzzer.cpp'); do - fuzz_basename=$(basename -s .cpp $fuzzers) - $CXX $CXXFLAGS -std=c++17 -I$SRC/spirv-cross \ - -I$SRC/spirv-cross/external/spirv-tools \ - -I$SRC/spirv-cross/external/spirv-tools/include \ - -c $fuzzers -o $fuzz_basename.o - - $CXX $CXXFLAGS -std=c++17 $LIB_FUZZING_ENGINE \ - $fuzz_basename.o -o $OUT/$fuzz_basename \ - -Wl,--start-group \ - $SRC/spirv-cross/build/*.a \ - $SRC/spirv-cross/external/glslang-build/output/lib/*.a \ - -Wl,--end-group -done - -cd $SRC/ -mkdir -p spirv-corpus -find $SRC/spirv-cross -name "*.spv" -exec cp {} $SRC/spirv-corpus \; -zip -q -r -j $OUT/parser_fuzzer_seed_corpus.zip $SRC/spirv-corpus/* diff --git a/projects/spirv-cross/parser_fuzzer.cpp b/projects/spirv-cross/parser_fuzzer.cpp deleted file mode 100644 index f726aecc63b6..000000000000 --- a/projects/spirv-cross/parser_fuzzer.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright 2024 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. -*/ - -#include "spirv_common.hpp" -#include "spirv_parser.hpp" -#include -#include - -using namespace spirv_cross; - -extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - // Skip this iteration if data is not enough - if (size < (sizeof(uint32_t) * 5) || (size % 4 != 0)) { - return 0; - } - - // Initialise objects and random data - std::vector spirv_data((uint32_t *)data, (uint32_t *)(data + size)); - - // Set magic number, since this is needed to get past initial checks. - spirv_data[0] = 0x07230203; - spirv_data[1] = 0x10600; - - Parser parser(spirv_data); - ParsedIR &ir = parser.get_parsed_ir(); - SPIRFunction *current_function = nullptr; - SPIRBlock *current_block = nullptr; - - try { - parser.parse(); - } catch (...) { - } - - return 0; -} diff --git a/projects/spirv-cross/patch.diff b/projects/spirv-cross/patch.diff deleted file mode 100644 index 68c8b04f389b..000000000000 --- a/projects/spirv-cross/patch.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/Makefile b/Makefile -index b44eb5e8..def197c9 100644 ---- a/Makefile -+++ b/Makefile -@@ -30,7 +30,7 @@ all: $(TARGET) - -include $(DEPS) - - $(TARGET): $(CLI_OBJECTS) $(STATIC_LIB) -- $(CXX) -o $@ $(CLI_OBJECTS) $(STATIC_LIB) $(LDFLAGS) -+ $(CXX) ${CXXFLAGS} -o $@ $(CLI_OBJECTS) $(STATIC_LIB) $(LDFLAGS) - - $(STATIC_LIB): $(OBJECTS) - $(AR) rcs $@ $(OBJECTS) diff --git a/projects/spirv-cross/project.yaml b/projects/spirv-cross/project.yaml deleted file mode 100644 index 14679f8d14e3..000000000000 --- a/projects/spirv-cross/project.yaml +++ /dev/null @@ -1,9 +0,0 @@ -homepage: "https://github.com/KhronosGroup/SPIRV-Cross" -main_repo: "https://github.com/KhronosGroup/SPIRV-Cross.git" -language: c++ -sanitizers: -- address -vendor_ccs: -- "fuzzing@fuchsia.dev" -- "david@adalogics.com" -- "arthur.chan@adalogics.com" diff --git a/projects/spirv-cross/run_tests.sh b/projects/spirv-cross/run_tests.sh deleted file mode 100755 index b4ec0a6843b5..000000000000 --- a/projects/spirv-cross/run_tests.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -eu -# Copyright 2025 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. -# -############################################################################### -export CXXFLAGS="$CXXFLAGS -pthread -stdlib=libc++" -./test_shaders.sh --parallel