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>
Thu, 17 Apr 2025 15:04:35 +0000 (17:04 +0200)
commitf668b85ecea96218c24524d91b7d4f1e065fcd74
tree50653a447729028b8257145e85e2652125c403da
parent453a7dfa3ffabb85cd11e7f244688799d71052e8
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>
src/debug.c