<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/sys/interposing_table.c, branch release/13.1.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F13.1.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F13.1.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2021-01-11T20:59:52Z</updated>
<entry>
<title>libthr: wrap pdfork(2), same as fork(2).</title>
<updated>2021-01-11T20:59:52Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2021-01-10T19:22:49Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=21f749da82e755aafab127618affeffb86cff9a5'/>
<id>urn:sha1: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>
</entry>
<entry>
<title>Fix initial exec TLS mode for dynamically loaded shared objects.</title>
<updated>2019-03-29T17:52:57Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2019-03-29T17:52:57Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=5d00c5a6571cdf533228338fa7ca532c91af1d66'/>
<id>urn:sha1:5d00c5a6571cdf533228338fa7ca532c91af1d66</id>
<content type='text'>
If dso uses initial exec TLS mode, rtld tries to allocate TLS in
static space. If there is no space left, the dlopen(3) fails. If space
if allocated, initial content from PT_TLS segment is distributed to
all threads' pcbs, which was missed and caused un-initialized TLS
segment for such dso after dlopen(3).

The mode is auto-detected either due to the relocation used, or if the
DF_STATIC_TLS dynamic flag is set.  In the later case, the TLS segment
is tried to allocate earlier, which increases chance of the dlopen(3)
to succeed.  LLD was recently fixed to properly emit the flag, ld.bdf
did it always.

Initial test by:	dumbbell
Tested by:	emaste (amd64), ian (arm)
Tested by:	Gerald Aryeetey &lt;aryeeteygerald_rogers.com&gt; (arm64)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D19072
</content>
</entry>
<entry>
<title>Add clock_nanosleep()</title>
<updated>2017-03-19T00:51:12Z</updated>
<author>
<name>Eric van Gyzen</name>
<email>vangyzen@FreeBSD.org</email>
</author>
<published>2017-03-19T00:51:12Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=3f8455b0905a05552b1155e09165787e1d098060'/>
<id>urn:sha1:3f8455b0905a05552b1155e09165787e1d098060</id>
<content type='text'>
Add a clock_nanosleep() syscall, as specified by POSIX.
Make nanosleep() a wrapper around it.

Attach the clock_nanosleep test from NetBSD. Adjust it for the
FreeBSD behavior of updating rmtp only when interrupted by a signal.
I believe this to be POSIX-compliant, since POSIX mentions the rmtp
parameter only in the paragraph about EINTR. This is also what
Linux does. (NetBSD updates rmtp unconditionally.)

Copy the whole nanosleep.2 man page from NetBSD because it is complete
and closely resembles the POSIX description. Edit, polish, and reword it
a bit, being sure to keep any relevant text from the FreeBSD page.

Reviewed by:	kib, ngie, jilles
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10020
</content>
</entry>
<entry>
<title>The fdatasync(2) call must be cancellation point.</title>
<updated>2016-08-16T08:27:03Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2016-08-16T08:27:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1c1cc89580f0fbfabaf6f6c7f0f6440eef0c128e'/>
<id>urn:sha1:1c1cc89580f0fbfabaf6f6c7f0f6440eef0c128e</id>
<content type='text'>
Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
</content>
</entry>
<entry>
<title>If libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbols</title>
<updated>2016-02-08T19:24:13Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2016-02-08T19:24:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=bd43f0691c95603818dd7df72f24ee318bb0f29f'/>
<id>urn:sha1:bd43f0691c95603818dd7df72f24ee318bb0f29f</id>
<content type='text'>
do not participate in the global symbols namespace, but rtld locks are
still replaced and functions are interposed.  In particular,
__pthread_map_stacks_exec is resolved to the libc version.  If a
library is loaded later, which requires adjustment of the stack
protection mode, rtld calls into libc __pthread_map_stacks_exec due to
the symbols scope.  The libc version might recurse into binder and
recursively acquire rtld bind lock, causing the hang.

Make libc __pthread_map_stacks_exec() interposed, which synchronizes
rtld locks and version of the stack exec hook when libthr loaded,
regardless of the symbol scope control or symbol resolution order.

The __pthread_map_stacks_exec() symbol is removed from the private
version in libthr since libc symbol now operates correctly in presence
of libthr.

Reported and tested by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
</content>
</entry>
<entry>
<title>The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and</title>
<updated>2015-04-18T21:50:13Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2015-04-18T21:50:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=0538aafc41ac136a3ab5a88d7d67f968f6d06b52'/>
<id>urn:sha1:0538aafc41ac136a3ab5a88d7d67f968f6d06b52</id>
<content type='text'>
pwrite(2) syscalls are wrapped to provide compatibility with pre-7.x
kernels which required padding before the off_t parameter.  The
fcntl(2) contains compatibility code to handle kernels before the
struct flock was changed during the 8.x CURRENT development.  The
shims were reasonable to allow easier revert to the older kernel at
that time.

Now, two or three major releases later, shims do not serve any
purpose.  Such old kernels cannot handle current libc, so revert the
compatibility code.

Make padded syscalls support conditional under the COMPAT6 config
option.  For COMPAT32, the syscalls were under COMPAT6 already.

Remove WITHOUT_SYSCALL_COMPAT build option, which only purpose was to
(partially) disable the removed shims.

Reviewed by:	jhb, imp (previous versions)
Discussed with:	peter
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
</entry>
<entry>
<title>Make wait6(2), waitid(3) and ppoll(2) cancellation points.  The</title>
<updated>2015-04-18T21:35:41Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2015-04-18T21:35:41Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=3d0045bb2b27da7ad0c1befac8cd3b421cd52d12'/>
<id>urn:sha1:3d0045bb2b27da7ad0c1befac8cd3b421cd52d12</id>
<content type='text'>
waitid() function is required to be cancellable by the standard.  The
wait6() and ppoll() follow the other syscalls in their groups.

Reviewed by:	jhb, jilles (previous versions)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
</entry>
<entry>
<title>Make kevent(2) a cancellation point.</title>
<updated>2015-03-29T19:14:41Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2015-03-29T19:14:41Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b072e86d0917ad6e699a6770c44130f7685b4605'/>
<id>urn:sha1:b072e86d0917ad6e699a6770c44130f7685b4605</id>
<content type='text'>
Note that to cancel blocked kevent(2) call, changelist must be empty,
since we cannot cancel a call which already made changes to the
process state.  And in reverse, call which only makes changes to the
kqueue state, without waiting for an event, is not cancellable.  This
makes a natural usage model to migrate kqueue loop to support
cancellation, where existing single kevent(2) call must be split into
two: first uncancellable update of kqueue, then cancellable wait for
events.

Note that this is ABI-incompatible change, but it is believed that
there is no cancel-safe code that relies on kevent(2) not being a
cancellation point.  Option to preserve the ABI would be to keep
kevent(2) as is, but add new call with flags to specify cancellation
behaviour, which only value seems to add complications.

Suggested and reviewed by:	jilles
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
</content>
</entry>
<entry>
<title>Properly interpose libc spinlocks, was missed in r276630.  In</title>
<updated>2015-02-14T11:47:40Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2015-02-14T11:47:40Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=45468c535679073d66091fc7b94dacd46257d337'/>
<id>urn:sha1:45468c535679073d66091fc7b94dacd46257d337</id>
<content type='text'>
particular, stdio locking was affected.

Reported and tested by:	"Matthew D. Fuller" &lt;fullermd@over-yonder.net&gt;
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
</content>
</entry>
<entry>
<title>Reduce the size of the interposing table and amount of</title>
<updated>2015-01-11T22:16:31Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2015-01-11T22:16:31Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=397d851d664c78683599ab7c46c44df85815a6d1'/>
<id>urn:sha1:397d851d664c78683599ab7c46c44df85815a6d1</id>
<content type='text'>
cancellation-handling code in the libthr.  Translate some syscalls
into their more generic counterpart, and remove translated syscalls
from the table.

List of the affected syscalls:
creat, open -&gt; openat
raise -&gt; thr_kill
sleep, usleep -&gt; nanosleep
pause -&gt; sigsuspend
wait, wait3, waitpid -&gt; wait4

Suggested and reviewed by:	jilles (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
</entry>
</feed>
