Skip to content

Conversation

@sangbida
Copy link
Collaborator

@sangbida sangbida commented Nov 25, 2025

Fixes #8726

When we enter the wrong passphrase hsmd crashes like this with an unknown message type:

lightning_hsmd: Failed to load hsm_secret: Wrong passphrase (version v25.12rc1-7-g7713a42-modded) 0x102ba44bf ???
        send_backtrace+0x4f:0
0x102b0900f status_failed
        common/status.c:207
0x102af1a37 hsmd_send_init_reply_failure
        hsmd/hsmd.c:301
0x102af1497 load_hsm
        hsmd/hsmd.c:446
0x102af1497 init_hsm
        hsmd/hsmd.c:548
0x102b29e63 next_plan
        ccan/ccan/io/io.c:60
0x102b29e63 do_plan
        ccan/ccan/io/io.c:422
0x102b29d8b io_ready
        ccan/ccan/io/io.c:439
0x102b2b4bf io_loop
        ccan/ccan/io/poll.c:470
0x102af0a83 main
        hsmd/hsmd.c:886
lightningd: HSM sent unknown message type

This change swaps write_all() to wire_synce_write() because write_all() is missing the wire protocol length prefix. Something to note is that we will still see a crash dump here because we are finishing with a status_failed() which produces a crash dump, this consistent with other hsm failures, we don't want to be starting up if we've been given the wrong passphrase. So the dump should look like this now:

lightningd: HSM initialization failed: Failed to load hsm_secret: Wrong passphrase 0x1003804b7 ???
        send_backtrace+0x4f:0
0x1002e5007 status_failed
        common/status.c:207
0x1002cda2f hsmd_send_init_reply_failure
        hsmd/hsmd.c:301
0x1002cd497 load_hsm
        hsmd/hsmd.c:446
0x1002cd497 init_hsm
        hsmd/hsmd.c:548
0x100305e5b next_plan
        ccan/ccan/io/io.c:60
0x100305e5b do_plan
        ccan/ccan/io/io.c:422
0x100305d83 io_ready
        ccan/ccan/io/io.c:439
0x1003074b7 io_loop
        ccan/ccan/io/poll.c:470
0x1002cca83 main
        hsmd/hsmd.c:886

Changelog-None

When we enter the wrong passphrase hsmd crashes like this with an unknown message type:

lightning_hsmd: Failed to load hsm_secret: Wrong passphrase (version v25.12rc1-7-g7713a42-modded)
0x102ba44bf ???
        send_backtrace+0x4f:0
0x102b0900f status_failed
        common/status.c:207
0x102af1a37 hsmd_send_init_reply_failure
        hsmd/hsmd.c:301
0x102af1497 load_hsm
        hsmd/hsmd.c:446
0x102af1497 init_hsm
        hsmd/hsmd.c:548
0x102b29e63 next_plan
        ccan/ccan/io/io.c:60
0x102b29e63 do_plan
        ccan/ccan/io/io.c:422
0x102b29d8b io_ready
        ccan/ccan/io/io.c:439
0x102b2b4bf io_loop
        ccan/ccan/io/poll.c:470
0x102af0a83 main
        hsmd/hsmd.c:886
lightningd: HSM sent unknown message type

This change swaps write_all() to wire_synce_write() because write_all() is missing the wire protocol length prefix. Something to note is that we will still see a crash dump here because we are finishing with a status_failed() which produces a crash dump, this consistent with other hsm failures, we don't want to be starting up if we've been given the wrong passphrase. So the dump should look like this now:

lightningd: HSM initialization failed: Failed to load hsm_secret: Wrong passphrase
0x1003804b7 ???
        send_backtrace+0x4f:0
0x1002e5007 status_failed
        common/status.c:207
0x1002cda2f hsmd_send_init_reply_failure
        hsmd/hsmd.c:301
0x1002cd497 load_hsm
        hsmd/hsmd.c:446
0x1002cd497 init_hsm
        hsmd/hsmd.c:548
0x100305e5b next_plan
        ccan/ccan/io/io.c:60
0x100305e5b do_plan
        ccan/ccan/io/io.c:422
0x100305d83 io_ready
        ccan/ccan/io/io.c:439
0x1003074b7 io_loop
        ccan/ccan/io/poll.c:470
0x1002cca83 main
        hsmd/hsmd.c:886
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crash when inputting wrong passphrase? v25.12rc1

1 participant