summaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-27 09:15:54 +0000
committerJakub Jelinek <jakub@redhat.com>2005-06-27 09:15:54 +0000
commit5570fbd25a574d54ab135e1d3cdac0bc74029689 (patch)
tree6af711ed17dd644491e68d1a85c22e51bac87179 /sysdeps/generic
parente4edec582dc1fb924a2cfbfb07409fd7b3c84a26 (diff)
Updated to fedora-glibc-20050627T0850
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/dl-osinfo.h13
-rw-r--r--sysdeps/generic/libc-start.c15
-rw-r--r--sysdeps/generic/libc-tls.c11
3 files changed, 27 insertions, 12 deletions
diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h
index b8e40d5a76..60b84a900d 100644
--- a/sysdeps/generic/dl-osinfo.h
+++ b/sysdeps/generic/dl-osinfo.h
@@ -1 +1,12 @@
-/* Nothing needed in general. */
+#include <stdint.h>
+
+static inline uintptr_t __attribute__ ((always_inline))
+_dl_setup_stack_chk_guard (void)
+{
+ uintptr_t ret = 0;
+ unsigned char *p = (unsigned char *) &ret;
+ p[sizeof (ret) - 1] = 255;
+ p[sizeof (ret) - 2] = '\n';
+ p[0] = 0;
+ return ret;
+}
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
index f0d69b443b..3fcadcf19f 100644
--- a/sysdeps/generic/libc-start.c
+++ b/sysdeps/generic/libc-start.c
@@ -35,6 +35,11 @@ extern void __pthread_initialize_minimal (void)
__attribute__ ((weak))
# endif
;
+# ifndef THREAD_SET_STACK_GUARD
+/* Only exported for architectures that don't store the stack guard canary
+ in thread local area. */
+uintptr_t __stack_chk_guard attribute_relro;
+# endif
#endif
#ifdef HAVE_PTR_NTHREADS
@@ -152,6 +157,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
__pthread_initialize_minimal ();
#endif
+# ifndef SHARED
+ /* Set up the stack checker's canary. */
+ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
+# ifdef THREAD_SET_STACK_GUARD
+ THREAD_SET_STACK_GUARD (stack_chk_guard);
+# else
+ __stack_chk_guard = stack_chk_guard;
+# endif
+#endif
+
/* Register the destructor of the dynamic linker if there is any. */
if (__builtin_expect (rtld_fini != NULL, 1))
__cxa_atexit ((void (*) (void *)) rtld_fini, NULL, NULL);
diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c
index 0cf884ca08..bfb6de0f73 100644
--- a/sysdeps/generic/libc-tls.c
+++ b/sysdeps/generic/libc-tls.c
@@ -133,17 +133,6 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
break;
}
-#ifdef TLS_INIT_TP_EXPENSIVE
- if (memsz == 0 && tcbsize <= TLS_INIT_TCB_SIZE)
- {
- /* We do not need a TLS block and no thread descriptor. */
-# ifdef NONTLS_INIT_TP
- NONTLS_INIT_TP;
-# endif
- return;
- }
-#endif
-
/* We have to set up the TCB block which also (possibly) contains
'errno'. Therefore we avoid 'malloc' which might touch 'errno'.
Instead we use 'sbrk' which would only uses 'errno' if it fails.