freebsd-src/libexec
Konstantin Belousov a687683b99 rtld: mask signals for default read locks
Rtld locks from libthr defer signals delivery, which means that binding
is not possible while a signal handler is executed.

Binding might upgrade read-locked rtld_bind_lock to write-lock, if
symbol resolution requires loading filters.  If a signal would be delivered
while rtld is in read-locked section, and signal handler needs binding
which upgrades the lock, for non-threaded image that uses default rtld
locks, we get the rtld data structures modified under the top-level
active rtld frame.

To correct the problem, mask signals for read-locking of default locks
in addition to the write-locking.  It is very cheap now with
sigfastblock(2).

Note that the global state is used to track pre-locked state of either
sigfastblock(2) or signal mask (if sigfastblock(2) is administratively
disabled).  It is fine for non-threaded images since there are no other
threads.  But I believe that it is fine for threaded images using libc_r
as well, since masking signals disables preemption (I did not tested
it).

NetBSD PR:	https://gnats.netbsd.org/56979
Reported by:	tmunro
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36396
2022-09-04 07:28:02 +03:00
..
atf testing: provide meaningful error when pytest is not available 2022-07-06 19:55:58 +00:00
atrun
blacklistd-helper
bootpd bootp: remove the USE_BFUNCS knob 2021-09-30 23:47:06 -05:00
comsat
dma dma: make the version exposed reflect the new version 2021-09-22 11:12:04 +02:00
fingerd Update Makefile.depend files 2019-12-11 17:37:53 +00:00
flua stand: lua: enhance lfs.dir() to speed up kernels_autodetect 2021-01-29 12:47:29 -06:00
ftpd ftp: Use /var/spool/ftp as ftp's home consistently 2022-06-28 15:20:05 +02:00
getty pkgbase: Put more binaries/lib in runtime 2021-12-21 10:17:27 +01:00
hyperv pkgbase: Create a FreeBSD-hyperv package 2021-09-07 10:24:54 +02:00
mail.local
makewhatis.local makewhatis: do not try to operate on read-only mounted directories 2018-10-27 17:15:58 +00:00
mknetid
phttpget phttpget: move out of portsnap 2020-09-09 00:39:47 +00:00
pppoed
rbootd Fix the following -Werror warning from clang 10.0.0 in rbootd: 2020-01-28 19:19:55 +00:00
rc rc.conf: Fix a typo in a comment 2022-09-03 14:57:39 +02:00
revnetgroup
rpc.rquotad pkgbase: Create a FreeBSD-nfs package 2021-06-19 17:49:50 +02:00
rpc.rstatd
rpc.rusersd
rpc.rwalld
rpc.sprayd
rtld-elf rtld: mask signals for default read locks 2022-09-04 07:28:02 +03:00
rtld-elf32 libcompat: Correct rtld MLINKS 2019-11-12 22:31:59 +00:00
save-entropy Reduce disk write load in /usr/libexec/save-entropy. 2019-11-30 20:06:53 +00:00
smrsh
talkd Regularize my copyright notice 2019-12-04 16:56:11 +00:00
tcpd pkgbase: Create a FreeBSD-tcpd package 2021-12-21 10:17:31 +01:00
telnetd ncurses: chase dependency changes in the source tree 2021-10-04 11:38:24 +02:00
tests
tftp-proxy (t)ftp-proxy: use libpfctl 2021-04-10 11:16:02 +02:00
tftpd When receiving a file having a length, which is a mulitple of the blocksize, 2020-12-15 09:43:18 +00:00
ulog-helper
ypxfr pkgbase: Put yellow pages programs to its own package 2021-12-21 10:17:22 +01:00
Makefile phttpget: move out of portsnap 2020-09-09 00:39:47 +00:00
Makefile.amd64
Makefile.i386
Makefile.inc Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00