]> sourceware.org Git - glibc.git/commit
elf: Use relaxed atomics for racy accesses [BZ #19329]
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 30 Dec 2020 19:19:37 +0000 (19:19 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 11 May 2021 16:16:37 +0000 (17:16 +0100)
commitf4f8f4d4e0f92488431b268c8cd9555730b9afe9
tree5bdda8e64325bdf0c3a69e3ddd483a0ce47fb614
parent1387ad6225c2222f027790e3f460e31aa5dd2c54
elf: Use relaxed atomics for racy accesses [BZ #19329]

This is a follow up patch to the fix for bug 19329.  This adds relaxed
MO atomics to accesses that were previously data races but are now
race conditions, and where relaxed MO is sufficient.

The race conditions all follow the pattern that the write is behind the
dlopen lock, but a read can happen concurrently (e.g. during tls access)
without holding the lock.  For slotinfo entries the read value only
matters if it reads from a synchronized write in dlopen or dlclose,
otherwise the related dtv entry is not valid to access so it is fine
to leave it in an inconsistent state.  The same applies for
GL(dl_tls_max_dtv_idx) and GL(dl_tls_generation), but there the
algorithm relies on the fact that the read of the last synchronized
write is an increasing value.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
elf/dl-close.c
elf/dl-open.c
elf/dl-tls.c
sysdeps/x86_64/dl-tls.c
This page took 0.075953 seconds and 5 git commands to generate.