r3959 - in glibc-package/trunk/debian: . patches patches/hppa
Author: aurel32
Date: 2009-11-12 11:31:20 +0000 (Thu, 12 Nov 2009)
New Revision: 3959
Added:
glibc-package/trunk/debian/patches/hppa/local-stack-grows-up.diff
Modified:
glibc-package/trunk/debian/changelog
glibc-package/trunk/debian/patches/series
Log:
* patches/hppa/local-stack-grows-up.diff: fix pthread stack related
functions when the stack grows up. Closes: #553722.
Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog 2009-11-10 19:25:19 UTC (rev 3958)
+++ glibc-package/trunk/debian/changelog 2009-11-12 11:31:20 UTC (rev 3959)
@@ -18,8 +18,12 @@
* debhelper.in/locales-all.prerm: remove /usr/lib/locale on removal, to
make puiparts happy.
- -- Aurelien Jarno <aurel32@debian.org> Tue, 10 Nov 2009 20:24:18 +0100
+ [ Carlos O'Donell]
+ * patches/hppa/local-stack-grows-up.diff: fix pthread stack related
+ functions when the stack grows up. Closes: #553722.
+ -- Aurelien Jarno <aurel32@debian.org> Thu, 12 Nov 2009 12:29:53 +0100
+
eglibc (2.10.1-6) unstable; urgency=high
[ Aurelien Jarno ]
Added: glibc-package/trunk/debian/patches/hppa/local-stack-grows-up.diff
===================================================================
--- glibc-package/trunk/debian/patches/hppa/local-stack-grows-up.diff (rev 0)
+++ glibc-package/trunk/debian/patches/hppa/local-stack-grows-up.diff 2009-11-12 11:31:20 UTC (rev 3959)
@@ -0,0 +1,163 @@
+--- eglibc-2.10.1-orig/nptl/allocatestack.c 2009-02-05 09:29:56.000000000 -0500
++++ eglibc-2.10.1/nptl/allocatestack.c 2009-11-09 09:39:02.000000000 -0500
+@@ -353,6 +353,12 @@
+ if (__builtin_expect (attr->flags & ATTR_FLAG_STACKADDR, 0))
+ {
+ uintptr_t adj;
++#if _STACK_GROWS_DOWN
++ char * stackaddr = (char *) attr->stackaddr;
++#else
++ /* Assume the same layout, but later adjust the stack pointer. */
++ char * stackaddr = (char *) attr->stackaddr + attr->stacksize;
++#endif
+
+ /* If the user also specified the size of the stack make sure it
+ is large enough. */
+@@ -362,11 +368,11 @@
+
+ /* Adjust stack size for alignment of the TLS block. */
+ #if TLS_TCB_AT_TP
+- adj = ((uintptr_t) attr->stackaddr - TLS_TCB_SIZE)
++ adj = ((uintptr_t) stackaddr - TLS_TCB_SIZE)
+ & __static_tls_align_m1;
+ assert (size > adj + TLS_TCB_SIZE);
+ #elif TLS_DTV_AT_TP
+- adj = ((uintptr_t) attr->stackaddr - __static_tls_size)
++ adj = ((uintptr_t) stackaddr - __static_tls_size)
+ & __static_tls_align_m1;
+ assert (size > adj);
+ #endif
+@@ -376,10 +382,10 @@
+ the stack. It is the user's responsibility to do this if it
+ is wanted. */
+ #if TLS_TCB_AT_TP
+- pd = (struct pthread *) ((uintptr_t) attr->stackaddr
++ pd = (struct pthread *) ((uintptr_t) stackaddr
+ - TLS_TCB_SIZE - adj);
+ #elif TLS_DTV_AT_TP
+- pd = (struct pthread *) (((uintptr_t) attr->stackaddr
++ pd = (struct pthread *) (((uintptr_t) stackaddr
+ - __static_tls_size - adj)
+ - TLS_PRE_TCB_SIZE);
+ #endif
+@@ -391,7 +397,7 @@
+ pd->specific[0] = pd->specific_1stblock;
+
+ /* Remember the stack-related values. */
+- pd->stackblock = (char *) attr->stackaddr - size;
++ pd->stackblock = (char *) stackaddr - size;
+ pd->stackblock_size = size;
+
+ /* This is a user-provided stack. It will not be queued in the
+@@ -616,7 +622,7 @@
+ char *guard = mem + (((size - guardsize) / 2) & ~pagesize_m1);
+ #elif _STACK_GROWS_DOWN
+ char *guard = mem;
+-# elif _STACK_GROWS_UP
++#elif _STACK_GROWS_UP
+ char *guard = (char *) (((uintptr_t) pd - guardsize) & ~pagesize_m1);
+ #endif
+ if (mprotect (guard, guardsize, PROT_NONE) != 0)
+@@ -715,7 +721,6 @@
+ *stack = stacktop;
+ #elif _STACK_GROWS_UP
+ *stack = pd->stackblock;
+- assert (*stack > 0);
+ #endif
+
+ return 0;
+--- eglibc-2.10.1-orig/nptl/pthread_getattr_np.c 2007-09-12 12:26:54.000000000 -0400
++++ eglibc-2.10.1/nptl/pthread_getattr_np.c 2009-11-09 09:51:01.000000000 -0500
+@@ -61,7 +61,11 @@
+ if (__builtin_expect (thread->stackblock != NULL, 1))
+ {
+ iattr->stacksize = thread->stackblock_size;
++#ifdef _STACK_GROWS_DOWN
+ iattr->stackaddr = (char *) thread->stackblock + iattr->stacksize;
++#else
++ iattr->stackaddr = (char *) thread->stackblock;
++#endif
+ }
+ else
+ {
+@@ -94,7 +98,7 @@
+
+ char *line = NULL;
+ size_t linelen = 0;
+- uintptr_t last_to = 0;
++ uintptr_t last_stackaddr = 0;
+
+ while (! feof_unlocked (fp))
+ {
+@@ -110,18 +114,25 @@
+ {
+ /* Found the entry. Now we have the info we need. */
+ iattr->stacksize = rl.rlim_cur;
++#ifdef _STACK_GROWS_DOWN
+ iattr->stackaddr = (void *) to;
+-
++#else
++ iattr->stackaddr = (void *) from;
++#endif
+ /* The limit might be too high. */
+ if ((size_t) iattr->stacksize
+- > (size_t) iattr->stackaddr - last_to)
+- iattr->stacksize = (size_t) iattr->stackaddr - last_to;
++ > (size_t) iattr->stackaddr - last_stackaddr)
++ iattr->stacksize = (size_t) iattr->stackaddr - last_stackaddr;
+
+ /* We succeed and no need to look further. */
+ ret = 0;
+ break;
+ }
+- last_to = to;
++#ifdef _STACK_GROWS_DOWN
++ last_stackaddr = to;
++#else
++ last_stackaddr = from;
++#endif
+ }
+
+ free (line);
+diff -urN eglibc-2.10.1-orig/nptl/pthread_attr_getstack.c eglibc-2.10.1/nptl/pthread_attr_getstack.c
+--- eglibc-2.10.1-orig/nptl/pthread_attr_getstack.c 2006-08-16 21:18:26.000000000 -0400
++++ eglibc-2.10.1/nptl/pthread_attr_getstack.c 2009-11-08 15:22:15.000000000 -0500
+@@ -33,7 +33,11 @@
+ iattr = (struct pthread_attr *) attr;
+
+ /* Store the result. */
++#ifdef _STACK_GROWS_DOWN
+ *stackaddr = (char *) iattr->stackaddr - iattr->stacksize;
++#else
++ *stackaddr = (char *) iattr->stackaddr;
++#endif
+ *stacksize = iattr->stacksize;
+
+ return 0;
+diff -urN eglibc-2.10.1-orig/nptl/pthread_attr_setstack.c eglibc-2.10.1/nptl/pthread_attr_setstack.c
+--- eglibc-2.10.1-orig/nptl/pthread_attr_setstack.c 2006-10-18 11:30:11.000000000 -0400
++++ eglibc-2.10.1/nptl/pthread_attr_setstack.c 2009-11-08 15:23:06.000000000 -0500
+@@ -48,7 +48,11 @@
+ #endif
+
+ iattr->stacksize = stacksize;
++#if _STACK_GROWS_DOWN
+ iattr->stackaddr = (char *) stackaddr + stacksize;
++#else
++ iattr->stackaddr = (char *) stackaddr;
++#endif
+ iattr->flags |= ATTR_FLAG_STACKADDR;
+
+ return 0;
+@@ -81,7 +85,11 @@
+ # endif
+
+ iattr->stacksize = stacksize;
++#if _STACK_GROWS_DOWN
+ iattr->stackaddr = (char *) stackaddr + stacksize;
++#else
++ iattr->stackaddr = (char *) stackaddr;
++#endif
+ iattr->flags |= ATTR_FLAG_STACKADDR;
+
+ return 0;
Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series 2009-11-10 19:25:19 UTC (rev 3958)
+++ glibc-package/trunk/debian/patches/series 2009-11-12 11:31:20 UTC (rev 3959)
@@ -73,6 +73,7 @@
hppa/submitted-nptl-carlos.diff
hppa/submitted-pie.diff
hppa/cvs-nptl-compat.diff
+hppa/local-stack-grows-up.diff
hurd-i386/local-dl-dynamic-weak.diff
hurd-i386/local-enable-ldconfig.diff
Reply to: