Page MenuHomePhabricator

Merge #13081: wallet: Add compile time checking for cs_wallet runtime locking assertions
ClosedPublic

Authored by nakihito on Sat, Aug 31, 00:36.

Details

Reviewers
deadalnix
Fabien
jasonbcox
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABCec813bc91426: Merge #13081: wallet: Add compile time checking for cs_wallet runtime locking…
Summary

66b0b1b2a6 Add compile time checking for all cs_wallet runtime locking assertions (practicalswift)

Pull request description:

Add compile time checking for `cs_wallet` runtime locking assertions.

This PR is a subset of #12665. The PR was broken up to make reviewing easier.

The intention is that literally all `EXCLUSIVE_LOCKS_REQUIRED`/`LOCKS_EXCLUDED`:s added in this PR should follow either directly or indirectly from `AssertLockHeld(…)`/`AssertLockNotHeld(…)`:s already existing in the repo.

Consider the case where function `A(…)` contains `AssertLockHeld(cs_foo)` (without
first locking `cs_foo` in `A`), and that `B(…)` calls `A(…)` (without first locking `cs_main`):
* It _directly_ follows that: `A(…)` should have an `EXCLUSIVE_LOCKS_REQUIRED(cs_foo)` annotation.
* It _indirectly_ follows that: `B(…)` should have an `EXCLUSIVE_LOCKS_REQUIRED(cs_foo)` annotation.

Tree-SHA512: d561d89e98a823922107e56dbd493f0f82e22edac91e51e6422f17daf2b446a70c143b7b157ca618fadd33d0ec63eb7a57dde5a83bfdf1fc19d71459b43e21fd

Backport of Core PR13081
https://github.com/bitcoin/bitcoin/pull/13081/

Depends on D3998

Test Plan
./configure CXX=clang++ CC=clang
make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

nakihito created this revision.Sat, Aug 31, 00:36
Owners added a reviewer: Restricted Owners Package.Sat, Aug 31, 00:36
Herald added a reviewer: Restricted Project. · View Herald TranscriptSat, Aug 31, 00:36
Fabien requested changes to this revision.Tue, Sep 3, 08:24

See D3980

This revision now requires changes to proceed.Tue, Sep 3, 08:24
nakihito edited the test plan for this revision. (Show Details)Tue, Sep 3, 19:06
nakihito updated this revision to Diff 11073.Tue, Sep 3, 19:16

Rebased.

nakihito updated this revision to Diff 11075.Tue, Sep 3, 19:47

Added an instance of EXCLUSIVE_LOCKS_REQUIRED() to wallet/wallet.cpp.

Fabien requested changes to this revision.Wed, Sep 4, 15:55
This revision now requires changes to proceed.Wed, Sep 4, 15:55
nakihito updated this revision to Diff 11091.Wed, Sep 4, 22:08

Rebased off D3998.

Fabien accepted this revision.Thu, Sep 5, 07:01
This revision is now accepted and ready to land.Thu, Sep 5, 07:01