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

Merge bitcoin/bitcoin#36077: bugfix: give TxDownloadManager its own RNG

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge bitcoin/bitcoin#36077: bugfix: give TxDownloadManager its own RNG

80eaa6cabf28b7d68c61fc5aced189b36970f17e bugfix: give TxDownloadManager its own RNG (Greg Sanders)

Pull request description:

TxDownloadManagerImpl retains a reference to PeerManagerImpl::m_rng,
which is non-thread-safe and guarded by g_msgproc_mutex.

BlockConnected runs on the validation background thread while holding
only m_tx_download_mutex. Reconsidering an orphan with multiple
announcers could therefore use m_rng concurrently with message
processing.

Regression introduced in #35986

Added a regression test on second commit, can remove it from the PR if deemed superfluous.

This is a Project Loupe find.

ACKs for top commit:
maflcko:
review ACK 80eaa6cabf28b7d68c61fc5aced189b36970f17e 🐓
hodlinator:
ACK 80eaa6cabf28b7d68c61fc5aced189b36970f17e
sedited:
ACK 80eaa6cabf28b7d68c61fc5aced189b36970f17e

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

What changed, and why it matters

This fix gives a network transaction-download component its own random-number generator instead of borrowing one from another part of the program. The borrowed generator was only meant to be used while a specific message-processing lock was held, but a background validation thread could use it at the same time without that lock. That is a race condition: two threads updating the same internal state unpredictably. In practice this could corrupt the random generator's state, cause crashes, or make transaction-download behavior unreliable, but it is not a direct theft-of-coins bug and would be hard to trigger on demand.

Recommended action

Apply the patch. It is a targeted, low-risk refactor that removes a real data race. Operators running nodes built from commits between #35986 and this fix should upgrade, though no emergency response is warranted because exploitation is not straightforward and the bug is more reliability/integrity than direct fund theft.

Security signals we found

01

Concurrent use of non-thread-safe FastRandomContext across threads

02

Missing lock synchronization between message-processing and validation background threads

03

Regression introduced by prior refactor (#35986)

04

Fix includes regression test

05

Disclosed as a Project Loupe find

Risk score

Why this scored 49/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 10/15
Affected reach 7/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.