BUG/MEDIUM: stream: never allocate connection addresses from signal handler
authorWilly Tarreau <w@1wt.eu>
Fri, 21 Feb 2025 15:45:18 +0000 (16:45 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 28 Feb 2025 15:26:15 +0000 (16:26 +0100)
commit5f22fca932a1c3d5c92f30add31ffce81abdf758
tree94cb944c5e50043f80b7d8610c7abd99b04f0a6d
parentbc35f7763b413370f611c775e64acab469dead04
BUG/MEDIUM: stream: never allocate connection addresses from signal handler

In __strm_dump_to_buffer(), we call conn_get_src()/conn_get_dst() to try
to retrieve the connection's IP addresses. But this function may be called
from a signal handler to dump a currently running stream, and if the
addresses were not allocated yet, a poll_alloc() will be performed while
we might possibly already be running pools code, resulting in pool list
corruption.

Let's just make sure we don't call these sensitive functions there when
called from a signal handler.

This must be backported at least to 3.1 and ideally all other versions,
along with this previous commit:

  MINOR: tinfo: add a new thread flag to indicate a call from a sig handler

(cherry picked from commit 84d4c948fce4b31220bb9a30cbf676613bbbf4f2)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/stream.c