public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] s390: tls pointer extraction in __libc_start_main
@ 2008-10-06 18:17 Martin Schwidefsky
  2008-10-22 21:45 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Schwidefsky @ 2008-10-06 18:17 UTC (permalink / raw)
  To: Glibc hackers

Greetings,
a glibc compiled with the latest gcc crashes in __libc_start_main.
The cause is that the compiler has decided to extract the tls pointer
in __libc_start_main() from the access registers a0/a1 into a general
register before the tls pointer has been set up by the call to
__pthread_initialize_minimal(). 

The least invasive fix is to clobber the access registers before the
first use in THREAD_SET_STACK_GUARD(). This makes the compiler to
do the tls pointer extraction after __pthread_initialize_minimal().

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.
--

2008-10-06  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/s390/tls.h (THREAD_SET_STACK_GUARD): Add empty inline
	assembly with a clobber list for access registers a0 and a1.

diff -urpN libc/nptl/sysdeps/s390/tls.h libc-s390/nptl/sysdeps/s390/tls.h
--- libc/nptl/sysdeps/s390/tls.h	2007-08-07 13:09:01.000000000 +0200
+++ libc-s390/nptl/sysdeps/s390/tls.h	2008-10-06 19:55:46.000000000 +0200
@@ -161,7 +161,12 @@ typedef struct
 
 /* Set the stack guard field in TCB head.  */
 #define THREAD_SET_STACK_GUARD(value) \
-  THREAD_SETMEM (THREAD_SELF, header.stack_guard, value)
+  do 									      \
+   {									      \
+     __asm __volatile ("" : : : "a0", "a1");				      \
+     THREAD_SETMEM (THREAD_SELF, header.stack_guard, value);		      \
+   }									      \
+  while (0)
 #define THREAD_COPY_STACK_GUARD(descr) \
   ((descr)->header.stack_guard						      \
    = THREAD_GETMEM (THREAD_SELF, header.stack_guard))


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390: tls pointer extraction in __libc_start_main
  2008-10-06 18:17 [PATCH] s390: tls pointer extraction in __libc_start_main Martin Schwidefsky
@ 2008-10-22 21:45 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2008-10-22 21:45 UTC (permalink / raw)
  To: schwidefsky; +Cc: Glibc hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Applied.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkj/nu4ACgkQ2ijCOnn/RHTrrgCgrJ0dzo5Kbwc2Z6CMwHhHxrSC
MBsAnA3kp4CWRCp8uDtSHWXDB6JgcJUM
=/4dS
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-22 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-06 18:17 [PATCH] s390: tls pointer extraction in __libc_start_main Martin Schwidefsky
2008-10-22 21:45 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).