BUG/MINOR: payload: distcc_body must not sample unreceived buffer bytes
When the declared body of a distcc token is longer than the data actually
received but still fits within the channel's receive limit,
smp_fetch_distcc_body() truncates the sample to channel_recv_limit() instead
of ci_data(). The sample then covers a range of the buffer that has not been
filled by the current connection, exposing stale bytes left by a previous
connection using the same pooled buffer, e.g. via ACLs, set-var, log-format
or header insertion.
In addition, the incomplete-body check mixed reference frames: ofs is
relative to the input head, but was compared against ci_head() - b_orig() +
ci_data(), which is only equivalent when the input head sits at the buffer
origin. With bytes already forwarded, a body extending past the received
data could be considered complete.
Both issues are fixed by comparing and truncating against ci_data(), the
amount of input data actually received, and by always setting
SMP_F_MAY_CHANGE on truncated bodies so the rules are re-evaluated once more
data arrives.
This patch should fix the issue #3583. It must be backported to all
supported versions.
BUG/MINOR: quic: fix uninitialized read of pkt->rs.delivered in ACK processing (BBR)
In qc_notify_cc_of_newly_acked_pkts() the ->rs.delivered field of a TX
packet is unconditionally read for each newly acknowledged packet. But
->rs is filled in at TX time by quic_cc_drs_on_pkt_sent() (called from
drs_on_transmit() under QUIC_FL_TX_PACKET_ACK_ELICITING guard) for
ack-eliciting packets only. For a non ack-eliciting packet, e.g. a pure
ACK packet, which can be acknowledged by a peer, ->rs has never been
written and this read returns an indeterminate value.
This value is consumed by quic_cc_drs_on_ack_recv() and on_ack_rcvd()
which may corrupt the delivery rate sampling round counting
(drs->round_count, drs->next_round_delivered): a stale value from a
previously recycled packet freezes the round detection, a null one
spuriously increments round_count. Only BBR is affected: cubic neither
provides get_drs() nor on_ack_rcvd().
Fix this by reading ->rs.delivered for ack-eliciting packets only, as
already done for the call to quic_cc_drs_update_rate_sample() just
below, and for on_pkt_lost() in quic_loss.c. Also document in
quic_tx_packet_init() that ->rs is deliberately left uninitialized and
must never be read for a non ack-eliciting packet.
Thank you to @brhenc for having reported this bug in GH #3587.
This bug was introduced by 44af88d85 ("MINOR: quic: RX part
modifications to support BBR") with the delivery rate sampling support.
This must be backported up to v3.2.
BUG/MINOR: lua: channel: append() must insert data at the end, not at the start
hlua_channel_append() inserts the string at the offset of the start of the
input data, like hlua_channel_prepend() does, instead of after the existing
input data. The offset+len expression is computed and passed through
hlua_channel_filter() but never used. The function is otherwise identical to
hlua_channel_prepend(), it seems to be a copy-paste mistake when the
filter-aware insert path was introduced; hlua_http_msg_append() correctly
inserts at offset+len for the same operation.
As a result, Channel.append() behaved exactly like Channel.prepend(),
placing the string in front of the channel's input data instead of at its
end, in contradiction with its documentation ("Same as
Channel.insert(channel, string, channel:input())").
This patch should fix the issue #3598. It must be backported to all
supported versions.
BUG/MINOR: vars: fix missing string termination in get var on too long values
vars_parse_cli_get_var() builds the output for the CLI's "get var" in the
shared trash chunk using b_putchr(), which silently drops bytes once the
buffer is full. For a value long enough to exhaust trash mid-loop, the
trailing '>' and the terminating NUL were dropped, leaving trash.area
without any NUL within its bounds. cli_msg() only stores the pointer and the
string is later read with ist() (i.e. strlen) in cli_output_msg(), reading
past the buffer.
Now the loop stops before the last byte, and the terminating NUL is always
written within bounds, truncating the output if needed.
This patch should fix the issue #3592. It could be backported to all
supported versions.
BUG/MINOR: tcpcheck: fix out-of-bounds read on the MySQL server version
On success, the MySQL health-check stores the server version, read at offset
5 of the received buffer, as the check description. The version is a
NUL-terminated string, but nothing guarantees the string is terminated,
neither inside the received data nor past its end. And the version pointer
is directly passed to set_server_check_status(), which copies it with
strncpy() up to 127 bytes, stopping at the first NUL byte. With a
non-compliant server sending a handshake with an unterminated version and no
NUL byte in the rest of the received data, the copy reads past the received
data, into the remaining content of the buffer chunk, and the stale bytes
are disclosed in the check status, visible in the logs, the stats page and
'show servers state'.
To fix it, the version is bounded to the received data before being copied
into the check status, like the plugin name of an auth switch request. This
is a rework of the out-of-bounds reads fixed by 3bbfc3bd7 ('BUG/MINOR:
tcpcheck: fix out-of-bounds reads on short MySQL error packets'), which
covered the error packets but not the success path.
This is a read past the received data, so it requires a non-compliant
server, which is out of the threat model (servers are trusted). Thus there
is no security impact here, only a potential information leak in the check
status.
This patch should fix the issue #3596. It should be backported to all
supported versions.
Olivier Houchard [Fri, 20 Nov 2026 14:33:44 +0000 (15:33 +0100)]
BUG/MEDIUM: mux-spop: let the buffer callback allocate despite the queue
spop_buf_available() is called by offer_buffers() while the spop_conn is
still in the buffer wait queue. Since commit d1eb48a12 ("MEDIUM: dynbuf:
refrain from offering a buffer if more critical ones are waiting"),
b_alloc() refuses to allocate when the queue of the same or of a more
critical level is not empty, unless DB_F_NOQUEUE is passed. As the spop_conn
is queued with DB_MUX_RX, the demux buffer allocation always fails from
the callback, and the connection remains blocked until it times out.
This was reproduced by faking a failed demux buffer allocation when
receiving the agent's reply: the SPOE processing times out.
Let's pass DB_F_NOQUEUE to the allocations made from the callback, as
was done for mux-h2 in commit d7192a667 ("BUG/MEDIUM: mux-h2: permit the
buffer callback to allocate despite the queue").
The issue comes from the commit above, and mux-spop is affected since
it was introduced in 3.1. This must be backported to 3.1.
Olivier Houchard [Fri, 20 Nov 2026 14:33:44 +0000 (15:33 +0100)]
BUG/MEDIUM: mux-fcgi: let the buffer callback allocate despite the queue
fcgi_buf_available() is called by offer_buffers() while the fconn is
still in the buffer wait queue. Since commit d1eb48a12 ("MEDIUM: dynbuf:
refrain from offering a buffer if more critical ones are waiting"),
b_alloc() refuses to allocate when the queue of the same or of a more
critical level is not empty, unless DB_F_NOQUEUE is passed. As the fconn
is queued with DB_MUX_RX, the demux buffer allocation always fails from
the callback, and the connection remains blocked until it times out.
This was reproduced by faking a failed demux buffer allocation when
receiving the response: the request ends with a 504.
Let's pass DB_F_NOQUEUE to the allocations made from the callback, as
was done for mux-h2 in commit d7192a667 ("BUG/MEDIUM: mux-h2: permit the
buffer callback to allocate despite the queue").
This was introduced in 3.0 by the commit above and must be backported
to 3.0.
Olivier Houchard [Fri, 20 Nov 2026 13:29:45 +0000 (14:29 +0100)]
BUG/MEDIUM: mux-h2: don't stall on a failed rxbuf alloc without stream
When h2c_dec_hdrs() fails to allocate the temporary buffer used to
decode the HEADERS frame of a new request, it sets H2_CF_DEM_SALLOC and
the connection is queued in the buffer wait list. But h2_buf_available()
only serves H2_CF_DEM_SALLOC for a stream which has a stream connector,
which is not the case yet, so it never succeeds: the demux remains
blocked and the request is not processed until the connection times
out. This can be reproduced by faking a failed allocation there on the
first request of a connection.
There is no buffer the callback could allocate in this case, so let's
clear the flag and restart the demux, which will retry by itself. Since
b_alloc() refuses to allocate when other entries are queued, the retry
would be queued again and the offered buffer would be lost for
everyone, so a new flag H2_CF_DEM_MAYALLOC is set to let the next
h2_get_buf() allocate with DB_F_NOQUEUE, as mux-h1 does with
H1C_F_IN_MAYALLOC.
This was introduced in 2.0 by commit 5c8cafae3 ("MEDIUM: mux-h2: decode
HEADERS frames before allocating the stream"). It must be backported to
all supported versions. Before 3.0 there is no DB_F_NOQUEUE and the new
flag is not needed, clearing H2_CF_DEM_SALLOC and restarting the demux
is enough.
Willy Tarreau [Fri, 20 Nov 2026 14:01:46 +0000 (15:01 +0100)]
MINOR: http: use fuzzy-match for the "return" action keywords
The "http-request return" action supports ~10 keywords whose spelling
is never well-known for the least common ones and requires one to check
the doc. Let's just leverage find_word_index_in_array() to locate the
keyword or suggest a close match.
Willy Tarreau [Fri, 20 Nov 2026 13:15:11 +0000 (14:15 +0100)]
MINOR: init: automatically turn "set-dumpable" on when using "-d"
Since we started to automatically chroot for unprivileged users, it
has become really annoying for developers to get a core file during
their testing. Let's always turn "set-dumpable" on when debug mode
is forced on via "-d".
Willy Tarreau [Fri, 20 Nov 2026 12:43:39 +0000 (13:43 +0100)]
CLEANUP: mux-h2: get rid of the redundant h2_parse_int() function
This one was brought by commiy 8475b372c ("BUG/MINOR: mux-h2: reject
non-numeric values in the tune.h2 keywords") but is no longer needed
with the recent intops additions, let's get rid of it.
The 'jwt_verify' converter was built with the idea of being easy to use
for all JWT tokens and its second parameter needied to be interpreted
totally differently depending on the first parameter (HMAC vs pubkey
path). This comes with a potential security risk if a user did not check
the algorithm type before calling the converter. If an HMAC-signed token
was tested in a jwt_verify call that provided a certificate as second
parameter, an attacker could try to guess the certificate path and forge
HMAC tokens that validate against the certificate path.
In order to get rid of this potential risk, a new jwt_verify_secret
converter was introduced, and paired with the already existing
jwt_verify_cert one, we can fully get rid of this risk since no
parameter gets treated differently based off client-provided
information.
The 'jwt_verify' converter interprets its second parameter differently
depending on its first one: for HMAC algorithms it is used as a shared
secret, while for asymmetric ones it holds the path to a certificate or
a public key. Letting client-provided data decide how a configuration
parameter is interpreted is risky.
Splitting this logic into two converters removes the ambiguity. The new
'jwt_verify_secret' converter only accepts HMAC algorithms and always
interprets its second parameter as a secret, while the existing
'jwt_verify_cert' converter only accepts asymmetric algorithms and
always interprets it as a certificate or public key path.
The historical 'jwt_verify' converter, which keeps both behaviors for
backward compatibility, is left untouched for now, but it is the
converter that should eventually disappear once users migrated to the
two new ones.
BUG/MINOR: tcpcheck: fix out-of-bounds reads on truncated SPOP hello frames
The SPOP health-check parser reads the frame header, then dispatches on the
frame type with a read right after the 11-byte header, and decodes the K/V
items of the payload. Nothing prevents these reads to go past the received
data:
- With a frame announcing no payload (flen == 0) and a received data
exactly covering the header, the frame type is read one byte past
the received data. It is fully deterministic and does not even
require the connection to be closed by the server.
- When a K/V item key name ends exactly at the end of the received
data, the type byte of the item value is read one byte past it.
- The frame length check may also overflow: it is computed as
4 + flen on a 32-bit value read from the wire, which wraps for a
length close to UINT32_MAX.
The bytes past the received data are stale buffer content: the parsing and
the check result are then driven by bytes never sent by the server.
The SPOP parser now validates the received data itself: a frame with no
payload is invalid (both the AGENT-HELLO and AGENT-DISCONNECT frames carry
at least one K/V item), the length comparison is made overflow-safe, and the
type byte of every K/V item value is only read when the payload is not fully
consumed. Truncated frames are reported as invalid instead of being parsed
from bytes never received.
It is a read past the received data, inside the check buffer, so it requires
a non-compliant agent, which is out of the threat model (servers are
trusted). There is no security impact, only a check status that depends on
stale data.
It should be backported to all supported versions.
BUG/MINOR: tcpcheck: fix out-of-bounds reads on truncated LDAP bind responses
The LDAP health-check relies on the min-recv parameter of the expect rule
matching the first byte of the bind response to guarantee enough data are
received before parsing the message. But this parameter is only honored
while data are still expected: on a FIN or a connection error, the last read
is already reached and the rule is evaluated on the received data only. A
truncated response may thus be parsed with fewer bytes than the parser
assumes:
- With a single byte received, the message size is read one byte past
the received data.
- With a message announcing a size lower than 4, the 4-byte comparison
on the message ID and the bindResponse tag reads up to 3 bytes past
the received data.
The bytes past the received data are stale buffer content: the parsing and
the check result are then driven by bytes never sent by the server.
The LDAP parser now validates the received data itself: the message size
must be received, and the message must be at least 5 bytes to cover the
message ID, the bindResponse tag and its length. Shorter responses are
reported as truncated.
It is a read past the received data, inside the check buffer, so it requires
a non-compliant server, which is out of the threat model (servers are
trusted). There is no security impact, only a check status that depends on
stale data.
It should be backported to all supported versions.
REGTEST: spoe: add large-frame tests for the applet and the mux
Two tests exercising a near-max-size SPOP frame (a 14000-byte
binary argument) through the SPOE applet and the SPOP mux:
- largeframe.vtc, on-frontend-tcp-request event carrying
req.payload(0,14000) sampled from a buffered 30KB request;
- groupframe.vtc, http-request send-spoe-group carrying req.body,
the rule yielding until the request is complete so args are
encoded from the fully buffered body.
Both rely on a protocol-correct python agent (spoa_largeframe.py),
mirroring encode_varint()/decode_varint() from
include/haproxy/intops.h. largeframe.vtc also uses a small raw
TCP client (lf_client.py) for the 30KB request.
REGTEST: spoe: fix the SPOP varint encoding in the mock agent
The mock agent implemented a LEB128-style variable-length
integer instead of the SPOP one: the continuation shift was
off by 16 on encode and the decode masked the continuation
bytes where the reference implementation adds their full
value. The echoed max-frame-size was thus wrong (14076 instead
of 16380 with the default tune.bufsize) and only passed the
negotiation because it stayed within the accepted range. With
a smaller tune.bufsize the test would fail.
Mirror encode_varint()/decode_varint() from
include/haproxy/intops.h. Validated against the C
implementation for all values below 2000 plus larger
boundaries.
Olivier Houchard [Thu, 19 Nov 2026 18:16:31 +0000 (19:16 +0100)]
BUG/MEDIUM: stick-tables: update the bucket's next_exp before releasing its lock
process_tables_expire() computes the next expiration date of a table's
bucket under the bucket's lock, but releases the lock (and frees the
expired entries) before replacing the bucket's next_exp with this date. In
this window, another thread may insert a new entry (under the bucket's
lock) and call stktable_requeue_exp() for it. If next_exp still holds the
old (past) date, stktable_requeue_exp() considers the table as already
queued early enough and does nothing. Then the expiration task replaces
next_exp with the later date it computed, possibly TICK_ETERNITY, and
repositions or removes the table from its tree accordingly. The new entry
then doesn't expire until some other activity on this table requeues it.
The window was widened by commit 3e25104a9 ("MEDIUM: stick-tables: Avoid
freeing elements while holding a lock") which moved the freeing of expired
entries there.
Let's set next_exp before releasing the bucket's lock, so that any
insertion performed after it sees the new value. Since entries are
inserted under this lock, the computed date covers every entry present
in the bucket, so a concurrent stktable_requeue_exp() may safely be
overwritten and a plain store is enough, the CAS is not needed anymore.
This was introduced in 3.3 by commit 8bc8a21b2 ("MEDIUM: stick-tables: Use
a per-shard expiration task") and must be backported to 3.3.
Willy Tarreau [Fri, 20 Nov 2026 10:47:43 +0000 (11:47 +0100)]
CLEANUP: tree-wide: remove unneeded dependencies on tools.h
110 files were including tools.h without needing it, despite this file
being large and coming itself with many dependencies. This patch removes
these includes or replaces them with smaller ones when appropriate. All
these files were successfully built.
This reduces the total preprocessed size by ~1%:
- before: 8643090 lines, 260047208 total bytes
- after: 8562136 lines, 258459721 total bytes
Willy Tarreau [Fri, 20 Nov 2026 10:25:29 +0000 (11:25 +0100)]
REORG: tools/intops: move the int-to-str conversion functions to intops as well
These functions come with statically allocated thread-local arrays that
are used to store the output values during conversions. But they're used
just like the str-to-int ones, so let's place them here. This comes with
the creation of intops-t.h for a few macro definitions used to define the
array sizes.
Willy Tarreau [Fri, 20 Nov 2026 10:06:27 +0000 (11:06 +0100)]
REORG: tools/intops: move the integer-specific functions from tools to intops
This was already the case for their declaration in intops.h instead of
tools.h, but we were still lacking an intops.c file, so everything
remained stuffed anywhere in tools.c, difficult to find.
This moves all the functions mentioned in intops.h from tools.c to a new
intops.c file. That's roughly 450 less lines in tools.c and a slightly
better organized file where it should be easier in the future to locate
the function one needs.
Willy Tarreau [Thu, 19 Nov 2026 16:26:44 +0000 (17:26 +0100)]
MINOR: tools: add some of the missing null-terminated integer parsers
We have a number of integer parsers depending on what delimits the
integer, but the null-terminated ones were still fairly limited,
especially when range checks were expected. This commit adds the
following parsers:
int str2irc(const char *str, int *ret);
int str2uirc(const char *str, uint *ret);
int str2lrc(const char *str, long *ret);
int str2ulrc(const char *str, ulong *ret);
int str2llrc(const char *str, llong *ret);
int str2ullrc(const char *str, ullong *ret);
The all return an error status like their equivalent length-defined
ones, with the returned value via a pointer. They stop on a null
character and return parsing error when non-digit chars appear in the
string, or when too large a number is being produced for the range.
Note that for now they're in tools.c and defined in intops.h because
other ones were done similarly, but all of these should move to a new
intops.c file.
Martin Mirchev [Wed, 18 Nov 2026 12:36:59 +0000 (20:36 +0800)]
BUG/MINOR: mux-h2: reject non-numeric values in the tune.h2 keywords
The tune.h2 numeric keywords are parsed with atoi(), so trailing garbage
and non-numeric values are silently accepted: "tune.h2.max-frame-size
16384x" sets 16384, "tune.h2.fe.max-total-streams x" and
"tune.h2.fe.glitches-threshold x" set 0, which means "unlimited" for both,
"tune.h2.header-table-size 8192k" sets 8192 and a missing glitches value
is taken as 0. The same applies to initial-window-size,
max-concurrent-streams (including its "rq-load" and "min" values) and the
max-{frames,rst}-at-once keywords, where a negative value is also silently
turned into a huge unsigned limit.
Parse these values with strtol() and reject empty values, trailing
characters and values that do not fit in an int, keeping the existing
range checks and error messages. max-{frames,rst}-at-once now also reject
negative values.
mqtt_is_valid() and the mqtt_field_value() converter accept several
messages the specifications forbid:
- a CONNECT with the Will QoS set to 3. The only check rejected the
case where both QoS bits are set without the Will flag, so neither
"Will QoS 3 with Will" nor "Will QoS 1 or Will Retain without Will"
was caught (MQTT 3.1.1 3.1.2.6/3.1.2.7, MQTT 5.0 3.1.2.6/3.1.2.7);
- an MQTT 3.1.1 CONNECT with the Password flag but not the User Name
flag (MQTT 3.1.1 3.1.2.9; MQTT 5.0 allows it, so only 3.1.1 is
checked);
- an MQTT 3.1.1 CONNACK with a return code above 5, e.g. 200 (MQTT
3.1.1 3.2.2.3 only defines 0 to 5).
For example mqtt_is_valid returns 1 for a 3.1.1 CONNECT with flags 0x1c
or 0x40, and for a 3.1.1 CONNACK "20 02 00 c8". Reject these messages.
Martin Mirchev [Wed, 18 Nov 2026 12:34:24 +0000 (20:34 +0800)]
BUG/MINOR: mux-spop: match the AGENT-HELLO and AGENT-DISCONNECT keys exactly
The K/V keys of the AGENT-HELLO and AGENT-DISCONNECT frames are compared
with "sz >= strlen(KEY) && !memcmp(str, KEY, strlen(KEY))", which is a
prefix match: an agent sending "max-frame-size-bogus" (or "versionX",
"capabilitiesX", "status-codeX") has the item treated as the mandatory
one. With an invalid value under "max-frame-size-bogus", haproxy closes the
connection with "max-frame-size too big or too small", exactly as for the
real key, while a key sharing no prefix is ignored as it should be.
Compare the whole key instead. The commented-out "message" check is
updated the same way.
This should be backported to all versions with mux-spop (3.1+).
Willy Tarreau [Thu, 19 Nov 2026 14:57:15 +0000 (15:57 +0100)]
BUG/MINOR: intops: reject varints that do not fit in 64 bits in decode_varint()
decode_varint() accepts any number of continuation bytes. From the 11th
byte on, the shift count exceeds 63, which is undefined behaviour (UBSan:
"shift exponent 67 is too large for 64-bit type"), and a 10-byte varint
whose last byte is above 15 silently wraps: a value >= 2^64 is decoded
modulo 2^64. For example an SPOP agent sending the AGENT-HELLO
max-frame-size as f0 ff ff ff ff ff ff ff ff 7f has it decoded as 2314921131297212640 instead of being rejected.
In order to avoid adding costly checks in the inner loop, let's only
process the first 9 bytes as usual in the current loop and make a
special case of the 10th byte where we add an overflow check if ever
met.
This should be backported to all stable versions.
Reported-by: Martin Mirchev <mirchevmartin2203@gmail.com> Co-authored-by: Martin Mirchev <mirchevmartin2203@gmail.com>
Martin Mirchev [Wed, 18 Nov 2026 03:33:04 +0000 (11:33 +0800)]
BUG/MINOR: resolvers: reject DNS messages without the QR bit
resolv_validate_dns_response() checks the query ID, the RCODE, the
question and the records, but not the QR bit, which tells a response
(1) from a query (0). A message with QR=0 is thus processed as a
response: one carrying the same answer as a valid response is accepted,
and the query itself, if it comes back from the nameserver's address
(e.g. through an echo or a forwarding loop), is processed as a response
without any answer.
The sender still has to match the nameserver address, the query ID and
the question, so this does not make spoofing easier, but such a message
is not a response and should be treated as invalid, as RFC 1035 defines
the QR bit for this purpose.
This patch adds DNS_FLAG_RESPONSE and makes such messages invalid. The
new reg-test reg-tests/resolvers/response_flag.vtc uses a small DNS
fixture that sends the same A answer with and without the QR bit, and
checks that only the former resolves and that the latter is counted as
invalid.
Martin Mirchev [Wed, 18 Nov 2026 03:25:34 +0000 (11:25 +0800)]
BUG/MINOR: net_helper: accept an Ethernet header ending with the protocol
The eth.data, eth.hdr, eth.proto and eth.vlan converters walk the
Ethernet header with "idx + 2 < data", which requires at least one byte
after the 2-byte protocol field. An input that ends exactly with the
header is thus reported as incomplete, so eth.proto and eth.vlan return
nothing on the output of eth.hdr: "eth.hdr,eth.proto" never works, and
neither does any frame truncated right after the protocol field.
The protocol field is complete when idx + 2 <= data, so let's use this
condition in the 4 loops. Frames that carry data after the header are
not affected. The net_helper reg-test now checks eth.hdr followed by
eth.proto and eth.vlan.
Martin Mirchev [Wed, 18 Nov 2026 03:25:19 +0000 (11:25 +0800)]
BUG/MINOR: net_helper: check the TCP option length before reading its value
tcp_fullhdr_find_opt() only checks that an option fits in the TCP header
and has a length of at least 2, so the tcp.options.mss, tcp.options.tsval
and tcp.options.wscale converters read their value from the bytes that
follow the option when its length field is too small. With a 24-byte
header ending with "NOP NOP 02 02" followed by the payload 0x12 0x34,
tcp.options.mss returns 4660, and with "NOP NOP 03 02" followed by 0xaa,
tcp.options.wscale returns 170. When the option is the last one and
nothing follows the header, the value is read past the end of the input
sample (by up to 4 bytes for tsval).
This patch makes these 3 converters ignore the option when its length is
not the one defined for it (4 for MSS, 10 for TimeStamp, 3 for Window
Scale), as when the option is absent, so that they return 0 in this case. A new
reg-test, reg-tests/converter/net_helper.vtc, checks these cases.
BUG/MINOR: ocsp: fix NULL dereference when the OCSP responder sends no header
Both OCSP response handlers look for a "Content-Type" header in the
response received from the responder by iterating over hc->res.hdrs
until they reach the end-of-array marker. But this array is only
allocated when the response contains at least one header so the array
may be NULL.
This is reachable in production as soon as the OCSP auto-update is
enabled. Any responder which answers with a header-less HTTP/1.0
response (a plain error page, a minimal embedded server, a proxy that
strips the headers) crashes the worker. The same issue applies to the
client-certificate OCSP check used by the "do-ocsp-request" action,
where the request is sent to the URI found in the client certificate.
BUG/MINOR: httpclient/cli: fix NULL dereference when the response has no header
The CLI "httpclient" command (expert mode) displays the response status
line, then its headers, then its body. The httpclient applet only
allocates the response headers array when the response contains at least
one header.
A response without any header is perfectly legal for HTTP/1.0, so any
server which answers a header-less response crashes the process when the
"httpclient" command is used against it. Only an admin can run this
command, so it cannot be triggered by untrusted input and stays MEDIUM,
but a crash remains a crash for users who rely on this command to probe
their backends.
Amaury Denoyelle [Thu, 19 Nov 2026 15:19:14 +0000 (16:19 +0100)]
MINOR: ssl/quic: mark hq-interop QUIC ALPN as experimental
hq-interop in ALPN corresponds to HTTP/0.9 layer. This protocol is
reserved for QUIC interop testing and must not be active in production.
Introduces a new global keyword 'tune.quic.interop'. It may be set to
either 'fe' or 'off', anticipating a future 'be' value for backend
support. The keyword parsing forces users to activate experimental
directives.
The second part of this patch is in ALPN keyword parsing. If hq-interop
is found but 'tune.quic.interop fe' is not set, an error is reported.
This parser may also run at runtime for dynamic crt-list loading. In
this case, 'hq-interop' token is silently removed if present.
For now, nothing is performed on the server-side. This is because QUIC
backend is still incomplete and is itself experimental.
Amaury Denoyelle [Fri, 20 Nov 2026 08:42:24 +0000 (09:42 +0100)]
MINOR: ssl: allow prefix lookup for alpn_remove_token()
Extend alpn_remove_token() by adding an extra boolean argument <prefix>.
This changes how ALPN entries are compared, so that strings are
considered as matching if they begin with the specified value.
This will allow clearing ALPNs which may take various suffixes, for
example for hq-interop/h3 with an IETF draft version.
BUG/MINOR: ssl/cli: use the right list member in "add ssl crt-list" release
cli_release_add_crtlist() walks the crtlist_entry's list of ckch_inst with
the "by_ckchs" list member instead of "by_crtlist_entry". Since
list_for_each_entry_safe() re-bases each node with the offset of the given
member, walking a list whose elements are chained through
"by_crtlist_entry" using the offset of "by_ckchs" produces a bogus struct
ckch_inst pointer, which is then passed to ckch_inst_free(). The latter
writes through it (LIST_DELETE on both members and free()), so this is
not just a wild read but real memory corruption.
This happens when "add ssl crt-list" fails after at least one ckch_inst
was already generated and appended to the entry being added (e.g. a later
bind_conf failing to instantiate), in which case the worker dies with a
SIGSEGV during the cleanup of the discarded entry. This requires ADMIN
CLI access so it stays out of the threat model, but it is a crash of the
worker triggered by a legitimate command.
Use "by_crtlist_entry" like every other walk of this list in the same
file (crtlist_entry_free() and both loops of the delete handler). The bug
is present since the introduction of the command in 2.2 (e67c80be7f
"MEDIUM: ssl/cli: 'add ssl crt-list' command"), so every maintained
branch is affected, but the fix applies cleanly everywhere as this code
never changed since.
This should be backported in every stable branches.
BUG/MINOR: ech: keep CLI success messages alive until printed
The add, set and del ssl ech parsers build their success messages in local
stack buffers and pass them to cli_msg(). This helper only stores the
pointer: the CLI applet prints it after the parser returns, when the
buffer is already out of scope. The success response is therefore read
through a dangling pointer.
Allocate these messages with memprintf() and transfer ownership to
cli_dynmsg(), which frees them after printing or on connection teardown.
Remove the now-unused fixed message size.
Reported by Bruno Henc (@brhenc) in issue #3589.
Fixes issue #3589.
This should be backported to 3.3 and 3.4.
BUG/MEDIUM: jwt: Use JWT cert tree for jwt_decrypt
The jwt_decrypt converters have the same issue as the jwt_verify one,
they were taking the ckch_lock during runtime processing which could
fail in case the lock was already taken by a CLI operation.
We now make use of the already existing jwt tree to store the private
keys used in the decrypt operations. The only lock taken during runtime
is the jwt tree one which also gets locked in write mode while updating
certificates via the CLI or changing the jwt mode ("add/del ssl jwt").
This patch is a continuation of "BUG/MEDIUM: jwt: Use only JWT cert tree
for jwt_verify", it helps fix for good the issue decribed in GitHub
issue #3526. It relies on "MINOR: jwt: Add rwlock to jwt_cert_tree" as
well.
BUG/MEDIUM: jwt: Use only JWT cert tree for jwt_verify
The jwt_verify converter can either used a public key that was already
stored in a dedicated tree built during init that did not require any
lock, or use a certificate loaded in the ckch_store tree. The main issue
in this second case is that we needed to take the ckch_lock during
runtime but this spinlock is also taken during all CLI commands that
modify the certificates (and can last a long time when a lot of chck
instances are rebuilt for instance).
We now store the public keys used by jwt_verify in the JWT certificate
tree for all code paths instead of looking them up in the CKCH tree. We
keep the tree entry in sync when certificates are loaded, replaced,
removed, or when the "jwt" option is toggled through the CLI. In those
cases, the lock on the JWT tree in only taken while the tree gets
updated, during the ckch_store_replace call.
A keyless entry is also created for certificates whose "jwt" option is
disabled so that jwt_verify can still report JWT_VRFY_UNAVAIL_CERT (-7)
instead of JWT_VRFY_UNKNOWN_CERT (-5).
This patch relies on "MINOR: jwt: Add rwlock to jwt_cert_tree". It
fixes the issue described in GitHub #3526 (and raised by some IA models
as well).
The jwt_cert_tree that stores pure public keys loaded during init and is
used by the jwt_verify converter was never locked since we only appended
entries during init and never modified them during runtime.
In future commits its usage will be extended so it will need a locking
mechanism. The tree will only change following CLI updates so a rwlock
should do the job since mos of the work will be done under a read lock
only.
BUG/MEDIUM: log/tools: fix cbor binary integer encoding regression with x86_64 systems
A regression was introduced in commit c1abbb11f ("OPTIM: log/tools:
switch from function pointer design to dual mode HEX/BIN design for
CBOR encoding").
Indeed, it was assumed that for x86_64 systems that the byte order
for uint64_t was already correct and that the value could be written
as-is. This is totally wrong, because x86_64 is little endian while
CBOR is big endian. Because of this mistake, values greater than 24
were written in reverse/incorrect order when using
cbor_encode_uint64_prefix_bin().
To fix the issue, instead of completely ditching the fast-path,
let's leverage htons, htonl and my_htonll for 2, 4 and 8 bytes
value respectively (since the value length is known under the
function), as they are less expensive than writing the value 1
byte at a time.
Many thanks to Dragan Dosen and Martin Mirchev for having reported the
issue.
Olivier Houchard [Thu, 19 Nov 2026 09:53:50 +0000 (10:53 +0100)]
BUG/MEDIUM: xprt_qmux: apply the configured bidi streams limit on FE
QMux frontends always advertise 100 bidirectional streams, ignoring
"tune.quic.fe.stream.max-concurrent" and "tune.quic.fe.stream.max-total"
which QUIC applies in quic_transport_params_init(). The MUX however
relies on the client never being allowed to open more than
stream.max-total streams: with a value below 100, releasing the first
remote stream hits BUG_ON(qcc->lfctl.ms_bidi > max) in
qcc_release_remote_stream(), so the process dies on the first completed
request on a "proto qmux" frontend.
Let's compute the frontend limit as QUIC does. The h3_clr QMux reg-test
now sets stream.max-total to cover this.
This was introduced in 3.4 by commit 497cabd9e ("MEDIUM: quic: implement
fe.stream.max-total"), which did not apply to the QMux transport
parameters. It must be backported to 3.4.
Olivier Houchard [Thu, 19 Nov 2026 17:08:33 +0000 (18:08 +0100)]
BUG/MEDIUM: quic: do not spin on the accept tasklet of a blocked listener
Since commit 4377dbd75 ("BUG/MINOR: quic: Missing listener accept queue
tasklet wakeups") in 2.8-dev5, quic_accept_run() wakes itself up again as
long as connections remain in a listener's accept queue, so that those
beyond the maxaccept budget are accepted. But when the listener cannot
accept anymore, because it is full (bind maxconn) or limited (rate limit,
global maxconn), the tasklet runs in a loop and uses 100% of a thread
until the listener is resumed.
Let's only retry at once when the listener is still ready. Otherwise,
the accept tasklets of the threads with queued connections are woken up
when the listener is enabled again, and when it is unbound so that these
connections are refused.
This should be backported to all stable versions, with the previous
commit.
Olivier Houchard [Thu, 19 Nov 2026 17:00:34 +0000 (18:00 +0100)]
BUG/MEDIUM: quic: refuse handshakes completed after the listener unbind
QUIC connections are accepted once their handshake is complete. When a
soft-stop unbinds the listener in the meantime, the connection is still
queued, but listener_accept() does not call accept_conn() anymore on the
unbound receiver. The connection never gets its mux and the client waits
until its timeout, while the stopping process keeps it until its idle
timeout and quic_accept_run() wakes itself up in a loop, using 100% of a
thread.
Let's close such connections with a CONNECTION_REFUSED error instead,
when their handshake completes on an unbound listener, or when they are
still queued once it is unbound. The client gets the error right after
its handshake and the stopping process can leave.
This was introduced in 2.8 with the soft-stop support for connections
with their own socket, by commit fb375574f ("MINOR: quic: mark quic-conn
as jobs on socket allocation"). It should be backported to all stable
versions.
Olivier Houchard [Thu, 19 Nov 2026 15:45:45 +0000 (16:45 +0100)]
BUG/MINOR: h3: reject interim responses ending the stream
On the backend side, a HEADERS frame carrying a 1xx status with the FIN
bit is converted into an interim response ending the message with the
EOM flag, which the H1 and H2 muxes never do. The stream forwards it as
an interim response and the client then gets a 502 once the end of the
stream is reported, while such a response is malformed since a final
response must follow an interim one.
Let's reject it as a malformed response with H3_ERR_MESSAGE_ERROR, as
the H2 mux does with an END_STREAM flag on a 1xx response, so the client
only gets a 502.
This was introduced with the backend side support by commit f79effa30
("MINOR: h3: convert HTTP/3 response into HTX for backend side support")
in 3.3-dev2, so it must be backported to 3.3.
Olivier Houchard [Thu, 19 Nov 2026 15:44:09 +0000 (16:44 +0100)]
BUG/MINOR: hlua: reject interim responses in HTTP applets
A Lua HTTP service may set a 1xx status. But it can only send one
response, so once the service returns, the interim response is ended
with the EOM flag, which the H1 and H2 muxes never do on a 1xx. The
stream forwards it as an interim response and, the applet being done,
produces a 502 while the interim response is still in the buffer. Since
commit 5fb43f017 ("MEDIUM: htx: Harden HTX API to avoid invalid uses
when EOM was reached") in 3.5-dev8, it crashes on
BUG_ON(htx_msg_ended(dst)). Before, the client got the interim response
followed by the 502.
Let's make start_response() raise a Lua error for interim responses
other than 101, so the service fails with a 500 as for any other error.
The documentation of set_status() was updated accordingly.
Olivier Houchard [Thu, 19 Nov 2026 13:51:19 +0000 (14:51 +0100)]
BUG/MINOR: hlua: wait for the request in HTTP applets
Since the HTTP applet uses its own buffers, it only waits for the input
buffer to be allocated before parsing the request, so it may run on an
empty buffer and crash on BUG_ON() when it is woken up before the request
was transferred, e.g. when the stream yields after the applet creation.
Let's wait for some input data instead, as the other HTTP applets do.
This was introduced by commit 48df877da ("MEDIUM: hlua: Update the http
applet to use its own buffers") in 3.3-dev4, so it must be backported to
3.3.
BUG/MEDIUM: hlua: make coroutine.create() safe under haproxy (new attempt)
We got a report from Khaled Nassar that the current coroutine.create()
wrapper implementation that was introduced in 8cd620b4 ("MINOR: hlua:
safe coroutine.create()") is still not safe. Indeed, the fact that the
freshly created coroutine could outlive the ctx that created it (and is
thus bound to it) was overlooked.
This obviously causes undefined behavior ranging from UAF to potential
memory disclosures when the coroutine which outlives its parent ctx
still continues to reference the parent hlua which is destroyed.
As of today, Lua doesn't provide a way to forcefully kill a coroutine
or thread that we created. This means we don't have control over
user created coroutines which were instanciated using coroutine.create()
This is really bug-prone, so instead of allowing potentially unsafe usages
we refuse to create threads from sub contexts. This means
coroutine.create() may only be used from the main context (body / init)
where we know for sure that the context which created the thread will
outlive it.
If user is willing to do parallel work and the current coroutine.create()
is too restrictive, core.register_task() may come into play.
It may be backported to 2.8, although we may decide to change the hard
error into a warning to prevent existing scripts breakage, especially
if coroutine.create() was used wisely by ensuring the coroutine couldn't
outlive its parent context. The warning could give time to migrate to
more suitable API such as core.register_task().
Thanks to Khaled Nassar for having reported the issue.
Amaury Denoyelle [Thu, 19 Nov 2026 13:43:06 +0000 (14:43 +0100)]
MINOR: ncbuf/test: define seed for random insert test
Previously, random seed was not set so random insert test would always
use the same offsets. Change this to use the machine timestamp to
generate different runs each time.
The seed is displayed during the test. It can also be forced via command
line argument '-j' to be able to replay a specific run.
Amaury Denoyelle [Thu, 19 Nov 2026 13:41:26 +0000 (14:41 +0100)]
MINOR: ncbuf/test: define max iteration to random insert test
To ensure random insert test does not run for too long, specify a
maximum number of iteration. By default it is set to 10.000, which
is sufficient to fill a 16kB buffer. It can also be overriden on the
command-line using option '-i'.
Amaury Denoyelle [Thu, 19 Nov 2026 10:54:13 +0000 (11:54 +0100)]
MINOR: ncbuf/test: extract random insert test in a dedicated function
ncbuf modules provides a function for unit testing. One of the test is
the insertion of random offsets and then their removal. Extract this in
a dedicated test function for better readability.
Amaury Denoyelle [Thu, 19 Nov 2026 13:35:34 +0000 (14:35 +0100)]
BUG/MINOR: ncbuf/test: remove unnecessary delay in random insert
A delay is used for better readability when the buffer content is
displayed on each iteration during the random insert test.
However, this delay also applied when nothing was printed. This renders
the test artificially long. Thus, removes the delay when print is not
requested so that the test can run as fast as possible.
Amaury Denoyelle [Thu, 19 Nov 2026 10:50:50 +0000 (11:50 +0100)]
BUG/MINOR: ncbuf/test: remove list dependency for standalone tests
List dependency prevents compiling ncbuf module as a standalone unit to
execute unit tests. This was required for the random insertion test,
where each inserted offset is saved in a list.
Removes the list dependency and implements a simple single-linked list
for random offsets. This fixes compilation in standalone mode.
Amaury Denoyelle [Thu, 19 Nov 2026 09:39:47 +0000 (10:39 +0100)]
CLEANUP/MINOR: ncbmbuf: avoid noop memcpy when data ends on wrapping
This patch is similar to the previous one applied to ncbuf. It changes
the comparison operator used against wrapping address during an add
operation, so that data fitting with the buffer end are inserted with a
single memcpy invocation.
Amaury Denoyelle [Thu, 19 Nov 2026 09:49:41 +0000 (10:49 +0100)]
CLEANUP/MINOR: ncbuf: avoid noop memcpy when data ends on wrapping
The ncbuf add operation implements support for wrapping in case the
newly inserted data exceeds the buffer end.
This operation is inefficient due to an excessive comparison, in case
the data just ends at the buffer boundary. Two memcpy are used, the
second one with a 0 length argument which is a noop.
Change the comparison to greater-than to select the single memcpy path.
The main objective of this patch is to clean up wrapping comparison and
avoid future incorrect code duplication.
Amaury Denoyelle [Wed, 18 Nov 2026 15:50:24 +0000 (16:50 +0100)]
BUG/MINOR: quic: do not reject CRYPTO data exactly fitting in buffer
CRYPTO data buffering does not support wrapping of data. A BUG_ON()
ensures data never wraps during SSL read operations. This can never fire
as a similar comparison exists first in CRYPTO parsing to reject
wrapping content.
However, this code uses an incorrect greater-than-or-equal operator on
buffer wrapping. This incorrectly rejects CRYPTO content that exactly
fits in the receive buffer and closes connection. Fixes the comparison
operators so that CRYPTO data ending exactly at the buffer end can now
be normally handled.
This should be backported up to 2.6 after a period of observation.
BUG/MEDIUM: http-ana: restore the purge of backend analyzers on applets
Commit 7568a0555 ("BUG/MINOR: http-ana: fix response compression for
applets") introduced a regression. It removed the purge of the request
analyzers performed when a request was intercepted by an applet, to only set
AN_REQ_HTTP_INNER. The idea was that http_process_request() called on
AN_REQ_HTTP_INNER configures all the analyzers needed to handle keep-alive
and compression on the HTTP response.
But doing so, some analyzers that were removed before the commit above,
remain attached. One of them, AN_REQ_SWITCHING_RULES, is responsible to set
a backend and all backend analyzers with it. So an request intercepted by an
applet in the frontend is still branched to a backend with its analyzers
armed. And they are evaluated against the intercepted request, as if it was
forwarded to the backend. Thus the http-request rules of the unassigned
backend are applied to the applet request. For instance, with a
"http-request deny" rule in the backend, a request intercepted by the
frontend stats applet is denied with a 403.
So the purge of the backend analyzers is restored, to only keep the
minimally required analyzers to handle keep-alive and compression on the
HTTP response. But, unlike the antique code from 1.5-dev24, the inner
processing is preserved: AN_REQ_HTTP_INNER is not removed by the purge
because it is needed to enable compression of the applet response when the
applet is branched from a backend.
REGTESTS: protobuf: cover the gRPC message compression flag
Regression test for "BUG/MINOR: sample: do not parse compressed gRPC
messages in ungrpc".
Two bodies are added to the frontend which already walks a body of two
gRPC messages:
- "01 000000050a03616161 00 00000002 1007" flags the first message
compressed. Its payload must not be parsed, so x-g1 stays empty
instead of reading "aaa". x-g2 must still find 7 in the second
message, which checks the skip resumes on a message boundary.
- "02 00000002 1007" sets an invalid flag, so the walk must stop and
x-g2 must stay empty.
A failing expect aborts the script, so the second body is only observed
after the fix, not before it.
Martin Mirchev [Wed, 18 Nov 2026 12:39:28 +0000 (20:39 +0800)]
BUG/MINOR: sample: do not parse compressed gRPC messages in ungrpc
sample_conv_ungrpc() skips the 5-byte gRPC message header without looking
at its Compressed-Flag byte, so a message whose payload is compressed
(flag 1) is handed to the protobuf parser as if it were plain protobuf,
and so is a message with an invalid flag value. A request body
"01 00 00 00 02 08 2a" (compressed flag, 2-byte payload) returns 42 from
"req.body,ungrpc(1,uint32)", exactly as the uncompressed one does, while
the real field value would only appear after decompression.
Skip compressed messages, as their payload cannot be parsed, and stop on
a flag other than 0 or 1 since the gRPC framing is then invalid.
Dinko Korunic [Wed, 18 Nov 2026 17:05:05 +0000 (18:05 +0100)]
BUG/MINOR: payload: also encode an absolute payload_lv offset2
Since commit bf65cd4d77 ("MAJOR: arg: converts uint and sint in sint")
in 1.6-dev3, the optional offset2 of payload_lv is stored as a single
SINT whose LSB indicates a relative offset and whose 63 MSB carry the
value, and smp_fetch_payload_lv() decodes it this way. But
val_payload_lv() only encodes relative values as "(v << 1) + 1" and
leaves absolute ones untouched. An absolute offset2 is thus read as half
of its value, and an odd one is even taken as a relative offset. With a
payload starting with "01 41 42 43 44 45":
req.payload_lv(0,1,4) returns 0x42 instead of 0x44
req.payload_lv(0,1,5) behaves like (0,1,+2), returns 0x43
instead of 0x45
This only affects which bytes are extracted: the resulting offset is
still checked against the buffer by the fetch function, so there is no
memory-safety impact. Configurations using an absolute offset2 were
silently reading from the wrong place and will now read from the
documented one.
Let's always encode offset2, adding the relative flag as the LSB. Relative
and implicit offsets are not affected.
This depends on the previous commit "BUG/MEDIUM: payload: reject
out-of-range payload and payload_lv arguments" for its context, and
should be backported to all supported versions along with it.
Dinko Korunic [Wed, 18 Nov 2026 17:05:04 +0000 (18:05 +0100)]
BUG/MEDIUM: payload: reject out-of-range payload and payload_lv arguments
The offsets and lengths taken by the payload and payload_lv sample fetch
families are parsed as 64-bit ARGT_SINT, but smp_fetch_payload() and
smp_fetch_payload_lv() store them into unsigned ints and perform their
bounds checks in 32 bits:
if (buf_size > max || buf_offset + buf_size > max)
The payload, req.payload and res.payload keywords have no argument
validation at all, and val_payload_lv() only rejects a negative offset1
and a null length. A negative or oversized argument therefore becomes a
value close to 4G once truncated, the sum wraps, passes the checks, and
the fetch either returns a sample pointing about 4 GB past the buffer
(payload) or makes the length loop read past it (payload_lv, where a
negative length turns into a ~4G byte count). Each of these expressions
crashes the process the first time it is evaluated, for example from a
"tcp-request content" rule:
req.payload(-1,1)
req.payload(4294967295,1)
req.payload_lv(1,-1) (heap-buffer-overflow read)
req.payload_lv(4294967295,1)
req.payload_lv(0,1,+4294967290) (once a converter reads the sample)
Lua is affected as well (e.g. txn.f:req_payload(-1,1)), since it relies
on the same validation callbacks. HTX streams are not affected because
the fetches return early there. The tcp-check path performs the same
arithmetic on check->bi.
Such an expression has to be written in the configuration, so this is not
a vulnerability per the threat model, but nothing warns about it, and once
it is present the first connection that reaches the rule crashes the
process.
This patch adds val_payload() for the payload family, which limits both
the offset and the length to [0, INT_MAX] (a null length still means "the
rest of the buffer"). val_payload_lv() now limits offset1 to [0, INT_MAX],
the length to [1, INT_MAX], the raw offset2 to [-2*INT_MAX, INT_MAX], and
the resulting relative offset to [0, INT_MAX]. INT_MAX is far beyond any
buffer size so no working configuration is affected, and with each term
bounded this way the sums computed by the fetch functions can no longer
wrap, so these functions are left untouched. Configurations that used
out-of-range values already crashed or never matched; they now fail to
load with an explicit error instead:
invalid args in fetch method 'req.payload' : payload offset must be
between 0 and 2147483647
Lua calls now raise an error instead of crashing.
This should be backported to all supported versions.
REGTESTS: quic: undecryptable 0-RTT packets must not exhaust the Rx buffer
On a listener with "allow-0rtt", a 0-RTT packet whose header protection
cannot be removed is queued in the 0-RTT encryption level pqpkts list, with
a reference on the connection Rx buffer. That buffer is reclaimed in order
and stops at the first referenced packet, so a queued 0-RTT packet pins all
the data behind it. When no 0-RTT RX secret exists, because the early data
were rejected by the TLS stack or because the TLS library does not support
0-RTT, those packets can never be decrypted and are never released: past
about 64 kB, every packet of the connection is dropped until the idle
timeout.
The test completes a handshake, keeps the connection healthy with an HTTP/3
request, then injects 120 long header 0-RTT packets whose payload is
encrypted with keys haproxy does not know, which reproduces the state
reached when 0-RTT keys are absent. Dropped packets are counted as
dropped_pkt_bufoverrun, shown as dropbuff= by "show quic full", so the vtc
asserts through the CLI that this field does not appear: the Rx buffer was
not exhausted and the connection was not stalled.
It needs the Python client in reg-tests/quic/qclient, so it carries
'#REGTEST_EXTRA=qclient' and only runs when requested.
REGTESTS: quic: NEW_CONNECTION_ID must not reference a retired CID
A NEW_CONNECTION_ID frame stored pointers to the CID and the stateless
reset token of its quic_connection_id. RETIRE_CONNECTION_ID frees that
object at once, while a frame built for it may still be queued, in flight,
or duplicated later for a retransmission: it was then built from freed
memory.
Retiring sequence numbers 1 and 2 in the same packet is enough to reach
it: the second RETIRE frees the CID the first NEW_CONNECTION_ID frame
still points to. With the pool cache, the freed object is handed back to
the next CID of the same connection, so two frames carry the same CID,
which the client detects. Without it (ASan, DEBUG_DONT_SHARE_POOLS), freed
heap content is sent and the sanitizer reports a use-after-free.
The test drives a real handshake through the QUIC client in
reg-tests/quic/qclient, then retires both sequence numbers in one packet,
and checks two things: no duplicate CID is advertised for two different
sequence numbers, and the connection is closed with a transport error of
type PROTOCOL_VIOLATION, as RFC 9000 19.16 requires for a sequence number
that was never sent. A crash instead of the CONNECTION_CLOSE frame leaves
the test waiting, which also fails it.
It needs the Python client, so it carries '#REGTEST_EXTRA=qclient' and
only runs when requested.
REGTESTS: quic: backend must drop packets with an unsupported version
On backend connections, quic_rx_pkt_parse() accepts long header packets
carrying an unsupported version, since the version checks only apply to
listeners. Such packets keep QUIC_PACKET_TYPE_UNKNOWN, which maps to no
encryption level, and reach BUG_ON(!qel || !pktns) in qc_enc_level_alloc()
from qc_try_rm_hp().
A server which does not support the negotiated version answers with a
Version Negotiation packet (RFC 9000 6.1), so no malicious peer is needed.
The test starts a socket that replies to the Initial with a long header
packet using an unsupported version, and checks that the request fails with
a 503 instead of killing the process. It needs no helper beyond python3, so
it carries no #REGTEST_EXTRA directive.
Replaying some QUIC bugs requires a peer that completes a handshake and
then sends specific frames. Hand-crafted datagrams cannot do that.
Add a minimal QUIC v1 + TLS 1.3 + HTTP/3 client in reg-tests/quic/qclient:
- qcrypto.py: RFC 9001 packet protection (HKDF, initial keys, varints,
long and short header protection).
- qclient.py: a QClient object over a real socket, with the received
frames exposed. Hooks on the send and handshake paths let a caller
alter packets, and the helpers cover key updates, connection migration
and HTTP/3 requests, so tests can drive whatever scenario they need.
Both need the 'cryptography' package. Tests using them will carry
'#REGTEST_EXTRA=qclient' and run only when requested.
MINOR: reg-tests: add --extra to run tests needing optional tools
Some VTC files need helper programs that are not built with HAProxy, such
as the Python QUIC client in reg-tests/quic/qclient/. They cannot simply be
typed 'slow' or 'devel' instead: their type says what they check, and the CI
jobs select tests by type.
Add a new --extra option to run-regtests.sh. A VTC file declares the helper
it needs:
#REGTEST_EXTRA=qclient
and is skipped unless that name is listed in the --extra option. From the
Makefile, options are passed after '--':
$ make reg-tests -- --extra qclient
The filter only adds tests: files without the directive, and the selection
made by --type/REGTESTS_TYPES, are unchanged.
Not to be backported: this is development tooling.
Olivier Houchard [Wed, 18 Nov 2026 16:41:03 +0000 (17:41 +0100)]
BUG/MEDIUM: mux-quic: cap elastic MAX_STREAMS to stream.max-total
With "tune.streams-elasticity", qcc_release_remote_stream() grants as
MAX_STREAMS increment the difference between the elastic limit and the
streams still usable by the peer. Unlike the static path, nothing caps
the new limit to "tune.quic.fe.stream.max-total". If the window was
reduced under load and the load then drops, the increment computed close
to the end of the connection may exceed the remaining streams, and the
next released stream hits BUG_ON(qcc->lfctl.ms_bidi > max).
Let's cap the increment to the remaining streams. It is still at least 1
since ms_bidi is below max there.
This was introduced by commit e139dd90e ("MAJOR: mux_quic: support
stream elasticity during connection lifetime") in 3.4-dev13 and must be
backported to 3.4.
Olivier Houchard [Wed, 18 Nov 2026 16:52:44 +0000 (17:52 +0100)]
BUG/MEDIUM: quic: never advertise more streams than configured
With "tune.streams-elasticity", the initial max-streams-bidi transport
parameter is set to conn_calc_max_streams() of the configured limit,
i.e. the lowest of "tune.quic.fe.stream.max-concurrent" and
"tune.quic.fe.stream.max-total". But this function may return more than
the value it is passed, as it also considers the share of the extra
streams budget left for each remaining connection, which does not depend
on it: with "tune.streams-elasticity 1000", it returns 10 at low load.
When "tune.quic.fe.stream.max-total" is lower than this, releasing the
first remote stream hits BUG_ON(qcc->lfctl.ms_bidi > max) in
qcc_release_remote_stream(), so the process dies on the first completed
request.
Let's not advertise more than the configured limit. The stream_max_total
reg-test now enables stream elasticity to cover this.
This was introduced by commit d21ec4c70 ("MINOR: quic: use stream
elasticity value for initial advertisement") in 3.4-dev13 and must be
backported to 3.4.
On QMux, qcm_init() takes over the Rx buffer of the xprt layer. When it
fails later, its error path resets qcc->conn before calling
qcc_release(), which only releases the QMux connection buffers when a
connection is attached, so the Rx buffer is leaked. A client connecting
with TLS but without ALPN to a "proto qmux" listener makes
qcc_install_app_ops() fail and leaks one buffer per connection.
Let's release the QMux Rx buffer in the qcm_init() error path, where the
connection type is still known. The Tx one cannot be allocated yet.
This was introduced in 3.4 by commit 81f22cd68 ("MINOR: mux-quic: define
Rx connection buffer for QMux") and must be backported to 3.4.
Willy Tarreau [Wed, 18 Nov 2026 15:58:50 +0000 (16:58 +0100)]
[RELEASE] Released version 3.5-dev13
Released version 3.5-dev13 with the following main changes :
- BUG/MINOR: tcpcheck: fix out-of-bounds reads on short MySQL error packets
- BUG/MEDIUM: mux-h2: put BE conn back in idle list after deferred shut
- BUG/MEDIUM: mux-spop: do not enforce the timeout on connections with streams
- MINOR: mux-spop: ignore conn->owner when deciding if a connection is dead
- BUG/MEDIUM: mux-spop: refresh the connection timeout before parking it idle
- MINOR: mux-spop: don't add a closing connection to an idle list on detach
- BUG/MEDIUM: mux-fcgi: put BE conn back in idle list after deferred shut
- BUG/MAJOR: cache: do not mix variants varying on different headers
- BUG/MEDIUM: cache: fix "show cache" crash/skip with several caches
- BUG/MEDIUM: cache: do not create a second applet when two cache-use rules hit
- BUG/MEDIUM: cache: forbid cache rules in defaults sections
- BUG/MEDIUM: filters: order the implicit filters around the explicit ones
- BUG/MINOR: cache: do not refuse to store responses with "Age: 0"
- BUG/MINOR: cache: do not remove the Age header from the forwarded response
- BUG/MINOR: cache: recognize null qvalues with decimals in Accept-Encoding
- BUG/MINOR: cache: do not eat the request while waiting for a buffer
- BUG/MINOR: cache: reduce the max-age lifetime by the response's Age
- BUG/MINOR: cache: compare the Age to the heuristic lifetime when none is given
- BUG/MINOR: cache: do not ignore null lifetimes not written as "max-age=0"
- REGTESTS: cache: cover the object lifetime with a single script
- BUG/MINOR: quic: fix ACK_ECN parsing after optional ack ranges
- BUG/MINOR: qmux: remove invalid BUG_ON() on empty record
- BUG/MINOR: init: fix missing error on no listener on config check
- BUG/MEDIUM: fd: Mark a fd as dead on early close
- BUG/MEDIUM: mux-h1: Report EOS when a demux error is handled by the app layer
- BUG/MINOR: cache: skip already resolved filters when resolving caches
- BUG/MINOR: quic: remove CID on BE conn alloc failure
- BUG/MINOR: h3: prevent missing request FIN on empty trailers
- BUG/MINOR: sample: fix host_only and port_only on empty input
- BUG/MINOR: sample: reject a \0 byte in raw string fetches
- BUG/MINOR: http-ana: don't emit a network-path Location for a "/" redirect prefix
- BUG/MINOR: log: don't let an LF in a forwarded message create new events
- BUG/MEDIUM: mux_quic: fix Rx flow control increment on RESET_STREAM
- OPTIM: lb-chash: don't look for more servers when there is only one
- OPTIM: lb-chash: limit the scan to few consecutive nodes
- MEDIUM: backend: avoid picking the same server twice in random draws
- DOC: config: explain the effect of the weights on random's draws
- IMPORT: slz: update slz to 1.4-dev5-24
- MINOR: compression: pass COMP_CT_EVENT to the algorithms for server-sent events
- MINOR: compression: add tune.comp.res.ring to disable the rings of responses
- MEDIUM: compression/slz: use the event content type for server-sent events
- DEV: sse-latency: add a parameter after the content-type
- MINOR: http-ana: also match text/event-stream with trailing parameters
- BUG/MINOR: h3: skip content-length check on backend bodyless responses
- BUG/MINOR: h3: reject CANCEL_PUSH on backend side
- MINOR: h3: reject malformed push frames
- BUG/MEDIUM: sample: parse json_query integers within the token length
- BUG/MINOR: mjson: bound the exponent in mystrtod()
- BUG/MEDIUM: stick-tables: compute the shard of string keys on the stored key
- BUG/MINOR: hq-interop: skip zero-copy with large buffers
- BUG/MINOR: hq-interop: ignore uni streams in HTTP/0.9
- BUG/MINOR: hq-interop: drop data after request
- REGTESTS: http-messaging: Fix abortonclose issue with connect_tunnels
- REGTESTS: http-messaging: Properly handle WINDOW_UPDATEs with connect_tunnels
- BUG/MEDIUM: quic: do not keep 0-RTT packets which cannot be decrypted
- BUG/MEDIUM: quic-be: keep the source port range of a closing backend connection
- BUG/MINOR: quic-be: do not register the connection before the quic_conn is initialized
- BUG/MINOR: quic: initialize the members read by quic_conn_release() first
- BUG/MINOR: debug: Do not allocate context when we don't need one
- DEV: h2: add h2dec, a raw HTTP/2 frame decoder
- DEV: h2: add mkhdr.c, a C port of mkhdr.sh
- DEV: h2: mkhdr: add -n to repeat the emitted frames
- DEV: h2: mkhdr: support stream ID ranges with -i
- DEV: h2: mkhdr: support "--" as a delimiter between frame descriptions
- MINOR: ssl: add alpn_remove_token() to drop a protocol from an ALPN string
- MINOR: global: add tune.options2 to host new GTUNE2_* flags
- MINOR: global: add tune.h2.fe.enabled to disable HTTP/2 on frontends
- MINOR: sample: add h2_enabled to report whether H2 may be used on frontends
- REGTEST: ssl: test tune.h2.fe.enabled and h2_enabled on two instances
- IMPORT: slz-prv: work around lobotomized compilers' fallthrough diagnostics
- MINOR: sample: add smp_prepare_out() to prepare an output buffer
- OPTIM: sample: use smp_prepare_out() in the lower and upper converters
- MINOR: sample: add a "tr" converter
- BUG/MINOR: http/hardening: free the new profile on strdup() failure
- BUG/MEDIUM: stick-tables/cli: "set table" without key must not clear the table
- BUG/MEDIUM: peers: make the soft-stop "dont_stop" state per peers section
- BUG/MEDIUM: htx: never merge the next DATA block into the referenced one on defrag
- BUG/MEDIUM: flt-decomp: don't expose EOM before the end of decompression
- REGTESTS: decompression: test a large decompressed Content-Length response
- BUG/MEDIUM: mux-h2: don't abort a tunnel attempt on interim responses
- REGTESTS: http-messaging: check that 1xx don't abort H2 backend tunnels
- REGTESTS: decompression: don't use yes(1) in http_large_cl
- BUG/MEDIUM: dns: release the session slot of expired TCP queries
- BUG/MAJOR: buf: make the shift distance check less strict in b_move()
- BUG/MAJOR: mux-h2: fail on impossible data transfers in rcv_buf()
- BUG/MAJOR: h3: do not panic on HTX_FL_PARSING_ERROR after htx_xfer()
- BUG/MAJOR: mux-quic: fail on impossible data transfers in rcv_buf()
- Revert "BUG/MINOR: h3: fix missing EOM after trailers without FIN"
- CI: github: include WolfSSL version in job name
- CI: github: test WolfSSL with and without debugging
- Revert "MINOR: http: add <need_eot> to trailers parsing function"
- CI: github: restrict WolfSSL sanitizer flags to debug jobs
- BUG/MINOR: ssl: exclude wolfSSL from custom extension support
- BUG/MEDIUM: stream: keep channel_auto_close() on the request error path
- REGTESTS: http-messaging: send h1_big_chunk_size_line request at once
- BUG/MINOR: checks: only trigger a DNS resolution with the resolvers lock
- BUG/MINOR: dns: detect the server's shutdown on a partial TCP response
- SCRIPTS: vtest: allow overriding the Git repository URL
- BUG/MINOR: map: split "add map/acl" payload keys on line breaks
- CI: github: use haproxytech/VTest2 for regression tests
- BUG/MEDIUM: peers: bound stick-table update messages
- BUG/MEDIUM: peers: bound stick-table switch messages
- BUG/MINOR: peers: bound stick-table acknowledge messages
- CLEANUP: peers: remove the unused intencode()
- BUG/MINOR: quic/ssl: report SSL_CTX allocation failure
- MINOR: peers: move message length constants to peers-t.h
- BUG/MEDIUM: stick-table: fix the peers overhead in proto_size
- BUG/MEDIUM: peers: trim received string keys to fit in a buffer
Olivier Houchard [Wed, 18 Nov 2026 10:02:39 +0000 (11:02 +0100)]
BUG/MEDIUM: peers: trim received string keys to fit in a buffer
Commit b224f63c1 ("BUG/MEDIUM: stick-table: restrict key sizes to what
fits in a buffer") trims string keys in stksess_setkey() so that the
update message fits in a buffer, but string keys received from a peer
are copied directly and only bounded by the table's key size. A peer
with a larger bufsize, or a forged message, can thus store a key which
cannot be encoded when it is later taught to another peer. Since commit ef4405d67 ("BUG/MEDIUM: peers: bound stick-table update messages") this
does not overflow the trash buffer anymore, but the peer session is
closed and reopened in loop and the resync never completes, as reported
in GitHub issue #3576.
Let's apply the same trimming on the receive path. This must be
backported wherever b224f63c1 was.
Olivier Houchard [Wed, 18 Nov 2026 10:07:58 +0000 (11:07 +0100)]
BUG/MEDIUM: stick-table: fix the peers overhead in proto_size
proto_size accounts for 11 bytes of encapsulation, but update messages
are built in place with the header, room for the encoded length, the
update id and the expiration date, plus the string key length. String
keys trimmed to fit the estimate, such as a large header tracked on a
table whose len is close to or above bufsize, thus never fit an update
message, and neither do binary keys of a table accepted at the limit by
the config check. Since commit ef4405d67 ("BUG/MEDIUM: peers: bound
stick-table update messages") this does not overflow the trash buffer
anymore, but the peer session is closed and reopened in loop and the
resync never completes. See GitHub issue #3576.
Let's count the real overhead. This was brought by commit 858263591
("MINOR: stick-table: calculate the on-wire size of each key") and must
be backported wherever it was, along with previous commit "MINOR: peers:
move message length constants to peers-t.h".
Olivier Houchard [Wed, 18 Nov 2026 10:07:49 +0000 (11:07 +0100)]
MINOR: peers: move message length constants to peers-t.h
PEER_MSG_HEADER_LEN and PEER_MSG_ENC_LENGTH_MAXLEN are needed by the
stick-table code to estimate the size of update messages, so let's
move them out of peers.c.
This is needed by the next commit, so it must be backported along with
it.
ssl_quic_initial_ctx() stores the result of SSL_CTX_new() into
bind_conf->initial_ctx without checking it, unlike ssl_sock_initial_ctx()
which alerts and returns an error. On allocation failure the QUIC bind
therefore crashed without any diagnostic.
Report the failure the same way the TCP path does.
All peers message builders now use encode_varint(), which knows the end of
the destination buffer and can fail. intencode() has no caller left, and
its comment still advises callers to ensure the room left after the
pointer, which is exactly what the new code checks explicitly.
peer_prepare_ackmsg() was the last message builder of the peers code
still encoding without knowing the buffer end: lengths went through
intencode(), which cannot fail, and the last acknowledged update counter
was copied with a plain memcpy().
Its payload is a bounded varint plus a 32-bit counter, i.e. 9 bytes at
most, so it could not overflow. The bounds are added anyway, for
consistency with the update and switch message builders, and they make
intencode() unused: being defined without any prototype in a header, the
compiler cannot report it as unused, so it is removed here along with its
comment, otherwise it would have stayed in the binary silently.
peer_prepare_switchmsg() builds the table definition message in the
<size>-byte trash buffer but, like its update counterpart before commit 8e0f311ff, never checked that the encoded data fit. The table name was
copied with a plain memcpy() following an intencode() of its length, and
all other fields were encoded with intencode(), which cannot fail.
Unlike the update message, this one is mostly made of a variable-length
field, the table name: the peers section name, a '/', and the table name,
which gives a nid as large as the configuration line allows. The rest is
a fixed 33-byte overhead plus the data type parameters. Nothing accounts
for that name when validating the stick-table at configuration time, so
a table whose name is close to tune.bufsize is accepted and its copy runs
past the end of the trash buffer when the peer sessions start.
Let's check the room left before every copy and every varint encoding,
using the same peer_bufcpy() helper and the same single-exit error
convention as for the update message. The data type parameters are
staged in a trash chunk, not in <msg>, so their encoding is bounded by
the chunk itself through a distinct chunk_end pointer, while the varints
written to <msg>, the bitfield and the expiration are bounded by the
message end.
The payload length becomes a size_t for consistency with the update
message, though the definition message is inherently small.
Thank you to @h110hawk for having reported this issue in GH #3576.
This should be backported to all supported versions.
peer_prepare_updatemsg() builds a stick-table update in the <size>-byte
trash buffer but never checked that the encoded data actually fit, and
still carried its "TODO: check size" comment. Fixed-size fields were
copied with memcpy() and every length was encoded with intencode(),
which cannot fail and has no knowledge of the buffer end.
An entry learned from a peer may hold a string key up to key_size - 1,
which the peers protocol accepts in a full-size message. Re-encoding it
adds a 2-byte header, the update identifier and, for timed updates, an
expiration before the key, so the copy runs past the end of the trash
buffer. ASan reports a heap-buffer-overflow WRITE right after the
16384-byte trash region, and on a normal build the two overflowing bytes
land in the next chunk.
Let's check the room left before every copy and every varint encoding.
A new peer_bufcpy() helper copies at most what the buffer can take,
advances the cursor on success and leaves it untouched on failure, so
the success path is unchanged. Lengths are now encoded with
encode_varint(), whose bounds are those of the destination buffer, and
all failures return 0 through a single exit point that releases the
session lock.
The payload length becomes a size_t: as an unsigned short it silently
truncated messages larger than 65535 bytes, which tune.bufsize above 64k
makes reachable.
This should be backported to all supported versions.
CI: github: use haproxytech/VTest2 for regression tests
The official VTest2 repository frequently causes CI failures. Use the
haproxytech/VTest2 repository instead.
Point the shared VTest setup action and the FreeBSD workflow at the
haproxytech/VTest2 repository for both cache SHA lookups and builds.
Select the build source through VTEST_URL, leaving the script default
unchanged.
This could be backported together with the previous commit, 691e22fbbd ("SCRIPTS: vtest: allow overriding the Git repository URL").
Olivier Houchard [Wed, 18 Nov 2026 14:23:21 +0000 (15:23 +0100)]
BUG/MINOR: map: split "add map/acl" payload keys on line breaks
The payload of "add map" and "add acl" contains one entry per line, but
the key was only split on spaces and tabs. A map line without a value
was thus merged with the next line into a single bogus entry instead of
being reported as an error, as is done for the last line. For "add acl",
whose patterns contain no space, all the lines were merged into a single
pattern, and the parser then stepped past the end of the payload, where
it only reads the payload terminator line.
Let's also stop the key on line breaks, and consider that a line without
a space or tab after the key has no value.
This was introduced in 1.9 by commit 25650ce51 ("MINOR: map: Add payload
support to "add map"") and may be backported to all stable branches.
SCRIPTS: vtest: allow overriding the Git repository URL
Read the VTest repository URL from VTEST_URL so that builds can use
an alternate repository. Keep the current URL as the default when the
variable is unset or empty.
Olivier Houchard [Wed, 18 Nov 2026 13:53:37 +0000 (14:53 +0100)]
BUG/MINOR: dns: detect the server's shutdown on a partial TCP response
When a DNS response is only partially received over TCP, the session's
I/O handler reads the available data with applet_getblk() and waits for
more. When nothing new is available, the requested length is zero, and
applet_getblk() never reports the shutdown in this case since
applet_may_get() only checks it when more data than available is
requested. If the server closes after sending part of a response, the
session then waits for data that will never come, and queries assigned
to it are lost until it times out, about 20s later.
Let's check for the shutdown when the message is incomplete: the rest
cannot come anymore. This was brought in 3.3 by commit 217da087f
("MEDIUM: dns: Update the dns_session applet to use its own buffers").
It must be backported to 3.3.
Olivier Houchard [Wed, 18 Nov 2026 13:06:45 +0000 (14:06 +0100)]
BUG/MINOR: checks: only trigger a DNS resolution with the resolvers lock
When a health check fails to establish its L4 connection, the check code
calls resolv_trigger_resolution() on the server's requester to force a
new resolution. This function reads the resolution's status, step and
last_resolution, and writes last_resolution, while these fields are
otherwise only accessed under the resolvers' lock, possibly from another
thread processing a response. At worst a resolution is triggered again
too early, causing an extra DNS query. The resolution itself cannot be
freed in the meantime since the check holds the server's lock, which the
unlinking paths take before releasing the resolution.
The resolvers take the server's lock under their own lock, so we cannot
wait for the resolvers' lock here. The trigger being opportunistic, let's
just try to take it and skip the trigger when it is busy.
Olivier Houchard [Wed, 18 Nov 2026 12:44:29 +0000 (13:44 +0100)]
REGTESTS: http-messaging: send h1_big_chunk_size_line request at once
The test expects the headers and the chunk-size line to fill the buffer
on the first read, so that the request is rejected before being
forwarded. But they were sent as ~986 small writes, and when haproxy
received them in two parts (seen on FreeBSD CI), the first read did not
fill the buffer: the headers were forwarded and the server's 200 was
logged instead of the expected 400. Let's send the whole request in a
single write, with a chunk-size line longer than the buffer.
BUG/MEDIUM: stream: keep channel_auto_close() on the request error path
Commit 6c5df88d ("BUG/MEDIUM: stream: reset analyse_exp when analysers are
stripped on error") replaced channel_auto_close(req) with
req->analyse_exp = TICK_ETERNITY instead of adding the new statement, so
auto-close is no longer re-enabled on the client error/timeout path while
the remaining request analysers are stripped. The response path correctly
kept channel_auto_close(res) and got the analyse_exp reset in addition.
Restore channel_auto_close(req) so shutdowns are still forwarded when an
unhandled client error is caught, as fixed by b1368adc ("BUG/MEDIUM: stream:
Forward shutdowns when unhandled errors are caught"): without it the stream
may freeze when no analyser remains and no wakeup happens.
This patch must be backported with 6c5df88d to all stable versions.
BUG/MINOR: ssl: exclude wolfSSL from custom extension support
wolfSSL provides SSL_CTX_add_server_custom_ext() as a stub which always
returns zero. Do not advertise HAVE_SSL_CTX_ADD_SERVER_CUSTOM_EXT when
building with wolfSSL.
Since 8957622353 ("BUG/MEDIUM: ssl: fix an out-of-bounds read on SSL_CTX
switch with a .sctl file"), the extension is registered on every frontend
context. Calling the stub therefore makes certificate loading fail even
when no .sctl file is present.
Exclude wolfSSL from the capability guard while keeping the OpenSSL
registration unchanged.
Verified an ERR=1 build against wolfSSL 5.7.0, the verifyhost_san VTest,
and live TLS requests using all three certificates from that test.
This must be backported to all supported versions.
CI: github: restrict WolfSSL sanitizer flags to debug jobs
Only override WolfSSL CFLAGS and HAProxy ARCH_FLAGS when debug=1.
Keep WolfSSL debugging and AddressSanitizer enabled for that variant.
For debug=0, use the default WolfSSL compiler flags and HAProxy's
default ARCH_FLAGS=-g, matching the flags of the removed VTest job.
Leave the shared HAProxy debug defines unchanged.
CI: github: test WolfSSL with and without debugging
Add a debug matrix axis to run WolfSSL 5.7.0 with WOLFSSL_DEBUG=0 and
WOLFSSL_DEBUG=1 in parallel. Include the debug setting in each job name
and disable fail-fast so one variant cannot cancel the other.
Keep AddressSanitizer enabled for both variants and leave the HAProxy
build flags unchanged.
Define the WolfSSL version once in the job matrix and use it in both the
job display name and the WOLFSSL_VERSION build setting.
This makes the tested version visible in GitHub Actions without
duplicating the version string. The workflow still runs a single job
using WolfSSL 5.7.0.
This fix introduces a major regression as emitting trailers without EOT
is not supported by htx_xfer(). A BUG_ON() in this function is triggered
if rcv_buf runs between the trailers parsing and the FIN reception.
This may reveals deeper limitation which may requires a different
approach for the original issue. A revert is considered the most viable
solution for now until a decision is made the most viable as the
original issue is not a major one.
Several conflits were fixed as code changed multiple times in
H3/hq-interop due to other minor fixes introduced since the bug
introuction.
The faulty patch was not yet picked in stable releases as it was under
observation. As such, it must now be skipped and thus this revert is
only relevant for the current dev tree.
Willy Tarreau [Tue, 17 Nov 2026 16:55:22 +0000 (17:55 +0100)]
BUG/MAJOR: mux-quic: fail on impossible data transfers in rcv_buf()
When some data couldn't be transferred from the rxbuf to the channel,
leaving the channel empty (e.g. due to the reserve), we must not set
SE_FL_WANT_ROOM otherwise we cannot get out of this situation and
sc_conn_recv() detects it and panics. Let's just report a stream
error for non-fragmentable contents that exceed the maximum size
and stop here.
Willy Tarreau [Tue, 17 Nov 2026 16:41:01 +0000 (17:41 +0100)]
BUG/MAJOR: h3: do not panic on HTX_FL_PARSING_ERROR after htx_xfer()
After various tests and a long code analysis, it turns out that this
condition which was thought never to be triggerable can finally be
triggered if some data cannot be transferred to the channel due to
the reserve. The condition is rare but not impossible, so let's get
rid of it. This patch must be backported to all stable releases.
Willy Tarreau [Tue, 17 Nov 2026 17:27:58 +0000 (18:27 +0100)]
BUG/MAJOR: mux-h2: fail on impossible data transfers in rcv_buf()
When some data couldn't be transferred from the rxbuf to the channel,
leaving the channel empty (e.g. due to the reserve), we must not set
SE_FL_WANT_ROOM otherwise we cannot get out of this situation. There's
even already a BUG_ON() for this. However it turns out that in some
tricky circumstances it can be triggered. The test is thus not correct
and instead we should simply report a stream error.
This needs to be backported as far as 2.6.
Many thanks to Adam Crawford for reporting this issue along with a
repro and a candidate fix. In the end the current fix is different
as it addresses the root cause (WANT_ROOM + no-data) so it should
be more future-proof.
Willy Tarreau [Mon, 16 Nov 2026 15:21:26 +0000 (16:21 +0100)]
BUG/MAJOR: buf: make the shift distance check less strict in b_move()
Yuqi Qiu and Xiang Li from Nankai University (AOSP Lab) found during
code analysis that the check "BUG_ON(-shift > size)" in b_move() is
incorrect and can trigger too easily. The test as written like this
to only consider a one-byte minimum move, but the function could also
be called either with a larger move and a large offset, or with no data
and a larger move, typically the result of a full buffer deletion. What
matters is that the moved data plus the shift do not go larger than the
buffer.
Let's fix the test to consider both the length and the distance to save
it from triggering too easily.
The test was added in 2.6-dev3 with commit 8873b85bd9 ("DEBUG: buf: add
BUG_ON_HOT() to most buffer management functions") so this fix must be
backported to all stable versions.
Olivier Houchard [Tue, 17 Nov 2026 16:20:57 +0000 (17:20 +0100)]
BUG/MEDIUM: dns: release the session slot of expired TCP queries
A DNS-over-TCP session counts its pipelined queries in ds->nb_queries, up
to DNS_STREAM_MAX_PIPELINED_REQ (4), and only dns_recv_nameserver()
releases a slot, when a response is delivered. But when a query expires
without response, dns_process_query_exp() only decrements onfly_queries.
After 4 unanswered queries, the session is thus neither in the free nor in
the idle list anymore: it is never reused nor released and its connection
remains open forever, while new queries open new connections. With a TCP
nameserver not answering some names, one connection is leaked every 4
such queries, without limit.
Let's release the slot when a query expires, and move the session to the
free or idle list, under the stream server's lock, exactly as done when a
response is received.
This was introduced in 2.4 with commit fd647d5f5 ("MEDIUM: dns: adds code
to support pipelined DNS requests over TCP."), so this must be backported
to all stable branches.
Olivier Houchard [Tue, 17 Nov 2026 16:37:14 +0000 (17:37 +0100)]
REGTESTS: decompression: don't use yes(1) in http_large_cl
The body of http_large_cl.vtc was produced using "yes | head -c". But
vtest ignores SIGPIPE, which is inherited by the shell commands, and
BusyBox's yes never stops when its output is closed in this case. The test
then hangs until it is killed by vtest, as seen on the Alpine CI. GNU yes
is not affected because it exits on the write error.
Let's use awk instead to produce the same 24000 bytes. This test was added
by commit 68a8abcbe ("REGTESTS: decompression: test a large decompressed
Content-Length response"), no backport is needed.
Olivier Houchard [Tue, 17 Nov 2026 15:37:38 +0000 (16:37 +0100)]
REGTESTS: http-messaging: check that 1xx don't abort H2 backend tunnels
This test sends a CONNECT request, then an Extended CONNECT request (via
an H1 upgrade), through H2 backends whose servers answer with an interim
response then with a 200 response, and checks that data may then be
exchanged in the tunnel. It validates the previous fix.
Olivier Houchard [Tue, 17 Nov 2026 15:37:38 +0000 (16:37 +0100)]
BUG/MEDIUM: mux-h2: don't abort a tunnel attempt on interim responses
On the backend side, when a CONNECT or an Extended CONNECT request was
sent, h2c_dec_hdrs() aborts the tunnel attempt as soon as a response
without H2_MSGF_BODY_TUNNEL is received. But h2_make_htx_response() clears
this flag for any status other than 2xx and 101, including interim
responses (1xx) such as 100 Continue or 103 Early Hints. H2_SF_BODY_TUNNEL
is then removed and H2_SF_TUNNEL_ABRT set, so that the final 200 response
is processed as a regular response with a body. The client receives the
interim and the final responses, but the connection is closed as soon as
data are exchanged. This breaks CONNECT and WebSocket (Extended CONNECT)
through H2 servers emitting interim responses.
Let's only abort the tunnel attempt on final responses.
This has been there since 2.4 with commit d0db42326 ("MINOR: mux-h2: Add 2
flags to help to properly handle tunnel mode") and must be backported to
all stable versions.
Olivier Houchard [Tue, 17 Nov 2026 14:38:01 +0000 (15:38 +0100)]
REGTESTS: decompression: test a large decompressed Content-Length response
This test sends a small gzip-compressed body with a Content-Length header,
decompressing into more than a buffer, and checks that the whole
decompressed body is received. It is used to validate the previous fix.