HomePhabricator

[backport#15971] validation: Add compile-time checking for negative locking…

Description

[backport#15971] validation: Add compile-time checking for negative locking requirement in LimitValidationInterfaceQueue

Summary:
62d50ef308 Add LOCKS_EXCLUDED(cs_main) to LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main) (practicalswift)

Pull request description:

This PR adds compile-time checking for negative locking requirements that follow from the run-time locking requirement `AssertLockNotHeld(cs_main)` in `LimitValidationInterfaceQueue(...)`.

Changes:
* Add `LOCKS_EXCLUDED(cs_main)` to `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`
* Add `LOCKS_EXCLUDED(cs_main)` to `CChainState::ActivateBestChain(…)`, `CChainState:: InvalidateBlock(…)` and `CChainState::RewindBlockIndex(…)` which all call `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`
* Add `LOCKS_EXCLUDED(cs_main)` to `InvalidateBlock(…)` which calls `CChainState::InvalidateBlock(...)` which in turn calls `LimitValidationInterfaceQueue(...)` which  does `AssertLockNotHeld(cs_main)`
* Add `LOCKS_EXCLUDED(cs_main)` to `RewindBlockIndex(…)` which calls `CChainState::RewindBlockIndex(...)` which in turn calls `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`

Depends on D7213

Backport of Core PR15971

Test Plan:

cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug
ninja check && ninja check-functional

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6940

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on May 8 2019, 13:19
majcostaCommitted on Aug 21 2020, 15:06
majcostaPushed on Aug 21 2020, 15:06
Reviewer
Restricted Project
Differential Revision
D6940: [backport#15971] validation: Add compile-time checking for negative locking requirement in LimitValidationInterfaceQueue
Parents
rABCc0c79f53e5c7: [backport#15402] Prevent callback overruns in InvalidateBlock and…
Branches
Unknown
Tags
Unknown