[all-commits] [llvm/llvm-project] ab0268: tsan: fix a bug in trace part switching

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Thu Jul 14 08:49:13 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ab02680b5aee81fbcf564e30891e8e2089d513e1
      https://github.com/llvm/llvm-project/commit/ab02680b5aee81fbcf564e30891e8e2089d513e1
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2022-07-14 (Thu, 14 Jul 2022)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
    M compiler-rt/lib/tsan/tests/unit/tsan_trace_test.cpp

  Log Message:
  -----------
  tsan: fix a bug in trace part switching

Callers of TraceSwitchPart expect that TraceAcquire will always succeed
after the call. It's possible that TryTraceFunc/TraceMutexLock in TraceSwitchPart
that restore the current stack/mutexset filled the trace part exactly up
to the TracePart::kAlignment gap and the next TraceAcquire won't succeed.
Skip the alignment gap after writing initial stack/mutexset to avoid that.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D129777




More information about the All-commits mailing list