[compiler-rt] [llvm] [tsan] Introduce Adaptive Delay Scheduling to TSAN (PR #178836)

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 15 01:53:52 PST 2026


================
@@ -1446,6 +1464,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_trylock, void *m) {
 #if !SANITIZER_APPLE
 TSAN_INTERCEPTOR(int, pthread_mutex_timedlock, void *m, void *abstime) {
   SCOPED_TSAN_INTERCEPTOR(pthread_mutex_timedlock, m, abstime);
+  GetFuzzingScheduler().MutexCvOp();
   int res = REAL(pthread_mutex_timedlock)(m, abstime);
----------------
dvyukov wrote:

I meant changing the actual wait durations used in APIs, e.g.:

```
void usleep(us int) {
  REAL(usleep, Scheduler().RandomizeDelay(us));
}
```

This may perturb executions much more than just small delays.

But let's ignore this for now. It may become messy b/c we would either need to lie in all functions that return current time, or only return EINTR on shorter sleeps. Otherwise some programs may legitimately break.

https://github.com/llvm/llvm-project/pull/178836


More information about the llvm-commits mailing list