From 6094b101b813e5c6173e1e6f5000fd7112d2b64d Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:32:35 +0000 Subject: [PATCH] fix: Keep Clang sanitizers combined, only separate GCC Clang doesn't have the 2GB shadow memory collision that GCC has, so keep ASAN+UBSAN and TSAN+UBSAN combined for Clang-20. Only GCC-13 needs separate ASAN, TSAN, and UBSAN jobs. Co-Authored-By: Claude Opus 4.6 --- .github/scripts/strategy-matrix/generate.py | 50 +++++++++++++++------ 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index dcda12ead8..b8868218cb 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -234,17 +234,14 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: # Add the configuration to the list, with the most unique fields first, # so that they are easier to identify in the GitHub Actions UI, as long # names get truncated. - # Add ASAN, TSAN, and UBSAN sanitizer jobs for specific bookworm distros. - # Each sanitizer runs independently to keep binary size under ASAN's - # 2GB shadow memory limit (combining ASAN+UBSAN inflates data sections - # past 2GB, see https://github.com/google/sanitizers/issues/856). - if os[ - "distro_version" - ] == "bookworm" and f"{os['compiler_name']}-{os['compiler_version']}" in [ - "clang-20", - "gcc-13", - ]: - # Add ASAN configuration. + # Add sanitizer jobs for specific bookworm distros. + # GCC sanitizers run independently because combining ASAN+UBSAN inflates + # GCC data sections past ASAN's 2GB shadow memory limit + # (see https://github.com/google/sanitizers/issues/856). + # Clang doesn't have this issue, so ASAN+UBSAN and TSAN+UBSAN stay combined. + compiler_id = f"{os['compiler_name']}-{os['compiler_version']}" + if os["distro_version"] == "bookworm" and compiler_id == "gcc-13": + # Add separate ASAN, TSAN, and UBSAN configurations for GCC. configurations.append( { "config_name": config_name + "-asan", @@ -257,7 +254,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: "sanitizers": "address", } ) - # Add TSAN configuration. # TSAN instrumentation significantly increases memory usage during # compilation, so reduce build parallelism to avoid OOM on CI runners. configurations.append( @@ -273,7 +269,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: "nproc_subtract": 20, } ) - # Add UBSAN configuration. configurations.append( { "config_name": config_name + "-ubsan", @@ -286,6 +281,35 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: "sanitizers": "undefinedbehavior", } ) + elif os["distro_version"] == "bookworm" and compiler_id == "clang-20": + # Add combined ASAN+UBSAN and TSAN+UBSAN configurations for Clang. + configurations.append( + { + "config_name": config_name + "-asan-ubsan", + "cmake_args": cmake_args, + "cmake_target": cmake_target, + "build_only": build_only, + "build_type": build_type, + "os": os, + "architecture": architecture, + "sanitizers": "address,undefinedbehavior", + } + ) + # TSAN instrumentation significantly increases memory usage during + # compilation, so reduce build parallelism to avoid OOM on CI runners. + configurations.append( + { + "config_name": config_name + "-tsan-ubsan", + "cmake_args": cmake_args, + "cmake_target": cmake_target, + "build_only": build_only, + "build_type": build_type, + "os": os, + "architecture": architecture, + "sanitizers": "thread,undefinedbehavior", + "nproc_subtract": 20, + } + ) else: configurations.append( {