[Minor Feature] Install modern Clang for improved TSan and fuzzing #282

Open
opened 2026-03-08 03:19:50 +00:00 by john · 0 comments
Owner

Context

The build system currently uses GCC 12.2.0 (Debian 12 default). This is adequate for ASan and UBSan, but:

  • TSan has improved substantially in Clang 16–18, particularly around suppression handling and false-positive reduction with atomics — exactly what free-threaded CPython uses internally
  • Atheris fuzzing (see #283) requires a Clang build with coverage instrumentation
  • GCC 12 doesn't support -fno-sanitize=function (Clang-only UBSan check), so we already have a compiler-detection workaround in CMakeLists.txt

Proposal

  1. Install Clang 18+ (available via LLVM apt repository for Debian 12)
  2. Make the compiler selectable via env var or CMake option: CC=clang CXX=clang++ make asan
  3. Update TSan targets to prefer Clang when available

Value

  • More accurate TSan results for --disable-gil work
  • Enables coverage-guided fuzzing
  • -fno-sanitize=function works natively (no workaround needed)
  • #281 (free-threaded + TSan targets)
  • #279 (memory safety audit meta-issue)
## Context The build system currently uses GCC 12.2.0 (Debian 12 default). This is adequate for ASan and UBSan, but: - TSan has improved substantially in Clang 16–18, particularly around suppression handling and false-positive reduction with atomics — exactly what free-threaded CPython uses internally - Atheris fuzzing (see #283) requires a Clang build with coverage instrumentation - GCC 12 doesn't support `-fno-sanitize=function` (Clang-only UBSan check), so we already have a compiler-detection workaround in CMakeLists.txt ## Proposal 1. Install Clang 18+ (available via LLVM apt repository for Debian 12) 2. Make the compiler selectable via env var or CMake option: `CC=clang CXX=clang++ make asan` 3. Update TSan targets to prefer Clang when available ## Value - More accurate TSan results for `--disable-gil` work - Enables coverage-guided fuzzing - `-fno-sanitize=function` works natively (no workaround needed) ## Related - #281 (free-threaded + TSan targets) - #279 (memory safety audit meta-issue)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#282
No description provided.