AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 29 Bitcoin

Merge bitcoin/bitcoin#36556: depends: fix non-atomic reads in capnp debug assertions

Public commit record

What the developer wrote

Authored by merge-script

81/100 · Strong
Merge bitcoin/bitcoin#36556: depends: fix non-atomic reads in capnp debug assertions

6e8e85ddcf2eb4a062fab3cd2b9c046edfbf72ec depends: fix non-atomic reads in capnp debug assertions (xyzconstant)

Pull request description:

KJ's debug assertions read the mutex futex word and `AtomicRefcounted` refcounts non-atomically. The TSan job builds capnp without optimization, which automatically enables these assertions, and TSan reports these reads as data races the moment KJ objects start communicating across threads.

libmultiprocess enables cross-thread communication for the first time in bitcoin-core/libmultiprocess#376, which replaces the pipe used in `EventLoop::sync()` with `kj::Executor::executeSync()`. This is what triggered the [failure](https://github.com/bitcoin-core/libmultiprocess/actions/runs/38094008438/job/114336046070?pr=376).

Patches are the upstream commits capnproto/capnproto@b91a6ba7c7 and capnproto/capnproto@cc13c8c45f, which are backports of the v2 fixes in capnproto/capnproto#2781 and capnproto/capnproto#2843 (backport PR: capnproto/capnproto#2855).

ACKs for top commit:
Sjors:
ACK 6e8e85ddcf2eb4a062fab3cd2b9c046edfbf72ec
ryanofsky:
Code review ACK 6e8e85ddcf2eb4a062fab3cd2b9c046edfbf72ec. Thanks for tracking down the race and getting the fix merged upstream first, which makes the patches easy to check.

Tree-SHA512: 07bc877c39b9e598b29eba73d066561dfd981ddf2d750d1cab383697084ecea497b6c7e7d1925fb4eed59bd7ccadfc05eef734b46e83b654a2e31033d34189ab
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit adds two upstream patches to Bitcoin Core's build of the Cap'n Proto library. The patches fix debug-only assertions that read shared memory values without using atomic operations. These non-atomic reads were flagged by ThreadSanitizer as data races once KJ objects communicate across threads. The fix only affects debug/TSan builds and does not change release behavior; it is a correctness and testing-infrastructure improvement rather than a user-facing security bug.

Recommended action

No urgent action required. The change is a build-system patch update. Ensure CI TSan builds pick up the new patches and verify no new warnings appear. Consider updating to a future Cap'n Proto release that includes these fixes natively.

Security signals we found

01

Fixes ThreadSanitizer-reported data races in dependency debug assertions

02

Backports upstream capnproto fixes (#2781 and #2843) to 1.x branch

03

Only affects capnp built without optimization / with debug assertions enabled

04

No change to release-build atomic synchronization logic

05

Triggered by cross-thread KJ communication in libmultiprocess

Risk score

Why this scored 29/100

Our methodology →
Potential impact 5/30
Exploitability 2/25
Stealth signal 4/15
Affected reach 6/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.