[PATCH] D129755: Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls
Gulfem Savrun Yeniceri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 7 10:33:54 PDT 2022
gulfem added a comment.
In D129755#3843206 <https://reviews.llvm.org/D129755#3843206>, @aaronpuchert wrote:
> 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`?
https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/kernel/vm/vm_cow_pages.cc
It looks like `Cursor` is an alias to `VmoCursor`.
https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/kernel/vm/include/vm/vm_cow_pages.h
> Edit: the second error seems to be same that @hans was posting. That's a true positive sadly, we didn't emit a warning previously by accident.
Yes, that is the same error.
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