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

Oliver Stöneberg via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 16 05:47:16 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);
----------------
firewave wrote:

> 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.

A bit off-topic. That might be an idea for a separate "ErrnoSanitizer" which will intercept functions which provide errno and randomly fail them with an error which requires a re-try.

And on a side note the previous author of libxml2 wrote an allocator which randomly failed to be able to detect issues which would also be along those lines.

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


More information about the cfe-commits mailing list