Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Apr 2, 2019

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
Copy link
Contributor

DrahtBot commented Apr 2, 2019

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
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
Copy link
Contributor Author

practicalswift commented May 7, 2019

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