freebsd-dev/lib/libc
Konstantin Belousov 5d00c5a657 Fix initial exec TLS mode for dynamically loaded shared objects.
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 <aryeeteygerald_rogers.com> (arm64)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D19072
2019-03-29 17:52:57 +00:00
..
aarch64 Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
amd64 Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
arm Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
capability Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
compat-43 General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
db Remove "All rights reserved" from my files. 2018-05-10 06:41:08 +00:00
gdtoa libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
gen Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
gmon mcount: tidy up ANSIfication 2018-10-20 22:39:35 +00:00
i386 Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
iconv libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
include Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
inet libc: fix cases of undefined behavior. 2018-08-07 15:24:19 +00:00
isc SPDX: more ISC-related files. 2017-12-08 17:52:53 +00:00
locale Fix WITHOUT_ICONV build after r340276. 2018-11-14 09:06:15 +00:00
md Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
mips Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
nameser SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
net Use correct buffer sizes in sctp_get[lp]addrs(). 2019-03-02 13:16:01 +00:00
nls Create new EINTEGRITY error with message "Integrity check failed". 2019-01-17 06:35:45 +00:00
posix1e Remove some redundant code in _posix1e_acl_strip_np 2019-02-19 19:15:15 +00:00
powerpc Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
powerpc64 Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
powerpcspe Fix fabs(3) for powerpcspe, this time for real 2018-07-26 14:42:20 +00:00
quad ANSIfy libc/quad 2018-10-21 00:20:40 +00:00
regex regcomp: revert part of r341838 which turned out to be unrelated 2018-12-19 23:28:56 +00:00
resolv Allow the use of TCP instead of UDP for queries by setting options usevc 2018-08-16 13:18:40 +00:00
riscv Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
rpc Fix CONFS to append the value in this case. 2018-09-18 01:38:44 +00:00
secure Carefully update stack guard bytes inside __guard_setup(). 2018-04-24 15:59:39 +00:00
softfloat Add implementations for clog(3), clogf(3), and clog(3). 2018-05-13 09:54:34 +00:00
sparc64 Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
stdio GC a historical artifact. 2019-02-07 23:17:44 +00:00
stdlib getopt_long(3): fix case of malformed long opt 2019-01-04 03:13:24 +00:00
stdtime strptime: make %k and %l specifiers match their description in 2018-11-03 23:37:13 +00:00
string Fix WITHOUT_NLS build after r342551. 2018-12-28 16:08:49 +00:00
sys Fix initial exec TLS mode for dynamically loaded shared objects. 2019-03-29 17:52:57 +00:00
tests Drop "All rights reserved" from my copyright statements. 2019-03-06 22:11:45 +00:00
uuid libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
x86 pkru(3) man page. 2019-02-20 10:03:03 +00:00
xdr General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
yp libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
libc_nossp.ldscript Add different libc ldscript: the one without libssp -- 2016-10-12 13:19:21 +00:00
libc.ldscript
Makefile revert r341429 "disable BIND_NOW in libc, libthr, and rtld" 2019-03-28 02:12:32 +00:00
Makefile.depend DIRDEPS_BUILD: Regenerate without local dependencies. 2016-02-24 17:20:11 +00:00
Versions.def Create namespace for the symbols added during 13-CURRENT cycle. 2018-11-12 19:12:14 +00:00