[all-commits] [llvm/llvm-project] ea2036: [scudo] Fix the use of ASSERT_CAPABILITY in TSD (#...

ChiaHungDuan via All-commits all-commits at lists.llvm.org
Thu Oct 5 11:35:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ea2036e1e56b720d7da8d46f62263ba46c126522
      https://github.com/llvm/llvm-project/commit/ea2036e1e56b720d7da8d46f62263ba46c126522
  Author: ChiaHungDuan <chiahungduan at google.com>
  Date:   2023-10-05 (Thu, 05 Oct 2023)

  Changed paths:
    M compiler-rt/lib/scudo/standalone/combined.h
    M compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
    M compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
    M compiler-rt/lib/scudo/standalone/tsd.h
    M compiler-rt/lib/scudo/standalone/tsd_shared.h

  Log Message:
  -----------
  [scudo] Fix the use of ASSERT_CAPABILITY in TSD (#68273)

In getCache()/getQuarantineCache(), they return a reference to variable
guarded by a mutex. After #67776, thread-safey analysis checks if a
variable return by reference has the lock held. The ASSERT_CAPABILITY
only claims after calling that function, the lock will be held. But not
asserting that the lock is held *before* calling that function.

In the patch, we switch to use REQUIRES() and assertLocked() to mark the
code paths. Also remove the misused ASSERT_CAPABILITY.

Fixes #67795, #67796




More information about the All-commits mailing list