BUG/MEDIUM: fd: Use the provided tgid in fd_insert() to get tgroup_info
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 10 Jun 2025 12:39:22 +0000 (12:39 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 17 Jun 2025 06:04:13 +0000 (08:04 +0200)
commitf4ce06e7bc4e9d5a723b37b381b4f13bf372ae44
tree3be50b2664c0c4207a87adbdbacaacc96fc82cc3
parent50984532e8851d7d36491d953236aebcf78255e3
BUG/MEDIUM: fd: Use the provided tgid in fd_insert() to get tgroup_info

In fd_insert(), use the provided tgid to ghet the thread group info,
instead of using the one of the current thread, as we may call
fd_insert() from a thread of another thread group, that will happen at
least when binding the listeners. Otherwise we'd end up accessing the
thread mask containing enabled thread of the wrong thread group, which
can lead to crashes if we're binding on threads not present in the
thread group.
This should fix Github issue #2991.

This should be backported up to 2.8.

(cherry picked from commit 6993981cd6e81448cd6a21ca32f21f2b548aa1b3)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 12989a221bdf829a36f73d25ac947e95af7af59a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 67455c2e293fe0af1dfaf12c031de04bff958930)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
include/haproxy/fd.h