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

ecdh_hsmd: ensure HSM fd is blocking on setup

Public commit record

What the developer wrote

Authored by Níckolas Goline

68/100 · Adequate
ecdh_hsmd: ensure HSM fd is blocking on setup

On macOS under load, socketpair fds sent via SCM_RIGHTS can have
O_NONBLOCK set (from the sender's io_new_conn call in hsmd's
pass_client_hsmfd). This causes wire_sync_read to return NULL
with EAGAIN, killing connectd or channeld with "No hsmd ECDH response".

The fix mirrors the "Don't trust subd to set it blocking" pattern
already used in lightningd/subd.c:read_fds(): explicitly call
io_fd_block(hsm_fd, true) in ecdh_hsmd_setup.

Changelog-Fixed: connectd: fix intermittent "No hsmd ECDH response" crash on macOS under load.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug where a special internal communication channel (file descriptor) used by Core Lightning could accidentally be left in non-blocking mode on macOS under heavy load. When that happened, a part of the program expecting a blocking read would get an unexpected 'try again' error and crash with 'No hsmd ECDH response.' The fix explicitly forces the channel to blocking mode when it is set up, matching a safety pattern already used elsewhere in the codebase. It is a reliability fix rather than a security vulnerability in the usual attacker-vs-system sense.

Recommended action

Treat as a stability/reliability fix. Apply the patch and backport to maintained branches, especially for macOS deployments. No immediate incident-response action is required unless node operators on macOS are experiencing intermittent 'No hsmd ECDH response' crashes, in which case upgrading will resolve it.

Security signals we found

01

Crash/DoS condition in connectd/channeld due to unexpected EAGAIN on synchronous HSM read

02

Inherited O_NONBLOCK on SCM_RIGHTS-passed socketpair fd on macOS

03

Defensive hardening: explicit blocking-mode enforcement on setup

04

Pattern consistency with existing subd.c read_fds() hardening

Risk score

Why this scored 47/100

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