BUG/MAJOR: mux-quic: fix crash on reload during emission
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 1 Sep 2025 13:07:53 +0000 (15:07 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Oct 2025 14:48:34 +0000 (16:48 +0200)
commitb14c4ffd6b992ba1915673b8cd0c48a278fccfce
tree82d35b1bcf428d58fad1f8f207a61dd0720bce1a
parentd62c2145b20793e129b80d63f5e973d59efd5391
BUG/MAJOR: mux-quic: fix crash on reload during emission

MUX QUIC restricts buffer allocation per connection based on the
underlying congestion window. If a QCS instance cannot allocate a new
buffer, it is put in a buf_wait list. Typically, this will cause stream
upper layer to subscribe for sending.

A BUG_ON() was present on snd_buf and nego_ff callback prologue to
ensure that these functions were not called if QCS is already in
buf_wait list. The objective was to guarantee that there is no wake up
on a stream if it cannot allocate a buffer.

However, this BUG_ON() is not correct, as it can be fired legitimely.
Indeed, stream layer can retry emission even if no wake up occured. This
case can happen on reload. Thus, BUG_ON() will cause an unexpected
crash.

Fix this by removing these BUG_ON(). Instead, snd_buf/nego_ff callbacks
ensure that QCS is not subscribed in buf_wait list. If this is the case,
a nul value will be returned, which is sufficient for the stream layer
to pause emission and subscribe if necessary.

Occurences for this crash have been reported on the mailing list. It is
also the subject of github issue #3080, which should be fixed with this
patch.

This must be backported up to 3.0.

(cherry picked from commit dcf22616123432e3230c0a084cf13c5adc57b851)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 49fd57fe90939f15e7f75040a968266d7fa0112a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 54115fc2205ffbfe19a36212178cd861a210883f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/mux_quic.c