<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib, branch stable/12</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>msun: remove fabs from Symbol.map, and adjust comment</title>
<updated>2024-01-30T17:52:55+00:00</updated>
<author>
<name>Dimitry Andric</name>
<email>dim@FreeBSD.org</email>
</author>
<published>2024-01-27T21:24:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ca89a51d407a1d6b78d27b8d407f0c12f7c8c9a1'/>
<id>ca89a51d407a1d6b78d27b8d407f0c12f7c8c9a1</id>
<content type='text'>
We have s_fabs.c, but fabs(3) is already provided by libc due to
historical reasons, so it is not compiled into libm. When the linker
does not use --undefined-version, this leads to a complaint about the
symbol being nonexistent, so remove it from Symbol.map.

While here, adjust the comment about some functions being supplied by
libc: while it is true that all these are indeed in libc, libm still
includes its own versions of frexp(3), isnan(3), isnanf(3), and
isnanl(3).

Reported by:	Steve Kargl &lt;sgk@troutmask.apl.washington.edu&gt;
MFC after:	3 days

(cherry picked from commit d04e03c19a8d7660ea36f62720eef9bc96b69889)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have s_fabs.c, but fabs(3) is already provided by libc due to
historical reasons, so it is not compiled into libm. When the linker
does not use --undefined-version, this leads to a complaint about the
symbol being nonexistent, so remove it from Symbol.map.

While here, adjust the comment about some functions being supplied by
libc: while it is true that all these are indeed in libc, libm still
includes its own versions of frexp(3), isnan(3), isnanf(3), and
isnanl(3).

Reported by:	Steve Kargl &lt;sgk@troutmask.apl.washington.edu&gt;
MFC after:	3 days

(cherry picked from commit d04e03c19a8d7660ea36f62720eef9bc96b69889)
</pre>
</div>
</content>
</entry>
<entry>
<title>libc/libc/rpc: refactor some global variables</title>
<updated>2023-12-01T21:15:45+00:00</updated>
<author>
<name>Alan Somers</name>
<email>asomers@FreeBSD.org</email>
</author>
<published>2023-11-09T22:58:56+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c7d8a572acb2bcdf824a75af3e97b24e36463a34'/>
<id>c7d8a572acb2bcdf824a75af3e97b24e36463a34</id>
<content type='text'>
* Combine dg_fd_locks and dg_cv into one array.
* Similarly for vc_fd_locks and vc_cv
* Turn some macros into inline functions

This is a mostly cosmetic change to make refactoring these strutures in
a future commit easier.

Sponsored by:	Axcient
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D42597

(cherry picked from commit a5c2f4e939430f0048136c39fb9fa6093d401905)

lib/libc/rpc: switch the per-fd structs in clnt_{dg,vc}.c to RB Trees

This saves oodles of memory, especially when "ulimit -n" is large.  It
also prevents a buffer overflow if getrlimit should fail.

Also replace per-fd condvars with mutexes to simplify the code.

PR:		274968
Sponsored by:	Axcient
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D42597

(cherry picked from commit 24938f9311c9c9acc1ce747f4e6a088c2dbc967d)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Combine dg_fd_locks and dg_cv into one array.
* Similarly for vc_fd_locks and vc_cv
* Turn some macros into inline functions

This is a mostly cosmetic change to make refactoring these strutures in
a future commit easier.

Sponsored by:	Axcient
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D42597

(cherry picked from commit a5c2f4e939430f0048136c39fb9fa6093d401905)

lib/libc/rpc: switch the per-fd structs in clnt_{dg,vc}.c to RB Trees

This saves oodles of memory, especially when "ulimit -n" is large.  It
also prevents a buffer overflow if getrlimit should fail.

Also replace per-fd condvars with mutexes to simplify the code.

PR:		274968
Sponsored by:	Axcient
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D42597

(cherry picked from commit 24938f9311c9c9acc1ce747f4e6a088c2dbc967d)
</pre>
</div>
</content>
</entry>
<entry>
<title>libcasper: Fix a typo in a source code comment</title>
<updated>2023-11-26T07:55:11+00:00</updated>
<author>
<name>Gordon Bergling</name>
<email>gbe@FreeBSD.org</email>
</author>
<published>2023-11-23T08:58:15+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=92dff9984d12bab2fb49bf8302f9e59688c3cfe2'/>
<id>92dff9984d12bab2fb49bf8302f9e59688c3cfe2</id>
<content type='text'>
- s/mutiple/multiple/

(cherry picked from commit 637e4ef1a6bcd8677dabd8c08916df3091be5f64)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- s/mutiple/multiple/

(cherry picked from commit 637e4ef1a6bcd8677dabd8c08916df3091be5f64)
</pre>
</div>
</content>
</entry>
<entry>
<title>fflush: Add test for buffer handling in __sflush</title>
<updated>2023-11-07T14:30:07+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2023-08-03T15:13:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=6a0891c6ebb78bd59a3fc440675e31b6982de896'/>
<id>6a0891c6ebb78bd59a3fc440675e31b6982de896</id>
<content type='text'>
Sponsored by:	Klara, Inc.

(cherry picked from commit b8dbfb0a6c181a9aeab0b793deb0813d06052df9)
(cherry picked from commit ba490dfc95e0941216420a2003757b3c4b5b2ec2)
(cherry picked from commit 66d84f1362f63c23f6f451490e153e0703a7cda6)

Approved by:	so
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sponsored by:	Klara, Inc.

(cherry picked from commit b8dbfb0a6c181a9aeab0b793deb0813d06052df9)
(cherry picked from commit ba490dfc95e0941216420a2003757b3c4b5b2ec2)
(cherry picked from commit 66d84f1362f63c23f6f451490e153e0703a7cda6)

Approved by:	so
</pre>
</div>
</content>
</entry>
<entry>
<title>fflush: correct buffer handling in __sflush</title>
<updated>2023-11-07T14:11:54+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2023-08-03T15:13:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=3a2ea31568c81f7b29710abd3d3e1ada2fbeb6c9'/>
<id>3a2ea31568c81f7b29710abd3d3e1ada2fbeb6c9</id>
<content type='text'>
This fixes CVE-2014-8611 correctly.

The commit that purported to fix CVE-2014-8611 (805288c2f062) only hid
it behind another bug.  Two later commits, 86a16ada1ea6 and
44cf1e5eb470, attempted to address this new bug but mostly just confused
the issue.  This commit rolls back the three previous changes and fixes
CVE-2014-8611 correctly.

The key to understanding the bug (and the fix) is that `_w` has
different meanings for different stream modes.  If the stream is
unbuffered, it is always zero.  If the stream is fully buffered, it is
the amount of space remaining in the buffer (equal to the buffer size
when the buffer is empty and zero when the buffer is full).  If the
stream is line-buffered, it is a negative number reflecting the amount
of data in the buffer (zero when the buffer is empty and negative buffer
size when the buffer is full).

At the heart of `fflush()`, we call the stream's write function in a
loop, where `t` represents the return value from the last call and `n`
the amount of data that remains to be written.  When the write function
fails, we need to move the unwritten data to the top of the buffer
(unless nothing was written) and adjust `_p` (which points to the next
free location in the buffer) and `_w` accordingly.  These variables have
already been set to the values they should have after a successful
flush, so instead of adjusting them down to reflect what was written,
we're adjusting them up to reflect what remains.

The bug was that while `_p` was always adjusted, we only adjusted `_w`
if the stream was fully buffered.  The fix is to also adjust `_w` for
line-buffered streams.  Everything else is just noise.

Fixes: 805288c2f062
Fixes: 86a16ada1ea6
Fixes: 44cf1e5eb470
Sponsored by:	Klara, Inc.

(cherry picked from commit d09a3bf72c0b5f1779c52269671872368c99f02a)
(cherry picked from commit 92709431b14df6c0687446247ac57cfc189ee827)
(cherry picked from commit 6cb5690b3495741e9ece6f42ba4a85732932aa83)

Approved by:	so
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes CVE-2014-8611 correctly.

The commit that purported to fix CVE-2014-8611 (805288c2f062) only hid
it behind another bug.  Two later commits, 86a16ada1ea6 and
44cf1e5eb470, attempted to address this new bug but mostly just confused
the issue.  This commit rolls back the three previous changes and fixes
CVE-2014-8611 correctly.

The key to understanding the bug (and the fix) is that `_w` has
different meanings for different stream modes.  If the stream is
unbuffered, it is always zero.  If the stream is fully buffered, it is
the amount of space remaining in the buffer (equal to the buffer size
when the buffer is empty and zero when the buffer is full).  If the
stream is line-buffered, it is a negative number reflecting the amount
of data in the buffer (zero when the buffer is empty and negative buffer
size when the buffer is full).

At the heart of `fflush()`, we call the stream's write function in a
loop, where `t` represents the return value from the last call and `n`
the amount of data that remains to be written.  When the write function
fails, we need to move the unwritten data to the top of the buffer
(unless nothing was written) and adjust `_p` (which points to the next
free location in the buffer) and `_w` accordingly.  These variables have
already been set to the values they should have after a successful
flush, so instead of adjusting them down to reflect what was written,
we're adjusting them up to reflect what remains.

The bug was that while `_p` was always adjusted, we only adjusted `_w`
if the stream was fully buffered.  The fix is to also adjust `_w` for
line-buffered streams.  Everything else is just noise.

Fixes: 805288c2f062
Fixes: 86a16ada1ea6
Fixes: 44cf1e5eb470
Sponsored by:	Klara, Inc.

(cherry picked from commit d09a3bf72c0b5f1779c52269671872368c99f02a)
(cherry picked from commit 92709431b14df6c0687446247ac57cfc189ee827)
(cherry picked from commit 6cb5690b3495741e9ece6f42ba4a85732932aa83)

Approved by:	so
</pre>
</div>
</content>
</entry>
<entry>
<title>fflush: Split a temporary variable in two.</title>
<updated>2023-11-06T14:43:45+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2023-08-03T15:08:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=95fbce59c9f4ed4015b19a88491a37dac9d4e7d5'/>
<id>95fbce59c9f4ed4015b19a88491a37dac9d4e7d5</id>
<content type='text'>
It is clearer to avoid reusing temporary variables for different
purposes.

Sponsored by:	Klara, Inc.

(cherry picked from commit 1f90b4edffe815aebb35e74b79e10593b31f6b75)
(cherry picked from commit 1e99535be2ea9c0ef8bc57fc885e9c01fa95d2dd)
(cherry picked from commit ccdd8337f9cbd7d34e2e95df1440dd5f7225d0b4)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is clearer to avoid reusing temporary variables for different
purposes.

Sponsored by:	Klara, Inc.

(cherry picked from commit 1f90b4edffe815aebb35e74b79e10593b31f6b75)
(cherry picked from commit 1e99535be2ea9c0ef8bc57fc885e9c01fa95d2dd)
(cherry picked from commit ccdd8337f9cbd7d34e2e95df1440dd5f7225d0b4)
</pre>
</div>
</content>
</entry>
<entry>
<title>libbe: bail out early if the zfs kmod isn't loaded</title>
<updated>2023-11-03T04:50:46+00:00</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2023-07-07T00:41:14+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ee4bdd4b0db5b9d64e64490fc84a395344862aed'/>
<id>ee4bdd4b0db5b9d64e64490fc84a395344862aed</id>
<content type='text'>
As noted in the comment, we already know the rest of libbe_init() will
fail because there's no pool imported.  Avoid the side effect by
checking beforehand and bailing out early.

With this, freebsd-update(8) should no longer trigger a load of the zfs
kmod just because it runs `bectl check`.

Reviewed by:	jwmaag_gmail.com, rew

(cherry picked from commit 2f700ca965a04c4a03b6f760da6a210b6ca4df4b)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As noted in the comment, we already know the rest of libbe_init() will
fail because there's no pool imported.  Avoid the side effect by
checking beforehand and bailing out early.

With this, freebsd-update(8) should no longer trigger a load of the zfs
kmod just because it runs `bectl check`.

Reviewed by:	jwmaag_gmail.com, rew

(cherry picked from commit 2f700ca965a04c4a03b6f760da6a210b6ca4df4b)
</pre>
</div>
</content>
</entry>
<entry>
<title>libfetch: don't rely on ca_root_nss for certificate validation</title>
<updated>2023-10-05T15:58:59+00:00</updated>
<author>
<name>Michael Osipov</name>
<email>michael.osipov@siemens.com</email>
</author>
<published>2023-10-03T05:53:20+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=8d939b7d98452c0357e49b090d5a685ea8a0e69a'/>
<id>8d939b7d98452c0357e49b090d5a685ea8a0e69a</id>
<content type='text'>
Before certctl(8), there was no system trust store, and libfetch
relied on the CA certificate bundle from the ca_root_nss port to
verify peers.

We now have a system trust store and a reliable mechanism for
manipulating it (to explicitly add, remove, or revoke certificates),
but if ca_root_nss is installed, libfetch will still prefer that to
the system trust store.

With this change, unless explicitly overridden, libfetch will rely on
OpenSSL to pick up the default system trust store.

PR:		256902
MFC after:	3 days
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D42059

(cherry picked from commit 09f5c1e118bb4eca77b83a0d08f559b20f60aa59)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before certctl(8), there was no system trust store, and libfetch
relied on the CA certificate bundle from the ca_root_nss port to
verify peers.

We now have a system trust store and a reliable mechanism for
manipulating it (to explicitly add, remove, or revoke certificates),
but if ca_root_nss is installed, libfetch will still prefer that to
the system trust store.

With this change, unless explicitly overridden, libfetch will rely on
OpenSSL to pick up the default system trust store.

PR:		256902
MFC after:	3 days
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D42059

(cherry picked from commit 09f5c1e118bb4eca77b83a0d08f559b20f60aa59)
</pre>
</div>
</content>
</entry>
<entry>
<title>unbound: Vendor import 1.18.0</title>
<updated>2023-10-03T02:01:07+00:00</updated>
<author>
<name>Cy Schubert</name>
<email>cy@FreeBSD.org</email>
</author>
<published>2023-09-19T04:17:09+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=8ac4404ce27b180cca79e5e6e188616bbf30b2c5'/>
<id>8ac4404ce27b180cca79e5e6e188616bbf30b2c5</id>
<content type='text'>
Release notes at
    https://www.nlnetlabs.nl/news/2023/Aug/30/unbound-1.18.0-released/

Merge commit '401770e05c71ecb5ae61a59d316069b4b78bf622' into main

(cherry picked from commit 8f76bb7dad48538c6832c2fb466a433d2a3f8cd5)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Release notes at
    https://www.nlnetlabs.nl/news/2023/Aug/30/unbound-1.18.0-released/

Merge commit '401770e05c71ecb5ae61a59d316069b4b78bf622' into main

(cherry picked from commit 8f76bb7dad48538c6832c2fb466a433d2a3f8cd5)
</pre>
</div>
</content>
</entry>
<entry>
<title>regcomp: use unsigned char when testing for escapes</title>
<updated>2023-09-30T01:41:57+00:00</updated>
<author>
<name>Christos Zoulas</name>
<email>christos@NetBSD.org</email>
</author>
<published>2023-08-30T20:37:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=25307d6c927934dd44628e06cbc7047415fb6931'/>
<id>25307d6c927934dd44628e06cbc7047415fb6931</id>
<content type='text'>
- cast GETNEXT to unsigned where it is being promoted to int to prevent
  sign-extension (really it would have been better for PEEK*() and
  GETNEXT() to return unsigned char; this would have removed a ton of
  (uch) casts, but it is too intrusive for now).
- fix an isalpha that should have been iswalpha

PR:		264275, 274032
Reviewed by:	kevans, eugen (previous version)
Obtained from:	NetBSD

(cherry picked from commit 3fb80f1476c7776f04ba7ef6d08397cef6abcfb0)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- cast GETNEXT to unsigned where it is being promoted to int to prevent
  sign-extension (really it would have been better for PEEK*() and
  GETNEXT() to return unsigned char; this would have removed a ton of
  (uch) casts, but it is too intrusive for now).
- fix an isalpha that should have been iswalpha

PR:		264275, 274032
Reviewed by:	kevans, eugen (previous version)
Obtained from:	NetBSD

(cherry picked from commit 3fb80f1476c7776f04ba7ef6d08397cef6abcfb0)
</pre>
</div>
</content>
</entry>
</feed>
