glibc/include
Tulio Magno Quites Machado Filho e5d262effe Fix _dl_profile_fixup data-dependency issue (Bug 23690)
There is a data-dependency between the fields of struct l_reloc_result
and the field used as the initialization guard. Users of the guard
expect writes to the structure to be observable when they also observe
the guard initialized. The solution for this problem is to use an acquire
and release load and store to ensure previous writes to the structure are
observable if the guard is initialized.

The previous implementation used DL_FIXUP_VALUE_ADDR (l_reloc_result->addr)
as the initialization guard, making it impossible for some architectures
to load and store it atomically, i.e. hppa and ia64, due to its larger size.

This commit adds an unsigned int to l_reloc_result to be used as the new
initialization guard of the struct, making it possible to load and store
it atomically in all architectures. The fix ensures that the values
observed in l_reloc_result are consistent and do not lead to crashes.
The algorithm is documented in the code in elf/dl-runtime.c
(_dl_profile_fixup). Not all data races have been eliminated.

Tested with build-many-glibcs and on powerpc, powerpc64, and powerpc64le.

	[BZ #23690]
	* elf/dl-runtime.c (_dl_profile_fixup): Guarantee memory
	modification order when accessing reloc_result->addr.
	* include/link.h (reloc_result): Add field init.
	* nptl/Makefile (tests): Add tst-audit-threads.
	(modules-names): Add tst-audit-threads-mod1 and
	tst-audit-threads-mod2.
	Add rules to build tst-audit-threads.
	* nptl/tst-audit-threads-mod1.c: New file.
	* nptl/tst-audit-threads-mod2.c: Likewise.
	* nptl/tst-audit-threads.c: Likewise.
	* nptl/tst-audit-threads.h: Likewise.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-11-30 18:05:32 -02:00
..
arpa
bits
gnu
net
netinet
programs
protocols
rpc
rpcsvc
sys
aio.h
aliases.h
alloc_buffer.h
alloca.h
allocate_once.h
argp-fmtstream.h
argp.h
argz.h
array_length.h
assert.h
atomic.h
byteswap.h
complex.h
cpio.h
crypt.h
ctype.h
des.h
dirent.h
dlfcn.h
dso_handle.h
elf.h
endian.h
envz.h
err.h
errno.h
error.h
execinfo.h
fcntl.h
features.h
fenv.h Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
float.h
fmtmsg.h
fnmatch.h
fpu_control.h
ftw.h
gconv.h
getopt.h
getopt_int.h
glob.h
gmp.h
gnu-versions.h
grp-merge.h
grp.h
gshadow.h
iconv.h
ifaddrs.h
ifreq.h
ifunc-impl-list.h
inline-hashtab.h
intprops.h Merge mktime, timegm from upstream Gnulib 2018-09-19 17:09:08 -07:00
inttypes.h
langinfo.h
libc-diag.h
libc-internal.h
libc-pointer-arith.h
libc-symbols.h Add hidden_tls_def macros, fix powerpc-soft build with GCC 9. 2018-11-13 01:53:53 +00:00
libgen.h
libintl.h
limits.h
link.h Fix _dl_profile_fixup data-dependency issue (Bug 23690) 2018-11-30 18:05:32 -02:00
list.h
list_t.h
locale.h
malloc.h
math-narrow-eval.h
math.h Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
mcheck.h
memory.h
mntent.h
monetary.h Use STRFMON_LDBL_IS_DBL instead of __ldbl_is_dbl. 2018-11-16 09:21:14 -02:00
mqueue.h
netdb.h
netgroup.h
nl_types.h
nss.h
nsswitch.h
obstack.h
plural-exp.h
poll.h
printf.h
pthread.h
pty.h
pwd.h
regex.h
resolv.h
rounding-mode.h
sched.h
scratch_buffer.h
search.h
set-hooks.h
setjmp.h
sgtty.h
shadow.h
shlib-compat.h
signal.h
spawn.h posix: Add internal symbols for posix_spawn interface 2018-10-24 15:22:27 -03:00
stab.h
stackinfo.h
stap-probe.h
stdc-predef.h
stdio.h
stdio_ext.h
stdlib.h
string.h
strings.h
stropts.h
stubs-prologue.h
syscall.h
sysexits.h
syslog.h
tar.h
termios.h
tgmath.h
time.h Y2038: Add 64-bit time for all architectures 2018-10-24 22:09:34 +02:00
ttyent.h
uchar.h
ucontext.h
ulimit.h
unistd.h
utime.h
utmp.h
values.h
verify.h Merge mktime, timegm from upstream Gnulib 2018-09-19 17:09:08 -07:00
wchar.h
wctype.h
wordexp.h