From: W.C.A. Wijngaards Date: Thu, 28 May 2026 07:34:04 +0000 (+0200) Subject: - Fix #1457: race condition causes segfault when starting X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=57f92cc97ecff604cb83ccb3d0c52575be957718;p=thirdparty%2Funbound.git - Fix #1457: race condition causes segfault when starting threads. --- diff --git a/daemon/daemon.c b/daemon/daemon.c index 9a692c1cb..1f87d853e 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -919,13 +919,14 @@ thread_start(void* arg) { struct worker* worker = (struct worker*)arg; int port_num = 0; - log_assert(worker->thr_id); set_log_thread_id(worker, worker->daemon->cfg); { char name[16]; /* seems to be the safest size between different OSes */ snprintf(name, sizeof(name), "unbound/%u", worker->thread_num); - ub_thread_setname(worker->thr_id, name); + /* worker->thr_id can be written to after the thread was made + * by the creating thread, so this uses pthread_self. */ + ub_thread_setname(ub_thread_self(), name); } ub_thread_blocksigs(); #ifdef THREADS_DISABLED diff --git a/doc/Changelog b/doc/Changelog index 8da65418d..2e8ba15ef 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +28 May 2026: Wouter + - Fix #1457: race condition causes segfault when starting + threads. + 27 May 2026: Wouter - Fix for autotrust state-file line overflow, that can give hold-down bypass. Thanks to Qifan Zhang, Palo Alto Networks,