lightningd: don't assert if plugin crashes early.
What changed, and why it matters
This change removes a hard crash (assert) that occurred when a plugin exited unexpectedly during startup. Instead of the main lightning daemon crashing with an assertion failure, it now allows the daemon to shut down cleanly using the already-set exit code. This is a robustness fix that prevents a misbehaving plugin from causing an uncontrolled crash, but it does not appear to be a security vulnerability on its own.
Treat as a low-severity hardening/robustness fix. No urgent security action required. Users should upgrade normally and ensure plugins are from trusted sources, as a crashing plugin can still cause daemon shutdown (now graceful rather than abort).
Security signals we found
Removal of assert() that could abort the daemon
Plugin crash during startup could previously cause daemon abort
Improves graceful shutdown behavior for early plugin failures
Evidence from the diff
In plugins_init(), the code previously called io_loop_with_timers() and then asserted that its return value was the plugins object. If a plugin crashed early, the io loop would return because ld->exit_code was set, but the return value would not equal plugins, triggering an assertion failure and aborting lightningd. The patch removes the assertion and the ret variable, simply calling io_loop_with_timers() and letting the daemon exit gracefully via ld->exit_code. This is a defensive fix against denial-of-service via plugin crash during initialization.
Changed components
lightningd/plugin.cplugins_init() functiondaemon startup / plugin initialization pathInspect captured patch +2 / −6
diff --git a/lightningd/plugin.c b/lightningd/plugin.c
index 7c1f7316..447eb59d 100644
--- a/lightningd/plugin.c
+++ b/lightningd/plugin.c
@@ -2062,12 +2062,8 @@ void plugins_init(struct plugins *plugins)
setenv("LIGHTNINGD_PLUGIN", "1", 1);
setenv("LIGHTNINGD_VERSION", version(), 1);
- if (plugins_send_getmanifest(plugins, NULL)) {
- void *ret;
- ret = io_loop_with_timers(plugins->ld);
- log_debug(plugins->ld->log, "io_loop_with_timers: %s", __func__);
- assert(ret == plugins);
- }
+ if (plugins_send_getmanifest(plugins, NULL))
+ io_loop_with_timers(plugins->ld);
}
static void plugin_config_cb(const char *buffer,
Why this scored 26/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.