From d5c2c486f1f1d2805c721189ebd1f486df5ff7fa Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 16 Feb 2026 17:40:33 +1030 Subject: [PATCH] askrene: close files in child to isolate against bugs. This makes sure it cannot interfere with the parent askrene's connection to lightningd, for example. Signed-off-by: Rusty Russell --- plugins/askrene/askrene.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/askrene/askrene.c b/plugins/askrene/askrene.c index a5709c127..c16aa6501 100644 --- a/plugins/askrene/askrene.c +++ b/plugins/askrene/askrene.c @@ -653,6 +653,13 @@ static struct command_result *do_getroutes(struct command *cmd, close(replyfds[0]); set_child_log_fd(logfds[1]); + /* Make sure we don't stomp over plugin fds, even if we have a bug */ + for (int i = 0; i < min_u64(logfds[1], replyfds[1]); i++) { + /* stderr is maintained */ + if (i != 2) + close(i); + } + /* Does not return! */ run_child(askrene->gossmap, layers,