]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #1457: race condition causes segfault when starting
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 28 May 2026 07:34:04 +0000 (09:34 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 28 May 2026 07:34:04 +0000 (09:34 +0200)
  threads.

daemon/daemon.c
doc/Changelog

index 9a692c1cbd55264cc62d981b7c7c257facf9530f..1f87d853e972f003dcbcd3033adadf14ffdb2275 100644 (file)
@@ -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
index 8da65418d917fc1aa5aa76a1b8d95f9e3f7c9e7c..2e8ba15efeee6105254db85ee2e71c256e8cd28b 100644 (file)
@@ -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,