[all-commits] [llvm/llvm-project] f01377: [tsan] Mark `pthread_*_lock` functions as blocking...

Nazım Can Altınova via All-commits all-commits at lists.llvm.org
Tue Mar 26 04:33:14 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f01377d8ebcb1f52fe75a236cdf34f1b8b1e99fb
      https://github.com/llvm/llvm-project/commit/f01377d8ebcb1f52fe75a236cdf34f1b8b1e99fb
  Author: Nazım Can Altınova <canaltinova at gmail.com>
  Date:   2024-03-26 (Tue, 26 Mar 2024)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
    A compiler-rt/test/tsan/signal_in_mutex_lock.cpp

  Log Message:
  -----------
  [tsan] Mark `pthread_*_lock` functions as blocking (#84162)

Fixes #83561.

When a thread is blocked on a mutex and we send an async signal to that
mutex, it never arrives because tsan thinks that `pthread_mutex_lock` is
not a blocking function. This patch marks `pthread_*_lock` functions as
blocking so we can successfully deliver async signals like `SIGPROF`
when the thread is blocked on them.

See the issue also for more details. I also added a test, which is a
simplified version of the compiler explorer example I posted in the
issue.

Please let me know if you have any other ideas or things to improve!
Happy to work on them.

Also I filed #83844 which is more tricky because we don't have a libc
wrapper for `SYS_futex`. I'm not sure how to intercept this yet. Please
let me know if you have ideas on that as well. Thanks!



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