diff options
-rw-r--r-- | ChangeLog | 105 | ||||
-rwxr-xr-x | debug/xtrace.sh | 2 | ||||
-rw-r--r-- | elf/tst-audit4.c | 22 | ||||
-rw-r--r-- | elf/tst-audit6.c | 22 | ||||
-rwxr-xr-x | malloc/memusage.sh | 2 | ||||
-rw-r--r-- | nptl/ChangeLog | 10 | ||||
-rw-r--r-- | nptl/nptl-init.c | 22 | ||||
-rw-r--r-- | nptl/pthreadP.h | 13 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/pthread-functions.h | 3 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/fork.c | 33 | ||||
-rw-r--r-- | nscd/nscd.c | 2 | ||||
-rw-r--r-- | posix/getopt.c | 9 | ||||
-rw-r--r-- | posix/glob.c | 42 | ||||
-rw-r--r-- | resolv/res_init.c | 2 | ||||
-rw-r--r-- | resolv/res_query.c | 2 | ||||
-rw-r--r-- | stdlib/strtod_l.c | 4 | ||||
-rw-r--r-- | stdlib/tst-strtod.c | 3 | ||||
-rw-r--r-- | string/strxfrm_l.c | 5 | ||||
-rw-r--r-- | sysdeps/i386/i486/bits/string.h | 16 | ||||
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/internal_statvfs.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/linux_fsinfo.h | 7 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/pathconf.c | 4 | ||||
-rw-r--r-- | sysdeps/x86_64/bits/link.h | 7 | ||||
-rw-r--r-- | sysdeps/x86_64/dl-trampoline.S | 36 |
25 files changed, 321 insertions, 66 deletions
diff --git a/ChangeLog b/ChangeLog index 1b239ac2d8..64e0fb6739 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,108 @@ +2011-07-22 Andreas Schwab <schwab@redhat.com> + + * resolv/res_init.c (__res_vinit): Properly tokenize nameserver + line. + +2011-07-26 Andreas Schwab <schwab@redhat.com> + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Don't discard result of + encoding to ACE if AI_IDN. + +2011-07-25 Andreas Schwab <schwab@redhat.com> + + * sysdeps/i386/i486/bits/string.h (__strncat_g): Correctly handle + __n bigger than INT_MAX+1. + (__strncmp_g): Likewise. + +2011-07-23 Ulrich Drepper <drepper@gmail.com> + + * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix one more + typo. + (_dl_x86_64_save_sse): Likewise. + +2011-07-22 Ulrich Drepper <drepper@gmail.com> + + * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix test for + OSXSAVE. + (_dl_x86_64_save_sse): Likewise. + +2011-07-21 Andreas Schwab <schwab@redhat.com> + + * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix last + change. + (_dl_x86_64_save_sse): Use correct AVX check. + +2011-07-20 Ulrich Drepper <drepper@gmail.com> + + [BZ #13007] + * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): More complete + check for AVX enablement so that we don't crash with old kernels and + new hardware. + * elf/tst-audit4.c: Add same checks here. + * elf/tst-audit6.c: Likewise. + +2011-07-20 Ulrich Drepper <drepper@gmail.com> + + [BZ #12852] + * posix/glob.c (glob): Check passed in values before using them in + expressions to avoid some overflows. + (glob_in_dir): Likewise. + +2011-07-20 Ulrich Drepper <drepper@gmail.com> + + * sysdeps/x86_64/bits/link.h (La_x86_64_ymm): Force 16-byte alignment. + +2011-07-20 Andreas Schwab <schwab@redhat.com> + + * resolv/res_query.c (__libc_res_nquerydomain): Use size_t for + strlen results. + +2011-07-19 Andreas Schwab <schwab@redhat.com> + + * string/strxfrm_l.c (STRXFRM): Fix alloca accounting. + +2011-07-19 Ulrich Drepper <drepper@gmail.com> + + * nscd/nscd.c (termination_handler): Don't do anything for a database + if it has not yet been initialized. + +2011-07-05 Andreas Jaeger <aj@suse.de> + + [BZ#9696] + * stdlib/tst-strtod.c: Add testcase. + +2011-07-07 Ulrich Drepper <drepper@gmail.com> + + [BZ #12868] + * sysdeps/unix/sysv/linux/linux_fsinfo.h: Define Lustre constants. + * sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags): + Handle Lustre. + * sysdeps/unix/sysv/linux/pathconf.c (__statfs_link_max): Likewise. + (__statfs_filesize_max): Likewise. + Patch mostly by Andreas Dilger <adilger@whamcloud.com>. + +2011-07-06 Ulrich Drepper <drepper@gmail.com> + + [BZ #12922] + * posix/getopt.c (_getopt_internal_r): When "W;" is in short options + but no long options are defined, just return 'W'. + +2011-06-22 Marek Polacek <mpolacek@redhat.com> + + [BZ #9696] + * stdlib/strtod_l.c (round_and_return): Set ERANGE instead of EDOM. + +2011-06-30 Andreas Schwab <schwab@redhat.com> + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Make sure RES_USE_INET6 + is always restored. + +2011-06-28 Ulrich Drepper <drepper@gmail.com> + + [BZ #12935] + * malloc/memusage.sh: Fix quoting in message. + * debug/xtrace.sh: Likewise. + 2011-06-28 Andreas Schwab <schwab@redhat.com> * iconvdata/gb18030.c: Update tables. diff --git a/debug/xtrace.sh b/debug/xtrace.sh index 5cb193ab5a..acaf77a06e 100755 --- a/debug/xtrace.sh +++ b/debug/xtrace.sh @@ -30,7 +30,7 @@ do_usage() { # Refer to --help option. help_info() { - printf >&2 $"Try \`%s --help' or `%s --usage' for more information.\n" xtrace xtrace + printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" xtrace xtrace exit 1 } diff --git a/elf/tst-audit4.c b/elf/tst-audit4.c index b17d4a61a7..c4f1d5bdb9 100644 --- a/elf/tst-audit4.c +++ b/elf/tst-audit4.c @@ -6,16 +6,30 @@ #include <cpuid.h> #include <immintrin.h> + +static int +avx_enabled (void) +{ + unsigned int eax, ebx, ecx, edx; + + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0 + || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE)) + return 0; + + /* Check the OS has AVX and SSE saving enabled. */ + asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); + + return (eax & 6) == 6; +} + + extern __m256i audit_test (__m256i, __m256i, __m256i, __m256i, __m256i, __m256i, __m256i, __m256i); int main (void) { - unsigned int eax, ebx, ecx, edx; - /* Run AVX test only if AVX is supported. */ - if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) - && (ecx & bit_AVX)) + if (avx_enabled ()) { __m256i ymm = _mm256_setzero_si256 (); __m256i ret = audit_test (ymm, ymm, ymm, ymm, ymm, ymm, ymm, ymm); diff --git a/elf/tst-audit6.c b/elf/tst-audit6.c index 1f6dcb16e9..64209a152e 100644 --- a/elf/tst-audit6.c +++ b/elf/tst-audit6.c @@ -8,14 +8,28 @@ extern __m128i audit_test (__m128i, __m128i, __m128i, __m128i, __m128i, __m128i, __m128i, __m128i); -int -main (void) + +static int +avx_enabled (void) { unsigned int eax, ebx, ecx, edx; + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0 + || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE)) + return 0; + + /* Check the OS has AVX and SSE saving enabled. */ + asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); + + return (eax & 6) == 6; +} + + +int +main (void) +{ /* Run AVX test only if AVX is supported. */ - if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) - && (ecx & bit_AVX)) + if (avx_enabled ()) { __m128i xmm = _mm_setzero_si128 (); __m128i ret = audit_test (xmm, xmm, xmm, xmm, xmm, xmm, xmm, xmm); diff --git a/malloc/memusage.sh b/malloc/memusage.sh index f1ccbb4d19..75d5f3ba39 100755 --- a/malloc/memusage.sh +++ b/malloc/memusage.sh @@ -24,7 +24,7 @@ TEXTDOMAIN=libc # Print usage message. do_usage() { - printf >&2 $"Try \`%s --help' or `%s --usage' for more information.\n" memusage memusage + printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" memusage memusage exit 1 } diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 59c6945ab3..0b94d0bf58 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,13 @@ +2011-06-30 Ulrich Drepper <drepper@gmail.com> + + * nptl-init.c (__nptl_set_robust): New function. + (pthread_functions): Add reference. + * npthreadP.h: Declare __nptl_set_robust. + * sysdeps/pthread/pthread-functions.h (pthread_functions): Add + ptr_set_robust member. + * sysdeps/unix/sysv/linux/fork.c: Call set_robust_list syscall in + child if threads are used. + 2011-06-14 Andreas Jaeger <aj@suse.de> * pthread_rwlock_init.c: Include <string.h> for memset declaration. diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c index c663f21ba6..25b32e9f41 100644 --- a/nptl/nptl-init.c +++ b/nptl/nptl-init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2007, 2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2002-2007, 2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -68,6 +68,13 @@ extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign); #endif #ifdef SHARED +static +#else +extern +#endif +void __nptl_set_robust (struct pthread *); + +#ifdef SHARED static void nptl_freeres (void); @@ -130,7 +137,8 @@ static const struct pthread_functions pthread_functions = .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd, .ptr__nptl_setxid = __nptl_setxid, /* For now only the stack cache needs to be freed. */ - .ptr_freeres = nptl_freeres + .ptr_freeres = nptl_freeres, + .ptr_set_robust = __nptl_set_robust }; # define ptr_pthread_functions &pthread_functions #else @@ -147,7 +155,17 @@ nptl_freeres (void) __unwind_freeres (); __free_stacks (0); } + + +static #endif +void +__nptl_set_robust (struct pthread *self) +{ + INTERNAL_SYSCALL_DECL (err); + INTERNAL_SYSCALL (set_robust_list, err, 2, &self->robust_head, + sizeof (struct robust_list_head)); +} /* For asynchronous cancellation we use a signal. This is the handler. */ diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 43ca44c829..df4f4d769b 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2002-2007, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -555,17 +555,20 @@ extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffe /* Old cleanup interfaces, still used in libc.so. */ extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, - void (*routine) (void *), void *arg); + void (*routine) (void *), void *arg); extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, - int execute); + int execute); extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, - void (*routine) (void *), void *arg); + void (*routine) (void *), void *arg); extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, - int execute); + int execute); extern void __nptl_deallocate_tsd (void) attribute_hidden; extern int __nptl_setxid (struct xid_command *cmdp) attribute_hidden; +#ifndef SHARED +extern void __nptl_set_robust (struct pthread *self); +#endif extern void __free_stacks (size_t limit) attribute_hidden; diff --git a/nptl/sysdeps/pthread/pthread-functions.h b/nptl/sysdeps/pthread/pthread-functions.h index 0c404fcbb3..15a4dff142 100644 --- a/nptl/sysdeps/pthread/pthread-functions.h +++ b/nptl/sysdeps/pthread/pthread-functions.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -97,6 +97,7 @@ struct pthread_functions void (*ptr__nptl_deallocate_tsd) (void); int (*ptr__nptl_setxid) (struct xid_command *); void (*ptr_freeres) (void); + void (*ptr_set_robust) (struct pthread *); }; /* Variable in libc.so. */ diff --git a/nptl/sysdeps/unix/sysv/linux/fork.c b/nptl/sysdeps/unix/sysv/linux/fork.c index 524d72c587..80fb147788 100644 --- a/nptl/sysdeps/unix/sysv/linux/fork.c +++ b/nptl/sysdeps/unix/sysv/linux/fork.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2007, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -29,6 +29,7 @@ #include <ldsodefs.h> #include <bits/stdio-lock.h> #include <atomic.h> +#include <pthreadP.h> unsigned long int *__fork_generation_pointer; @@ -86,8 +87,8 @@ __libc_fork (void) just go away. The unloading code works in the order of the list. - While executing the registered handlers we are building a - list of all the entries so that we can go backward later on. */ + While executing the registered handlers we are building a + list of all the entries so that we can go backward later on. */ while (1) { /* Execute the handler if there is one. */ @@ -154,6 +155,24 @@ __libc_fork (void) GL(dl_cpuclock_offset) = now; #endif +#ifdef __NR_set_robust_list + /* Initialize the robust mutex list which has been reset during + the fork. We do not check for errors since if it fails here + it failed at process start as well and noone could have used + robust mutexes. We also do not have to set + self->robust_head.futex_offset since we inherit the correct + value from the parent. */ +# ifdef SHARED + if (__builtin_expect (__libc_pthread_functions_init, 0)) + PTHFCT_CALL (ptr_set_robust, (self)); +# else + extern __typeof (__nptl_set_robust) __nptl_set_robust + __attribute__((weak)); + if (__builtin_expect (__nptl_set_robust != NULL, 0)) + __nptl_set_robust (self); +# endif +#endif + /* Reset the file list. These are recursive mutexes. */ fresetlockfiles (); @@ -170,10 +189,10 @@ __libc_fork (void) allp->handler->child_handler (); /* Note that we do not have to wake any possible waiter. - This is the only thread in the new process. The count - may have been bumped up by other threads doing a fork. - We reset it to 1, to avoid waiting for non-existing - thread(s) to release the count. */ + This is the only thread in the new process. The count + may have been bumped up by other threads doing a fork. + We reset it to 1, to avoid waiting for non-existing + thread(s) to release the count. */ allp->handler->refcntr = 1; /* XXX We could at this point look through the object pool diff --git a/nscd/nscd.c b/nscd/nscd.c index c3d9fe6cef..f50e81423f 100644 --- a/nscd/nscd.c +++ b/nscd/nscd.c @@ -477,7 +477,7 @@ termination_handler (int signum) /* Synchronize memory. */ for (int cnt = 0; cnt < lastdb; ++cnt) { - if (!dbs[cnt].enabled) + if (!dbs[cnt].enabled || dbs[cnt].head == NULL) continue; /* Make sure nobody keeps using the database. */ diff --git a/posix/getopt.c b/posix/getopt.c index db89abf6a7..3fa5a4d6d1 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -871,6 +871,9 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { + if (longopts == NULL) + goto no_longs; + char *nameend; const struct option *p; const struct option *pfound = NULL; @@ -1086,8 +1089,10 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, } return pfound->val; } - d->__nextchar = NULL; - return 'W'; /* Let the application handle it. */ + + no_longs: + d->__nextchar = NULL; + return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { diff --git a/posix/glob.c b/posix/glob.c index 2cd52904d5..89c8775109 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -46,6 +46,12 @@ #include <pwd.h> +#if defined HAVE_STDINT_H || defined _LIBC +# include <stdint.h> +#elif !defined UINTPTR_MAX +# define UINTPTR_MAX (~((size_t) 0)) +#endif + #include <errno.h> #ifndef __set_errno # define __set_errno(val) errno = (val) @@ -436,6 +442,10 @@ glob (pattern, flags, errfunc, pglob) else { size_t i; + + if (pglob->gl_offs >= ~((size_t) 0) / sizeof (char *)) + return GLOB_NOSPACE; + pglob->gl_pathv = (char **) malloc ((pglob->gl_offs + 1) * sizeof (char *)); if (pglob->gl_pathv == NULL) @@ -954,10 +964,8 @@ glob (pattern, flags, errfunc, pglob) int newcount = pglob->gl_pathc + pglob->gl_offs; char **new_gl_pathv; - new_gl_pathv - = (char **) realloc (pglob->gl_pathv, - (newcount + 1 + 1) * sizeof (char *)); - if (new_gl_pathv == NULL) + if (newcount > UINTPTR_MAX - (1 + 1) + || newcount + 1 + 1 > ~((size_t) 0) / sizeof (char *)) { nospace: free (pglob->gl_pathv); @@ -965,6 +973,12 @@ glob (pattern, flags, errfunc, pglob) pglob->gl_pathc = 0; return GLOB_NOSPACE; } + + new_gl_pathv + = (char **) realloc (pglob->gl_pathv, + (newcount + 1 + 1) * sizeof (char *)); + if (new_gl_pathv == NULL) + goto nospace; pglob->gl_pathv = new_gl_pathv; if (flags & GLOB_MARK) @@ -1104,14 +1118,19 @@ glob (pattern, flags, errfunc, pglob) int newcount = pglob->gl_pathc + pglob->gl_offs; char **new_gl_pathv; - new_gl_pathv = (char **) realloc (pglob->gl_pathv, - (newcount + 2) - * sizeof (char *)); - if (new_gl_pathv == NULL) + if (newcount > UINTPTR_MAX - 2 + || newcount + 2 > ~((size_t) 0) / sizeof (char *)) { + nospace2: globfree (&dirs); return GLOB_NOSPACE; } + + new_gl_pathv = (char **) realloc (pglob->gl_pathv, + (newcount + 2) + * sizeof (char *)); + if (new_gl_pathv == NULL) + goto nospace2; pglob->gl_pathv = new_gl_pathv; pglob->gl_pathv[newcount] = __strdup (pattern); @@ -1636,6 +1655,13 @@ glob_in_dir (const char *pattern, const char *directory, int flags, { result = 0; + if (pglob->gl_pathc > UINTPTR_MAX - pglob->gl_offs + || pglob->gl_pathc + pglob->gl_offs > UINTPTR_MAX - nfound + || pglob->gl_pathc + pglob->gl_offs + nfound > UINTPTR_MAX - 1 + || (pglob->gl_pathc + pglob->gl_offs + nfound + 1 + > UINTPTR_MAX / sizeof (char *))) + goto memory_error; + char **new_gl_pathv; new_gl_pathv = (char **) realloc (pglob->gl_pathv, diff --git a/resolv/res_init.c b/resolv/res_init.c index 64934b0e5f..73caaa4c5e 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -318,7 +318,7 @@ __res_vinit(res_state statp, int preinit) { struct in6_addr a6; char *el; - if ((el = strchr(cp, '\n')) != NULL) + if ((el = strpbrk(cp, " \t\n")) != NULL) *el = '\0'; if ((el = strchr(cp, SCOPE_DELIMITER)) != NULL) *el = '\0'; diff --git a/resolv/res_query.c b/resolv/res_query.c index 26daf0d87b..2f7cfaa4b7 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -543,7 +543,7 @@ __libc_res_nquerydomain(res_state statp, { char nbuf[MAXDNAME]; const char *longname = nbuf; - int n, d; + size_t n, d; #ifdef DEBUG if (statp->options & RES_DEBUG) diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 537d1fbc61..b3380fdba3 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -1,5 +1,5 @@ /* Convert string representing a number to float value, using given locale. - Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008,2009,2010 + Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -185,7 +185,7 @@ round_and_return (mp_limb_t *retval, int exponent, int negative, if (shift > MANT_DIG) { - __set_errno (EDOM); + __set_errno (ERANGE); return 0.0; } diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c index c30eb1ee12..1cb9a5cb0e 100644 --- a/stdlib/tst-strtod.c +++ b/stdlib/tst-strtod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1996-2001,2003,2009 Free Software Foundation, Inc. +/* Copyright (C) 1991,1996-2001,2003,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -72,6 +72,7 @@ static const struct ltest tests[] = { "+InFiNiTy", HUGE_VAL, '\0', 0 }, #endif { "0x80000Ap-23", 0x80000Ap-23, '\0', 0 }, + { "1e-324", 0, '\0', ERANGE }, { NULL, 0, '\0', 0 } }; diff --git a/string/strxfrm_l.c b/string/strxfrm_l.c index 351b426541..220253c4d6 100644 --- a/string/strxfrm_l.c +++ b/string/strxfrm_l.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1995-1997,2002,2004-2006,2010 Free Software Foundation, Inc. +/* Copyright (C) 1995-1997,2002,2004-2006,2010,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper <drepper@gnu.org>, 1995. @@ -150,7 +151,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l) values. But since there is no limit on the length of the string we have to use `malloc' if the string is too long. We should be very conservative here. */ - if (! __libc_use_alloca (srclen)) + if (! __libc_use_alloca ((srclen + 1) * (sizeof (int32_t) + 1))) { idxarr = (int32_t *) malloc ((srclen + 1) * (sizeof (int32_t) + 1)); rulearr = (unsigned char *) &idxarr[srclen]; diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h index 9f05c7e655..4f8c104fee 100644 --- a/sysdeps/i386/i486/bits/string.h +++ b/sysdeps/i386/i486/bits/string.h @@ -1,6 +1,6 @@ /* Optimized, inlined string functions. i486 version. - Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004,2007 - Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004,2007,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -1058,8 +1058,8 @@ __strncat_g (char *__dest, __const char __src[], size_t __n) "movl %4, %3\n\t" "decl %1\n\t" "1:\n\t" - "decl %3\n\t" - "js 2f\n\t" + "subl $1,%3\n\t" + "jc 2f\n\t" "movb (%2),%b0\n\t" "movsb\n\t" "testb %b0,%b0\n\t" @@ -1078,8 +1078,8 @@ __strncat_g (char *__dest, __const char __src[], size_t __n) "leal 1(%1),%1\n\t" "jne 1b\n" "2:\n\t" - "decl %3\n\t" - "js 3f\n\t" + "subl $1,%3\n\t" + "jc 3f\n\t" "movb (%2),%b0\n\t" "leal 1(%2),%2\n\t" "movb %b0,(%1)\n\t" @@ -1219,8 +1219,8 @@ __strncmp_g (__const char *__s1, __const char *__s2, size_t __n) register int __res; __asm__ __volatile__ ("1:\n\t" - "decl %3\n\t" - "js 2f\n\t" + "subl $1,%3\n\t" + "jc 2f\n\t" "movb (%1),%b0\n\t" "incl %1\n\t" "cmpb %b0,(%2)\n\t" diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 7e52918de0..ce50eee786 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -432,7 +432,10 @@ gaih_inet (const char *name, const struct gaih_service *service, /* In case the output string is the same as the input string no new string has been allocated. */ if (p != name) - malloc_name = true; + { + name = p; + malloc_name = true; + } } #endif @@ -828,6 +831,7 @@ gaih_inet (const char *name, const struct gaih_service *service, tmpbuf = malloc (tmpbuflen); if (tmpbuf == NULL) { + _res.options |= old_res_options & RES_USE_INET6; result = -EAI_MEMORY; goto free_and_return; } @@ -872,6 +876,7 @@ gaih_inet (const char *name, const struct gaih_service *service, 2 * tmpbuflen); if (newp == NULL) { + _res.options |= old_res_options & RES_USE_INET6; result = -EAI_MEMORY; goto free_and_return; } @@ -991,6 +996,8 @@ gaih_inet (const char *name, const struct gaih_service *service, canonbuf = malloc (max_fqdn_len); if (canonbuf == NULL) { + _res.options + |= old_res_options & RES_USE_INET6; result = -EAI_MEMORY; goto free_and_return; } diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c b/sysdeps/unix/sysv/linux/internal_statvfs.c index 828854806c..2ddec1edba 100644 --- a/sysdeps/unix/sysv/linux/internal_statvfs.c +++ b/sysdeps/unix/sysv/linux/internal_statvfs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2006, 2010 Free Software Foundation, Inc. +/* Copyright (C) 1998-2006, 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -115,6 +115,9 @@ __statvfs_getflags (const char *name, int fstype, struct stat64 *st) case CGROUP_SUPER_MAGIC: fsname = "cgroup"; break; + case LUSTRE_SUPER_MAGIC: + fsname = "lustre"; + break; } FILE *mtab = __setmntent ("/proc/mounts", "r"); diff --git a/sysdeps/unix/sysv/linux/linux_fsinfo.h b/sysdeps/unix/sysv/linux/linux_fsinfo.h index a0e070071d..55bc6e380a 100644 --- a/sysdeps/unix/sysv/linux/linux_fsinfo.h +++ b/sysdeps/unix/sysv/linux/linux_fsinfo.h @@ -1,5 +1,5 @@ /* Constants from kernel header for various FSes. - Copyright (C) 1998-2003,2005,2010 Free Software Foundation, Inc. + Copyright (C) 1998-2003,2005,2010,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -83,6 +83,9 @@ /* Constant that identifies the `logfs' filesystem. */ #define LOGFS_MAGIC_U32 0xc97e8168u +/* Constant that identifies the `lustre' filesystem. */ +#define LUSTRE_SUPER_MAGIC 0x0BD00BD0 + /* Constants that identify the `minix2' filesystem. */ #define MINIX2_SUPER_MAGIC 0x2468 #define MINIX2_SUPER_MAGIC2 0x2478 @@ -150,6 +153,8 @@ /* Maximum link counts. */ #define COH_LINK_MAX 10000 #define EXT2_LINK_MAX 32000 +#define EXT4_LINK_MAX 65000 +#define LUSTRE_LINK_MAX EXT4_LINK_MAX #define MINIX2_LINK_MAX 65530 #define MINIX_LINK_MAX 250 #define REISERFS_LINK_MAX 64535 diff --git a/sysdeps/unix/sysv/linux/pathconf.c b/sysdeps/unix/sysv/linux/pathconf.c index 52610a14d8..42b7b80c39 100644 --- a/sysdeps/unix/sysv/linux/pathconf.c +++ b/sysdeps/unix/sysv/linux/pathconf.c @@ -121,6 +121,9 @@ __statfs_link_max (int result, const struct statfs *fsbuf) case XFS_SUPER_MAGIC: return XFS_LINK_MAX; + case LUSTRE_SUPER_MAGIC: + return LUSTRE_LINK_MAX; + default: return LINUX_LINK_MAX; } @@ -157,6 +160,7 @@ __statfs_filesize_max (int result, const struct statfs *fsbuf) case JFS_SUPER_MAGIC: case VXFS_SUPER_MAGIC: case CGROUP_SUPER_MAGIC: + case LUSTRE_SUPER_MAGIC: return 64; case MSDOS_SUPER_MAGIC: diff --git a/sysdeps/x86_64/bits/link.h b/sysdeps/x86_64/bits/link.h index 643a293bb0..14cc92b145 100644 --- a/sysdeps/x86_64/bits/link.h +++ b/sysdeps/x86_64/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -65,7 +65,8 @@ __END_DECLS /* Registers for entry into PLT on x86-64. */ # if __GNUC_PREREQ (4,0) typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16))); -typedef float La_x86_64_ymm __attribute__ ((__vector_size__ (32))); +typedef float La_x86_64_ymm + __attribute__ ((__vector_size__ (32), __aligned__ (16))); # else typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__))); # endif @@ -76,7 +77,7 @@ typedef union La_x86_64_ymm ymm[2]; # endif La_x86_64_xmm xmm[4]; -} La_x86_64_vector __attribute__ ((aligned(16))); +} La_x86_64_vector __attribute__ ((__aligned__ (16))); typedef struct La_x86_64_regs { diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S index 5564a11af2..45a2dc20c8 100644 --- a/sysdeps/x86_64/dl-trampoline.S +++ b/sysdeps/x86_64/dl-trampoline.S @@ -1,5 +1,5 @@ /* PLT trampolines. x86-64 version. - Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -139,11 +139,20 @@ L(have_avx): movl $1, %eax cpuid movq %r11,%rbx # Restore rbx - movl $1, %eax - testl $(1 << 28), %ecx + xorl %eax, %eax + // AVX and XSAVE supported? + andl $((1 << 28) | (1 << 27)), %ecx + cmpl $((1 << 28) | (1 << 27)), %ecx jne 2f - negl %eax -2: movl %eax, L(have_avx)(%rip) + xorl %ecx, %ecx + // Get XFEATURE_ENABLED_MASK + xgetbv + andl $0x6, %eax + cmpl $0x6, %eax + // Nonzero if SSE and AVX state saving is enabled. + sete %al +2: leal -1(%eax,%eax), %eax + movl %eax, L(have_avx)(%rip) cmpl $0, %eax 1: js L(no_avx) @@ -176,11 +185,20 @@ _dl_x86_64_save_sse: movl $1, %eax cpuid movq %r11,%rbx # Restore rbx - movl $1, %eax - testl $(1 << 28), %ecx + xorl %eax, %eax + // AVX and XSAVE supported? + andl $((1 << 28) | (1 << 27)), %ecx + cmpl $((1 << 28) | (1 << 27)), %ecx jne 2f - negl %eax -2: movl %eax, L(have_avx)(%rip) + xorl %ecx, %ecx + // Get XFEATURE_ENABLED_MASK + xgetbv + andl $0x6, %eax + cmpl $0x6, %eax + // Nonzero if SSE and AVX state saving is enabled. + sete %al +2: leal -1(%eax,%eax), %eax + movl %eax, L(have_avx)(%rip) cmpl $0, %eax 1: js L(no_avx5) |