[all-commits] [llvm/llvm-project] c5be2b: [IR] Add the sanitize_concurrency function attribute
Joseph Huber via All-commits
all-commits at lists.llvm.org
Tue Sep 29 12:37:29 PDT 2026
Branch: refs/heads/users/jhuber6/csan
Home: https://github.com/llvm/llvm-project
Commit: c5be2b3b3804b186658170a4f258fcf84f7fc760
https://github.com/llvm/llvm-project/commit/c5be2b3b3804b186658170a4f258fcf84f7fc760
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M llvm/docs/LangRef.md
M llvm/include/llvm/Bitcode/LLVMBitCodes.h
M llvm/include/llvm/IR/Attributes.td
M llvm/lib/Analysis/Loads.cpp
M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
M llvm/lib/CodeGen/ShrinkWrap.cpp
M llvm/lib/IR/Verifier.cpp
M llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
M llvm/lib/Transforms/IPO/HotColdSplitting.cpp
M llvm/lib/Transforms/Scalar/ExpandMemCmp.cpp
M llvm/lib/Transforms/Utils/CodeExtractor.cpp
M llvm/test/Bitcode/attributes.ll
M llvm/test/Bitcode/compatibility.ll
M llvm/test/CodeGen/AMDGPU/amdgpu-attributor-min-agpr-alloc.ll
M llvm/test/CodeGen/X86/x86-sanitizer-shrink-wrapping.ll
M llvm/test/Transforms/CodeExtractor/PartialInlineAttributes.ll
M llvm/test/Transforms/ExpandMemCmp/X86/sanitizer-skip.ll
M llvm/test/Transforms/HotColdSplit/X86/do-not-split.ll
M llvm/test/Transforms/SimplifyCFG/no_speculative_loads_with_tsan.ll
A llvm/test/Verifier/sanitize-concurrency-attrs.ll
Log Message:
-----------
[IR] Add the sanitize_concurrency function attribute
This introduces a new concurrency sanitizer attribute to be used with
the runtime of the same name. This has no major change and simply
updates the IR to handle it properly. This attribute is invalid when
combined with the thread sanitizer one as they are mutually exclusive.
Commit: 323c4a37cc4584de11e3255249f62a2b62d1143f
https://github.com/llvm/llvm-project/commit/323c4a37cc4584de11e3255249f62a2b62d1143f
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
A llvm/include/llvm/Transforms/Instrumentation/ConcurrencySanitizer.h
M llvm/lib/Passes/PassBuilder.cpp
M llvm/lib/Passes/PassRegistry.def
M llvm/lib/Transforms/Instrumentation/CMakeLists.txt
A llvm/lib/Transforms/Instrumentation/ConcurrencySanitizer.cpp
A llvm/test/Instrumentation/ConcurrencySanitizer/address_space.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/atomic.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/basic.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/callbacks.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/function_control.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/memintrinsics.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/module.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/no_sanitize.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/selection.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/shared_alloca.ll
A llvm/test/Instrumentation/ConcurrencySanitizer/unusual_sizes.ll
Log Message:
-----------
[LLVM] Add a ConcurrencySanitizer LLVM pass
Summary:
Add an LLVM ConcurrencySanitizer pass to instrument memory and atomic
operations for a sampling race detector. Fundamentally the pass iterates
through every candidate memory operation and adds a check above it.
Unlike TSAN, we do not replace any operations, which heavily simplifies
the instrumentation.
We do not re-use the TSAN instrumentaiton because the appraoches are
different enough and the passes simple enough that the extra code is not
a large concern. More differences will be added in the future, so
keeping them separate is easlier.
Commit: 3d5fc8d66b135eca930f2717e6802ee3c163bf5d
https://github.com/llvm/llvm-project/commit/3d5fc8d66b135eca930f2717e6802ee3c163bf5d
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
A clang/docs/ConcurrencySanitizer.md
M clang/docs/index.md
M clang/include/clang/Basic/Sanitizers.def
M clang/include/clang/Driver/SanitizerArgs.h
M clang/lib/CodeGen/BackendUtil.cpp
M clang/lib/CodeGen/CGDeclCXX.cpp
M clang/lib/CodeGen/CodeGenFunction.cpp
M clang/lib/Driver/SanitizerArgs.cpp
M clang/lib/Driver/ToolChains/AMDGPU.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/lib/Driver/ToolChains/CommonArgs.cpp
M clang/lib/Driver/ToolChains/Linux.cpp
M clang/lib/Frontend/InitPreprocessor.cpp
A clang/test/CodeGen/sanitize-concurrency.c
M clang/test/Driver/fsanitize.c
M clang/test/Preprocessor/sanitizer-predefines.c
Log Message:
-----------
[Clang] Add support for the `-fsanitize=concurrency` runtime
Summary:
Add the frontend sanitizer kind, function attributes, pass pipeline
integration, predefined macro, driver handling, and documentation for
ConcurrencySanitizer.
Commit: 2a928d893e2e8e44fb40e216ca410e6a861ea3e0
https://github.com/llvm/llvm-project/commit/2a928d893e2e8e44fb40e216ca410e6a861ea3e0
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M clang/docs/ConcurrencySanitizer.md
M clang/lib/Driver/SanitizerArgs.cpp
M clang/lib/Driver/ToolChains/AMDGPU.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/lib/Driver/ToolChains/CommonArgs.cpp
M clang/lib/Driver/ToolChains/Linux.cpp
A clang/test/Driver/Inputs/resource_dir_with_amdgpu_csan/lib/amdgpu-amd-amdhsa/libclang_rt.csan.a
A clang/test/Driver/Inputs/resource_dir_with_amdgpu_csan/lib/x86_64-unknown-linux-gnu/libclang_rt.csan.a
A clang/test/Driver/Inputs/resource_dir_with_amdgpu_csan/lib/x86_64-unknown-linux-gnu/libclang_rt.csan_offload.a
A clang/test/Driver/fsanitize-concurrency-offload.c
M clang/test/Driver/fsanitize.c
Log Message:
-----------
Comments
Commit: e020cb009375990cac39e340737d9492f0e24f62
https://github.com/llvm/llvm-project/commit/e020cb009375990cac39e340737d9492f0e24f62
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
A clang/test/CodeGen/Inputs/sanitize-concurrency-ignorelist.txt
M clang/test/CodeGen/sanitize-concurrency.c
Log Message:
-----------
ignore
Commit: fab382ed99861e8846720290163d9d1b0e100b8b
https://github.com/llvm/llvm-project/commit/fab382ed99861e8846720290163d9d1b0e100b8b
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M clang/lib/Driver/ToolChains/CommonArgs.cpp
M clang/test/Driver/fsanitize-concurrency-offload.c
M clang/test/Driver/fsanitize.c
Log Message:
-----------
[Clang] Support `-shared-libsan` for offload CSan
Summary:
Follow the UBSan handling. The shared runtime embeds the HSA
interceptors, so `csan_offload` is only linked with static runtimes and
executables pull in `csan_offload-preinit` to initialize early.
Commit: dd7bfd1a49735bcd71df73dd1029bbf28772fab9
https://github.com/llvm/llvm-project/commit/dd7bfd1a49735bcd71df73dd1029bbf28772fab9
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M compiler-rt/cmake/caches/AMDGPU.cmake
M compiler-rt/cmake/config-ix.cmake
A compiler-rt/lib/csan/CMakeLists.txt
A compiler-rt/lib/csan/csan.cpp
A compiler-rt/lib/csan/csan.h
A compiler-rt/lib/csan/csan_defs.h
A compiler-rt/lib/csan/csan_flags.inc
A compiler-rt/lib/csan/csan_gpu.cpp
A compiler-rt/lib/csan/csan_offload_packet.h
A compiler-rt/lib/csan/csan_report.cpp
A compiler-rt/lib/csan/csan_watch.h
A compiler-rt/lib/csan/offload/CMakeLists.txt
A compiler-rt/lib/csan/offload/csan_offload.h
A compiler-rt/lib/csan/offload/csan_offload_hsa_interceptors.cpp
A compiler-rt/lib/csan/offload/csan_offload_report.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
M compiler-rt/lib/sanitizer_common/sanitizer_offload.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_offload.h
M compiler-rt/lib/sanitizer_common/sanitizer_offload_hsa.h
M compiler-rt/lib/sanitizer_common/sanitizer_offload_image.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_offload_opcodes.h
M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h
M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp
A compiler-rt/test/csan/AMDGPU/aba-race.hip
A compiler-rt/test/csan/AMDGPU/array-race.hip
A compiler-rt/test/csan/AMDGPU/atomic-nonatomic.hip
A compiler-rt/test/csan/AMDGPU/atomic.hip
A compiler-rt/test/csan/AMDGPU/disjoint.hip
A compiler-rt/test/csan/AMDGPU/global-race.hip
A compiler-rt/test/csan/AMDGPU/helper-race.hip
A compiler-rt/test/csan/AMDGPU/lds-disjoint.hip
A compiler-rt/test/csan/AMDGPU/lds-race.hip
A compiler-rt/test/csan/AMDGPU/lit.local.cfg.py
A compiler-rt/test/csan/AMDGPU/memcpy-large-race.hip
A compiler-rt/test/csan/AMDGPU/memcpy-race.hip
A compiler-rt/test/csan/AMDGPU/memmove-race.hip
A compiler-rt/test/csan/AMDGPU/openmp-race.cpp
A compiler-rt/test/csan/AMDGPU/race.h
A compiler-rt/test/csan/AMDGPU/shared-watchpoints.hip
A compiler-rt/test/csan/AMDGPU/single-thread.hip
A compiler-rt/test/csan/AMDGPU/write-read-race.hip
A compiler-rt/test/csan/CMakeLists.txt
A compiler-rt/test/csan/access-sizes.cpp
A compiler-rt/test/csan/atomic-nonatomic.cpp
A compiler-rt/test/csan/atomic.cpp
A compiler-rt/test/csan/halt-on-error.cpp
A compiler-rt/test/csan/ignore-thread.cpp
A compiler-rt/test/csan/large-access.cpp
A compiler-rt/test/csan/large-range-race.cpp
A compiler-rt/test/csan/lit.common.cfg.py
A compiler-rt/test/csan/lit.site.cfg.py.in
A compiler-rt/test/csan/race.cpp
A compiler-rt/test/csan/read-read.cpp
A compiler-rt/test/csan/single-thread.cpp
A compiler-rt/test/csan/unknown-origin.cpp
M compiler-rt/test/lit.common.cfg.py
Log Message:
-----------
[compiler-rt] Add 'csan' library for the concurrency sanitizer
Summary:
Adds the runtime for the concurrency sanitizer, both CPU and GPU.
Fundamentally, this works using the following pseudocode:
```c
static u64 watchpoints[N]; // Hash-indexed, zero is empty.
// Emitted before the access, so we never trip on our own write.
void check_access(volatile void *addr, u32 size, u32 type) {
// Every access probes. A read conflicts only with a watched write, a
// write conflicts with either.
if (u64 *wp = find_watchpoint(addr, size, type))
consume(wp, this_pc()); // Hand our location to the owner.
if (!should_sample()) // Wave-uniform, 1-in-N chance.
return;
u64 *wp = arm_watchpoint(addr, size, type);
if (!wp) // Slot is already taken.
return;
auto old = read(addr, size);
delay(ctx.rand()); // Randomized, bounded.
if (void *peer = disarm(wp))
report_race(addr, this_pc(), peer);
else if (read(addr, size) != old)
report_race(addr, this_pc(), UNKNOWN);
}
```
This implementation is kept intentionally minimal to simplify the review
process. Many options are planned for later. The intended use is for
users to pass `-fsanitize=concurrency` for supported compilations.
Commit: aabf44a13fb55ba30a6a54e3721b843608db6ab7
https://github.com/llvm/llvm-project/commit/aabf44a13fb55ba30a6a54e3721b843608db6ab7
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
M compiler-rt/cmake/config-ix.cmake
M compiler-rt/lib/csan/CMakeLists.txt
M compiler-rt/lib/csan/csan_gpu.cpp
M compiler-rt/lib/csan/offload/CMakeLists.txt
M compiler-rt/test/csan/CMakeLists.txt
Log Message:
-----------
comments
Commit: 87c5d0f252bd5de78096a285e3cbadfba60a6105
https://github.com/llvm/llvm-project/commit/87c5d0f252bd5de78096a285e3cbadfba60a6105
Author: Joseph Huber <huberjn at outlook.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M compiler-rt/lib/csan/CMakeLists.txt
A compiler-rt/lib/csan/csan.syms.extra
M compiler-rt/lib/csan/offload/CMakeLists.txt
M compiler-rt/lib/csan/offload/csan_offload_hsa_interceptors.cpp
A compiler-rt/lib/csan/offload/csan_offload_preinit.cpp
M compiler-rt/test/csan/AMDGPU/global-race.hip
M compiler-rt/test/csan/AMDGPU/openmp-race.cpp
A compiler-rt/test/csan/hsa-load-order.cpp
A compiler-rt/test/csan/hsa-missing.cpp
M compiler-rt/test/csan/lit.common.cfg.py
M compiler-rt/test/csan/race.cpp
Log Message:
-----------
[compiler-rt] Remove dlsym interceptor and support `-shared-libsan` for CSan
Summary:
Follow the UBSan offload runtime. Offload now resolves HSA through the
global scope, so the `dlsym` interceptor is no longer needed. The real
HSA entry points are still taken from the loaded HSA library rather than
`RTLD_NEXT`, since every DSO with a static runtime exports the same
wrappers and they would otherwise chain back into each other.
Build `libclang_rt.csan.so` with the offload objects folded in. The
exported HSA wrappers report failure when HSA is absent and warn when HSA
was loaded ahead of the runtime. The preinit hook moves to a separate
`csan_offload-preinit` archive for executables.
Compare: https://github.com/llvm/llvm-project/compare/7945d2419726...87c5d0f252bd
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list