diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-06-27 09:15:54 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-06-27 09:15:54 +0000 |
commit | 5570fbd25a574d54ab135e1d3cdac0bc74029689 (patch) | |
tree | 6af711ed17dd644491e68d1a85c22e51bac87179 /sysdeps | |
parent | e4edec582dc1fb924a2cfbfb07409fd7b3c84a26 (diff) | |
download | glibc-5570fbd25a574d54ab135e1d3cdac0bc74029689.zip glibc-5570fbd25a574d54ab135e1d3cdac0bc74029689.tar.gz glibc-5570fbd25a574d54ab135e1d3cdac0bc74029689.tar.bz2 |
Updated to fedora-glibc-20050627T0850
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/dl-osinfo.h | 13 | ||||
-rw-r--r-- | sysdeps/generic/libc-start.c | 15 | ||||
-rw-r--r-- | sysdeps/generic/libc-tls.c | 11 | ||||
-rw-r--r-- | sysdeps/ia64/strlen.S | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/bits/resource.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/resource.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/dl-osinfo.h | 22 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/bits/resource.h | 2 |
8 files changed, 55 insertions, 18 deletions
diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h index b8e40d5..60b84a9 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 f0d69b4..3fcadcf 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 0cf884c..bfb6de0 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. diff --git a/sysdeps/ia64/strlen.S b/sysdeps/ia64/strlen.S index a05b054..518d86b 100644 --- a/sysdeps/ia64/strlen.S +++ b/sysdeps/ia64/strlen.S @@ -1,6 +1,6 @@ /* Optimized version of the standard strlen() function. This file is part of the GNU C Library. - Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc. Contributed by Dan Pop <Dan.Pop@cern.ch>. The GNU C Library is free software; you can redistribute it and/or @@ -73,7 +73,7 @@ ENTRY(strlen) ld8 val1 = [str], 8;; nop.b 0 nop.b 0 -l2: ld8.s val2 = [str], 8 // don't bomb out here +.l2: ld8.s val2 = [str], 8 // don't bomb out here czx1.r pos0 = val1 ;; cmp.ne p6, p0 = 8, pos0 @@ -81,7 +81,7 @@ l2: ld8.s val2 = [str], 8 // don't bomb out here chk.s val2, .recovery .back: mov val1 = val2 - br.cond.dptk l2 + br.cond.dptk .l2 .foundit: sub tmp = str, origadd // tmp = crt address - orig add len = len, pos0;; diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h index 8bbd301..2163745 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h @@ -98,7 +98,7 @@ enum __rlimit_resource /* Maximum realtime priority allowed for non-priviledged processes. */ __RLIMIT_RTPRIO = 14, -#define RLIMIT_RTPRIO _RLIMIT_RTPRIO +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO __RLIMIT_NLIMITS = 15, __RLIM_NLIMITS = __RLIMIT_NLIMITS diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h index 115739d..526cdaf 100644 --- a/sysdeps/unix/sysv/linux/bits/resource.h +++ b/sysdeps/unix/sysv/linux/bits/resource.h @@ -98,7 +98,7 @@ enum __rlimit_resource /* Maximum realtime priority allowed for non-priviledged processes. */ __RLIMIT_RTPRIO = 14, -#define RLIMIT_RTPRIO _RLIMIT_RTPRIO +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO __RLIMIT_NLIMITS = 15, __RLIM_NLIMITS = __RLIMIT_NLIMITS diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h index 03e1de7..e374023 100644 --- a/sysdeps/unix/sysv/linux/dl-osinfo.h +++ b/sysdeps/unix/sysv/linux/dl-osinfo.h @@ -23,6 +23,7 @@ #include <sys/utsname.h> #include "kernel-features.h" #include <dl-sysdep.h> +#include <stdint.h> #ifndef MIN # define MIN(a,b) (((a)<(b))?(a):(b)) @@ -157,3 +158,24 @@ _dl_discover_osversion (void) else if (__LINUX_KERNEL_VERSION > 0) \ FATAL ("FATAL: cannot determine kernel version\n"); \ } while (0) + +static inline uintptr_t __attribute__ ((always_inline)) +_dl_setup_stack_chk_guard (void) +{ + uintptr_t ret; +#ifdef ENABLE_STACKGUARD_RANDOMIZE + int fd = __open ("/dev/urandom", O_RDONLY); + if (fd >= 0) + { + ssize_t reslen = __read (fd, &ret, sizeof (ret)); + __close (fd); + if (reslen == (ssize_t) sizeof (ret)) + return ret; + } +#endif + ret = 0; + unsigned char *p = (unsigned char *) &ret; + p[sizeof (ret) - 1] = 255; + p[sizeof (ret) - 2] = '\n'; + return ret; +} diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h index 8e7b64f..3f2c600 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h @@ -98,7 +98,7 @@ enum __rlimit_resource /* Maximum realtime priority allowed for non-priviledged processes. */ __RLIMIT_RTPRIO = 14, -#define RLIMIT_RTPRIO _RLIMIT_RTPRIO +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO __RLIMIT_NLIMITS = 15, __RLIM_NLIMITS = __RLIMIT_NLIMITS |