]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: connection: Clear flags when a conn is removed from an idle list
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Feb 2023 14:39:38 +0000 (15:39 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Feb 2023 17:36:29 +0000 (18:36 +0100)
commit5e1b0e7bf86a300def07388df0ea7f4b3f9e68b9
tree681281c071e20b514c34cb57fb425cd84a787fcd
parent4bdd0696373b5a683cfab905c65c5af103855bd3
BUG/MEDIUM: connection: Clear flags when a conn is removed from an idle list

When a connection is removed from the safe list or the idle list,
CO_FL_SAFE_LIST and CO_FL_IDLE_LIST flags must be cleared. It is performed
when the connection is reused. But not when it is moved into the
toremove_conns list. It may be an issue because the multiplexer owning the
connection may be woken up before the connection is really removed. If the
connection flags are not sanitized, it may think the connection is idle and
reinsert it in the corresponding list. From this point, we can imagine
several bugs. An UAF or a connection reused with an invalid state for
instance.

To avoid any issue, the connection flags are sanitized when an idle
connection is moved into the toremove_conns list. The same is performed at
right places in the multiplexers. Especially because the connection release
may be delayed (for h2 and fcgi connections).

This patch shoudld fix the issue #2057. It must carefully be backported as
far as 2.2. Especially on the 2.2 where the code is really different. But
some conflicts should be expected on the 2.4 too.
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/server.c