HardenedBSD/lib
Konstantin Belousov 8495e8b1e9 Fix known issues which blow up the process after dlopen("libthr.so")
(or loading a dso linked to libthr.so into process which was not
linked against threading library).

- Remove libthr interposers of the libc functions, including
  __error(). Instead, functions calls are indirected through the
  interposing table, similar to how pthread stubs in libc are already
  done.  Libc by default points either to syscall trampolines or to
  existing libc implementations.  On libthr load, libthr rewrites the
  pointers to the cancellable implementations already in libthr.  The
  interposition table is separate from pthreads stubs indirection
  table to not pull pthreads stubs into static binaries.

- Postpone the malloc(3) internal mutexes initialization until libthr
  is loaded.  This avoids recursion between calloc(3) and static
  pthread_mutex_t initialization.

- Reinstall signal handlers with wrapper on libthr load.  The
  _rtld_is_dlopened(3) is used to avoid useless calls to sigaction(2)
  when libthr is statically referenced from the main binary.

In the process, fix openat(2), swapcontext(2) and setcontext(2)
interposing.  The libc symbols were exported at different versions
than libthr interposers.  Export both libc and libthr versions from
libc now, with default set to the higher version from libthr.

Remove unused and disconnected swapcontext(3) userspace implementation
from libc/gen.

No objections from:	deischen
Tested by:	pho, antoine (exp-run) (previous versions)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-03 18:38:46 +00:00
..
atf Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
clang Update build for LLDB snapshot at upstream rev 216948 2014-11-26 17:40:03 +00:00
csu
libalias
libarchive Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libauditd
libbegemot
libblocksruntime
libbluetooth
libbsdstat
libbsm
libbsnmp Fix build with recent binutils 2014-12-23 10:43:35 +00:00
libbz2
libc Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
libc_nonshared
libc++ Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libcalendar
libcam Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libcapsicum Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libcasper Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libcom_err Remove GNU texinfo from base along with all info pages. 2015-01-02 18:45:03 +00:00
libcompat
libcompiler_rt
libcrypt Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libcuse Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libcxxrt
libdevinfo
libdevstat Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libdpv mdoc: improvements to SEE ALSO. 2014-12-27 08:22:58 +00:00
libdwarf Update elftoolchain to upstream rev 3130 2014-12-29 19:16:40 +00:00
libedit Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libefi
libelf
libelftc Update elftoolchain to upstream rev 3130 2014-12-29 19:16:40 +00:00
libevent
libexecinfo Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libexpat
libfetch Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libfigpar
libgeom Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libgpib
libgpio Fix an off-by-one in gpio_pin_list(). 2014-12-02 06:24:45 +00:00
libgssapi mdoc: sort SEE ALSO. 2014-12-29 21:52:32 +00:00
libiconv
libiconv_modules
libipsec
libjail In preparation for using clang's -Wcast-qual: 2014-11-25 21:01:08 +00:00
libkiconv
libkvm
libldns Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
liblzma
libmagic MFV r276568: 2015-01-02 21:20:02 +00:00
libmandoc Update mandoc to 1.13.2 2014-12-25 21:56:56 +00:00
libmd
libmemstat Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libmilter
libmp Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libnandfs
libnetbsd
libnetgraph
libngatm
libnv Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libohash
libopie Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libpam mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
libpcap
libpjdlog Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libpmc
libproc Fix a memory leak that occured when looking up CTF info for a symbol. 2014-12-23 15:40:57 +00:00
libprocstat Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libradius Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
librpcsec_gss mdoc: sort SEE ALSO. 2014-12-29 21:59:44 +00:00
librpcsvc
librt Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
librtld_db mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
libsbuf
libsdp
libsm
libsmb Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libsmdb
libsmutil
libsqlite3 Fix typo 2014-11-25 11:08:58 +00:00
libstand Fix loader's ability to read the 10.1 release PowerPC ISOs. There appears to 2014-12-30 16:55:53 +00:00
libstdbuf
libstdthreads Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libtacplus Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libtelnet
libthr Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
libthread_db
libucl Update libucl to latest version 2014-11-29 00:45:09 +00:00
libufs
libugidfw
libulog Convert libraries to use LIBADD 2014-11-25 11:07:26 +00:00
libunbound Upgrade to Unbound 1.5.1. Almost all our local changes to date have been 2015-01-03 02:40:51 +00:00
libusb mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
libusbhid
libutil mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
libvgl
libvmmapi Replace bhyve's minimal RTC emulation with a fully featured one in vmm.ko. 2014-12-30 22:19:34 +00:00
libwrap
libxo Move libxo to /lib 2014-12-25 03:15:56 +00:00
liby
libypclnt
libz
msun mdoc: remove EOL whitespace. 2014-12-29 13:50:59 +00:00
ncurses Parallelize building lib/ncurses 2014-12-27 21:11:42 +00:00
tests
Makefile Deorbit the IEEE-488/GPIB support. 2014-12-25 20:15:13 +00:00
Makefile.inc