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)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 18 Mar 2025 15:13:40 +0000 (16:13 +0100)
commit57af6578908620d001414a31a9769c3337054c18
tree0342b25d42cd48e5dc6a812ddd9a407f86e8fbbe
parent685dbc44107298f725178e1e648d9959a1cf2a4f
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>
(cherry picked from commit 5f22fca932a1c3d5c92f30add31ffce81abdf758)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
src/stream.c