BUG/MINOR debug: fix !USE_THREAD_DUMP in ha_thread_dump_fill()
authorWilly Tarreau <w@1wt.eu>
Thu, 17 Apr 2025 08:28:37 +0000 (10:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Apr 2025 09:08:10 +0000 (11:08 +0200)
commit3a592c2eae4cdb23fcd0feb968df84ed3be34022
treeae9615792d4de54cf4d5e5169a73eccecab22834
parent003e6a8ad26dc10d8e4a200b2bd847128b0903e6
BUG/MINOR debug: fix !USE_THREAD_DUMP in ha_thread_dump_fill()

The function must make sure to return NULL for foreign threads and
the local buffer for the current thread in this case, otherwise panics
(and sometimes even warnings) will segfault when USE_THREAD_DUMP is
disabled. Let's slightly re-arrange the function to reduce the #if/else
since we have to specifically handle the case of !USE_THREAD_DUMP anyway.

This needs to be backported wherever b8adef065d ("MEDIUM: debug: on
panic, make the target thread automatically allocate its buf") was
backported (at least 2.8).

(cherry picked from commit 0b56839455c7f45ae58954e1eb3873a3725899dc)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit f668b85ecea96218c24524d91b7d4f1e065fcd74)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/debug.c