]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: quic: fix race-condition in quic_get_cid_tid()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 27 Jun 2024 15:15:55 +0000 (17:15 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 28 Jun 2024 14:27:20 +0000 (16:27 +0200)
commit72267ff35f7c82f5a32d99a03124b73d95b00a01
tree1f22122c6926f1ddbbfb86f4e78d19ce939333a3
parenta3bed52d1f84ba36af66be4317a5f746d498bdf4
BUG/MEDIUM: quic: fix race-condition in quic_get_cid_tid()

haproxy generates CID for clients which reuse them as DCID on their
packets. These CID are stored in a global tree quic_cid_trees. Each
operation on this tree must be done under lock protection.

quic_get_cid_tid() is a function which lookups a CID in global tree and
return the associated thread ID. This is used on datagram reception on
listener socket before redispatching the datagram to the correct thread.
This function uses a lock to protect quic_cid_trees access. However,
lock region is too small as CID tree node is accessed outside of it. Fix
this by extending lock protection for CID dereferencement until thread
ID is retrieved.

The impact of this bug is unknown, but it may possible cause crashes.
However, it is probably rare as most of datagram reception is done on
quic_conn socket which does not uses quic_get_cid_tid().

This may fix first crash of github issue #2607.

This must be backported up to 2.8.
src/quic_cid.c