From 10fb15a36b3f6bc3e5ca62cda081c86512f47d32 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 30 Dec 2020 19:19:37 +0000 Subject: 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 are racy, but relaxed MO is enough. -- v2: - handle x86_64 dl-tls.c too --- sysdeps/x86_64/dl-tls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sysdeps/x86_64/dl-tls.c') diff --git a/sysdeps/x86_64/dl-tls.c b/sysdeps/x86_64/dl-tls.c index 6595f6615b..24ef560b71 100644 --- a/sysdeps/x86_64/dl-tls.c +++ b/sysdeps/x86_64/dl-tls.c @@ -40,7 +40,8 @@ __tls_get_addr_slow (GET_ADDR_ARGS) { dtv_t *dtv = THREAD_DTV (); - if (__glibc_unlikely (dtv[0].counter != GL(dl_tls_generation))) + size_t gen = atomic_load_relaxed (&GL(dl_tls_generation)); + if (__glibc_unlikely (dtv[0].counter != gen)) return update_get_addr (GET_ADDR_PARAM); return tls_get_addr_tail (GET_ADDR_PARAM, dtv, NULL); -- cgit 1.4.1