From 89c7c5469f5c668963c52a8a4716273f458a0257 Mon Sep 17 00:00:00 2001 From: "rahul.singh" Date: Thu, 12 Mar 2026 06:48:00 +0100 Subject: [PATCH 1/2] Adopt sanitizers from @score_cpp_policies --- .bazelrc | 46 +++++++- MODULE.bazel | 8 ++ .../integration_testing.bzl | 10 +- .../sanitizer_support/BUILD} | 22 ++-- quality/sanitizer/BUILD | 102 ------------------ quality/sanitizer/asan.supp | 17 --- .../sanitizer/asan_ubsan_lsan.env.template | 3 - quality/sanitizer/constraints/BUILD | 49 --------- quality/sanitizer/flags/BUILD | 51 --------- quality/sanitizer/lsan.supp | 17 --- quality/sanitizer/sanitizer.bazelrc | 45 -------- .../sanitizer/sanitizers_functional_test.sh | 67 ------------ quality/sanitizer/test_workspace/MODULE.bazel | 43 -------- .../asan_fail_heap_out_of_bounds.cpp | 8 -- .../test_workspace/lsan_fail_leak.cpp | 18 ---- .../test_workspace/tsan_fail_data_race.cpp | 38 ------- quality/sanitizer/tsan.env.template | 1 - quality/sanitizer/tsan.supp | 31 ------ quality/sanitizer/ubsan.supp | 17 --- quality/sanitizer/wrapper.sh | 17 --- score/mw/com/impl/plumbing/rust/BUILD | 4 +- .../consumer_restart/integration_test/BUILD | 2 +- .../provider_restart/integration_test/BUILD | 2 +- .../integration_test/BUILD | 2 +- .../integration_test/BUILD | 2 +- 25 files changed, 73 insertions(+), 549 deletions(-) rename quality/{sanitizer/test_workspace/BUILD.tpl => integration_testing/sanitizer_support/BUILD} (56%) delete mode 100644 quality/sanitizer/BUILD delete mode 100644 quality/sanitizer/asan.supp delete mode 100644 quality/sanitizer/asan_ubsan_lsan.env.template delete mode 100644 quality/sanitizer/constraints/BUILD delete mode 100644 quality/sanitizer/flags/BUILD delete mode 100644 quality/sanitizer/lsan.supp delete mode 100644 quality/sanitizer/sanitizer.bazelrc delete mode 100755 quality/sanitizer/sanitizers_functional_test.sh delete mode 100644 quality/sanitizer/test_workspace/MODULE.bazel delete mode 100644 quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp delete mode 100644 quality/sanitizer/test_workspace/lsan_fail_leak.cpp delete mode 100644 quality/sanitizer/test_workspace/tsan_fail_data_race.cpp delete mode 100644 quality/sanitizer/tsan.env.template delete mode 100644 quality/sanitizer/tsan.supp delete mode 100644 quality/sanitizer/ubsan.supp delete mode 100755 quality/sanitizer/wrapper.sh diff --git a/.bazelrc b/.bazelrc index 7a664a902..064ff9bf5 100644 --- a/.bazelrc +++ b/.bazelrc @@ -88,7 +88,51 @@ test:clang-tidy --output_groups=+rules_lint_report test:clang-tidy --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux test:clang-tidy --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain -import quality/sanitizer/sanitizer.bazelrc +# ============================================================================== +# Sanitizer Configurations (adapted from @score_cpp_policies) +# ============================================================================== + +# Debug symbols for sanitizer stack traces +test:with_debug_symbols --cxxopt=-gline-tables-only +test:with_debug_symbols --cxxopt=-gcolumn-info +test:with_debug_symbols --strip=never + +# ASan + UBSan + LSan (Combined) +build:asan_ubsan_lsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux +build:asan_ubsan_lsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain +build:asan_ubsan_lsan --cxxopt=-fsanitize=undefined,address,leak +build:asan_ubsan_lsan --cxxopt=-fno-omit-frame-pointer +build:asan_ubsan_lsan --cxxopt=-fno-common +build:asan_ubsan_lsan --linkopt=-fsanitize=undefined,address,leak +build:asan_ubsan_lsan --linkopt=-fsanitize-link-c++-runtime +build:asan_ubsan_lsan --platform_suffix=asan_ubsan +test:asan_ubsan_lsan --config=with_debug_symbols +test:asan_ubsan_lsan --test_tag_filters=-no-asan,-no-lsan,-no-ubsan +test:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:sanitizer=asan_ubsan_lsan +test:asan_ubsan_lsan --run_under=@score_cpp_policies//sanitizers:wrapper + +# Shortcuts for individual sanitizers +build:asan --config=asan_ubsan_lsan +test:asan --test_tag_filters=-no-asan +build:ubsan --config=asan_ubsan_lsan +test:ubsan --test_tag_filters=-no-ubsan +build:lsan --config=asan_ubsan_lsan +test:lsan --test_tag_filters=-no-lsan + +# ThreadSanitizer +build:tsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux +build:tsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain +build:tsan --cxxopt=-fsanitize=thread +build:tsan --cxxopt=-O1 +build:tsan --linkopt=-fsanitize=thread +build:tsan --linkopt=-fsanitize-link-c++-runtime +build:tsan --platform_suffix=tsan +test:tsan --config=with_debug_symbols +test:tsan --test_tag_filters=-no-tsan +test:tsan --@score_cpp_policies//sanitizers/flags:sanitizer=tsan +test:tsan --run_under=@score_cpp_policies//sanitizers:wrapper + +# ============================================================================== common:codeql --platform_suffix=codeql common:codeql --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux diff --git a/MODULE.bazel b/MODULE.bazel index 7d63365ac..9d0624853 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -14,6 +14,14 @@ module(name = "score_communication") bazel_dep(name = "platforms", version = "1.0.0") +# Centralized sanitizer policies (ASan, TSan, UBSan, LSan) +bazel_dep(name = "score_cpp_policies", version = "0.0.0", dev_dependency = True) +git_override( + module_name = "score_cpp_policies", + commit = "d6f8104", # tip of rs/swp-245137 branch + remote = "https://github.com/RSingh1511/score_cpp_policies.git", +) + bazel_dep(name = "gcc_toolchain", version = "0.9.0", dev_dependency = True) gcc_toolchains = use_extension("@gcc_toolchain//toolchain:module_extensions.bzl", "gcc_toolchains", dev_dependency = True) diff --git a/quality/integration_testing/integration_testing.bzl b/quality/integration_testing/integration_testing.bzl index 7ec24fda8..9daa3a38b 100644 --- a/quality/integration_testing/integration_testing.bzl +++ b/quality/integration_testing/integration_testing.bzl @@ -51,14 +51,14 @@ def integration_test(name, srcs, filesystem, **kwargs): }), os = "linux", env = select({ - "//quality/sanitizer/flags:none": None, - "//quality/sanitizer/flags:any_sanitizer": "//quality/sanitizer:absolute_env", + "@score_cpp_policies//sanitizers/flags:none": None, + "@score_cpp_policies//sanitizers/flags:any_sanitizer": "@score_cpp_policies//sanitizers:absolute_env", }), tars = [ filesystem, ] + select({ - "//quality/sanitizer/flags:none": [], - "//quality/sanitizer/flags:any_sanitizer": ["//quality/sanitizer:suppressions_pkg"], + "@score_cpp_policies//sanitizers/flags:none": [], + "@score_cpp_policies//sanitizers/flags:any_sanitizer": ["//quality/integration_testing/sanitizer_support:suppressions_pkg"], }) + [ "@ubuntu24_04//:ubuntu24_04", ], @@ -166,7 +166,7 @@ def integration_test(name, srcs, filesystem, **kwargs): _extend_list_in_kwargs_without_duplicates( kwargs, "target_compatible_with", - ["//quality/sanitizer/constraints:no_tsan"], + ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) test_as_exec( diff --git a/quality/sanitizer/test_workspace/BUILD.tpl b/quality/integration_testing/sanitizer_support/BUILD similarity index 56% rename from quality/sanitizer/test_workspace/BUILD.tpl rename to quality/integration_testing/sanitizer_support/BUILD index 2b138b505..6416d9d3f 100644 --- a/quality/sanitizer/test_workspace/BUILD.tpl +++ b/quality/integration_testing/sanitizer_support/BUILD @@ -1,5 +1,5 @@ # ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation +# Copyright (c) 2026 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -11,17 +11,13 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -cc_test( - name = "asan_fail_heap_out_of_bounds", - srcs = ["asan_fail_heap_out_of_bounds.cpp"], -) - -cc_test( - name = "lsan_fail_leak", - srcs = ["lsan_fail_leak.cpp"], -) +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") -cc_test( - name = "tsan_fail_data_race", - srcs = ["tsan_fail_data_race.cpp"], +# Re-package suppressions from @score_cpp_policies for integration testing +pkg_tar( + name = "suppressions_pkg", + srcs = ["@score_cpp_policies//sanitizers:suppressions"], + mode = "0444", + package_dir = "sanitizers/suppressions", + visibility = ["//visibility:public"], ) diff --git a/quality/sanitizer/BUILD b/quality/sanitizer/BUILD deleted file mode 100644 index bdaee0f14..000000000 --- a/quality/sanitizer/BUILD +++ /dev/null @@ -1,102 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -load("@rules_pkg//pkg:tar.bzl", "pkg_tar") -load("//bazel/rules:expand_template.bzl", "expand_template") - -sh_test( - name = "sanitizers_functional_test", - srcs = ["sanitizers_functional_test.sh"], - data = [ - "sanitizer.bazelrc", - "test_workspace/BUILD.tpl", - "test_workspace/MODULE.bazel", - "test_workspace/asan_fail_heap_out_of_bounds.cpp", - "test_workspace/lsan_fail_leak.cpp", - "test_workspace/tsan_fail_data_race.cpp", - ], - env_inherit = [ - "PATH", - "http_proxy", - "https_proxy", - ], - tags = [ - "local", # Test marked local because it uses bazel. - "manual", # Due to long-runtime and local dependencies - ], - deps = ["@bazel_tools//tools/bash/runfiles"], -) - -filegroup( - name = "env_template", - srcs = select({ - "//quality/sanitizer/flags:tsan": ["tsan.env.template"], - "//quality/sanitizer/flags:asan_ubsan_lsan": ["asan_ubsan_lsan.env.template"], - }), - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], -) - -[ - expand_template( - name = name + "_env", - out = name + "_sanitizer.env", - substitutions = { - "%ROOT%": root, - }, - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], - template = ":env_template", - visibility = ["//:__subpackages__"], - ) - for name, root in ( - [ - "absolute", - "/", - ], - [ - "relative", - "./", - ], - ) -] - -filegroup( - name = "suppressions", - srcs = select({ - "//quality/sanitizer/flags:tsan": ["tsan.supp"], - "//quality/sanitizer/flags:asan_ubsan_lsan": [ - "asan.supp", - "lsan.supp", - "ubsan.supp", - ], - }), - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], -) - -pkg_tar( - name = "suppressions_pkg", - srcs = [":suppressions"], - mode = "0444", - package_dir = "quality/sanitizer", - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], - visibility = ["//:__subpackages__"], -) - -sh_binary( - name = "wrapper", - srcs = ["wrapper.sh"], - data = [ - ":relative_env", - ":suppressions", - ], - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], -) diff --git a/quality/sanitizer/asan.supp b/quality/sanitizer/asan.supp deleted file mode 100644 index 9050e0fe3..000000000 --- a/quality/sanitizer/asan.supp +++ /dev/null @@ -1,17 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -# Suppressions for the AddressSanitizer -# See: https://clang.llvm.org/docs/AddressSanitizer.html#issue-suppression -# Every suppression requires a justification. -# Suppressions that share the same justification may be organized in a single block. diff --git a/quality/sanitizer/asan_ubsan_lsan.env.template b/quality/sanitizer/asan_ubsan_lsan.env.template deleted file mode 100644 index 1842d7a18..000000000 --- a/quality/sanitizer/asan_ubsan_lsan.env.template +++ /dev/null @@ -1,3 +0,0 @@ -ASAN_OPTIONS=exitcode=55 allow_addr2line=1 verbosity=1 coverage=1 check_initialization_order=1 detect_stack_use_after_return=1 print_stats=1 halt_on_error=1 allocator_may_return_null=1 detect_leaks=1 suppressions=%ROOT%quality/sanitizer/asan.supp -UBSAN_OPTIONS=exitcode=55 allow_addr2line=1 verbosity=1 coverage=1 print_stacktrace=1 halt_on_error=1 suppressions=%ROOT%quality/sanitizer/ubsan.supp -LSAN_OPTIONS=exitcode=55 suppressions=%ROOT%quality/sanitizer/lsan.supp diff --git a/quality/sanitizer/constraints/BUILD b/quality/sanitizer/constraints/BUILD deleted file mode 100644 index 8d7b7beb3..000000000 --- a/quality/sanitizer/constraints/BUILD +++ /dev/null @@ -1,49 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -constraint_setting( - name = "dummy_setting", - default_constraint_value = ":always_true", -) - -constraint_value( - name = "always_true", - constraint_setting = ":dummy_setting", -) - -alias( - name = "any_sanitizer", - actual = select({ - "//quality/sanitizer/flags:any_sanitizer": ":always_true", - "//conditions:default": "@platforms//:incompatible", - }), - visibility = ["//:__subpackages__"], -) - -alias( - name = "no_asan_ubsan_lsan", - actual = select({ - "//quality/sanitizer/flags:asan_ubsan_lsan": "@platforms//:incompatible", - "//conditions:default": ":always_true", - }), - visibility = ["//:__subpackages__"], -) - -alias( - name = "no_tsan", - actual = select({ - "//quality/sanitizer/flags:tsan": "@platforms//:incompatible", - "//conditions:default": ":always_true", - }), - visibility = ["//:__subpackages__"], -) diff --git a/quality/sanitizer/flags/BUILD b/quality/sanitizer/flags/BUILD deleted file mode 100644 index 622e790a5..000000000 --- a/quality/sanitizer/flags/BUILD +++ /dev/null @@ -1,51 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -load("@bazel_skylib//lib:selects.bzl", "selects") -load("@bazel_skylib//rules:common_settings.bzl", "string_flag") - -string_flag( - name = "sanitizer", - build_setting_default = "none", - values = [ - "none", - "asan_ubsan_lsan", - "tsan", - ], -) - -config_setting( - name = "none", - flag_values = {":sanitizer": "none"}, - visibility = ["//:__subpackages__"], -) - -config_setting( - name = "asan_ubsan_lsan", - flag_values = {":sanitizer": "asan_ubsan_lsan"}, - visibility = ["//:__subpackages__"], -) - -config_setting( - name = "tsan", - flag_values = {":sanitizer": "tsan"}, - visibility = ["//:__subpackages__"], -) - -selects.config_setting_group( - name = "any_sanitizer", - match_any = [ - ":asan_ubsan_lsan", - ":tsan", - ], -) diff --git a/quality/sanitizer/lsan.supp b/quality/sanitizer/lsan.supp deleted file mode 100644 index 01fbf90fe..000000000 --- a/quality/sanitizer/lsan.supp +++ /dev/null @@ -1,17 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -# Suppressions for the LeakSanitizer -# See: https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions -# Every suppression requires a justification. -# Suppressions that share the same justification may be organized in a single block. diff --git a/quality/sanitizer/sanitizer.bazelrc b/quality/sanitizer/sanitizer.bazelrc deleted file mode 100644 index 11c74d3a6..000000000 --- a/quality/sanitizer/sanitizer.bazelrc +++ /dev/null @@ -1,45 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -# todo: Extract to toolchain feature once possible - -test:with_debug_symbols --cxxopt -gline-tables-only -test:with_debug_symbols --cxxopt -gcolumn-info -test:with_debug_symbols --strip=never - -test:asan_ubsan_lsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux -test:asan_ubsan_lsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain -test:asan_ubsan_lsan --config=with_debug_symbols -test:asan_ubsan_lsan --run_under=//quality/sanitizer:wrapper -test:asan_ubsan_lsan --//quality/sanitizer/flags:sanitizer=asan_ubsan_lsan -test:asan_ubsan_lsan --cxxopt -fsanitize=undefined,address,leak -test:asan_ubsan_lsan --cxxopt -fno-omit-frame-pointer -test:asan_ubsan_lsan --cxxopt -fno-common -test:asan_ubsan_lsan --linkopt -fsanitize=undefined,address,leak -test:asan_ubsan_lsan --linkopt -fsanitize-link-c++-runtime -test:asan_ubsan_lsan --platform_suffix=asan_ubsan - -test:asan --config=asan_ubsan_lsan -test:ubsan --config=asan_ubsan_lsan -test:lsan --config=asan_ubsan_lsan - -test:tsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux -test:tsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain -test:tsan --config=with_debug_symbols -test:tsan --run_under=//quality/sanitizer:wrapper -test:tsan --//quality/sanitizer/flags:sanitizer=tsan -test:tsan --cxxopt -fsanitize=thread -test:tsan --cxxopt -O1 -test:tsan --linkopt -fsanitize=thread -test:tsan --linkopt -fsanitize-link-c++-runtime -test:tsan --platform_suffix=tsan diff --git a/quality/sanitizer/sanitizers_functional_test.sh b/quality/sanitizer/sanitizers_functional_test.sh deleted file mode 100755 index b0cde5c8a..000000000 --- a/quality/sanitizer/sanitizers_functional_test.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -# --- begin runfiles.bash initialization --- -# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash). -#set -euo pipefail -if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then - if [[ -f "$0.runfiles_manifest" ]]; then - export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest" - elif [[ -f "$0.runfiles/MANIFEST" ]]; then - export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST" - elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then - export RUNFILES_DIR="$0.runfiles" - fi -fi -if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then - source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" -elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then - source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \ - "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)" -else - echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" - exit 1 -fi -# --- end runfiles.bash initialization --- - -rm -rf test_workspace -mkdir -p test_workspace -touch test_workspace/WORKSPACE - -# Unit under test -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/sanitizer.bazelrc)" "test_workspace/.bazelrc" - -# Test-Workspace -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/MODULE.bazel)" "test_workspace/MODULE.bazel" -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/BUILD.tpl)" "test_workspace/BUILD" -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp)" "test_workspace/asan_fail_heap_out_of_bounds.cpp" -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/lsan_fail_leak.cpp)" "test_workspace/lsan_fail_leak.cpp" -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/tsan_fail_data_race.cpp)" "test_workspace/tsan_fail_data_race.cpp" - -cd test_workspace - -if bazel test --config=asan //:asan_fail_heap_out_of_bounds; then - exit 1; -fi - -if bazel test --config=lsan //:lsan_fail_leak; then - exit 1; -fi - -if bazel test --config=tsan //:tsan_fail_data_race; then - exit 1; -fi - -exit 0; diff --git a/quality/sanitizer/test_workspace/MODULE.bazel b/quality/sanitizer/test_workspace/MODULE.bazel deleted file mode 100644 index 66e742149..000000000 --- a/quality/sanitizer/test_workspace/MODULE.bazel +++ /dev/null @@ -1,43 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* -module(name = "foo") - -bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True) - -llvm = use_extension( - "@toolchains_llvm//toolchain/extensions:llvm.bzl", - "llvm", - dev_dependency = True, -) -llvm.toolchain( - compile_flags = {"": [ - "-march=nehalem", - "-ffp-model=strict", - # Security - "-U_FORTIFY_SOURCE", # https://github.com/google/sanitizers/issues/247 - "-fstack-protector", - "-fno-omit-frame-pointer", - # Diagnostics - "-fcolor-diagnostics", - "-Wno-deprecated-declarations", - "-Wno-error=self-assign-overloaded", - "-Wthread-safety", - ]}, - cxx_standard = {"": "c++17"}, - link_libs = {"": [ - "-lrt", - ]}, - llvm_version = "16.0.0", - stdlib = {"": "dynamic-stdc++"}, -) -use_repo(llvm, "llvm_toolchain") diff --git a/quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp b/quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp deleted file mode 100644 index 6b524fdf5..000000000 --- a/quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// This code snippet is copied from https://github.com/google/sanitizers/wiki/AddressSanitizerExampleHeapOutOfBounds -int main(int argc, char **argv) { - int *array = new int[100]; - array[0] = 0; - int res = array[argc + 100]; // BOOM - delete [] array; - return res; -} diff --git a/quality/sanitizer/test_workspace/lsan_fail_leak.cpp b/quality/sanitizer/test_workspace/lsan_fail_leak.cpp deleted file mode 100644 index d4b38aeb3..000000000 --- a/quality/sanitizer/test_workspace/lsan_fail_leak.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************** -* Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -int main() { - auto *p = new int[100]; - p[0] = 0; // Leaked memory - return 0; -} diff --git a/quality/sanitizer/test_workspace/tsan_fail_data_race.cpp b/quality/sanitizer/test_workspace/tsan_fail_data_race.cpp deleted file mode 100644 index d29ae4f51..000000000 --- a/quality/sanitizer/test_workspace/tsan_fail_data_race.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include -#include - -// This is a very basic example of a data-race condition, which should be found by a thread-sanitizer -int main() -{ - std::uint32_t some_number{0}; - - std::thread first_thread{[&some_number]() { - for (int i = 0; i < 100; i++) - { - some_number++; - } - }}; - - std::thread second_thread{[&some_number]() { - for (int i = 0; i < 100; i++) - { - some_number++; - } - }}; - - first_thread.join(); - second_thread.join(); - return 0; -} diff --git a/quality/sanitizer/tsan.env.template b/quality/sanitizer/tsan.env.template deleted file mode 100644 index e2cac276e..000000000 --- a/quality/sanitizer/tsan.env.template +++ /dev/null @@ -1 +0,0 @@ -TSAN_OPTIONS=exitcode=55 allow_addr2line=1 verbosity=1 coverage=1 detect_deadlocks=1 second_deadlock_stack=1 halt_on_error=0 suppressions=%ROOT%quality/sanitizer/tsan.supp diff --git a/quality/sanitizer/tsan.supp b/quality/sanitizer/tsan.supp deleted file mode 100644 index 8f571941a..000000000 --- a/quality/sanitizer/tsan.supp +++ /dev/null @@ -1,31 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -# Suppressions for the ThreadSanitizer -# See: https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions -# Every suppression requires a justification. -# Suppressions that share the same justification may be organized in a single block. - - -# Standard library false positives (caused by a stdlib built without tsan instrumentation) -# We accept this because building the stdlib with instrumentation is currently out of scope. -race:include/c++/v1/ios - -# TODO ticket -called_from_lib:sample_ptr_test_rs -called_from_lib:sample_allocatee_ptr_test_rs - -# Rust's stdlib test runner is not built with TSan instrumentation, so TSan cannot observe the -# pthread_create happens-before relationship and incorrectly reports a race on the closure data transferred to the spawned test thread. -race:> -race:test::run_test diff --git a/quality/sanitizer/ubsan.supp b/quality/sanitizer/ubsan.supp deleted file mode 100644 index 0b1a39adb..000000000 --- a/quality/sanitizer/ubsan.supp +++ /dev/null @@ -1,17 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -# Suppressions for the UndefinedBehaviorSanitizer -# See: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions -# Every suppression requires a justification. -# Suppressions that share the same justification may be organized in a single block. diff --git a/quality/sanitizer/wrapper.sh b/quality/sanitizer/wrapper.sh deleted file mode 100755 index 57ffb0618..000000000 --- a/quality/sanitizer/wrapper.sh +++ /dev/null @@ -1,17 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -IFS=' -' -export $(cat quality/sanitizer/relative_sanitizer.env) -$@ diff --git a/score/mw/com/impl/plumbing/rust/BUILD b/score/mw/com/impl/plumbing/rust/BUILD index 3f57119b2..b7a790e19 100644 --- a/score/mw/com/impl/plumbing/rust/BUILD +++ b/score/mw/com/impl/plumbing/rust/BUILD @@ -47,7 +47,7 @@ rust_test( srcs = ["sample_allocatee_ptr.rs"], features = ["link_std_cpp_lib"], # Disabled for thread sanitizer because of detected race (Ticket-246891) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], deps = [ ":common_rs", "//score/mw/com/impl/plumbing/rust/test_support:test_helper_size_ffi_rs", @@ -60,7 +60,7 @@ rust_test( srcs = ["sample_ptr.rs"], features = ["link_std_cpp_lib"], # Disabled for thread sanitizer because of detected race (Ticket-246891) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], deps = [ ":common_rs", "//score/mw/com/impl/plumbing/rust/test_support:test_helper_size_ffi_rs", diff --git a/score/mw/com/test/partial_restart/consumer_restart/integration_test/BUILD b/score/mw/com/test/partial_restart/consumer_restart/integration_test/BUILD index 93af8fba8..ca702eb2d 100644 --- a/score/mw/com/test/partial_restart/consumer_restart/integration_test/BUILD +++ b/score/mw/com/test/partial_restart/consumer_restart/integration_test/BUILD @@ -27,5 +27,5 @@ integration_test( srcs = ["test_consumer_restart.py"], filesystem = ":filesystem", # Disabled for thread sanitizer because of detected race (Ticket-246892) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) diff --git a/score/mw/com/test/partial_restart/provider_restart/integration_test/BUILD b/score/mw/com/test/partial_restart/provider_restart/integration_test/BUILD index 67f4638ed..6bcd81b45 100644 --- a/score/mw/com/test/partial_restart/provider_restart/integration_test/BUILD +++ b/score/mw/com/test/partial_restart/provider_restart/integration_test/BUILD @@ -26,5 +26,5 @@ integration_test( srcs = ["test_provider_restart.py"], filesystem = ":filesystem", # Disabled for thread sanitizer because of detected race (Ticket-246892) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) diff --git a/score/mw/com/test/partial_restart/provider_restart_max_subscribers/integration_test/BUILD b/score/mw/com/test/partial_restart/provider_restart_max_subscribers/integration_test/BUILD index 912d4a10f..d3aa7e10c 100644 --- a/score/mw/com/test/partial_restart/provider_restart_max_subscribers/integration_test/BUILD +++ b/score/mw/com/test/partial_restart/provider_restart_max_subscribers/integration_test/BUILD @@ -27,5 +27,5 @@ integration_test( srcs = ["test_provider_restart_max_subscribers.py"], filesystem = ":filesystem", # Disabled for thread sanitizer because of detected race (Ticket-246892) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) diff --git a/score/mw/com/test/service_discovery_during_consumer_crash/integration_test/BUILD b/score/mw/com/test/service_discovery_during_consumer_crash/integration_test/BUILD index a1171d5ad..70d0efbdf 100644 --- a/score/mw/com/test/service_discovery_during_consumer_crash/integration_test/BUILD +++ b/score/mw/com/test/service_discovery_during_consumer_crash/integration_test/BUILD @@ -24,7 +24,7 @@ integration_test( srcs = ["test_service_discovery_during_consumer_crash.py"], filesystem = ":filesystem", # Disabled for thread sanitizer because of detected race (Ticket-246892) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) pkg_tar( From 859f9888be76a026bfe9aed2f045366701565fdb Mon Sep 17 00:00:00 2001 From: "rahul.singh" Date: Mon, 16 Mar 2026 06:21:54 +0100 Subject: [PATCH 2/2] Move sanitizer configs to quality/sanitizer and add repo-specific suppressions --- .bazelrc | 44 +-------------- MODULE.bazel | 2 +- .../sanitizer_support/BUILD | 6 +- quality/sanitizer/BUILD | 23 ++++++++ quality/sanitizer/asan.supp | 17 ++++++ quality/sanitizer/lsan.supp | 17 ++++++ quality/sanitizer/sanitizer.bazelrc | 55 +++++++++++++++++++ quality/sanitizer/tsan.supp | 24 ++++++++ quality/sanitizer/ubsan.supp | 17 ++++++ 9 files changed, 160 insertions(+), 45 deletions(-) create mode 100644 quality/sanitizer/BUILD create mode 100644 quality/sanitizer/asan.supp create mode 100644 quality/sanitizer/lsan.supp create mode 100644 quality/sanitizer/sanitizer.bazelrc create mode 100644 quality/sanitizer/tsan.supp create mode 100644 quality/sanitizer/ubsan.supp diff --git a/.bazelrc b/.bazelrc index 064ff9bf5..3a1f57071 100644 --- a/.bazelrc +++ b/.bazelrc @@ -89,49 +89,9 @@ test:clang-tidy --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux test:clang-tidy --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain # ============================================================================== -# Sanitizer Configurations (adapted from @score_cpp_policies) +# Sanitizer Configurations # ============================================================================== - -# Debug symbols for sanitizer stack traces -test:with_debug_symbols --cxxopt=-gline-tables-only -test:with_debug_symbols --cxxopt=-gcolumn-info -test:with_debug_symbols --strip=never - -# ASan + UBSan + LSan (Combined) -build:asan_ubsan_lsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux -build:asan_ubsan_lsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain -build:asan_ubsan_lsan --cxxopt=-fsanitize=undefined,address,leak -build:asan_ubsan_lsan --cxxopt=-fno-omit-frame-pointer -build:asan_ubsan_lsan --cxxopt=-fno-common -build:asan_ubsan_lsan --linkopt=-fsanitize=undefined,address,leak -build:asan_ubsan_lsan --linkopt=-fsanitize-link-c++-runtime -build:asan_ubsan_lsan --platform_suffix=asan_ubsan -test:asan_ubsan_lsan --config=with_debug_symbols -test:asan_ubsan_lsan --test_tag_filters=-no-asan,-no-lsan,-no-ubsan -test:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:sanitizer=asan_ubsan_lsan -test:asan_ubsan_lsan --run_under=@score_cpp_policies//sanitizers:wrapper - -# Shortcuts for individual sanitizers -build:asan --config=asan_ubsan_lsan -test:asan --test_tag_filters=-no-asan -build:ubsan --config=asan_ubsan_lsan -test:ubsan --test_tag_filters=-no-ubsan -build:lsan --config=asan_ubsan_lsan -test:lsan --test_tag_filters=-no-lsan - -# ThreadSanitizer -build:tsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux -build:tsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain -build:tsan --cxxopt=-fsanitize=thread -build:tsan --cxxopt=-O1 -build:tsan --linkopt=-fsanitize=thread -build:tsan --linkopt=-fsanitize-link-c++-runtime -build:tsan --platform_suffix=tsan -test:tsan --config=with_debug_symbols -test:tsan --test_tag_filters=-no-tsan -test:tsan --@score_cpp_policies//sanitizers/flags:sanitizer=tsan -test:tsan --run_under=@score_cpp_policies//sanitizers:wrapper - +import quality/sanitizer/sanitizer.bazelrc # ============================================================================== common:codeql --platform_suffix=codeql diff --git a/MODULE.bazel b/MODULE.bazel index 9d0624853..e7a329d27 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -18,7 +18,7 @@ bazel_dep(name = "platforms", version = "1.0.0") bazel_dep(name = "score_cpp_policies", version = "0.0.0", dev_dependency = True) git_override( module_name = "score_cpp_policies", - commit = "d6f8104", # tip of rs/swp-245137 branch + commit = "07a78d6", # tip of rs/swp-245137 branch remote = "https://github.com/RSingh1511/score_cpp_policies.git", ) diff --git a/quality/integration_testing/sanitizer_support/BUILD b/quality/integration_testing/sanitizer_support/BUILD index 6416d9d3f..e4ddc8dd3 100644 --- a/quality/integration_testing/sanitizer_support/BUILD +++ b/quality/integration_testing/sanitizer_support/BUILD @@ -13,10 +13,12 @@ load("@rules_pkg//pkg:tar.bzl", "pkg_tar") -# Re-package suppressions from @score_cpp_policies for integration testing pkg_tar( name = "suppressions_pkg", - srcs = ["@score_cpp_policies//sanitizers:suppressions"], + srcs = [ + "@score_cpp_policies//sanitizers:suppressions", + "//quality/sanitizer:repo_suppressions", + ], mode = "0444", package_dir = "sanitizers/suppressions", visibility = ["//visibility:public"], diff --git a/quality/sanitizer/BUILD b/quality/sanitizer/BUILD new file mode 100644 index 000000000..e396a2847 --- /dev/null +++ b/quality/sanitizer/BUILD @@ -0,0 +1,23 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +filegroup( + name = "repo_suppressions", + srcs = [ + "asan.supp", + "lsan.supp", + "tsan.supp", + "ubsan.supp", + ], + visibility = ["//quality/integration_testing/sanitizer_support:__pkg__"], +) diff --git a/quality/sanitizer/asan.supp b/quality/sanitizer/asan.supp new file mode 100644 index 000000000..9050e0fe3 --- /dev/null +++ b/quality/sanitizer/asan.supp @@ -0,0 +1,17 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +# Suppressions for the AddressSanitizer +# See: https://clang.llvm.org/docs/AddressSanitizer.html#issue-suppression +# Every suppression requires a justification. +# Suppressions that share the same justification may be organized in a single block. diff --git a/quality/sanitizer/lsan.supp b/quality/sanitizer/lsan.supp new file mode 100644 index 000000000..01fbf90fe --- /dev/null +++ b/quality/sanitizer/lsan.supp @@ -0,0 +1,17 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +# Suppressions for the LeakSanitizer +# See: https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions +# Every suppression requires a justification. +# Suppressions that share the same justification may be organized in a single block. diff --git a/quality/sanitizer/sanitizer.bazelrc b/quality/sanitizer/sanitizer.bazelrc new file mode 100644 index 000000000..783ccb5aa --- /dev/null +++ b/quality/sanitizer/sanitizer.bazelrc @@ -0,0 +1,55 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +# ============================================================================== +# Sanitizer Configurations (adapted from @score_cpp_policies) +# ============================================================================== + +# Debug symbols for sanitizer stack traces +test:with_debug_symbols --cxxopt=-g1 +test:with_debug_symbols --strip=never + +# ASan + UBSan + LSan (Combined) +build:asan_ubsan_lsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux +build:asan_ubsan_lsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain +build:asan_ubsan_lsan --features=asan +build:asan_ubsan_lsan --features=ubsan +build:asan_ubsan_lsan --features=lsan +build:asan_ubsan_lsan --linkopt=-fsanitize=undefined,address,leak +build:asan_ubsan_lsan --linkopt=-fsanitize-link-c++-runtime +build:asan_ubsan_lsan --platform_suffix=asan_ubsan_lsan +test:asan_ubsan_lsan --config=with_debug_symbols +test:asan_ubsan_lsan --test_tag_filters=-no-asan,-no-lsan,-no-ubsan +test:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:sanitizer=asan_ubsan_lsan +test:asan_ubsan_lsan --run_under=@score_cpp_policies//sanitizers:wrapper + +# Shortcuts for individual sanitizers +build:asan --config=asan_ubsan_lsan +build:asan --test_tag_filters=-no-asan +build:ubsan --config=asan_ubsan_lsan +build:ubsan --test_tag_filters=-no-ubsan +build:lsan --config=asan_ubsan_lsan +build:lsan --test_tag_filters=-no-lsan + +# ThreadSanitizer +build:tsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux +build:tsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain +build:tsan --features=tsan +build:tsan --linkopt=-fsanitize=thread +build:tsan --linkopt=-fsanitize-link-c++-runtime +build:tsan --platform_suffix=tsan +test:tsan --config=with_debug_symbols +test:tsan --cxxopt=-O1 +test:tsan --test_tag_filters=-no-tsan +test:tsan --@score_cpp_policies//sanitizers/flags:sanitizer=tsan +test:tsan --run_under=@score_cpp_policies//sanitizers:wrapper diff --git a/quality/sanitizer/tsan.supp b/quality/sanitizer/tsan.supp new file mode 100644 index 000000000..dcd88ea51 --- /dev/null +++ b/quality/sanitizer/tsan.supp @@ -0,0 +1,24 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +# Suppressions for the ThreadSanitizer +# See: https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions +# Every suppression requires a justification. +# Suppressions that share the same justification may be organized in a single block. + + + +# These tests are already marked with target_compatible_with = [...no_tsan] but suppressions kept for documentation. +# See: Ticket-246891 +called_from_lib:sample_ptr_test_rs +called_from_lib:sample_allocatee_ptr_test_rs diff --git a/quality/sanitizer/ubsan.supp b/quality/sanitizer/ubsan.supp new file mode 100644 index 000000000..0b1a39adb --- /dev/null +++ b/quality/sanitizer/ubsan.supp @@ -0,0 +1,17 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +# Suppressions for the UndefinedBehaviorSanitizer +# See: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions +# Every suppression requires a justification. +# Suppressions that share the same justification may be organized in a single block.