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

Merge bitcoin/bitcoin#36747: Update libmultiprocess subtree to add nonunix platform support and fix race conditions

Public commit record

What the developer wrote

Authored by merge-script

100/100 · Strong
Merge bitcoin/bitcoin#36747: Update libmultiprocess subtree to add nonunix platform support and fix race conditions

d5f7524897dd5ec638cebf7d61607c561c3b9e2b doc: Bump minimum required Cap'n Proto version to 0.9.2 (Ryan Ofsky)
4898199d8f97cad75cfd54a9caed3ffd3ce2948c build: suppress -Wc++23-lambda-attributes in warn_interface (Ryan Ofsky)
270f5dbe3ddac5191ec6b21ceb17c3dddb79b12f Squashed 'src/ipc/libmultiprocess/' changes from e8de5c7b68e..acded1aafae (Ryan Ofsky)

Pull request description:

The changes can be verified by running `test/lint/git-subtree-check.sh src/ipc/libmultiprocess` as described in [developer notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees) and [lint instructions](https://github.com/bitcoin/bitcoin/tree/master/test/lint#git-subtree-checksh).

Changes since last subtree update (#35720):

- Adds support for nonunix platforms, making API changes that are not backwards compatible ([#274](https://github.com/bitcoin-core/libmultiprocess/pull/274)). Follow-ups add a `CurrentThread()` accessor matching compatibility code in [bitcoin/bitcoin#35084](https://github.com/bitcoin/bitcoin/pull/35084) ([#323](https://github.com/bitcoin-core/libmultiprocess/pull/323)) and remove code for Cap'n Proto versions before 0.9 ([#331](https://github.com/bitcoin-core/libmultiprocess/pull/331)).
- Fixes a data race between IPC calls running on worker threads and disconnects, found by Antithesis ([#349](https://github.com/bitcoin-core/libmultiprocess/pull/349)).
- Fixes a use-after-free when a socket disconnects before `ConnectStream` connects, and leaks and hangs when a client `construct()` call throws ([#298](https://github.com/bitcoin-core/libmultiprocess/pull/298)).
- Fixes a race where file descriptors from `SpawnProcess` could leak into processes forked at the same time by other threads, by clearing `FD_CLOEXEC` in the child after forking ([#311](https://github.com/bitcoin-core/libmultiprocess/pull/311)).
- Makes `SpawnProcess` report `exec` failures back to the parent and throw, reaping the child ([#312](https://github.com/bitcoin-core/libmultiprocess/pull/312)).
- Adds support for `std::chrono::time_point` fields ([#303](https://github.com/bitcoin-core/libmultiprocess/pull/303)) and for serializing lists of interface objects that need to be moved from ([#304](https://github.com/bitcoin-core/libmultiprocess/pull/304)), both needed by [bitcoin/bitcoin#10102](https://github.com/bitcoin/bitcoin/pull/10102).
- Accepts container fields and parameters with any comparator, hash, and allocator types, like Bitcoin Core's `GCSFilter::ElementSet`, needed by [bitcoin/bitcoin#29409](https://github.com/bitcoin/bitcoin/pull/29409) ([#379](https://github.com/bitcoin-core/libmultiprocess/pull/379)).
- Finds the `capnp` tool in vcpkg and Windows builds, needed by [bitcoin/bitcoin#32387](https://github.com/bitcoin/bitcoin/pull/32387) ([#317](https://github.com/bitcoin-core/libmultiprocess/pull/317)).
- Adds a `destroy_connection` option to `ServeStream` and `ConnectStream`, lets `ServeStream` take ownership of the init object and return the new server and its connection, and adds an `EventLoop::incomingConnections()` accessor, simplifying test setup in both repositories and needed by [bitcoin/bitcoin#35932](https://github.com/bitcoin/bitcoin/pull/35932) ([#365](https://github.com/bitcoin-core/libmultiprocess/pull/365)).
- Replaces `EventLoop::post()` with `sync()` taking a `kj::FunctionParam`, avoiding a heap allocation per call ([#347](https://github.com/bitcoin-core/libmultiprocess/pull/347)).
- Names threads spawned by the event loop so they can be told apart in tools and logs ([#324](https://github.com/bitcoin-core/libmultiprocess/pull/324)).
- Fixes warnings that Bitcoin Core enables or plans to enable: adds `[[noreturn]]` attributes for `-Wmissing-noreturn` ([#339](https://github.com/bitcoin-core/libmultiprocess/pull/339), for [bitcoin/bitcoin#35911](https://github.com/bitcoin/bitcoin/pull/35911)), and fixes `-Wunused` ([#362](https://github.com/bitcoin-core/libmultiprocess/pull/362), for [bitcoin/bitcoin#36167](https://github.com/bitcoin/bitcoin/pull/36167)), `-Wunused-const-variable` and `-Wundef` ([#370](https://github.com/bitcoin-core/libmultiprocess/pull/370)), and `-Wmissing-prototypes` ([#386](https://github.com/bitcoin-core/libmultiprocess/pull/386), for [bitcoin/bitcoin#36743](https://github.com/bitcoin/bitcoin/pull/36743)) warnings.
- Fails at compile time with a suggested workaround when Cap'n Proto misdetects exception support (`KJ_NO_EXCEPTIONS`), as happens on NetBSD ([#364](https://github.com/bitcoin-core/libmultiprocess/pull/364)).
- Build improvements: fixes stale generated code when the `mpgen` binary changes ([#316](https://github.com/bitcoin-core/libmultiprocess/pull/316)), fixes `mpgen` link order for static Cap'n Proto builds ([#367](https://github.com/bitcoin-core/libmultiprocess/pull/367)), links `mpgen` against `kj-async` instead of `capnp-rpc` ([#327](https://github.com/bitcoin-core/libmultiprocess/pull/327)), shows Cap'n Proto `find_package` diagnostics ([#325](https://github.com/bitcoin-core/libmultiprocess/pull/325)), installs `type-unordered-set.h` and `version.h` ([#350](https://github.com/bitcoin-core/libmultiprocess/pull/350)), and shows include-what-you-use errors instead of failing silently ([#371](https://github.com/bitcoin-core/libmultiprocess/pull/371)).
- Test, CI, documentation, and minor code improvements: fix for a startup race in the example program ([#315](https://github.com/bitcoin-core/libmultiprocess/pull/315)), new test for immediate client disconnects in `ListenConnections` ([#310](https://github.com/bitcoin-core/libmultiprocess/pull/310)), `ReadList` return value check ([#338](https://github.com/bitcoin-core/libmultiprocess/pull/338)), connect test race fix ([#343](https://github.com/bitcoin-core/libmultiprocess/pull/343)) and cleanups ([#344](https://github.com/bitcoin-core/libmultiprocess/pull/344)), `std::ranges::copy` follow-ups ([#307](https://github.com/bitcoin-core/libmultiprocess/pull/307)), trailing whitespace removal ([#345](https://github.com/bitcoin-core/libmultiprocess/pull/345)), Cap'n Proto version documentation fix ([#357](https://github.com/bitcoin-core/libmultiprocess/pull/357)), clang-tidy updates ([#358](https://github.com/bitcoin-core/libmultiprocess/pull/358), [#360](https://github.com/bitcoin-core/libmultiprocess/pull/360), [#380](https://github.com/bitcoin-core/libmultiprocess/pull/380), [#389](https://github.com/bitcoin-core/libmultiprocess/pull/389)), new CI job testing newer cmake and Cap'n Proto versions ([#212](https://github.com/bitcoin-core/libmultiprocess/pull/212), [#359](https://github.com/bitcoin-core/libmultiprocess/pull/359)), CI coverage for the minimum supported g++ ([#330](https://github.com/bitcoin-core/libmultiprocess/pull/330), [#366](https://github.com/bitcoin-core/libmultiprocess/pull/366)), new CI warnings ([#332](https://github.com/bitcoin-core/libmultiprocess/pull/332), [#341](https://github.com/bitcoin-core/libmultiprocess/pull/341)), CI parallelism ([#334](https://github.com/bitcoin-core/libmultiprocess/pull/334), [#356](https://github.com/bitcoin-core/libmultiprocess/pull/356)), CI diagnostics ([#351](https://github.com/bitcoin-core/libmultiprocess/pull/351), [#352](https://github.com/bitcoin-core/libmultiprocess/pull/352)), Nix and LLVM updates ([#296](https://github.com/bitcoin-core/libmultiprocess/pull/296), [#363](https://github.com/bitcoin-core/libmultiprocess/pull/363)), NetBSD and OpenBSD CI fixes ([#321](https://github.com/bitcoin-core/libmultiprocess/pull/321), [#340](https://github.com/bitcoin-core/libmultiprocess/pull/340), [#381](https://github.com/bitcoin-core/libmultiprocess/pull/381)), building Cap'n Proto with GCC in the 32-bit CI job to avoid an ABI mismatch ([#383](https://github.com/bitcoin-core/libmultiprocess/pull/383)), and GitHub Actions updates ([#387](https://github.com/bitcoin-core/libmultiprocess/pull/387)).

The second commit suppresses the clang `-Wc++23-lambda-attributes` warning, which the new `[[noreturn]]` lambda attribute in `mp/proxy-types.h` triggers in C++20 builds. Since #31507 the Windows build uses clang-cl, so the same flag covers it.

The third commit updates the minimum Cap'n Proto version in `doc/dependencies.md` to 0.9.2 (1.0 with Clang). This update raises libmultiprocess's own minimum from 0.7 to 0.9 (bitcoin-core/libmultiprocess#331), and libmultiprocess rejects 0.9.0 and 0.9.1 for CVE-2022-46149 and, with Clang 16 or newer, every version before 1.0.

ACKs for top commit:
fanquake:
ACK d5f7524897dd5ec638cebf7d61607c561c3b9e2b
willcl-ark:
ACK d5f7524897dd5ec638cebf7d61607c561c3b9e2b

Tree-SHA512: 4064944f4d8bb6c1665ddc7d5fae838492235d7dfdafab88b19b687ff6892460a3f450b90a145b287866330c569b862d748c941a70c65abc7f273ef13e490fd7
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This is a routine subtree update that pulls in a newer version of the libmultiprocess inter-process communication library used by Bitcoin Core. The commit message and code changes explicitly describe several bug fixes for race conditions, use-after-free, and file-descriptor leaks in the IPC layer. It also raises the minimum required Cap'n Proto version because older versions have a known memory-safety vulnerability (CVE-2022-46149). The changes are defensive: they fix bugs rather than introduce new attack surface, but the bugs being fixed are in security-relevant areas (cross-process communication, threading, and process spawning).

Recommended action

Treat this as a security-relevant maintenance update. Users building Bitcoin Core with multiprocess support should ensure Cap'n Proto is at least 0.9.2 (or 1.0+ when using Clang). Operators running multiprocess node/GUI should upgrade to the release containing this commit. No immediate emergency response is warranted, but the race-condition fixes should be included in release notes and backported to maintained branches that ship multiprocess builds.

Security signals we found

01

Fixes data race between IPC worker threads and disconnects (Antithesis)

02

Fixes use-after-free on socket disconnect before ConnectStream connects

03

Fixes FD_CLOEXEC race where SpawnProcess descriptors could leak into other forked processes

04

Fixes connection/resource leaks and hangs when client construct() throws

05

Bumps minimum Cap'n Proto version to 0.9.2 (1.0 with Clang) and rejects CVE-2022-46149-affected versions

06

Adds compile-time guard against KJ_NO_EXCEPTIONS=1

07

Replaces raw FD socketpair with kj AsyncIoStream for portable, reference-counted stream ownership

08

Adds shutdownWrite in Connection destructor to ensure clean cross-process teardown

Risk score

Why this scored 59/100

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