Skip to content

validation: Check absence of locks at compile-time (LOCKS_EXCLUDED) in addition to the current run-time checking (AssertLockNotHeld) - #15721

Closed
practicalswift wants to merge 1 commit into
bitcoin:masterfrom
practicalswift:negative-locking-annotations
Closed

practicalswift wants to merge 1 commit into
bitcoin:masterfrom
practicalswift:negative-locking-annotations

Conversation

@practicalswift

@practicalswift practicalswift commented Apr 2, 2019 •

Copy link
Copy Markdown
Contributor

Check absence of locks at compile-time (using LOCKS_EXCLUDED annotation) in addition to the current run-time checking (using AssertLockNotHeld(…)).

In line with the developer notes:

Generally; compile-time checking is preferred over run-time checking.

For people who are not compiling with clang -Werror=thread-safety-analysis -- this is the type of checking these annotations enable:

[…]: error: cannot call function 'LimitValidationInterfaceQueue' while mutex 'cs_main' is
     held [-Werror,-Wthread-safety-analysis]
            LimitValidationInterfaceQueue();
            ^

…n addition to the current run-time checking (AssertLockNotHeld)
@DrahtBot

DrahtBot commented Apr 2, 2019 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #15921 (Tidy up ValidationState interface by jnewbery)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@practicalswift

Copy link
Copy Markdown
Contributor Author

FWIW: I've verified that a disassembly of the bitcoind binary built on a Ubuntu 18.04 machine with this patch applied is identical to a disassembly of the bitcoind binary built against master (as expected).

@practicalswift

practicalswift commented May 7, 2019 •

Copy link
Copy Markdown
Contributor Author

Oh, forgot that I submitted this PR back in April. Replaced by #15967 submitted earlier today which covers a few more functions. See also #15967.

@practicalswift
practicalswift deleted the negative-locking-annotations branch April 10, 2021 19:38
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants