Author: sthibault Date: 2015-11-24 23:58:18 +0000 (Tue, 24 Nov 2015) New Revision: 6701
Modified: glibc-package/branches/glibc-2.21/debian/changelog glibc-package/branches/glibc-2.21/debian/patches/hurd-i386/tg-tls-threadvar.diff Log: * patches/hurd-i386/tg-tls-threadvar.diff: Update, to fix recursion while accessing TLS while locking for accessing TLS. Modified: glibc-package/branches/glibc-2.21/debian/changelog =================================================================== --- glibc-package/branches/glibc-2.21/debian/changelog 2015-11-23 21:30:14 UTC (rev 6700) +++ glibc-package/branches/glibc-2.21/debian/changelog 2015-11-24 23:58:18 UTC (rev 6701) @@ -12,6 +12,10 @@ * patches/hppa/submitted-mathdef.diff: new patch from John David Anglin to define __NO_LONG_DOUBLE_MATH on hppa. Closes: #805836. + [ Samuel Thibault ] + * patches/hurd-i386/tg-tls-threadvar.diff: Update, to fix recursion while + accessing TLS while locking for accessing TLS. + -- Aurelien Jarno <aure...@debian.org> Sun, 22 Nov 2015 20:20:54 +0100 glibc (2.21-0experimental3) experimental; urgency=medium Modified: glibc-package/branches/glibc-2.21/debian/patches/hurd-i386/tg-tls-threadvar.diff =================================================================== --- glibc-package/branches/glibc-2.21/debian/patches/hurd-i386/tg-tls-threadvar.diff 2015-11-23 21:30:14 UTC (rev 6700) +++ glibc-package/branches/glibc-2.21/debian/patches/hurd-i386/tg-tls-threadvar.diff 2015-11-24 23:58:18 UTC (rev 6701) @@ -4,6 +4,8 @@ replace the custom threadvar mechanism with generic TLS. That will fix sigaltstack. +Note: the added reply_port and _hurd_sigstate fields should be kept last. + --- hurd/Versions | 7 +-- hurd/hurd/signal.h | 24 +++++---- @@ -237,7 +239,7 @@ /* Linked-list of per-thread signal state. */ struct hurd_sigstate *_hurd_sigstates; -@@ -234,11 +234,11 @@ abort_thread (struct hurd_sigstate *ss, +@@ -234,14 +234,14 @@ abort_thread (struct hurd_sigstate *ss, that this location can be set without faulting, or else return NULL. */ static mach_port_t * @@ -251,7 +253,11 @@ + mach_port_t *portloc = &THREAD_TCB(thread, thread_state)->reply_port; if (sigthread && _hurdsig_catch_memory_fault (portloc)) - /* Faulted trying to read the stack. */ +- /* Faulted trying to read the stack. */ ++ /* Faulted trying to read the TCB. */ + return NULL; + + /* Fault now if this pointer is bogus. */ @@ -323,7 +323,8 @@ _hurdsig_abort_rpcs (struct hurd_sigstat our nonzero return tells the trampoline code to finish the message receive operation before running the handler. */ @@ -397,7 +403,7 @@ GLIBC_PRIVATE { # Functions shared with the dynamic linker __libc_read; __libc_write; __libc_lseek64; -+ __libc_lock_self0; __libc_get_lock_self; ++ __libc_lock_self0; _dl_init_first; } @@ -414,7 +420,7 @@ # functions that must be shared with libc __libc_read; __libc_write; __libc_lseek64; -+ __libc_lock_self0; __libc_get_lock_self; ++ __libc_lock_self0; } } Index: glibc-2.21/sysdeps/mach/hurd/bits/libc-lock.h @@ -429,17 +435,13 @@ typedef struct mutex __libc_lock_t; typedef struct -@@ -35,7 +34,12 @@ typedef struct +@@ -35,7 +34,8 @@ typedef struct } __libc_lock_recursive_t; typedef __libc_lock_recursive_t __rtld_lock_recursive_t; -#define __libc_lock_owner_self() ((void *) __hurd_threadvar_location (0)) +extern char __libc_lock_self0[0]; -+/* We have to hide the __libc_lock_self access behind a function call, -+ otherwise gcc >= 4.9 would try to prefetch the TLS dereference even before -+ the __LIBC_NO_TLS test is finished... */ -+extern void *__libc_get_lock_self(void); -+#define __libc_lock_owner_self() (__LIBC_NO_TLS() ? &__libc_lock_self0 : __libc_get_lock_self()) ++#define __libc_lock_owner_self() (__LIBC_NO_TLS() ? &__libc_lock_self0 : THREAD_SELF) #else typedef struct __libc_lock_opaque__ __libc_lock_t; @@ -486,19 +488,12 @@ =================================================================== --- glibc-2.21.orig/sysdeps/mach/hurd/cthreads.c +++ glibc-2.21/sysdeps/mach/hurd/cthreads.c -@@ -19,6 +19,15 @@ +@@ -19,6 +19,8 @@ #include <errno.h> #include <stdlib.h> +char __libc_lock_self0[0]; -+static __thread char __libc_lock_self[0]; + -+void * -+__libc_get_lock_self(void) -+{ -+ return (void*) &__libc_lock_self; -+} -+ /* Placeholder for key creation routine from Hurd cthreads library. */ int weak_function @@ -711,6 +706,15 @@ =================================================================== --- glibc-2.21.orig/sysdeps/mach/hurd/i386/sigreturn.c +++ glibc-2.21/sysdeps/mach/hurd/i386/sigreturn.c +@@ -68,7 +68,7 @@ __sigreturn (struct sigcontext *scp) + + if (scp->sc_onstack) + { +- ss->sigaltstack.ss_flags &= ~SS_ONSTACK; /* XXX threadvars */ ++ ss->sigaltstack.ss_flags &= ~SS_ONSTACK; + /* XXX cannot unlock until off sigstack */ + abort (); + } @@ -77,8 +77,7 @@ __sigreturn (struct sigcontext *scp) /* Destroy the MiG reply port used by the signal handler, and restore the @@ -725,10 +729,12 @@ =================================================================== --- glibc-2.21.orig/sysdeps/mach/hurd/i386/tls.h +++ glibc-2.21/sysdeps/mach/hurd/i386/tls.h -@@ -53,6 +53,8 @@ typedef struct +@@ -53,6 +53,10 @@ typedef struct void *__private_tm[4]; /* GCC split stack support. */ void *__private_ss; ++ ++ /* Keep this field last */ + mach_port_t reply_port; /* This thread's reply port. */ + struct hurd_sigstate *_hurd_sigstate; } tcbhead_t;