<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libthr/thread/thr_fork.c, branch stable/13</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>libthr: remove explicit sys/cdefs.h includes</title>
<updated>2024-03-13T00:31:20+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2024-03-06T07:06:35+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=32651946de0d354f2cb15bb0bf4e86a73ecbe493'/>
<id>32651946de0d354f2cb15bb0bf4e86a73ecbe493</id>
<content type='text'>
(cherry picked from commit f8bbbce458194ff4312c610d32a64ff4a3a71d45)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit f8bbbce458194ff4312c610d32a64ff4a3a71d45)
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line .c pattern</title>
<updated>2023-08-23T17:43:26+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-22T01:31:41+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=3d497e17ebd33fe0f58d773e35ab994d750258d6'/>
<id>3d497e17ebd33fe0f58d773e35ab994d750258d6</id>
<content type='text'>
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in main:
(cherry picked from commit 1d386b48a555)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in main:
(cherry picked from commit 1d386b48a555)
</pre>
</div>
</content>
</entry>
<entry>
<title>libthr rtld locks: do not leak URWLOCK_READ_WAITERS into child</title>
<updated>2023-05-29T03:20:42+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2023-05-20T08:11:54+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=5b45cd83c44edb9386eed1155acd3c52f36bf12c'/>
<id>5b45cd83c44edb9386eed1155acd3c52f36bf12c</id>
<content type='text'>
PR:	271490

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

(cherry picked from commit 6f49eafb056cfa0703dfc97a731cabe4ed2596b8)
</pre>
</div>
</content>
</entry>
<entry>
<title>libthr: wrap pdfork(2), same as fork(2).</title>
<updated>2021-01-11T20:59:52+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2021-01-10T19:22:49+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=21f749da82e755aafab127618affeffb86cff9a5'/>
<id>21f749da82e755aafab127618affeffb86cff9a5</id>
<content type='text'>
Without wrapping, rtld services and malloc(3) are not guaranteed
to operate correctly in the forked child.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28088
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without wrapping, rtld services and malloc(3) are not guaranteed
to operate correctly in the forked child.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28088
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid conflicts with libc symbols in libthr jump table.</title>
<updated>2019-07-31T19:27:20+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2019-07-31T19:27:20+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0ab1bfc7b28f495718a3dc4e4bc0faaea5684b0f'/>
<id>0ab1bfc7b28f495718a3dc4e4bc0faaea5684b0f</id>
<content type='text'>
In some corner cases of static linking and unexpected libraries order
on the linker command line, libc symbol might preempt the same libthr
symbol, in which case libthr jump table points back to libc causing
either infinite recursion or loop.  Handle all of such symbols by
using private libthr names for them, ensuring that the right pointers
are installed into the table.

In collaboration with: arichardson
PR:	239475
Tested by:	pho
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D21088
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In some corner cases of static linking and unexpected libraries order
on the linker command line, libc symbol might preempt the same libthr
symbol, in which case libthr jump table points back to libc causing
either infinite recursion or loop.  Handle all of such symbols by
using private libthr names for them, ensuring that the right pointers
are installed into the table.

In collaboration with: arichardson
PR:	239475
Tested by:	pho
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D21088
</pre>
</div>
</content>
</entry>
<entry>
<title>Untangle jemalloc and mutexes initialization.</title>
<updated>2019-01-29T22:46:44+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2019-01-29T22:46:44+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=381c2d2e9a882f8ba03ab84d6fc06f1347866f65'/>
<id>381c2d2e9a882f8ba03ab84d6fc06f1347866f65</id>
<content type='text'>
The need to use libc malloc(3) from some places in libthr always
caused issues.  For instance, per-thread key allocation was switched to
use plain mmap(2) to get storage, because some third party mallocs
used keys for implementation of calloc(3).

Even more important, libthr calls calloc(3) during initialization of
pthread mutexes, and jemalloc uses pthread mutexes.  Jemalloc provides
some way to both postpone the initialization, and to make
initialization to use specialized allocator, but this is very fragile
and often breaks.  See the referenced PR for another example.

Add the small malloc implementation used by rtld, to libthr. Use it in
thr_spec.c and for mutexes initialization. This avoids the issues with
mutual dependencies between malloc and libthr in principle.  The
drawback is that some more allocations are not interceptable for
alternate malloc implementations.  There should be not too much memory
use from this allocator, and the alternative, direct use of mmap(2) is
obviously worse.

PR:	235211
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D18988
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The need to use libc malloc(3) from some places in libthr always
caused issues.  For instance, per-thread key allocation was switched to
use plain mmap(2) to get storage, because some third party mallocs
used keys for implementation of calloc(3).

Even more important, libthr calls calloc(3) during initialization of
pthread mutexes, and jemalloc uses pthread mutexes.  Jemalloc provides
some way to both postpone the initialization, and to make
initialization to use specialized allocator, but this is very fragile
and often breaks.  See the referenced PR for another example.

Add the small malloc implementation used by rtld, to libthr. Use it in
thr_spec.c and for mutexes initialization. This avoids the issues with
mutual dependencies between malloc and libthr in principle.  The
drawback is that some more allocations are not interceptable for
alternate malloc implementations.  There should be not too much memory
use from this allocator, and the alternative, direct use of mmap(2) is
obviously worse.

PR:	235211
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D18988
</pre>
</div>
</content>
</entry>
<entry>
<title>Use _thr_isthreaded() and _thr_setthreaded() wrappers</title>
<updated>2018-11-30T03:02:49+00:00</updated>
<author>
<name>Eric van Gyzen</name>
<email>vangyzen@FreeBSD.org</email>
</author>
<published>2018-11-30T03:02:49+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=dbb1c64e82a9da2805814f17307fcf7cc3f55bd4'/>
<id>dbb1c64e82a9da2805814f17307fcf7cc3f55bd4</id>
<content type='text'>
...instead of directly using the global variable.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
...instead of directly using the global variable.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
</pre>
</div>
</content>
</entry>
<entry>
<title>General further adoption of SPDX licensing ID tags.</title>
<updated>2017-11-20T19:49:47+00:00</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-11-20T19:49:47+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=8a16b7a18f5d0b031f09832fd7752fba717e2a97'/>
<id>8a16b7a18f5d0b031f09832fd7752fba717e2a97</id>
<content type='text'>
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use __FBSDID() for .c files from lib/libthr/thread.</title>
<updated>2016-04-08T11:15:26+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2016-04-08T11:15:26+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=3279301186099f2fe0a3b98f05944434d84c056a'/>
<id>3279301186099f2fe0a3b98f05944434d84c056a</id>
<content type='text'>
Sponsored by:	The FreeBSD Foundation
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sponsored by:	The FreeBSD Foundation
</pre>
</div>
</content>
</entry>
<entry>
<title>Lock pshared_lock shared around fork, to ensure that the COW snapshot</title>
<updated>2016-03-21T06:52:35+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2016-03-21T06:52:35+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=53fd961f050e888c7882c314b8dc8a0d100759bf'/>
<id>53fd961f050e888c7882c314b8dc8a0d100759bf</id>
<content type='text'>
of the pshared hash in child is consistent and can be safely used.

Reported and tested by:	"Oleg V. Nauman" &lt;oleg@opentransfer.com&gt;
Sponsored by:	The FreeBSD Foundation
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
of the pshared hash in child is consistent and can be safely used.

Reported and tested by:	"Oleg V. Nauman" &lt;oleg@opentransfer.com&gt;
Sponsored by:	The FreeBSD Foundation
</pre>
</div>
</content>
</entry>
</feed>
