]> sourceware.org Git - glibc.git/commit
x86: Fix THREAD_SELF definition to avoid ld.so crash (bug 27004)
authorJakub Jelinek <jakub@redhat.com>
Thu, 3 Dec 2020 12:33:44 +0000 (13:33 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 3 Dec 2020 12:48:55 +0000 (13:48 +0100)
commit1d9cbb96082e646de7515a1667efa041ffb79958
treeb52e641f97c37dfed401538a038a4ae058ea87ce
parent7c331116971d38e57703af4097ed13ab6bef91d0
x86: Fix THREAD_SELF definition to avoid ld.so crash (bug 27004)

The previous definition of THREAD_SELF did not tell the compiler
that %fs (or %gs) usage is invalid for the !DL_LOOKUP_GSCOPE_LOCK
case in _dl_lookup_symbol_x.  As a result, ld.so could try to use the
TCB before it was initialized.

As the comment in tls.h explains, asm volatile is undesirable here.
Using the __seg_fs (or __seg_gs) namespace does not interfere with
optimization, and expresses that THREAD_SELF is potentially trapping.
sysdeps/i386/nptl/tls.h
sysdeps/x86_64/nptl/tls.h
This page took 0.039178 seconds and 5 git commands to generate.