[PATCH] D129755: Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 10:12:49 PDT 2022


aaronpuchert added a comment.

In D129755#3843144 <https://reviews.llvm.org/D129755#3843144>, @gulfem wrote:

> We also started seeing `-Wthread-safety-precise` error in our Fuchsia code. 
> https://luci-milo.appspot.com/ui/p/fuchsia/builders/ci/clang_toolchain.ci.core.x64-release/b8800959115965408001/overview
> I'm trying to verify with our team whether it is a false positive, but I just wanted to give you heads up!

Both places have <https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/zircon/kernel/vm/vm_cow_pages.cc>

  Cursor cursor(DiscardableVmosLock::Get(), ...);
  AssertHeld(cursor.lock_ref());

At the end of the scope we get

  error: calling function '~VmoCursor' requires holding mutex 'lock_' exclusively [-Werror,-Wthread-safety-precise]
  note: found near match 'cursor.lock_'

Presumably `Cursor` is some kind of alias to `VmoCursor`, as we don't look at base destructors yet. Since the code is not easily searchable for me, can you look up the annotations on `DiscardableVmosLock::Get`, the constructor of `Cursor`/`VmoCursor` being used here, `Cursor::lock_ref`, and `AssertHeld`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129755/new/

https://reviews.llvm.org/D129755



More information about the cfe-commits mailing list