mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
hurd: Fix using interposable hurd_thread_self
Create a private hidden __hurd_thread_self alias, and use that one. Fixes2f8ecb58a5
"hurd: Fix x86_64 _hurd_tls_fork" andc7fcce38c8
"hurd: Make sure to not use tcb->self" Reported-by: Joseph Myers <joseph@codesourcery.com> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
This commit is contained in:
parent
6af84886ad
commit
b44c1e1252
@ -156,6 +156,7 @@ libc {
|
||||
__libc_open; __libc_close;
|
||||
|
||||
# Used by libpthread.
|
||||
__hurd_thread_self;
|
||||
_hurd_sigstate_set_global_rcv;
|
||||
_hurd_sigstate_lock;
|
||||
_hurd_sigstate_pending;
|
||||
|
@ -19,7 +19,10 @@
|
||||
#include <hurd/signal.h>
|
||||
|
||||
thread_t
|
||||
hurd_thread_self (void)
|
||||
__hurd_thread_self (void)
|
||||
{
|
||||
return _hurd_self_sigstate ()->thread;
|
||||
}
|
||||
|
||||
libc_hidden_def (__hurd_thread_self)
|
||||
weak_alias (__hurd_thread_self, hurd_thread_self)
|
||||
|
@ -11,5 +11,8 @@ void _hurd_libc_proc_init (char **argv);
|
||||
libc_hidden_proto (_hurd_exec_paths)
|
||||
libc_hidden_proto (_hurd_init)
|
||||
libc_hidden_proto (_hurd_libc_proc_init)
|
||||
|
||||
extern thread_t __hurd_thread_self (void);
|
||||
libc_hidden_proto (__hurd_thread_self)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -79,7 +79,7 @@ __pthread_setup (struct __pthread *thread,
|
||||
{
|
||||
error_t err;
|
||||
|
||||
if (thread->kernel_thread == hurd_thread_self ())
|
||||
if (thread->kernel_thread == __hurd_thread_self ())
|
||||
/* Fix up the TCB for the main thread. The C library has already
|
||||
installed a TCB, which we want to keep using. This TCB must not
|
||||
be freed so don't register it in the thread structure. On the
|
||||
|
@ -56,7 +56,7 @@ __pthread_setup (struct __pthread *thread,
|
||||
struct i386_thread_state state;
|
||||
struct i386_fsgs_base_state fsgs_state;
|
||||
|
||||
if (thread->kernel_thread == hurd_thread_self ())
|
||||
if (thread->kernel_thread == __hurd_thread_self ())
|
||||
/* Fix up the TCB for the main thread. The C library has already
|
||||
installed a TCB, which we want to keep using. This TCB must not
|
||||
be freed so don't register it in the thread structure. On the
|
||||
|
@ -132,6 +132,10 @@ THREAD_TCB (thread_t thread,
|
||||
((descr)->pointer_guard \
|
||||
= THREAD_GETMEM (THREAD_SELF, pointer_guard))
|
||||
|
||||
/* From hurd.h, reproduced here to avoid a circular include. */
|
||||
extern thread_t __hurd_thread_self (void);
|
||||
libc_hidden_proto (__hurd_thread_self)
|
||||
|
||||
/* Set up TLS in the new thread of a fork child, copying from the original. */
|
||||
static inline kern_return_t __attribute__ ((unused))
|
||||
_hurd_tls_fork (thread_t child, thread_t orig,
|
||||
@ -141,8 +145,7 @@ _hurd_tls_fork (thread_t child, thread_t orig,
|
||||
struct i386_fsgs_base_state state;
|
||||
mach_msg_type_number_t state_count = i386_FSGS_BASE_STATE_COUNT;
|
||||
|
||||
extern thread_t hurd_thread_self (void);
|
||||
if (orig != hurd_thread_self ())
|
||||
if (orig != __hurd_thread_self ())
|
||||
{
|
||||
err = __thread_get_state (orig, i386_FSGS_BASE_STATE,
|
||||
(thread_state_t) &state,
|
||||
|
Loading…
Reference in New Issue
Block a user