]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: threads: don't read lock history entries that don't fit in ulong
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 12 Nov 2026 11:58:20 +0000 (12:58 +0100)
committerOlivier Houchard <cognet@ci0.org>
Thu, 12 Nov 2026 16:30:41 +0000 (17:30 +0100)
commite51c393f8fd5cb2898f7a241a0d38b4be61cefaf
tree01082a0d7fad5e2aacdd946ea9f62ea790f72e90
parent026b8cdcd8d59c3d3b1d180e588dd648ec26041f
BUG/MEDIUM: threads: don't read lock history entries that don't fit in ulong

The per-thread lock history is stored in the "ulong lock_history" field,
with 8 bits per lock operation. On 32-bit systems only 4 entries fit,
but the dump code in ha_thread_dump_one() always read 8 of them,
shifting the value by up to 56, which is undefined behavior with a
32-bit operand. Recent clang versions may generate bad code that will
lead to a crash when using "show threads" on 32bits machines.

Let's keep the field an ulong and only iterate over the entries that
fit in it. On 64-bit nothing changes, and on 32-bit the last 4 entries
are dumped, which is all the field stores anyway.

This should be backported up to 3.2.
src/debug.c