<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/haproxy.git/include/haproxy/buf.h, branch master</title>
<subtitle>github.com: haproxy/haproxy.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/'/>
<entry>
<title>MINOR: buffer: add br_single() to check if a buffer ring has more than one buf</title>
<updated>2023-03-16T17:45:46+00:00</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2023-03-16T16:30:04+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=9824f8c8908d67f6cedf2434e12a23f18a27eaf0'/>
<id>9824f8c8908d67f6cedf2434e12a23f18a27eaf0</id>
<content type='text'>
It's cheaper and cleaner than using br_count()==1 given that it just compares
two indexes, and that a ring having a single buffer is in a special case where
it is between empty and used up-to-1. In other words it's not congested.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's cheaper and cleaner than using br_count()==1 given that it just compares
two indexes, and that a ring having a single buffer is in a special case where
it is between empty and used up-to-1. In other words it's not congested.
</pre>
</div>
</content>
</entry>
<entry>
<title>MINOR: buffer: add br_count() to return the number of allocated bufs</title>
<updated>2023-03-16T17:45:46+00:00</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2023-03-16T15:46:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=e5a26eb2def42f07aad5bde4cd27e9fdd441f207'/>
<id>e5a26eb2def42f07aad5bde4cd27e9fdd441f207</id>
<content type='text'>
We have no way to know how many buffers are currently allocated in a
buffer ring. Let's add br_count() for this.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have no way to know how many buffers are currently allocated in a
buffer ring. Let's add br_count() for this.
</pre>
</div>
</content>
</entry>
<entry>
<title>BUG/MAJOR: buf: Fix copy of wrapping output data when a buffer is realigned</title>
<updated>2023-01-05T08:34:49+00:00</updated>
<author>
<name>Christopher Faulet</name>
<email>cfaulet@haproxy.com</email>
</author>
<published>2023-01-05T08:34:47+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=61aded057dafc419f62b9534d03e6c99a3405f7a'/>
<id>61aded057dafc419f62b9534d03e6c99a3405f7a</id>
<content type='text'>
There is a bug in b_slow_realign() function when wrapping output data are
copied in the swap buffer. block1 and block2 sizes are inverted. Thus blocks
with a wrong size are copied. It leads to data mixin if the first block is
in reality larger than the second one or to a copy of data outside the
buffer is the first block is smaller than the second one.

The bug was introduced when the buffer API was refactored in 1.9. It was
found by a code review and seems never to have been triggered in almost 5
years. However, we cannot exclude it is responsible of some unresolved bugs.

This patch should fix issue #1978. It must be backported as far as 2.0.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is a bug in b_slow_realign() function when wrapping output data are
copied in the swap buffer. block1 and block2 sizes are inverted. Thus blocks
with a wrong size are copied. It leads to data mixin if the first block is
in reality larger than the second one or to a copy of data outside the
buffer is the first block is smaller than the second one.

The bug was introduced when the buffer API was refactored in 1.9. It was
found by a code review and seems never to have been triggered in almost 5
years. However, we cannot exclude it is responsible of some unresolved bugs.

This patch should fix issue #1978. It must be backported as far as 2.0.
</pre>
</div>
</content>
</entry>
<entry>
<title>MINOR: buffers: split b_force_xfer() into b_cpy() and b_force_xfer()</title>
<updated>2022-10-13T14:45:28+00:00</updated>
<author>
<name>William Lallemand</name>
<email>wlallemand@haproxy.org</email>
</author>
<published>2022-10-10T15:27:47+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=35df34223b5d45db8b498def39bd720a8d3f810e'/>
<id>35df34223b5d45db8b498def39bd720a8d3f810e</id>
<content type='text'>
Split the b_force_xfer() into b_ncat() and b_force_xfer().

The previous b_force_xfer() implementation was basically a copy with a
b_del on the src buffer. Keep this implementation to make b_ncat(), and
just call b_ncat() + b_del() into b_force_xfer().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Split the b_force_xfer() into b_ncat() and b_force_xfer().

The previous b_force_xfer() implementation was basically a copy with a
b_del on the src buffer. Keep this implementation to make b_ncat(), and
just call b_ncat() + b_del() into b_force_xfer().
</pre>
</div>
</content>
</entry>
<entry>
<title>BUG/MINOR: buffer: fix debugging condition in b_peek_varint()</title>
<updated>2022-03-11T15:59:14+00:00</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2022-03-11T15:55:49+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=f1cb4ac745994cf62bb259d117c4b7cdaf8c8dd7'/>
<id>f1cb4ac745994cf62bb259d117c4b7cdaf8c8dd7</id>
<content type='text'>
The BUG_ON_HOT() test condition added to b_peek_varint() by commit
8873b85bd ("DEBUG: buf: add BUG_ON_HOT() to most buffer management
functions") was wrong as &lt;data&gt; in this function is not b-&gt;data,
so that was triggering during live dumps of H2 traces on the CLI
when built with -DDEBUG_STRICT=2. No backport is needed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The BUG_ON_HOT() test condition added to b_peek_varint() by commit
8873b85bd ("DEBUG: buf: add BUG_ON_HOT() to most buffer management
functions") was wrong as &lt;data&gt; in this function is not b-&gt;data,
so that was triggering during live dumps of H2 traces on the CLI
when built with -DDEBUG_STRICT=2. No backport is needed.
</pre>
</div>
</content>
</entry>
<entry>
<title>DEBUG: buf: add BUG_ON_HOT() to most buffer management functions</title>
<updated>2022-02-28T15:14:02+00:00</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2022-02-28T15:11:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=8873b85bd92fb4a7744f13bf462c540ed6c4946d'/>
<id>8873b85bd92fb4a7744f13bf462c540ed6c4946d</id>
<content type='text'>
A number of tests are now performed in low-level buffer management
functions to verify that we're not appending data to a full buffer
for example, or that the buffer passed in argument is consistent in
that its data don't outweigh its size. The few functions that already
involve memcpy() or memmove() instead got a BUG_ON() that will always
be enabled, since the overhead remains minimalist.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A number of tests are now performed in low-level buffer management
functions to verify that we're not appending data to a full buffer
for example, or that the buffer passed in argument is consistent in
that its data don't outweigh its size. The few functions that already
involve memcpy() or memmove() instead got a BUG_ON() that will always
be enabled, since the overhead remains minimalist.
</pre>
</div>
</content>
</entry>
<entry>
<title>DEBUG: buf: replace some sensitive BUG_ON() with BUG_ON_HOT()</title>
<updated>2022-02-28T15:10:00+00:00</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2022-02-28T15:10:00+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=a8f4b34bb743f64e1c767d60756e508dd4abcc54'/>
<id>a8f4b34bb743f64e1c767d60756e508dd4abcc54</id>
<content type='text'>
The buffer ring management functions br_* were all stuffed with BUG_ON()
statements that never triggered and that are on some fast paths (e.g. in
mux_h2). Let's turn them to BUG_ON_HOT() instead.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The buffer ring management functions br_* were all stuffed with BUG_ON()
statements that never triggered and that are on some fast paths (e.g. in
mux_h2). Let's turn them to BUG_ON_HOT() instead.
</pre>
</div>
</content>
</entry>
<entry>
<title>DEBUG: buffer: check in __b_put_blk() whether the buffer room is respected</title>
<updated>2022-02-18T16:33:27+00:00</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2022-02-18T16:33:27+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=d439a496550ba44ceae09a59c72c278163ff8b99'/>
<id>d439a496550ba44ceae09a59c72c278163ff8b99</id>
<content type='text'>
This adds a BUG_ON() to make sure we don't face other situations like the
one fixed by previous commit.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds a BUG_ON() to make sure we don't face other situations like the
one fixed by previous commit.
</pre>
</div>
</content>
</entry>
<entry>
<title>BUG/MAJOR: buf: fix varint API post- vs pre- increment</title>
<updated>2021-10-21T13:28:24+00:00</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2021-10-21T13:05:34+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=dd362b7b24ea24d8f3c882dab1a69cf78af7cc90'/>
<id>dd362b7b24ea24d8f3c882dab1a69cf78af7cc90</id>
<content type='text'>
A bogus test in b_get_varint(), b_put_varint(), b_peek_varint() shifts
the end of the buffer by one byte. Since the bug is the same in the read
and write functions, the buffer contents remain compatible, which explains
why this bug was not detected earlier. But if the buffer ends on an
aligned address or page, it can result in a one-byte overflow which will
typically cause a crash or an inconsistent behavior.

This API is only used by rings (e.g. for traces and boot messages) and
by DNS responses, so the probability to hit it is extremely low, but a
crash on boot was observed.

This must be backported to 2.2.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A bogus test in b_get_varint(), b_put_varint(), b_peek_varint() shifts
the end of the buffer by one byte. Since the bug is the same in the read
and write functions, the buffer contents remain compatible, which explains
why this bug was not detected earlier. But if the buffer ends on an
aligned address or page, it can result in a one-byte overflow which will
typically cause a crash or an inconsistent behavior.

This API is only used by rings (e.g. for traces and boot messages) and
by DNS responses, so the probability to hit it is extremely low, but a
crash on boot was observed.

This must be backported to 2.2.
</pre>
</div>
</content>
</entry>
<entry>
<title>MINOR: buf: Add b_force_xfer() function</title>
<updated>2021-09-23T13:27:25+00:00</updated>
<author>
<name>Frédéric Lécaille</name>
<email>flecaille@haproxy.com</email>
</author>
<published>2021-09-09T14:53:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/haproxy.git/commit/?id=c7860007cc967b1e30fe9ba01ceb188ae7747f9d'/>
<id>c7860007cc967b1e30fe9ba01ceb188ae7747f9d</id>
<content type='text'>
This function does exactly the same thing as b_xfer() which transfers
data from a struct buffer to another one but without zero copy when
the destination buffer is empty. This is at least useful to transfer
h3 data to the QUIC mux from buffer with garbage medata which have
been used to build h3 frames without too much memcopy()/memmove().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This function does exactly the same thing as b_xfer() which transfers
data from a struct buffer to another one but without zero copy when
the destination buffer is empty. This is at least useful to transfer
h3 data to the QUIC mux from buffer with garbage medata which have
been used to build h3 frames without too much memcopy()/memmove().
</pre>
</div>
</content>
</entry>
</feed>
