DtTsa is a synchronization-aware dynamic thread-sharing analysis for multithreaded C/C++ programs. It is implemented as an LLVM instrumentation pass together with a lightweight runtime library.
DtTsa instruments memory accesses together with key synchronization events, records dynamic execution traces during program runs, and reports source-level thread-sharing points that can be used for program understanding, concurrency debugging, and schedule-focused testing.
This repository contains:
- the LLVM pass implementation (
src/MemAccessInstrumentPass.cpp) - the runtime support library (
src/runtime.c) - the analysis outputs produced by DtTsa on three benchmark suites (
evaluation/results/)
DtTsa/
├── README.md
├── src/
│ ├── MemAccessInstrumentPass.cpp
│ └── runtime.c
└── evaluation/
├── README.md
└── results/
├── CVE-Benchmarks/
├── DataRaceBench/
├── paper/
└── SCTBench/
src/contains the core implementation of DtTsa.src/MemAccessInstrumentPass.cppimplements the LLVM instrumentation pass.src/runtime.cimplements the runtime tracing support.evaluation/contains benchmark and result documentation.evaluation/results/contains summarized analysis outputs and selected experimental materials.
Given a multithreaded C/C++ program, DtTsa:
- compiles the program to LLVM bitcode;
- inserts instrumentation before memory accesses and synchronization operations;
- links the instrumented program with a runtime support library;
- records dynamic trace events during execution;
- aggregates the observed events across runs; and
- reports source-level thread-sharing points together with their frequency across runs.
DtTsa is a dynamic analysis tool. It reports sharing behavior observed in executed paths and schedules. It is not intended to prove the absence of unobserved sharing.
DtTsa is intended to be built and used on Linux or WSL2.
- clang
- clang++
- llvm-config
- opt
- python3
- standard Unix utilities such as bash, make, sed, grep, and awk
- Ubuntu 20.04 / 22.04, or WSL2 with Ubuntu
- a consistent LLVM/Clang toolchain version for:
- clang / clang++
- opt
- llvm-config
clang --version
clang++ --version
opt --version
llvm-config --version
python3 --versionImportant: the LLVM version used to build the pass should match the LLVM version used to instrument the target program.
Build the LLVM pass from the repository root:
clang++ `llvm-config --cxxflags` -fPIC -shared src/MemAccessInstrumentPass.cpp \
-o libMemInst.so `llvm-config --ldflags --system-libs --libs core ipo passes`Build the runtime library:
clang -fPIC -shared src/runtime.c -o libruntime.so -lpthreadAfter successful compilation, the repository root should contain:
libMemInst.so
libruntime.so
DtTsa takes the following inputs:
- a multithreaded C/C++ program;
- LLVM bitcode generated from that program;
- one or more program runs, such as tests, benchmark drivers, or PoCs.
This repository does not directly store the full benchmark source trees due to repository-size considerations. Instead, the benchmark suites should be obtained separately and placed under the expected local directories described in evaluation/README.md.
DtTsa produces dynamic-analysis outputs derived from runtime traces. Depending on the target program and benchmark setup, the output may include:
- raw trace logs;
- intermediate per-run dynamic records;
- merged source-level sharing summaries;
- text, JSON, or other summarized results.
The benchmark-level outputs included in this repository are stored under:
evaluation/results/CVE-Benchmarks/evaluation/results/DataRaceBench/evaluation/results/SCTBench/
At a minimum, DtTsa reports source-level thread-sharing points observed during execution. When repeated runs are used, DtTsa can also summarize the frequency or stability of each reported site across runs.
This section describes the generic workflow for applying DtTsa to a single program.
For a C program:
clang -g -emit-llvm -c target.c -o target.bcFor a C++ program:
clang++ -g -emit-llvm -c target.cpp -o target.bcIf the target uses threads or OpenMP, add the corresponding flags during compilation and linking, for example:
-pthread-fopenmp
Use the DtTsa pass to transform the bitcode into an instrumented version.
The pass has been tested with the following invocation style:
opt -load-pass-plugin /path/to/libMemInst.so -passes=meminst target.bc -o target_inst.bcReplace:
/path/to/libMemInst.sowith the actual path to the compiled pass librarytarget.bcwith the input LLVM bitcode filetarget_inst.bcwith the instrumented output bitcode file
For a C target:
clang target_inst.bc /path/to/libruntime.so -lpthread -o progFor a C++ target:
clang++ target_inst.bc /path/to/libruntime.so -lpthread -o progReplace:
/path/to/libruntime.sowith the actual path to the runtime libraryprogwith the desired executable name
If needed, also add -fopenmp.
./progIf the program requires command-line arguments:
./prog <program-arguments>After execution, DtTsa emits runtime-generated dynamic-analysis outputs. Depending on the target program and benchmark setup, the output may include:
- raw runtime traces;
- per-run dynamic records;
- source-level sharing summaries;
- merged results across repeated runs.
The included benchmark outputs are organized under:
evaluation/results/
Concurrency behavior may depend on scheduling and input diversity. DtTsa therefore supports repeated executions of the same subject.
For a subject program, repeated runs produce per-run sharing sets. These sets can be merged into a cumulative union set, and each reported sharing point can be summarized by its occurrence frequency across runs.
This is useful for distinguishing stable sharing points from rare schedule- or input-sensitive ones.
The repository contains summarized outputs and selected materials for the following benchmark families:
evaluation/results/CVE-Benchmarks/
evaluation/results/DataRaceBench/
evaluation/results/SCTBench/
evaluation/results/paper/
The full external benchmark source trees, generated LLVM bitcode, instrumented binaries, complete raw traces, and large temporary logs are not duplicated in this repository.
See evaluation/README.md for details about the evaluation directory and result organization.
At a minimum, DtTsa reports source-level thread-sharing points observed during execution.
A reported sharing point usually contains information such as:
- source location;
- function name;
- access kind;
- thread-sharing evidence;
- synchronization context when available.
When repeated runs are used, DtTsa can also summarize how frequently each reported site appears across executions.
DtTsa reports execution-grounded sharing information. Its completeness depends on the exercised inputs, schedules, and supported synchronization operations.
The tool is intended to help developers inspect observed cross-thread sharing and to provide compact scheduling candidates for downstream concurrency testing.