[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r14011 - in /fsf/glibc-2_11-branch/libc: ./ conform/data/ elf/ iconv/ include/ inet/ libio/ login/programs/ math/ misc/ nptl...
- To: commits@xxxxxxxxxx
- Subject: [commits] r14011 - in /fsf/glibc-2_11-branch/libc: ./ conform/data/ elf/ iconv/ include/ inet/ libio/ login/programs/ math/ misc/ nptl...
- From: eglibc@xxxxxxxxxx
- Date: Fri, 27 May 2011 16:43:09 -0000
Author: eglibc
Date: Fri May 27 09:43:06 2011
New Revision: 14011
Log:
Import glibc-2.11 for 2011-05-27
Added:
fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c (with props)
fsf/glibc-2_11-branch/libc/math/test-powl.c
fsf/glibc-2_11-branch/libc/stdio-common/bug23.c
fsf/glibc-2_11-branch/libc/stdlib/bug-getcontext.c
fsf/glibc-2_11-branch/libc/sysdeps/mach/hurd/ifreq.h
fsf/glibc-2_11-branch/libc/sysdeps/powerpc/powerpc64/power7/Makefile (with props)
fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/Makefile (with props)
fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/tst-writev.c
Modified:
fsf/glibc-2_11-branch/libc/ChangeLog
fsf/glibc-2_11-branch/libc/conform/data/netdb.h-data
fsf/glibc-2_11-branch/libc/elf/Makefile
fsf/glibc-2_11-branch/libc/elf/dl-close.c
fsf/glibc-2_11-branch/libc/elf/dl-deps.c
fsf/glibc-2_11-branch/libc/elf/dl-load.c
fsf/glibc-2_11-branch/libc/elf/dl-lookup.c
fsf/glibc-2_11-branch/libc/elf/dl-tls.c
fsf/glibc-2_11-branch/libc/elf/ldconfig.c
fsf/glibc-2_11-branch/libc/elf/noload.c
fsf/glibc-2_11-branch/libc/iconv/loop.c
fsf/glibc-2_11-branch/libc/include/link.h
fsf/glibc-2_11-branch/libc/inet/getnameinfo.c
fsf/glibc-2_11-branch/libc/libio/Makefile
fsf/glibc-2_11-branch/libc/libio/fileops.c
fsf/glibc-2_11-branch/libc/libio/fmemopen.c
fsf/glibc-2_11-branch/libc/login/programs/pt_chown.c
fsf/glibc-2_11-branch/libc/math/Makefile
fsf/glibc-2_11-branch/libc/misc/error.c
fsf/glibc-2_11-branch/libc/misc/mntent_r.c
fsf/glibc-2_11-branch/libc/nptl/ChangeLog
fsf/glibc-2_11-branch/libc/nptl/allocatestack.c
fsf/glibc-2_11-branch/libc/posix/fnmatch.c
fsf/glibc-2_11-branch/libc/resolv/netdb.h
fsf/glibc-2_11-branch/libc/resolv/res_debug.c
fsf/glibc-2_11-branch/libc/resolv/res_init.c
fsf/glibc-2_11-branch/libc/resolv/res_query.c
fsf/glibc-2_11-branch/libc/resolv/resolv.h
fsf/glibc-2_11-branch/libc/stdio-common/Makefile
fsf/glibc-2_11-branch/libc/stdio-common/_i18n_number.h
fsf/glibc-2_11-branch/libc/stdio-common/printf-parsemb.c
fsf/glibc-2_11-branch/libc/stdio-common/vfprintf.c
fsf/glibc-2_11-branch/libc/stdlib/Makefile
fsf/glibc-2_11-branch/libc/sysdeps/i386/dl-tls.h
fsf/glibc-2_11-branch/libc/sysdeps/ia64/dl-tls.h
fsf/glibc-2_11-branch/libc/sysdeps/posix/spawni.c
fsf/glibc-2_11-branch/libc/sysdeps/powerpc/dl-tls.h
fsf/glibc-2_11-branch/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
fsf/glibc-2_11-branch/libc/sysdeps/pthread/aio_misc.c
fsf/glibc-2_11-branch/libc/sysdeps/s390/dl-tls.h
fsf/glibc-2_11-branch/libc/sysdeps/sh/dl-tls.h
fsf/glibc-2_11-branch/libc/sysdeps/sparc/dl-tls.h
fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/Makefile
fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/x86_64/getcontext.S
fsf/glibc-2_11-branch/libc/sysdeps/x86_64/dl-tls.h
fsf/glibc-2_11-branch/libc/sysdeps/x86_64/fpu/e_powl.S
fsf/glibc-2_11-branch/libc/wcsmbs/wchar.h
Modified: fsf/glibc-2_11-branch/libc/ChangeLog
==============================================================================
--- fsf/glibc-2_11-branch/libc/ChangeLog (original)
+++ fsf/glibc-2_11-branch/libc/ChangeLog Fri May 27 09:43:06 2011
@@ -1,3 +1,246 @@
+2011-05-17 H.J. Lu <hongjiu.lu@xxxxxxxxx>
+
+ [BZ #12775]
+ * sysdeps/x86_64/fpu/e_powl.S: Fix a typo.
+ * math/Makefile (tests): Add test-powl.
+ (CFLAGS-test-powl.c): Define.
+ * math/test-powl.c: New file.
+
+2011-05-16 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12766]
+ * misc/error.c (error_at_line): Ensure file_name and old_file_name
+ point to strings before performing equality test for error_one_per_line
+ mode.
+
+ [BZ #11697]
+ * login/programs/pt_chown.c (do_pt_chown): Always call chown.
+
+2011-05-14 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12083]
+ * sysdeps/pthread/aio_misc.c (__aio_init): Compute optim.aio_num
+ correctly.
+
+ * libio/fileops.c (_IO_new_file_close_it): Initialize write_status.
+
+ * iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before
+ storing incomplete byte sequence in state object. Avoid testing for
+ guaranteed too small input if we know there is enough data available.
+
+2011-05-13 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12724]
+ * libio/fileops.c (_IO_new_file_close_it): Always flush when
+ currently writing and seek to current position when not.
+ * libio/Makefile (tests): Add bug-fclose1.
+ * libio/bug-fclose1.c: New file.
+
+2011-05-12 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12511]
+ * elf/dl-lookup.c (enter): Don't test for copy relocation here and
+ don't set DF_1_NODELETE here.
+ (do_lookup_x): When entering new entry test for copy relocation
+ and if necessary set DF_1_NODELETE flag.
+ Patch by Piotr Bury <pbury@xxxxxxxxxxx>.
+
+2011-05-11 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12052]
+ * sysdeps/posix/spawni.c (__spawni): Fix sched_setscheduler call.
+
+ [BZ #12625]
+ * misc/mntent_r.c (addmntent): Flush the stream after the output
+
+ [BZ #12393]
+ * elf/dl-load.c (is_trusted_path): Remove unnecessary test.
+ (is_trusted_path_normalize): Skip initial colon. Append slash
+ to empty buffer. Duplicate is_trusted_path code but allow
+ constructed patch to be prefix.
+ (is_dst): Allow $ORIGIN followed by /.
+ (_dl_dst_substitute): Correct clearing of check_for_trusted.
+ Correct testing of result of is_trusted_path_normalize
+ (decompose_rpath): Fix warning.
+
+2011-05-07 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12734]
+ * resolv/resolv.h: Define RES_NOTLDQUERY.
+ * resolv/res_init.c (res_setoptions): Recognize no_tld_query and
+ no-tld-query and set RES_NOTLDQUERY.
+ * resolv/res_debug.c (p_option): Handle RES_NOTLDQUERY.
+ * resolv/res_query.c (__libc_res_nsearch): Backport changes from
+ modern BIND to search name as TLD unless forbidden.
+
+2011-05-07 Petr Baudis <pasky@xxxxxxx>
+ Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12393]
+ * elf/dl-load.c (fillin_rpath): Move trusted path check...
+ (is_trusted_path): ...to here.
+ (is_norm_trusted_path): Add wrapper for /../ and /./ normalization.
+ (_dl_dst_substitute): Verify expanded $ORIGIN path elements
+ using is_norm_trusted_path() in setuid scripts.
+
+2011-05-03 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * elf/ldconfig.c (add_dir): Don't crash on empty path.
+
+2011-04-30 Bruno Haible <bruno@xxxxxxxxx>
+
+ [BZ #12717]
+ * conform/data/netdb.h-data (getnameinfo): Make POSIX compliant.
+ * resolv/netdb.h (getnameinfo): Change type of flags parameter
+ to 'int'.
+ * inet/getnameinfo.c (getnameinfo): Likewise.
+
+2011-04-22 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12685]
+ * libio/fileops.c (_IO_new_file_fopen): Scan up to 7 bytes of the
+ mode string.
+ Patch by Eric Blake <eblake@xxxxxxxxxx>.
+
+2011-04-17 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12420]
+ * sysdeps/unix/sysv/linux/x86_64/getcontext.S: Reload context after
+ storing it.
+ * stdlib/bug-getcontext.c: New file.
+ * stdlib/Makefile: Add rules to build and run bug-getcontext.
+
+2011-04-10 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12650]
+ * sysdeps/i386/dl-tls.h: Define TLS_DTV_UNALLOCATED.
+ * sysdeps/ia64/dl-tls.h: Likewise.
+ * sysdeps/powerpc/dl-tls.h: Likewise.
+ * sysdeps/s390/dl-tls.h: Likewise.
+ * sysdeps/sh/dl-tls.h: Likewise.
+ * sysdeps/sparc/dl-tls.h: Likewise.
+ * sysdeps/x86_64/dl-tls.h: Likewise.
+ * elf/dl-tls.c: Don't define TLS_DTV_UNALLOCATED here.
+
+2011-03-14 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * elf/dl-load.c (_dl_dst_substitute): When skipping the first
+ rpath element also skip the following colon.
+ (expand_dynamic_string_token): Add is_path parameter and pass
+ down to DL_DST_REQUIRED and _dl_dst_substitute.
+ (decompose_rpath): Call expand_dynamic_string_token with
+ non-zero is_path. Ignore empty rpaths.
+ (_dl_map_object_from_fd): Call expand_dynamic_string_token
+ with zero is_path.
+
+2011-04-07 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S (CALL_FAIL):
+ Maintain aligned stack.
+ (CHECK_RSP): Remove unused macro.
+
+2011-04-01 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
+ bits/timex.h
+
+2011-03-18 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12583]
+ * posix/fnmatch.c (fnmatch): Check size of pattern in wide
+ character representation.
+ Partly based on a patch by Tomas Hoger <thoger@xxxxxxxxxx>.
+
+2011-03-16 Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+ * sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S (isnanf): Fix
+ END(__isnan) to END(__isnanf) to match function entry point/label
+ EALIGN(__isnanf,...).
+
+2011-03-10 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * wcsmbs/wchar.h (wmemcmp): Remove __restrict qualifiers.
+
+2011-03-10 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12510]
+ * elf/dl-lookup.c (do_lookup_x): For copy relocations of unique objects
+ copy from the symbol referenced in the relocation to initialize the
+ used variable.
+ Patch by Piotr Bury <pbury@xxxxxxxxxxx>.
+
+2011-03-06 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ * elf/dl-load.c (_dl_map_object): If we are looking for the first
+ to-be-loaded object along a path to loader is ld.so.
+
+2011-03-03 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * libio/fmemopen.c (fmemopen): Don't read past end of buffer.
+
+2011-02-23 Andreas Schwab <schwab@xxxxxxxxxx>
+ Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12509]
+ * include/link.h (struct link_map): Add l_orig_initfini.
+ * elf/dl-load.c (_dl_map_object_from_fd): Free realname before
+ returning unsuccessfully.
+ * elf/dl-close.c (_dl_close_worker): If this is the last explicit
+ close of a file loaded at startup, restore the original l_initfini
+ list.
+ * elf/dl-deps.c (_dl_map_object_deps): Don't free old l_initfini
+ list, store the pointer.
+ * elf/Makefile ($(objpfx)noload-mem): New rule.
+ (noload-ENV): Define.
+ (tests): Add $(objpfx)noload-mem.
+ * elf/noload.c: Include <memcheck.h>.
+ (main): Call mtrace. Close all opened handles.
+
+2011-02-17 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ [BZ #12454]
+ * elf/dl-deps.c (_dl_map_object_deps): Signal error early when
+ dependencies are missing.
+
+2011-02-22 Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
+
+ Fix __if_freereq crash: Unlike the generic version which uses free,
+ Hurd needs munmap.
+ * sysdeps/mach/hurd/ifreq.h: New file.
+
+2011-01-27 Petr Baudis <pasky@xxxxxxx>
+ Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12445]
+ * stdio-common/vfprintf.c (vfprintf): Pass correct newlen
+ to extend_alloca().
+ * stdio-common/bug23.c: New file.
+ * stdio-common/Makefile (tests): Add bug23.
+
+2011-02-16 Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
+ (INTERNAL_VSYSCALL_NCS INTERNAL_SYSCALL_NCS): Remove erroneous (int)
+ cast from r3.
+ * sysdeps/wordsize-64/Makefile: New file. Add tst-writev to
+ 'tests' variable.
+ * sysdeps/wordsize-64/tst-writev.c: New file.
+
+2011-02-15 Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+ * sysdeps/powerpc/powerpc64/power7/Makefile: New file which adds
+ -mno-vsx to the CFLAGS-rtld.c variable to avoid using VSX registers and
+ insns in _dl_start to prevent a TOC reference before relocs are
+ resolved.
+
+2011-02-11 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * stdio-common/printf-parsemb.c (__parse_one_specmb): Handle
+ arginfo fn returning -1.
+
+ * stdio-common/_i18n_number.h (_i18n_number_rewrite): Ensure decimal
+ and thousands string is zero terminated.
+
2011-02-02 Ulrich Drepper <drepper@xxxxxxxxx>
* elf/dl-runtime.c (_dl_call_pltexit): Pass correct address of the
Modified: fsf/glibc-2_11-branch/libc/conform/data/netdb.h-data
==============================================================================
--- fsf/glibc-2_11-branch/libc/conform/data/netdb.h-data (original)
+++ fsf/glibc-2_11-branch/libc/conform/data/netdb.h-data Fri May 27 09:43:06 2011
@@ -87,7 +87,7 @@
function {struct hostent*} gethostbyaddr (const void*, socklen_t, int)
function {struct hostent*} gethostbyname (const char*)
function {struct hostent*} gethostent (void)
-function int getnameinfo (const struct sockaddr*, socklen_t, char*, socklen_t, char*, socklen_t, unsigned)
+function int getnameinfo (const struct sockaddr*, socklen_t, char*, socklen_t, char*, socklen_t, int)
function {struct netent*} getnetbyaddr (uint32_t, int)
function {struct netent*} getnetbyname (const char*)
function {struct netent*} getnetent (void)
Modified: fsf/glibc-2_11-branch/libc/elf/Makefile
==============================================================================
--- fsf/glibc-2_11-branch/libc/elf/Makefile (original)
+++ fsf/glibc-2_11-branch/libc/elf/Makefile Fri May 27 09:43:06 2011
@@ -209,7 +209,7 @@
ifeq (yesyes,$(have-fpie)$(build-shared))
tests: $(objpfx)tst-pie1.out
endif
-tests: $(objpfx)tst-leaks1-mem
+tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
@@ -658,6 +658,10 @@
LDFLAGS-noload = -rdynamic
$(objpfx)noload.out: $(objpfx)testobj5.so
+$(objpfx)noload-mem: $(objpfx)noload.out
+ $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
+noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
+
LDFLAGS-nodelete = -rdynamic
LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
Modified: fsf/glibc-2_11-branch/libc/elf/dl-close.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/elf/dl-close.c (original)
+++ fsf/glibc-2_11-branch/libc/elf/dl-close.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Close a shared object opened by `_dl_open'.
- Copyright (C) 1996-2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1996-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
@@ -119,8 +119,17 @@
if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
|| dl_close_state != not_pending)
{
- if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
- dl_close_state = rerun;
+ if (map->l_direct_opencount == 0)
+ {
+ if (map->l_type == lt_loaded)
+ dl_close_state = rerun;
+ else if (map->l_type == lt_library)
+ {
+ struct link_map **oldp = map->l_initfini;
+ map->l_initfini = map->l_orig_initfini;
+ _dl_scope_free (oldp);
+ }
+ }
/* There are still references to this object. Do nothing more. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
Modified: fsf/glibc-2_11-branch/libc/elf/dl-deps.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/elf/dl-deps.c (original)
+++ fsf/glibc-2_11-branch/libc/elf/dl-deps.c Fri May 27 09:43:06 2011
@@ -491,6 +491,10 @@
if (errno == 0 && errno_saved != 0)
__set_errno (errno_saved);
+ if (errno_reason)
+ _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
+ NULL, errstring);
+
struct link_map **old_l_initfini = NULL;
if (map->l_initfini != NULL && map->l_type == lt_loaded)
{
@@ -665,9 +669,5 @@
_dl_scope_free (old_l_reldeps);
}
if (old_l_initfini != NULL)
- _dl_scope_free (old_l_initfini);
-
- if (errno_reason)
- _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
- NULL, errstring);
+ map->l_orig_initfini = old_l_initfini;
}
Modified: fsf/glibc-2_11-branch/libc/elf/dl-load.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/elf/dl-load.c (original)
+++ fsf/glibc-2_11-branch/libc/elf/dl-load.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Map in a shared object's segments from the file.
- Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-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
@@ -168,6 +168,87 @@
}
+static bool
+is_trusted_path (const char *path, size_t len)
+{
+ const char *trun = system_dirs;
+
+ for (size_t idx = 0; idx < nsystem_dirs_len; ++idx)
+ {
+ if (len == system_dirs_len[idx] && memcmp (trun, path, len) == 0)
+ /* Found it. */
+ return true;
+
+ trun += system_dirs_len[idx] + 1;
+ }
+
+ return false;
+}
+
+
+static bool
+is_trusted_path_normalize (const char *path, size_t len)
+{
+ if (len == 0)
+ return false;
+
+ if (*path == ':')
+ {
+ ++path;
+ --len;
+ }
+
+ char *npath = (char *) alloca (len + 2);
+ char *wnp = npath;
+ while (*path != '\0')
+ {
+ if (path[0] == '/')
+ {
+ if (path[1] == '.')
+ {
+ if (path[2] == '.' && (path[3] == '/' || path[3] == '\0'))
+ {
+ while (wnp > npath && *--wnp != '/')
+ ;
+ path += 3;
+ continue;
+ }
+ else if (path[2] == '/' || path[2] == '\0')
+ {
+ path += 2;
+ continue;
+ }
+ }
+
+ if (wnp > npath && wnp[-1] == '/')
+ {
+ ++path;
+ continue;
+ }
+ }
+
+ *wnp++ = *path++;
+ }
+
+ if (wnp == npath || wnp[-1] != '/')
+ *wnp++ = '/';
+
+ const char *trun = system_dirs;
+
+ for (size_t idx = 0; idx < nsystem_dirs_len; ++idx)
+ {
+ if (wnp - npath >= system_dirs_len[idx]
+ && memcmp (trun, npath, system_dirs_len[idx]) == 0)
+ /* Found it. */
+ return true;
+
+ trun += system_dirs_len[idx] + 1;
+ }
+
+ return false;
+}
+
+
static size_t
is_dst (const char *start, const char *name, const char *str,
int is_path, int secure)
@@ -200,7 +281,8 @@
return 0;
if (__builtin_expect (secure, 0)
- && ((name[len] != '\0' && (!is_path || name[len] != ':'))
+ && ((name[len] != '\0' && name[len] != '/'
+ && (!is_path || name[len] != ':'))
|| (name != start + 1 && (!is_path || name[-2] != ':'))))
return 0;
@@ -240,13 +322,14 @@
int is_path)
{
const char *const start = name;
- char *last_elem, *wp;
/* Now fill the result path. While copying over the string we keep
track of the start of the last path element. When we come accross
a DST we copy over the value or (if the value is not available)
leave the entire path element out. */
- last_elem = wp = result;
+ char *wp = result;
+ char *last_elem = result;
+ bool check_for_trusted = false;
do
{
@@ -265,6 +348,9 @@
else
#endif
repl = l->l_origin;
+
+ check_for_trusted = (INTUSE(__libc_enable_secure)
+ && l->l_type == lt_executable);
}
else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
repl = GLRO(dl_platform);
@@ -284,6 +370,10 @@
name += len;
while (*name != '\0' && (!is_path || *name != ':'))
++name;
+ /* Also skip following colon if this is the first rpath
+ element, but keep an empty element at the end. */
+ if (wp == result && is_path && *name == ':' && name[1] != '\0')
+ ++name;
}
else
/* No DST we recognize. */
@@ -293,10 +383,27 @@
{
*wp++ = *name++;
if (is_path && *name == ':')
- last_elem = wp;
+ {
+ /* In SUID/SGID programs, after $ORIGIN expansion the
+ normalized path must be rooted in one of the trusted
+ directories. */
+ if (__builtin_expect (check_for_trusted, false)
+ && !is_trusted_path_normalize (last_elem, wp - last_elem))
+ wp = last_elem;
+ else
+ last_elem = wp;
+
+ check_for_trusted = false;
+ }
}
}
while (*name != '\0');
+
+ /* In SUID/SGID programs, after $ORIGIN expansion the normalized
+ path must be rooted in one of the trusted directories. */
+ if (__builtin_expect (check_for_trusted, false)
+ && !is_trusted_path_normalize (last_elem, wp - last_elem))
+ wp = last_elem;
*wp = '\0';
@@ -310,7 +417,7 @@
belonging to the map is loaded. In this case the path element
containing $ORIGIN is left out. */
static char *
-expand_dynamic_string_token (struct link_map *l, const char *s)
+expand_dynamic_string_token (struct link_map *l, const char *s, int is_path)
{
/* We make two runs over the string. First we determine how large the
resulting string is and then we copy it over. Since this is now
@@ -321,7 +428,7 @@
char *result;
/* Determine the number of DST elements. */
- cnt = DL_DST_COUNT (s, 1);
+ cnt = DL_DST_COUNT (s, is_path);
/* If we do not have to replace anything simply copy the string. */
if (__builtin_expect (cnt, 0) == 0)
@@ -335,7 +442,7 @@
if (result == NULL)
return NULL;
- return _dl_dst_substitute (l, s, result, 1);
+ return _dl_dst_substitute (l, s, result, is_path);
}
@@ -407,33 +514,8 @@
cp[len++] = '/';
/* Make sure we don't use untrusted directories if we run SUID. */
- if (__builtin_expect (check_trusted, 0))
- {
- const char *trun = system_dirs;
- size_t idx;
- int unsecure = 1;
-
- /* All trusted directories must be complete names. */
- if (cp[0] == '/')
- {
- for (idx = 0; idx < nsystem_dirs_len; ++idx)
- {
- if (len == system_dirs_len[idx]
- && memcmp (trun, cp, len) == 0)
- {
- /* Found it. */
- unsecure = 0;
- break;
- }
-
- trun += system_dirs_len[idx] + 1;
- }
- }
-
- if (unsecure)
- /* Simply drop this directory. */
- continue;
- }
+ if (__builtin_expect (check_trusted, 0) && !is_trusted_path (cp, len))
+ continue;
/* See if this directory is already known. */
for (dirp = GL(dl_all_dirs); dirp != NULL; dirp = dirp->next)
@@ -551,11 +633,19 @@
/* Make a writable copy. At the same time expand possible dynamic
string tokens. */
- copy = expand_dynamic_string_token (l, rpath);
+ copy = expand_dynamic_string_token (l, rpath, 1);
if (copy == NULL)
{
errstring = N_("cannot create RUNPATH/RPATH copy");
goto signal_error;
+ }
+
+ /* Ignore empty rpaths. */
+ if (*copy == 0)
+ {
+ free (copy);
+ sps->dirs = (struct r_search_path_elem **) -1;
+ return false;
}
/* Count the number of necessary elements in the result array. */
@@ -897,6 +987,7 @@
{
/* We are not supposed to load the object unless it is already
loaded. So return now. */
+ free (realname);
__close (fd);
return NULL;
}
@@ -915,6 +1006,7 @@
_dl_zerofd = _dl_sysdep_open_zero_fill ();
if (_dl_zerofd == -1)
{
+ free (realname);
__close (fd);
_dl_signal_error (errno, NULL, NULL,
N_("cannot open zero fill device"));
@@ -2100,7 +2192,9 @@
{
#ifdef SHARED
// XXX Correct to unconditionally default to namespace 0?
- l = loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded;
+ l = (loader
+ ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded
+ ?: &GL(dl_rtld_map));
#else
l = loader;
#endif
@@ -2166,7 +2260,7 @@
{
/* The path may contain dynamic string tokens. */
realname = (loader
- ? expand_dynamic_string_token (loader, name)
+ ? expand_dynamic_string_token (loader, name, 0)
: local_strdup (name));
if (realname == NULL)
fd = -1;
Modified: fsf/glibc-2_11-branch/libc/elf/dl-lookup.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/elf/dl-lookup.c (original)
+++ fsf/glibc-2_11-branch/libc/elf/dl-lookup.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Look up a symbol in the loaded objects.
- Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-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
@@ -312,39 +312,21 @@
definition we have to use it. */
void enter (struct unique_sym *table, size_t size,
unsigned int hash, const char *name,
- const ElfW(Sym) *sym, struct link_map *map)
+ const ElfW(Sym) *sym, const struct link_map *map)
{
size_t idx = hash % size;
size_t hash2 = 1 + hash % (size - 2);
- while (1)
+ while (table[idx].name != NULL)
{
- if (table[idx].name == NULL)
- {
- table[idx].hashval = hash;
- table[idx].name = name;
- if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
- {
- table[idx].sym = ref;
- table[idx].map = undef_map;
- }
- else
- {
- table[idx].sym = sym;
- table[idx].map = map;
-
- if (map->l_type == lt_loaded)
- /* Make sure we don't unload this object by
- setting the appropriate flag. */
- map->l_flags_1 |= DF_1_NODELETE;
- }
-
- return;
- }
-
idx += hash2;
if (idx >= size)
idx -= size;
}
+
+ table[idx].hashval = hash;
+ table[idx].name = name;
+ table[idx].sym = sym;
+ table[idx].map = map;
}
struct unique_sym_table *tab
@@ -363,8 +345,19 @@
if (entries[idx].hashval == new_hash
&& strcmp (entries[idx].name, undef_name) == 0)
{
- result->s = entries[idx].sym;
- result->m = (struct link_map *) entries[idx].map;
+ if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+ {
+ /* We possibly have to initialize the central
+ copy from the copy addressed through the
+ relocation. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
+ }
+ else
+ {
+ result->s = entries[idx].sym;
+ result->m = (struct link_map *) entries[idx].map;
+ }
__rtld_lock_unlock_recursive (tab->lock);
return 1;
}
@@ -425,8 +418,19 @@
tab->free = free;
}
- enter (entries, size, new_hash, strtab + sym->st_name, sym,
- (struct link_map *) map);
+ if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+ enter (entries, size, new_hash, strtab + sym->st_name, ref,
+ undef_map);
+ else
+ {
+ enter (entries, size, new_hash, strtab + sym->st_name, sym,
+ map);
+
+ if (map->l_type == lt_loaded)
+ /* Make sure we don't unload this object by
+ setting the appropriate flag. */
+ ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;
+ }
++tab->n_elements;
__rtld_lock_unlock_recursive (tab->lock);
Modified: fsf/glibc-2_11-branch/libc/elf/dl-tls.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/elf/dl-tls.c (original)
+++ fsf/glibc-2_11-branch/libc/elf/dl-tls.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. Generic version.
- Copyright (C) 2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc.
+ Copyright (C) 2002-2006,2008,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
@@ -32,9 +32,6 @@
/* Amount of excess space to allocate in the static TLS area
to allow dynamic loading of modules defining IE-model TLS data. */
#define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
-
-/* Value used for dtv entries for which the allocation is delayed. */
-#define TLS_DTV_UNALLOCATED ((void *) -1l)
/* Out-of-memory handler. */
Modified: fsf/glibc-2_11-branch/libc/elf/ldconfig.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/elf/ldconfig.c (original)
+++ fsf/glibc-2_11-branch/libc/elf/ldconfig.c Fri May 27 09:43:06 2011
@@ -384,14 +384,17 @@
}
/* Canonify path: for now only remove leading and trailing
- whitespace and the trailing slashes slashes. */
- i = strlen (entry->path) - 1;
-
- while (isspace (entry->path[i]) && i > 0)
- entry->path[i--] = '\0';
-
- while (entry->path[i] == '/' && i > 0)
- entry->path[i--] = '\0';
+ whitespace and the trailing slashes. */
+ i = strlen (entry->path);
+
+ while (i > 0 && isspace (entry->path[i - 1]))
+ entry->path[--i] = '\0';
+
+ while (i > 0 && entry->path[i - 1] == '/')
+ entry->path[--i] = '\0';
+
+ if (i == 0)
+ return;
char *path = entry->path;
if (opt_chroot)
Modified: fsf/glibc-2_11-branch/libc/elf/noload.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/elf/noload.c (original)
+++ fsf/glibc-2_11-branch/libc/elf/noload.c Fri May 27 09:43:06 2011
@@ -1,20 +1,28 @@
#include <dlfcn.h>
#include <stdio.h>
+#include <mcheck.h>
int
main (void)
{
int result = 0;
+ void *p;
+
+ mtrace ();
/* First try to load an object which is a dependency. This should
succeed. */
- if (dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD) == NULL)
+ p = dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD);
+ if (p == NULL)
{
printf ("cannot open \"testobj1.so\": %s\n", dlerror ());
result = 1;
}
else
- puts ("loading \"testobj1.so\" succeeded, OK");
+ {
+ puts ("loading \"testobj1.so\" succeeded, OK");
+ dlclose (p);
+ }
/* Now try loading an object which is not already loaded. */
if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) != NULL)
@@ -25,8 +33,6 @@
else
{
/* Load the object and run the same test again. */
- void *p;
-
puts ("\"testobj5.so\" wasn't loaded and RTLD_NOLOAD prevented it, OK");
p = dlopen ("testobj5.so", RTLD_LAZY);
@@ -41,13 +47,17 @@
{
puts ("loading \"testobj5.so\" succeeded, OK");
- if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) == NULL)
+ void *q = dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD);
+ if (q == NULL)
{
printf ("cannot open \"testobj5.so\": %s\n", dlerror ());
result = 1;
}
else
- puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK");
+ {
+ puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK");
+ dlclose (q);
+ }
if (dlclose (p) != 0)
{
Modified: fsf/glibc-2_11-branch/libc/iconv/loop.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/iconv/loop.c (original)
+++ fsf/glibc-2_11-branch/libc/iconv/loop.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Conversion loop frame work.
- Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1998-2003, 2005, 2008, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
@@ -399,6 +399,9 @@
{
*inptrp = inend;
#ifdef STORE_REST
+ while (inptr < inend)
+ bytebuf[inlen++] = *inptr++;
+
inptr = bytebuf;
inptrp = &inptr;
inend = &bytebuf[inlen];
Modified: fsf/glibc-2_11-branch/libc/include/link.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/include/link.h (original)
+++ fsf/glibc-2_11-branch/libc/include/link.h Fri May 27 09:43:06 2011
@@ -1,6 +1,6 @@
/* Data structure for communication from the run-time dynamic linker for
loaded ELF shared objects.
- Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-2006, 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
@@ -236,6 +236,9 @@
/* List of object in order of the init and fini calls. */
struct link_map **l_initfini;
+ /* The init and fini list generated at startup, saved when the
+ object is also loaded dynamically. */
+ struct link_map **l_orig_initfini;
/* List of the dependencies introduced through symbol binding. */
struct link_map_reldeps
Modified: fsf/glibc-2_11-branch/libc/inet/getnameinfo.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/inet/getnameinfo.c (original)
+++ fsf/glibc-2_11-branch/libc/inet/getnameinfo.c Fri May 27 09:43:06 2011
@@ -159,7 +159,7 @@
int
getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
socklen_t hostlen, char *serv, socklen_t servlen,
- unsigned int flags)
+ int flags)
{
int serrno = errno;
int tmpbuflen = 1024;
@@ -385,7 +385,7 @@
break;
default:
- return EAI_FAMILY;
+ return EAI_FAMILY;
}
if (serv && (servlen > 0))
Modified: fsf/glibc-2_11-branch/libc/libio/Makefile
==============================================================================
--- fsf/glibc-2_11-branch/libc/libio/Makefile (original)
+++ fsf/glibc-2_11-branch/libc/libio/Makefile Fri May 27 09:43:06 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2004,2006,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004,2006-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
@@ -58,7 +58,7 @@
tst-memstream1 tst-memstream2 \
tst-wmemstream1 tst-wmemstream2 \
bug-memstream1 bug-wmemstream1 \
- tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos
+ tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos bug-fclose1
test-srcs = test-freopen
all: # Make this the default target; it will be defined in Rules.
Added: fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c (added)
+++ fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c Fri May 27 09:43:06 2011
@@ -1,0 +1,132 @@
+// BZ #12724
+
+static void do_prepare (void);
+#define PREPARE(argc, argv) do_prepare ()
+static int do_test (void);
+#define TEST_FUNCTION do_test()
+#include "../test-skeleton.c"
+
+
+static int fd;
+
+
+static void
+do_prepare (void)
+{
+ fd = create_temp_file ("bug-fclose1.", NULL);
+ if (fd == -1)
+ {
+ printf ("cannot create temporary file: %m\n");
+ exit (1);
+ }
+}
+
+
+static int
+do_test (void)
+{
+ static const char pattern[] = "hello world";
+
+ /* Prepare a seekable file. */
+ if (write (fd, pattern, sizeof pattern) != sizeof pattern)
+ {
+ printf ("cannot write pattern: %m\n");
+ return 1;
+ }
+ if (lseek (fd, 1, SEEK_SET) != 1)
+ {
+ printf ("cannot seek after write: %m\n");
+ return 1;
+ }
+
+ /* Create an output stream visiting the file; when it is closed, all
+ other file descriptors visiting the file must see the new file
+ position. */
+ int fd2 = dup (fd);
+ if (fd2 < 0)
+ {
+ printf ("cannot duplicate descriptor for writing: %m\n");
+ return 1;
+ }
+ FILE *f = fdopen (fd2, "w");
+ if (f == NULL)
+ {
+ printf ("first fdopen failed: %m\n");
+ return 1;
+ }
+ if (fputc (pattern[1], f) != pattern[1])
+ {
+ printf ("fputc failed: %m\n");
+ return 1;
+ }
+ if (fclose (f) != 0)
+ {
+ printf ("first fclose failed: %m\n");
+ return 1;
+ }
+ errno = 0;
+ if (lseek (fd2, 0, SEEK_CUR) != -1)
+ {
+ printf ("lseek after fclose after write did not fail\n");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ printf ("lseek after fclose after write did not fail with EBADF: %m\n");
+ return 1;
+ }
+ off_t o = lseek (fd, 0, SEEK_CUR);
+ if (o != 2)
+ {
+ printf ("\
+lseek on original descriptor after first fclose returned %ld, expected 2\n",
+ (long int) o);
+ return 1;
+ }
+
+ /* Likewise for an input stream. */
+ fd2 = dup (fd);
+ if (fd2 < 0)
+ {
+ printf ("cannot duplicate descriptor for reading: %m\n");
+ return 1;
+ }
+ f = fdopen (fd2, "r");
+ if (f == NULL)
+ {
+ printf ("second fdopen failed: %m\n");
+ return 1;
+ }
+ char c = fgetc (f);
+ if (c != pattern[2])
+ {
+ printf ("getc returned %c, expected %c\n", c, pattern[2]);
+ return 1;
+ }
+ if (fclose (f) != 0)
+ {
+ printf ("second fclose failed: %m\n");
+ return 1;
+ }
+ errno = 0;
+ if (lseek (fd2, 0, SEEK_CUR) != -1)
+ {
+ printf ("lseek after fclose after read did not fail\n");
+ return 1;
+ }
+ if (errno != EBADF)
+ {
+ printf ("lseek after fclose after read did not fail with EBADF: %m\n");
+ return 1;
+ }
+ o = lseek (fd, 0, SEEK_CUR);
+ if (o != 3)
+ {
+ printf ("\
+lseek on original descriptor after second fclose returned %ld, expected 3\n",
+ (long int) o);
+ return 1;
+ }
+
+ return 0;
+}
Propchange: fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c
------------------------------------------------------------------------------
svn:mime-type = text/cpp
Modified: fsf/glibc-2_11-branch/libc/libio/fileops.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/libio/fileops.c (original)
+++ fsf/glibc-2_11-branch/libc/libio/fileops.c Fri May 27 09:43:06 2011
@@ -160,19 +160,27 @@
_IO_new_file_close_it (fp)
_IO_FILE *fp;
{
- int write_status, close_status;
if (!_IO_file_is_open (fp))
return EOF;
- if ((fp->_flags & _IO_NO_WRITES) == 0
- && (fp->_flags & _IO_CURRENTLY_PUTTING) != 0)
+ int write_status;
+ if (_IO_in_put_mode (fp))
write_status = _IO_do_flush (fp);
+ else if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+ && !_IO_in_backup (fp))
+ {
+ off64_t o = _IO_SEEKOFF (fp, 0, _IO_seek_cur, 0);
+ if (o == WEOF)
+ write_status = EOF;
+ else
+ write_status = _IO_SYSSEEK (fp, o, SEEK_SET) < 0 ? EOF : 0;
+ }
else
write_status = 0;
INTUSE(_IO_unsave_markers) (fp);
- close_status = _IO_SYSCLOSE (fp);
+ int close_status = _IO_SYSCLOSE (fp);
/* Free buffer. */
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
@@ -290,7 +298,7 @@
#ifdef _LIBC
last_recognized = mode;
#endif
- for (i = 1; i < 6; ++i)
+ for (i = 1; i < 7; ++i)
{
switch (*++mode)
{
@@ -997,18 +1005,18 @@
/* Adjust for read-ahead (bytes is buffer). */
offset -= fp->_IO_read_end - fp->_IO_read_ptr;
if (fp->_offset == _IO_pos_BAD)
- {
- if (mode != 0)
- goto dumb;
- else
- {
- result = _IO_SYSSEEK (fp, 0, dir);
- if (result == EOF)
- return result;
-
- fp->_offset = result;
- }
- }
+ {
+ if (mode != 0)
+ goto dumb;
+ else
+ {
+ result = _IO_SYSSEEK (fp, 0, dir);
+ if (result == EOF)
+ return result;
+
+ fp->_offset = result;
+ }
+ }
/* Make offset absolute, assuming current pointer is file_ptr(). */
offset += fp->_offset;
if (offset < 0)
@@ -1270,7 +1278,7 @@
{
f->_flags |= _IO_ERR_SEEN;
break;
- }
+ }
to_do -= count;
data = (void *) ((char *) data + count);
}
@@ -1358,12 +1366,12 @@
do_write = to_do - (block_size >= 128 ? to_do % block_size : 0);
if (do_write)
- {
+ {
count = new_do_write (f, s, do_write);
to_do -= count;
if (count < do_write)
return n - to_do;
- }
+ }
/* Now write out the remainder. Normally, this will fit in the
buffer, but it's somewhat messier for line-buffered files,
Modified: fsf/glibc-2_11-branch/libc/libio/fmemopen.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/libio/fmemopen.c (original)
+++ fsf/glibc-2_11-branch/libc/libio/fmemopen.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Fmemopen implementation.
- Copyright (C) 2000, 2002, 2005, 2006, 2008, 2009
+ Copyright (C) 2000, 2002, 2005, 2006, 2008, 2009, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Hanno Mueller, kontakt@xxxxxxxx, 2000.
@@ -243,7 +243,7 @@
if (mode[0] == 'w')
c->buffer[0] = '\0';
- c->maxpos = strlen (c->buffer);
+ c->maxpos = strnlen (c->buffer, len);
if (mode[0] == 'a')
c->pos = c->maxpos;
Modified: fsf/glibc-2_11-branch/libc/login/programs/pt_chown.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/login/programs/pt_chown.c (original)
+++ fsf/glibc-2_11-branch/libc/login/programs/pt_chown.c Fri May 27 09:43:06 2011
@@ -64,7 +64,7 @@
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "1999");
+"), "2011");
}
static char *
@@ -123,7 +123,7 @@
/* Set the owner to the real user ID, and the group to that special
group ID. */
- if (st.st_gid != gid && chown (pty, getuid (), gid) < 0)
+ if (chown (pty, getuid (), gid) < 0)
return FAIL_EACCES;
/* Set the permission mode to readable and writable by the owner,
Modified: fsf/glibc-2_11-branch/libc/math/Makefile
==============================================================================
--- fsf/glibc-2_11-branch/libc/math/Makefile (original)
+++ fsf/glibc-2_11-branch/libc/math/Makefile Fri May 27 09:43:06 2011
@@ -90,7 +90,8 @@
# Rules for the test suite.
tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \
test-misc test-fpucw tst-definitions test-tgmath test-tgmath-ret \
- bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int test-tgmath2
+ bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int \
+ test-tgmath2 test-powl
# We do the `long double' tests only if this data type is available and
# distinct from `double'.
test-longdouble-yes = test-ldouble test-ildoubl
@@ -131,6 +132,7 @@
CFLAGS-test-tgmath.c = -fno-builtin
CFLAGS-test-tgmath2.c = -fno-builtin
CFLAGS-test-tgmath-ret.c = -fno-builtin
+CFLAGS-test-powl.c = -fno-builtin
CPPFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \
-DTEST_FAST_MATH -fno-builtin
CPPFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \
Added: fsf/glibc-2_11-branch/libc/math/test-powl.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/math/test-powl.c (added)
+++ fsf/glibc-2_11-branch/libc/math/test-powl.c Fri May 27 09:43:06 2011
@@ -1,0 +1,51 @@
+/* Test for powl
+ Copyright (C) 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <math.h>
+#include <float.h>
+#include <ieee754.h>
+
+int
+main (void)
+{
+ int result = 0;
+
+#ifndef NO_LONG_DOUBLE
+# if LDBL_MANT_DIG == 64
+ {
+ long double x = 1e-20;
+ union ieee854_long_double u;
+ u.ieee.mantissa0 = 1;
+ u.ieee.mantissa1 = 1;
+ u.ieee.exponent = 0;
+ u.ieee.negative = 0;
+ (void) powl (0.2, u.d);
+ x = powl (x, 1.5);
+ if (fabsl (x - 1e-30) > 1e-10)
+ {
+ printf ("powl (1e-20, 1.5): wrong result: %Lg\n", x);
+ result = 1;
+ }
+ }
+# endif
+#endif
+
+ return result;
+}
Modified: fsf/glibc-2_11-branch/libc/misc/error.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/misc/error.c (original)
+++ fsf/glibc-2_11-branch/libc/misc/error.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1990-1998, 2000-2006, 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
@@ -272,7 +272,9 @@
if (old_line_number == line_number
&& (file_name == old_file_name
- || strcmp (old_file_name, file_name) == 0))
+ || (old_file_name != NULL
+ && file_name != NULL
+ && strcmp (old_file_name, file_name) == 0)))
/* Simply return and print nothing. */
return;
Modified: fsf/glibc-2_11-branch/libc/misc/mntent_r.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/misc/mntent_r.c (original)
+++ fsf/glibc-2_11-branch/libc/misc/mntent_r.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Utilities for reading/writing fstab, mtab, etc.
- Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010
+ Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -263,8 +263,8 @@
mntcopy.mnt_type,
mntcopy.mnt_opts,
mntcopy.mnt_freq,
- mntcopy.mnt_passno)
- < 0 ? 1 : 0);
+ mntcopy.mnt_passno) < 0
+ || fflush (stream) != 0);
}
weak_alias (__addmntent, addmntent)
Modified: fsf/glibc-2_11-branch/libc/nptl/ChangeLog
==============================================================================
--- fsf/glibc-2_11-branch/libc/nptl/ChangeLog (original)
+++ fsf/glibc-2_11-branch/libc/nptl/ChangeLog Fri May 27 09:43:06 2011
@@ -1,3 +1,15 @@
+2011-05-11 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #386]
+ * allocatestack.c (allocate_stack): Convert ENOMEM error to EAGAIN.
+
+2011-04-10 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12650]
+ * allocatestack.c (get_cached_stack): Deallocate DTV entries before
+ clearing memory.
+ Patch partly by Robert Rex <robert.rex@xxxxxxxxxx>.
+
2011-01-13 Ulrich Drepper <drepper@xxxxxxxxx>
[BZ #10484]
Modified: fsf/glibc-2_11-branch/libc/nptl/allocatestack.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/nptl/allocatestack.c (original)
+++ fsf/glibc-2_11-branch/libc/nptl/allocatestack.c Fri May 27 09:43:06 2011
@@ -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@xxxxxxxxxx>, 2002.
@@ -26,6 +26,7 @@
#include <sys/mman.h>
#include <sys/param.h>
#include <dl-sysdep.h>
+#include <dl-tls.h>
#include <tls.h>
#include <lowlevellock.h>
#include <kernel-features.h>
@@ -238,6 +239,10 @@
/* Clear the DTV. */
dtv_t *dtv = GET_DTV (TLS_TPADJ (result));
+ for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt)
+ if (! dtv[1 + cnt].pointer.is_static
+ && dtv[1 + cnt].pointer.val != TLS_DTV_UNALLOCATED)
+ free (dtv[1 + cnt].pointer.val);
memset (dtv, '\0', (dtv[-1].counter + 1) * sizeof (dtv_t));
/* Re-initialize the TLS. */
@@ -623,7 +628,7 @@
{
int err;
mprot_error:
- err = errno;
+ err = errno == ENOMEM ? EAGAIN : errno;
lll_lock (stack_cache_lock, LLL_PRIVATE);
Modified: fsf/glibc-2_11-branch/libc/posix/fnmatch.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/posix/fnmatch.c (original)
+++ fsf/glibc-2_11-branch/libc/posix/fnmatch.c Fri May 27 09:43:06 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2007,2010
+/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2007,2010,2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -375,6 +375,11 @@
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
return -1;
+ if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+ {
+ __set_errno (ENOMEM);
+ return -2;
+ }
wpattern_malloc = wpattern
= (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
assert (mbsinit (&ps));
@@ -419,6 +424,12 @@
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
goto free_return;
+ if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+ {
+ free (wpattern_malloc);
+ __set_errno (ENOMEM);
+ return -2;
+ }
wstring_malloc = wstring
= (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
Modified: fsf/glibc-2_11-branch/libc/resolv/netdb.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/resolv/netdb.h (original)
+++ fsf/glibc-2_11-branch/libc/resolv/netdb.h Fri May 27 09:43:06 2011
@@ -1,4 +1,4 @@
- /* Copyright (C) 1996-2002, 2003, 2004, 2009 Free Software Foundation, Inc.
+ /* Copyright (C) 1996-2004, 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
@@ -677,7 +677,7 @@
extern int getnameinfo (__const struct sockaddr *__restrict __sa,
socklen_t __salen, char *__restrict __host,
socklen_t __hostlen, char *__restrict __serv,
- socklen_t __servlen, unsigned int __flags);
+ socklen_t __servlen, int __flags);
#endif /* POSIX */
#ifdef __USE_GNU
Modified: fsf/glibc-2_11-branch/libc/resolv/res_debug.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/resolv/res_debug.c (original)
+++ fsf/glibc-2_11-branch/libc/resolv/res_debug.c Fri May 27 09:43:06 2011
@@ -189,7 +189,7 @@
buf = malloc(buflen += 1024);
if (buf == NULL) {
fprintf(file,
- ";; memory allocation failure\n");
+ ";; memory allocation failure\n");
return;
}
continue;
@@ -356,7 +356,7 @@
{C_HS, "HESIOD"},
{C_ANY, "ANY"},
{C_NONE, "NONE"},
- {C_IN, (char *)0}
+ {C_IN, (char *)0}
};
libresolv_hidden_data_def (__p_class_syms)
@@ -588,6 +588,7 @@
case RES_USEBSTRING: return "ip6-bytstring";
case RES_USE_EDNS0: return "edns0";
case RES_USE_DNSSEC: return "dnssec";
+ case RES_NOTLDQUERY: return "no-tld-query";
/* XXX nonreentrant */
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
return (nbuf);
Modified: fsf/glibc-2_11-branch/libc/resolv/res_init.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/resolv/res_init.c (original)
+++ fsf/glibc-2_11-branch/libc/resolv/res_init.c Fri May 27 09:43:06 2011
@@ -545,6 +545,11 @@
} else if (!strncmp(cp, "single-request",
sizeof("single-request") - 1)) {
statp->options |= RES_SNGLKUP;
+ } else if (!strncmp(cp, "no_tld_query",
+ sizeof("no_tld_query") - 1) ||
+ !strncmp(cp, "no-tld-query",
+ sizeof("no-tld-query") - 1)) {
+ statp->options |= RES_NOTLDQUERY;
} else {
/* XXX - print a warning here? */
}
Modified: fsf/glibc-2_11-branch/libc/resolv/res_query.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/resolv/res_query.c (original)
+++ fsf/glibc-2_11-branch/libc/resolv/res_query.c Fri May 27 09:43:06 2011
@@ -123,7 +123,7 @@
{
HEADER *hp = (HEADER *) answer;
int n, use_malloc = 0;
- u_int oflags = statp->_flags;
+ u_int oflags = statp->_flags;
size_t bufsize = (type == T_UNSPEC ? 2 : 1) * QUERYSIZE;
u_char *buf = alloca (bufsize);
@@ -210,7 +210,7 @@
if (statp->options & RES_DEBUG)
printf(";; res_nquery: retry without EDNS0\n");
#endif
- goto again;
+ goto again;
}
#ifdef DEBUG
if (statp->options & RES_DEBUG)
@@ -344,6 +344,7 @@
int trailing_dot, ret, saved_herrno;
int got_nodata = 0, got_servfail = 0, root_on_list = 0;
int tried_as_is = 0;
+ int searched = 0;
__set_errno (0);
RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); /* True if we never query. */
@@ -406,6 +407,7 @@
for (domain = (const char * const *)statp->dnsrch;
*domain && !done;
domain++) {
+ searched = 1;
if (domain[0][0] == '\0' ||
(domain[0][0] == '.' && domain[0][1] == '\0'))
@@ -477,11 +479,11 @@
}
/*
- * If the name has any dots at all, and no earlier 'as-is' query
- * for the name, and "." is not on the search list, then try an as-is
- * query now.
+ * f the query has not already been tried as is then try it
+ * unless RES_NOTLDQUERY is set and there were no dots.
*/
- if (dots && !(tried_as_is || root_on_list)) {
+ if ((dots || !searched || (statp->options & RES_NOTLDQUERY) == 0)
+ && !(tried_as_is || root_on_list)) {
ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
answer, anslen, answerp,
answerp2, nanswerp2, resplen2);
Modified: fsf/glibc-2_11-branch/libc/resolv/resolv.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/resolv/resolv.h (original)
+++ fsf/glibc-2_11-branch/libc/resolv/resolv.h Fri May 27 09:43:06 2011
@@ -102,7 +102,7 @@
# define RES_MAXTIME 65535 /* Infinity, in milliseconds. */
struct __res_state {
- int retrans; /* retransmition time interval */
+ int retrans; /* retransmition time interval */
int retry; /* number of times to retransmit */
u_long options; /* option flags - see below. */
int nscount; /* number of name servers */
@@ -219,6 +219,8 @@
#define RES_SNGLKUPREOP 0x00400000 /* -"-, but open new socket for each
request */
#define RES_USE_DNSSEC 0x00800000 /* use DNSSEC using OK bit in OPT */
+#define RES_NOTLDQUERY 0x01000000 /* Do not look up unqualified name
+ as a TLD. */
#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
Modified: fsf/glibc-2_11-branch/libc/stdio-common/Makefile
==============================================================================
--- fsf/glibc-2_11-branch/libc/stdio-common/Makefile (original)
+++ fsf/glibc-2_11-branch/libc/stdio-common/Makefile Fri May 27 09:43:06 2011
@@ -60,7 +60,7 @@
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
- scanf16 scanf17 tst-setvbuf1 tst-grouping
+ scanf16 scanf17 tst-setvbuf1 tst-grouping bug23
test-srcs = tst-unbputc tst-printf
Modified: fsf/glibc-2_11-branch/libc/stdio-common/_i18n_number.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/stdio-common/_i18n_number.h (original)
+++ fsf/glibc-2_11-branch/libc/stdio-common/_i18n_number.h Fri May 27 09:43:06 2011
@@ -30,8 +30,8 @@
# define decimal NULL
# define thousands NULL
#else
- char decimal[MB_LEN_MAX];
- char thousands[MB_LEN_MAX];
+ char decimal[MB_LEN_MAX + 1];
+ char thousands[MB_LEN_MAX + 1];
#endif
/* "to_outpunct" is a map from ASCII decimal point and thousands-sep
@@ -47,13 +47,19 @@
mbstate_t state;
memset (&state, '\0', sizeof (state));
- if (__wcrtomb (decimal, wdecimal, &state) == (size_t) -1)
+ size_t n = __wcrtomb (decimal, wdecimal, &state);
+ if (n == (size_t) -1)
memcpy (decimal, ".", 2);
+ else
+ decimal[n] = '\0';
memset (&state, '\0', sizeof (state));
- if (__wcrtomb (thousands, wthousands, &state) == (size_t) -1)
+ n = __wcrtomb (thousands, wthousands, &state);
+ if (n == (size_t) -1)
memcpy (thousands, ",", 2);
+ else
+ thousands[n] = '\0';
}
#endif
Added: fsf/glibc-2_11-branch/libc/stdio-common/bug23.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/stdio-common/bug23.c (added)
+++ fsf/glibc-2_11-branch/libc/stdio-common/bug23.c Fri May 27 09:43:06 2011
@@ -1,0 +1,21 @@
+#include <stdio.h>
+#include <string.h>
+
+static char buf[32768];
+static const char expected[] = "\
+\n\
+a\n\
+abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
+
+static int
+do_test (void)
+{
+ snprintf (buf, sizeof (buf),
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+ "a", "b", "c", "d", 5);
+ return strcmp (buf, expected) != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
Modified: fsf/glibc-2_11-branch/libc/stdio-common/printf-parsemb.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/stdio-common/printf-parsemb.c (original)
+++ fsf/glibc-2_11-branch/libc/stdio-common/printf-parsemb.c Fri May 27 09:43:06 2011
@@ -295,9 +295,9 @@
/* We don't try to get the types for all arguments if the format
uses more than one. The normal case is covered though. If
the call returns -1 we continue with the normal specifiers. */
- || (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
- (&spec->info, 1, &spec->data_arg_type,
- &spec->size)) < 0)
+ || (int) (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
+ (&spec->info, 1, &spec->data_arg_type,
+ &spec->size)) < 0)
{
/* Find the data argument types of a built-in spec. */
spec->ndata_args = 1;
Modified: fsf/glibc-2_11-branch/libc/stdio-common/vfprintf.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/stdio-common/vfprintf.c (original)
+++ fsf/glibc-2_11-branch/libc/stdio-common/vfprintf.c Fri May 27 09:43:06 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2008, 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
@@ -1676,7 +1676,8 @@
{
/* Extend the array of format specifiers. */
struct printf_spec *old = specs;
- specs = extend_alloca (specs, nspecs_max, 2 * nspecs_max);
+ specs = extend_alloca (specs, nspecs_max,
+ 2 * nspecs_max * sizeof (*specs));
/* Copy the old array's elements to the new space. */
memmove (specs, old, nspecs * sizeof (struct printf_spec));
Modified: fsf/glibc-2_11-branch/libc/stdlib/Makefile
==============================================================================
--- fsf/glibc-2_11-branch/libc/stdlib/Makefile (original)
+++ fsf/glibc-2_11-branch/libc/stdlib/Makefile Fri May 27 09:43:06 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1991-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
@@ -70,7 +70,7 @@
test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
- tst-makecontext2 tst-strtod6 tst-unsetenv1
+ tst-makecontext2 tst-strtod6 tst-unsetenv1 bug-getcontext
include ../Makeconfig
@@ -144,3 +144,10 @@
$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os
$(build-module)
CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1
+
+ifeq ($(build-shared),yes)
+link-libm = $(common-objpfx)math/libm.so
+else
+link-libm = $(common-objpfx)math/libm.a
+endif
+$(objpfx)bug-getcontext: $(link-libm)
Added: fsf/glibc-2_11-branch/libc/stdlib/bug-getcontext.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/stdlib/bug-getcontext.c (added)
+++ fsf/glibc-2_11-branch/libc/stdlib/bug-getcontext.c Fri May 27 09:43:06 2011
@@ -1,0 +1,48 @@
+/* BZ 12420 */
+
+#include <errno.h>
+#include <fenv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ucontext.h>
+
+static int
+do_test (void)
+{
+ int except_mask = FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW;
+ int status = feenableexcept (except_mask);
+
+ except_mask = fegetexcept ();
+ if (except_mask == -1)
+ {
+ printf("\nBefore getcontext(): fegetexcept returned: %d\n",
+ except_mask);
+ return 1;
+ }
+
+ ucontext_t ctx;
+ status = getcontext(&ctx);
+ if (status)
+ {
+ printf("\ngetcontext failed, errno: %d.\n", errno);
+ return 1;
+ }
+
+ printf ("\nDone with getcontext()!\n");
+ fflush (NULL);
+
+ int mask = fegetexcept ();
+ if (mask != except_mask)
+ {
+ printf("\nAfter getcontext(): fegetexcept returned: %d, expected: %d.\n",
+ mask, except_mask);
+ return 1;
+ }
+
+ printf("\nAt end fegetexcept() returned %d, expected: %d.\n",
+ mask, except_mask);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
Modified: fsf/glibc-2_11-branch/libc/sysdeps/i386/dl-tls.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/i386/dl-tls.h (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/i386/dl-tls.h Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. i386 version.
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 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
@@ -58,3 +58,6 @@
# endif
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
Modified: fsf/glibc-2_11-branch/libc/sysdeps/ia64/dl-tls.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/ia64/dl-tls.h (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/ia64/dl-tls.h Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. IA-64 version.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 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
@@ -28,3 +28,6 @@
#define DONT_USE_TLS_INDEX 1
extern void *__tls_get_addr (size_t m, size_t offset);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
Added: fsf/glibc-2_11-branch/libc/sysdeps/mach/hurd/ifreq.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/mach/hurd/ifreq.h (added)
+++ fsf/glibc-2_11-branch/libc/sysdeps/mach/hurd/ifreq.h Fri May 27 09:43:06 2011
@@ -1,0 +1,45 @@
+/* Copyright (C) 1999, 2002, 2003, 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@xxxxxxx>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <net/if.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+static inline struct ifreq *
+__if_nextreq (struct ifreq *ifr)
+{
+#ifdef _HAVE_SA_LEN
+ if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr)
+ return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len);
+#endif
+ return ifr + 1;
+}
+
+extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
+
+
+static inline void
+__if_freereq (struct ifreq *ifreqs, int num_ifs)
+{
+ munmap (ifreqs, num_ifs * sizeof (struct ifreq));
+}
Modified: fsf/glibc-2_11-branch/libc/sysdeps/posix/spawni.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/posix/spawni.c (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/posix/spawni.c Fri May 27 09:43:06 2011
@@ -142,9 +142,7 @@
}
else if ((flags & POSIX_SPAWN_SETSCHEDULER) != 0)
{
- if (__sched_setscheduler (0, attrp->__policy,
- (flags & POSIX_SPAWN_SETSCHEDPARAM) != 0
- ? &attrp->__sp : NULL) == -1)
+ if (__sched_setscheduler (0, attrp->__policy, &attrp->__sp) == -1)
_exit (SPAWN_ERROR);
}
#endif
Modified: fsf/glibc-2_11-branch/libc/sysdeps/powerpc/dl-tls.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/powerpc/dl-tls.h (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/powerpc/dl-tls.h Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. PowerPC version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 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
@@ -47,3 +47,6 @@
# define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
# define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
Modified: fsf/glibc-2_11-branch/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* isnanf(). PowerPC32 version.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 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
@@ -39,8 +39,7 @@
L(NaN):
li r3,1 /* else return 1 */
blr
- END (__isnan)
+ END (__isnanf)
hidden_def (__isnanf)
weak_alias (__isnanf, isnanf)
-
Added: fsf/glibc-2_11-branch/libc/sysdeps/powerpc/powerpc64/power7/Makefile
==============================================================================
Binary file - no diff available.
Propchange: fsf/glibc-2_11-branch/libc/sysdeps/powerpc/powerpc64/power7/Makefile
------------------------------------------------------------------------------
svn:mime-type = audio/x-669-mod
Modified: fsf/glibc-2_11-branch/libc/sysdeps/pthread/aio_misc.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/pthread/aio_misc.c (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/pthread/aio_misc.c Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Handle general operations.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006, 2007, 2009
+ Copyright (C) 1997-2001, 2003, 2004, 2006, 2007, 2009, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1997.
@@ -26,6 +26,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
+#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <aio_misc.h>
@@ -87,7 +88,7 @@
static struct aioinit optim =
{
20, /* int aio_threads; Maximal number of threads. */
- 64, /* int aio_num; Number of expected simultanious requests. */
+ 64, /* int aio_num; Number of expected simultaneous requests. */
0,
0,
0,
@@ -282,9 +283,10 @@
if (pool == NULL)
{
optim.aio_threads = init->aio_threads < 1 ? 1 : init->aio_threads;
+ assert (powerof2 (ENTRIES_PER_ROW));
optim.aio_num = (init->aio_num < ENTRIES_PER_ROW
? ENTRIES_PER_ROW
- : init->aio_num & ~ENTRIES_PER_ROW);
+ : init->aio_num & ~(ENTRIES_PER_ROW - 1));
}
if (init->aio_idle_time != 0)
Modified: fsf/glibc-2_11-branch/libc/sysdeps/s390/dl-tls.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/s390/dl-tls.h (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/s390/dl-tls.h Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. s390 version.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 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,9 @@
# define __TLS_GET_ADDR(__ti) \
({ extern char _GLOBAL_OFFSET_TABLE_[] attribute_hidden; \
(void *) __tls_get_offset ((char *) (__ti) - _GLOBAL_OFFSET_TABLE_) \
- + (unsigned long) __builtin_thread_pointer (); })
+ + (unsigned long) __builtin_thread_pointer (); })
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
Modified: fsf/glibc-2_11-branch/libc/sysdeps/sh/dl-tls.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/sh/dl-tls.h (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/sh/dl-tls.h Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. SH version.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 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
@@ -27,3 +27,6 @@
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
Modified: fsf/glibc-2_11-branch/libc/sysdeps/sparc/dl-tls.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/sparc/dl-tls.h (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/sparc/dl-tls.h Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. SPARC version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 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
@@ -27,3 +27,6 @@
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
Modified: fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/Makefile
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/Makefile (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/Makefile Fri May 27 09:43:06 2011
@@ -95,7 +95,7 @@
endif
ifeq ($(subdir),time)
-sysdep_headers += sys/timex.h
+sysdep_headers += sys/timex.h bits/timex.h
sysdep_routines += ntp_gettime
endif
Modified: fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h Fri May 27 09:43:06 2011
@@ -172,7 +172,7 @@
: "r9", "r10", "r11", "r12", \
"cr0", "ctr", "lr", "memory"); \
err = (long int) r0; \
- (int) r3; \
+ r3; \
})
#undef INLINE_SYSCALL
@@ -219,7 +219,7 @@
: "r9", "r10", "r11", "r12", \
"cr0", "ctr", "memory"); \
err = r0; \
- (int) r3; \
+ r3; \
})
#define INTERNAL_SYSCALL(name, err, nr, args...) \
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
Modified: fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S Fri May 27 09:43:06 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,2004,2005,2006,2009,2010 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2004,2005,2006,2009,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
@@ -30,18 +30,22 @@
//#define __longjmp ____longjmp_chk
#ifdef PIC
-# define CALL_FAIL leaq longjmp_msg(%rip), %rdi; \
- call __GI___fortify_fail
+# define CALL_FAIL subq $8, %rsp; \
+ cfi_remember_state; \
+ cfi_def_cfa_offset(16); \
+ leaq longjmp_msg(%rip), %rdi; \
+ call __GI___fortify_fail; \
+ nop; \
+ cfi_restore_state
#else
-# define CALL_FAIL movq $longjmp_msg, %rdi; \
- call __fortify_fail
+# define CALL_FAIL subq $8, %rsp; \
+ cfi_remember_state; \
+ cfi_def_cfa_offset(16); \
+ movq $longjmp_msg, %rdi; \
+ call __fortify_fail; \
+ nop; \
+ cfi_restore_state
#endif
-
-#define CHECK_RSP(reg) \
- cmpq reg, %rsp; \
- jbe .Lok; \
- CALL_FAIL; \
-.Lok:
/* Jump to the position specified by ENV, causing the
setjmp call there to return VAL, or 1 if VAL is 0.
Modified: fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/x86_64/getcontext.S
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/x86_64/getcontext.S (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/x86_64/getcontext.S Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Save current context.
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@xxxxxxx>, 2002.
@@ -62,6 +62,7 @@
movq %rcx, oFPREGS(%rdi)
/* Save the floating-point environment. */
fnstenv (%rcx)
+ fldenv (%rcx)
stmxcsr oMXCSR(%rdi)
/* Save the current signal mask with
Added: fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/Makefile
==============================================================================
Binary file - no diff available.
Propchange: fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/Makefile
------------------------------------------------------------------------------
svn:mime-type = audio/x-669-mod
Added: fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/tst-writev.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/tst-writev.c (added)
+++ fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/tst-writev.c Fri May 27 09:43:06 2011
@@ -1,0 +1,107 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ryan S. Arnold <rsa@xxxxxxxxxx>, 2011.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fcntl.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+
+/* The purpose of this test is to verify that the INTERNAL_[V]SYSCALL_NCS
+ macros on 64-bit platforms don't cast the return type to (int) which would
+ erroneously sign extend the return value should the high bit of the bottom
+ half of the word be '1'. */
+
+#if 0
+/* Used to test the non power-of-2 code path. */
+#undef IOV_MAX
+#define IOV_MAX 1000
+#endif
+
+/* writev() should report that it has written EXPECTED number of bytes. */
+#define EXPECTED ((size_t) INT32_MAX + 1)
+
+static int
+do_test (void)
+{
+ struct iovec iv[IOV_MAX];
+ /* POSIX doesn't guarantee that IOV_MAX is pow of 2 but we're optimistic. */
+ size_t bufsz = EXPECTED / IOV_MAX;
+ size_t bufrem = EXPECTED % IOV_MAX;
+
+ /* If there's a remainder then IOV_MAX probably isn't a power of 2 and we
+ need to make bufsz bigger so that the last iovec, iv[IOV_MAX-1], is free
+ for the remainder. */
+ if (bufrem)
+ {
+ bufsz = bufsz + 1;
+ bufrem = EXPECTED - (bufsz * (IOV_MAX - 1));
+ }
+
+ /* We writev to /dev/null since we're just testing writev's return value. */
+ int fd = open (_PATH_DEVNULL, O_WRONLY);
+ if (fd == -1)
+ {
+ printf ("Unable to open /dev/null for writing.\n");
+ return -1;
+ }
+
+ iv[0].iov_base = malloc (bufsz);
+ if (iv[0].iov_base == NULL)
+ {
+ printf ("malloc (%zu) failed.\n", bufsz);
+ close (fd);
+ return -1;
+ }
+ iv[0].iov_len = bufsz;
+
+ /* We optimistically presume that there isn't a remainder and set all iovec
+ instances to the same base and len as the first instance. */
+ for (int i = 1; i < IOV_MAX; i++)
+ {
+ /* We don't care what the data is so reuse the allocation from iv[0]; */
+ iv[i].iov_base = iv[0].iov_base;
+ iv[i].iov_len = iv[0].iov_len;
+ }
+
+ /* If there is a remainder then we correct the last iov_len. */
+ if (bufrem)
+ iv[IOV_MAX - 1].iov_len = bufrem;
+
+ /* Write junk to /dev/null with the writev syscall in order to get a return
+ of INT32_MAX+1 bytes to verify that the INTERNAL_SYSCALL wrappers aren't
+ mangling the result if the signbit of a 32-bit number is set. */
+ ssize_t ret = writev (fd, iv, IOV_MAX);
+
+ free (iv[0].iov_base);
+ close (fd);
+
+ if (ret != (ssize_t) EXPECTED)
+ {
+ printf ("writev() return value: %zd != EXPECTED: %zd\n", ret, EXPECTED);
+ return 1;
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
Modified: fsf/glibc-2_11-branch/libc/sysdeps/x86_64/dl-tls.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/x86_64/dl-tls.h (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/x86_64/dl-tls.h Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. x86-64 version.
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 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
@@ -27,3 +27,6 @@
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
Modified: fsf/glibc-2_11-branch/libc/sysdeps/x86_64/fpu/e_powl.S
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/x86_64/fpu/e_powl.S (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/x86_64/fpu/e_powl.S Fri May 27 09:43:06 2011
@@ -1,5 +1,5 @@
/* ix87 specific implementation of pow function.
- Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007
+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
@@ -154,7 +154,7 @@
fucompp // 1.0 : x : y
fnstsw
fxch // x : 1.0 : y
- test $4500,%eax
+ test $0x4500,%eax
jz 7f
fsub %st(1) // x-1 : 1.0 : y
fyl2xp1 // log2(x) : y
Modified: fsf/glibc-2_11-branch/libc/wcsmbs/wchar.h
==============================================================================
--- fsf/glibc-2_11-branch/libc/wcsmbs/wchar.h (original)
+++ fsf/glibc-2_11-branch/libc/wcsmbs/wchar.h Fri May 27 09:43:06 2011
@@ -319,8 +319,7 @@
#endif
/* Compare N wide characters of S1 and S2. */
-extern int wmemcmp (__const wchar_t *__restrict __s1,
- __const wchar_t *__restrict __s2, size_t __n)
+extern int wmemcmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
__THROW __attribute_pure__;
/* Copy N wide characters of SRC to DEST. */