<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/stdlib, branch releng/14.3</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>libc: allow __cxa_atexit handlers to be added during __cxa_finalize</title>
<updated>2025-04-17T01:01:36+00:00</updated>
<author>
<name>Aurélien Croc de Suray</name>
<email>freebsd@ap2c.com</email>
</author>
<published>2025-04-05T00:47:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c43ae65b4b89be422cdcd399a7abc44f6db4b298'/>
<id>c43ae65b4b89be422cdcd399a7abc44f6db4b298</id>
<content type='text'>
science/dlib-cpp reveals an interesting scenario that works fine on
other platforms but not on FreeBSD; notably, it ends up creating a new
global object from some destructor which is called during
__cxa_finalize.  This breaks when libdlib is dlopen()ed and then
subsequently dlclose()ed, as we never end up invoking the created
object's dtor until program exit when the shlib is already unmapped.

Fix it by noting when we're in the middle of __cxa_finalize for a dso,
and then restarting the search if __cxa_atexit() was called in the
middle somewhere.

We wait until we've processed the initial set before starting over and
processing the newly added handlers as if it were a complete set of
handlers added during runtime.  The alternative is calling them as
they're added to maintain a LIFO in terms of total ordering, but in
theory a constructor could add another global object that also needs to
be destroyed, and that object needs to be destroyed after the one that
constructed it to avoid creating unexpected lifetime issues.

This manifests in the pdlib PHP extension for dlib crashing, see [0].

[0] https://github.com/goodspb/pdlib/issues/39

PR:		285870
Reviewed by:	kevans (also supplied commit message)

(cherry picked from commit 23427c8e1fedb9fc68ad0bd27a59c7ffd2b3008c)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
science/dlib-cpp reveals an interesting scenario that works fine on
other platforms but not on FreeBSD; notably, it ends up creating a new
global object from some destructor which is called during
__cxa_finalize.  This breaks when libdlib is dlopen()ed and then
subsequently dlclose()ed, as we never end up invoking the created
object's dtor until program exit when the shlib is already unmapped.

Fix it by noting when we're in the middle of __cxa_finalize for a dso,
and then restarting the search if __cxa_atexit() was called in the
middle somewhere.

We wait until we've processed the initial set before starting over and
processing the newly added handlers as if it were a complete set of
handlers added during runtime.  The alternative is calling them as
they're added to maintain a LIFO in terms of total ordering, but in
theory a constructor could add another global object that also needs to
be destroyed, and that object needs to be destroyed after the one that
constructed it to avoid creating unexpected lifetime issues.

This manifests in the pdlib PHP extension for dlib crashing, see [0].

[0] https://github.com/goodspb/pdlib/issues/39

PR:		285870
Reviewed by:	kevans (also supplied commit message)

(cherry picked from commit 23427c8e1fedb9fc68ad0bd27a59c7ffd2b3008c)
</pre>
</div>
</content>
</entry>
<entry>
<title>Revise qsort(3) reflect POSIX.1-2024 update.</title>
<updated>2024-12-22T07:30:52+00:00</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2024-10-28T06:15:21+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=97cf82ebe02210daf14801f40164adc98e5197f4'/>
<id>97cf82ebe02210daf14801f40164adc98e5197f4</id>
<content type='text'>
Reviewed by:	emaste, trasz
Differential Revision: https://reviews.freebsd.org/D47262

(cherry picked from commit 3df1abdfd9c309efbdc7884d6b6f6fe25efcb397)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:	emaste, trasz
Differential Revision: https://reviews.freebsd.org/D47262

(cherry picked from commit 3df1abdfd9c309efbdc7884d6b6f6fe25efcb397)
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: indicate existing functions that are POSIX 2024</title>
<updated>2024-11-21T00:45:07+00:00</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2024-11-14T19:30:54+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=098ed26bf4564362c4478b8c92b11ab9ca074da1'/>
<id>098ed26bf4564362c4478b8c92b11ab9ca074da1</id>
<content type='text'>
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47581

(cherry picked from commit dfa0ac74c2fbc1cde3e8cdb1ab9fe5cbb90a9b16)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47581

(cherry picked from commit dfa0ac74c2fbc1cde3e8cdb1ab9fe5cbb90a9b16)
</pre>
</div>
</content>
</entry>
<entry>
<title>jemalloc: set LG_VADDR to 64 on amd64</title>
<updated>2024-10-15T15:06:44+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-09-16T21:09:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b90d68c9b28b0a458bdf4a963397817974ed0f90'/>
<id>b90d68c9b28b0a458bdf4a963397817974ed0f90</id>
<content type='text'>
(cherry picked from commit eade2001aa9d91440886de8359a4dec9edcde2a9)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit eade2001aa9d91440886de8359a4dec9edcde2a9)
</pre>
</div>
</content>
</entry>
<entry>
<title>exit(3): clarify how to obtain full exit status of the exited process</title>
<updated>2024-08-21T10:32:49+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-07-25T17:28:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2a1e8d7c30c90e17fccaeec89e4963a8d825063d'/>
<id>2a1e8d7c30c90e17fccaeec89e4963a8d825063d</id>
<content type='text'>
(cherry picked from commit c4269e63ecf301306a6176b9fe9002c4c2265695)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit c4269e63ecf301306a6176b9fe9002c4c2265695)
</pre>
</div>
</content>
</entry>
<entry>
<title>exit(3): make it thread-safe</title>
<updated>2024-08-21T10:32:49+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-07-24T20:41:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=8d801641a39834cf8ce72dc88cf8bc5712cc1cad'/>
<id>8d801641a39834cf8ce72dc88cf8bc5712cc1cad</id>
<content type='text'>
(cherry picked from commit 3f3ec4b99f79d32a0bf15495559ca9883bd751f2)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit 3f3ec4b99f79d32a0bf15495559ca9883bd751f2)
</pre>
</div>
</content>
</entry>
<entry>
<title>__cxa_thread_call_dtors(3): fix dtor pointer validity check</title>
<updated>2024-05-10T07:49:10+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-05-03T09:32:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=6a8ca2ff53389c36233e5e0b1576696d34b74407'/>
<id>6a8ca2ff53389c36233e5e0b1576696d34b74407</id>
<content type='text'>
PR:	278701

(cherry picked from commit b27eb9ce96b838622e125fd969e8dc4914aabe18)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PR:	278701

(cherry picked from commit b27eb9ce96b838622e125fd969e8dc4914aabe18)
</pre>
</div>
</content>
</entry>
<entry>
<title>strfmon.c: Use the restrict keyword directly</title>
<updated>2023-12-16T04:17:51+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2023-12-09T01:21:02+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=79ca908fded37d25dad76366137bdcbba2bf300c'/>
<id>79ca908fded37d25dad76366137bdcbba2bf300c</id>
<content type='text'>
(cherry picked from commit 86e2bcbf47fb4c8dbd799f2f21c0ed338b2e8f1b)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit 86e2bcbf47fb4c8dbd799f2f21c0ed338b2e8f1b)
</pre>
</div>
</content>
</entry>
<entry>
<title>strfmon: style fixes</title>
<updated>2023-12-16T04:17:51+00:00</updated>
<author>
<name>Jose Luis Duran</name>
<email>jlduran@gmail.com</email>
</author>
<published>2023-11-30T23:28:21+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2f427cbb3557fbcf19da6ecf0f5dfd14105eff2e'/>
<id>2f427cbb3557fbcf19da6ecf0f5dfd14105eff2e</id>
<content type='text'>
(cherry picked from commit 56a0d5444d6f39302f3476b61c1b81ed39abe589)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit 56a0d5444d6f39302f3476b61c1b81ed39abe589)
</pre>
</div>
</content>
</entry>
<entry>
<title>strfmon: Silence scan-build warning</title>
<updated>2023-12-16T04:17:51+00:00</updated>
<author>
<name>Jose Luis Duran</name>
<email>jlduran@gmail.com</email>
</author>
<published>2023-11-30T23:30:50+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ea99922484b7435ac8001ebd13614006c734b924'/>
<id>ea99922484b7435ac8001ebd13614006c734b924</id>
<content type='text'>
(cherry picked from commit 6abee52e0d79f68fd725de748d7027ca8eef2294)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit 6abee52e0d79f68fd725de748d7027ca8eef2294)
</pre>
</div>
</content>
</entry>
</feed>
