]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
9 years agoCVE-2012-3406: Stack overflow in vfprintf [BZ #16617]
Jeff Law [Mon, 15 Dec 2014 09:09:32 +0000 (10:09 +0100)] 
CVE-2012-3406: Stack overflow in vfprintf [BZ #16617]

A larger number of format specifiers coudld cause a stack overflow,
potentially allowing to bypass _FORTIFY_SOURCE format string
protection.

9 years agoBump required version of texinfo to 4.7
Will Newton [Thu, 11 Dec 2014 17:59:45 +0000 (17:59 +0000)] 
Bump required version of texinfo to 4.7

It seems we require texinfo 4.7 for the --plaintext option, so
document that and check for the correct version in configure.

ChangeLog:

2014-12-15  Will Newton  <will.newton@linaro.org>

* manual/install.texi: Bump required version of texinfo
to 4.7 from 4.5.
* INSTALL: Regenerated.
* configure.ac: Check for makeinfo version 4.7 and above.
* configure: Regenerated.

9 years agoNPTL: Refactor named semaphore code to use shm-directory.h
Roland McGrath [Fri, 12 Dec 2014 21:17:21 +0000 (13:17 -0800)] 
NPTL: Refactor named semaphore code to use shm-directory.h

9 years agoNPTL: Add stubs for Linux-only extension functions.
Roland McGrath [Fri, 12 Dec 2014 22:52:14 +0000 (14:52 -0800)] 
NPTL: Add stubs for Linux-only extension functions.

9 years agoFix NPTL build for !__ASSUME_SET_ROBUST_LIST case.
Roland McGrath [Fri, 12 Dec 2014 22:00:37 +0000 (14:00 -0800)] 
Fix NPTL build for !__ASSUME_SET_ROBUST_LIST case.

9 years agoresolv: Suppress maybe uninitialized warning
Stefan Liebler [Thu, 11 Dec 2014 12:38:01 +0000 (07:38 -0500)] 
resolv: Suppress maybe uninitialized warning

In send_vc function at resolv/res_send.c, There is the
following warning on some architectures:

  'resplen' may be used uninitialized in this function
  [-Wmaybe-uninitialized]

And this is a false positive.  This patch suppress the
compiler warning.

9 years agoGet rid of warning comparision will always evaluate as true
Stefan Liebler [Fri, 12 Dec 2014 10:13:09 +0000 (11:13 +0100)] 
Get rid of warning comparision will always evaluate as true

9 years agoFix for test "malloc_usable_size: expected 7 but got 11"
James Lemke [Fri, 12 Dec 2014 00:38:15 +0000 (16:38 -0800)] 
Fix for test "malloc_usable_size: expected 7 but got 11"

[BZ #17581] Revert this fix while investigating a problem.

9 years agoRefactor shm_{open,unlink} code to separate Linux-specific directory choice from...
Roland McGrath [Thu, 11 Dec 2014 22:15:51 +0000 (14:15 -0800)] 
Refactor shm_{open,unlink} code to separate Linux-specific directory choice from POSIX-generic code.

9 years ago* Fix SH specific compiler warnings which are for integer-pointer
Kaz Kojima [Thu, 11 Dec 2014 23:07:35 +0000 (08:07 +0900)] 
* Fix SH specific compiler warnings which are for integer-pointer
  type conversions without cast.

9 years agoMove semaphore.h to sysdeps/pthread/.
Joseph Myers [Thu, 11 Dec 2014 22:58:48 +0000 (22:58 +0000)] 
Move semaphore.h to sysdeps/pthread/.

Carlos reported failures in conform/ tests in environments where the
compiler used could only find headers in glibc's source and build
trees, not any previously installed headers
<https://sourceware.org/ml/libc-alpha/2014-09/msg00040.html>.

This patch moves nptl/semaphore.h to sysdeps/pthread/semaphore.h so
that it can be found by builds from all glibc subdirectories; it's not
in any way NPTL-specific.  (I left the Makefile setting to install
this header in nptl/, but maybe it should move as well - it's just not
clear to me what ifeq ($(subdir),...) conditional should be used to
select the directory to associate the header with for installation
purposes.  The path in the toplevel Makefile used for begin-end-check
also remains hardcoded; it's a known todo issue to rework that test to
run in each subdirectory checking the headers installed from that
subdirectory, rather than a separate hardcoded list.)

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  I did *not* test a
configuration such as that in which Carlos saw failure.

* nptl/semaphore.h: Move to ...
* sysdeps/pthread/semaphore.h: ... here.
* Makefile (installed-headers): Change nptl/semaphore.h to
sysdeps/pthread/semaphore.h.

9 years agoSuppress -Wformat-security in tst-error1.c.
Roland McGrath [Thu, 11 Dec 2014 21:52:57 +0000 (13:52 -0800)] 
Suppress -Wformat-security in tst-error1.c.

9 years agoEliminate -Wno-format from printf/scanf tests.
Roland McGrath [Thu, 11 Dec 2014 21:46:21 +0000 (13:46 -0800)] 
Eliminate -Wno-format from printf/scanf tests.

9 years agoAdd more headers to include/ for conform tests.
Joseph Myers [Thu, 11 Dec 2014 21:41:30 +0000 (21:41 +0000)] 
Add more headers to include/ for conform tests.

Carlos reported failures in conform/ tests in environments where the
compiler used could only find headers in glibc's source and build
trees, not any previously installed headers
<https://sourceware.org/ml/libc-alpha/2014-09/msg00040.html>.

This patch adds wrappers for two of the affected headers to include/,
which is the normal way to make headers visible when building or
testing in directories other than the one containing the header (I
suppose these headers weren't needed in any such directories except
conform/, or other build or test failures would have resulted).  I
believe the same issue applies at least to regexp.h and re_comp.h - we
don't currently have conform/ expectations for those, but when such
expectations are added we'll also need to add header wrappers.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  I did *not* test a
configuration such as that in which Carlos saw failure.

* include/cpio.h: New file.
* include/fmtmsg.h: Likewise.

9 years agoClean up localedata tests printf formats, don't use -Wno-format.
Joseph Myers [Thu, 11 Dec 2014 21:15:08 +0000 (13:15 -0800)] 
Clean up localedata tests printf formats, don't use -Wno-format.

9 years agoFix -Wformat-security warnings in posix/regexbug1.c
Roland McGrath [Thu, 11 Dec 2014 21:08:26 +0000 (13:08 -0800)] 
Fix -Wformat-security warnings in posix/regexbug1.c

9 years agotile: add inhibit_loop_to_libcall to string functions
Chris Metcalf [Thu, 11 Dec 2014 20:13:48 +0000 (15:13 -0500)] 
tile: add inhibit_loop_to_libcall to string functions

Without this, on gcc 4.8.2 the built glibc crashes when memcpy
or memset are invoked, since they call themselves recursively.
See commit 85c2e6110c9a01ec for the generic inhibit_loop_to_libcall.

9 years agoFix __sendmmsg prototype guards
Adhemerval Zanella [Thu, 11 Dec 2014 19:54:22 +0000 (14:54 -0500)] 
Fix __sendmmsg prototype guards

Add __USE_GNU guards on 'socket/sys/socket.h' __sendmmsg prototype.

9 years ago * sysdeps/mips/dl-trampoline.c: Modify switch expression to have
Steve Ellcey [Thu, 11 Dec 2014 18:23:01 +0000 (10:23 -0800)] 
* sysdeps/mips/dl-trampoline.c: Modify switch expression to have
integer value instead of boolean.

9 years ago2014-12-11 Steve Ellcey <sellcey@imgtec.com>
Steve Ellcey [Thu, 11 Dec 2014 16:14:17 +0000 (08:14 -0800)] 
2014-12-11  Steve Ellcey  <sellcey@imgtec.com>

* malloc/malloc.c: Fix powerof2 check.

9 years agoGet rid of warning inlining failed in call to maybe_swap_uint32
Stefan Liebler [Thu, 11 Dec 2014 16:03:37 +0000 (17:03 +0100)] 
Get rid of warning inlining failed in call to maybe_swap_uint32

9 years agoS/390: Get rid of assembler warning value truncated.
Stefan Liebler [Thu, 11 Dec 2014 16:02:24 +0000 (17:02 +0100)] 
S/390: Get rid of assembler warning value truncated.

9 years agoConstify string parameters
Andreas Schwab [Thu, 11 Dec 2014 15:00:49 +0000 (16:00 +0100)] 
Constify string parameters

9 years agopowerpc: Fix lgammal_r overflow warnings
Adhemerval Zanella [Thu, 11 Dec 2014 12:17:11 +0000 (07:17 -0500)] 
powerpc: Fix lgammal_r overflow warnings

ldbl-128ibm uses ldbl-128 e_lgammal_r implementation as is, however some
constants definitions overflows for IBM long double range.  This patch
suppress the compiler warnings until the ldbl-128ibm implementation is
fixed.

9 years agoRemove obsolete comment
Andreas Schwab [Thu, 11 Dec 2014 11:45:57 +0000 (12:45 +0100)] 
Remove obsolete comment

9 years agoProperly handle forced elision in pthread_mutex_trylock (bug 16657)
Andreas Schwab [Tue, 4 Mar 2014 12:00:26 +0000 (13:00 +0100)] 
Properly handle forced elision in pthread_mutex_trylock (bug 16657)

9 years agoRemove duplication from gconv-modules
Andreas Schwab [Thu, 11 Dec 2014 11:33:15 +0000 (12:33 +0100)] 
Remove duplication from gconv-modules

9 years agointl: Merge with gettext version 0.19.3
Will Newton [Wed, 10 Dec 2014 12:03:53 +0000 (12:03 +0000)] 
intl: Merge with gettext version 0.19.3

This patch merges the latest release of gettext into the intl
subdirectory. The initial motivation was to include the plural.y
changes which enable building with bison 3.0, but the majority
of the other changes are merely cosmetic so it seemed like merging
the whole directory was simpler than trying to take it piecemeal.

The merge was done by copying across the latext gettext code and
adding in a few small glibc changes that have been added over the
years that seemed beneficial, as well as a couple of small build
fixes that should be merged back to gettext. I also reverted the
gettext commit:

commit 279b57fc367251666f00e8e2b599b83703451afb
Author: Bruno Haible <bruno@clisp.org>
Date:   Fri Jun 14 12:03:49 2002 +0000

    Make absolute pathnames inside $LANGUAGE work.

As it caused localedata/tst-setlocale3 to fail and it wasn't clear
that glibc wanted that behaviour.

The merge has dropped many uses of __glibc_likely/unlikely. This is
intentional given that it eases merging. It seems to me that the cost
of continually rewriting these lines when merging and the risk of adding
bugs when doing so outweighs the benefits of using these macros when
code is shared with another project.

Tested with make check on x86_64.

ChangeLog:

2014-12-11  Will Newton  <will.newton@linaro.org>

Merge gettext 0.19.3 into intl/.

This involves a number of cosmetic changes to comments
and ANSI function definitions and prototypes throughout
all the files. The gettext copyright header is used but
with the date ranges taken from the glibc copy.

* NEWS: Add gettext merge to 2.21.
* intl/bindtextdom.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Use gl_* locking primitives rather than __libc_* ones.
Use __builtin_expect rather than __glibc_likely/unlikely.
* intl/dcgettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/dcigettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(INTDIV0_RAISES_SIGFPE): New define.
Use gl_* locking primitives rather than __libc_* ones.
Include eval-plural.h instead of plural-eval.c.
Use __builtin_expect rather than __glibc_likely/unlikely.
* intl/dcngettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/dgettext.c: Likewise.
* intl/dngettext.c: Likewise.
* intl/plural-eval.c: Renamed to...
* intl/eval-plural.h: ...this.
* intl/explodename.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(_nl_explode_name): Use strchr instead of __rawmemchr.
* intl/finddomain.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Use gl_* locking primitives rather than __libc_* ones.
(_nl_find_domain): Use malloc rather than alloca for
allocation of temporary locale name.
* intl/gettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/gettextP.h: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Use gl_* locking primitives rather than __libc_* ones.
* intl/gmo.h: Switch to gettext copyright.
(struct sysdep_string): Move struct segment_pair outside of
struct definition.
* intl/hash-string.c: Use ANSI definitions and prototypes.
* intl/hash-string.h: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/l10nflist.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(_nl_normalize_codeset): Avoid integer overflow.
* intl/loadinfo.h: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(LIBINTL_DLL_EXPORTED): New define.
(PATH_SEPARATOR): New define.
* intl/loadmsgcat.c: Switch to gettext copyright.
* intl/localealias.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(_nl_expand_alias): Use PATH_SEPARATOR.
* intl/ngettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/plural-exp.c: Likewise.
* intl/plural-exp.h: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(struct expression): Move definition of enum operator outside
of struct definition.
* intl/plural.c: Regenerate.
* intl/plural.y: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Port to bison 3.0.
* intl/textdomain.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Use gl_* locking primitives rather than __libc_* ones.

9 years ago2014-12-10 Steve Ellcey <sellcey@imgtec.com>
Steve Ellcey [Wed, 10 Dec 2014 21:46:28 +0000 (13:46 -0800)] 
2014-12-10  Steve Ellcey  <sellcey@imgtec.com>

* debug/warning-nop.c: Add used atrribute.

9 years agoFix MIPS waitid build.
Joseph Myers [Wed, 10 Dec 2014 18:50:07 +0000 (18:50 +0000)] 
Fix MIPS waitid build.

As previously discussed in
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, MIPS (o32)
waitid has build warnings (now errors) because a function is declared
inline but functions with five-argument syscalls cannot be inlined for
MIPS o32.

This patch disables the -Winline warnings for waitid.c using a
MIPS-specific wrapper file.  As it's whole-file disabling, there's no
point in using push and pop, so just DIAG_IGNORE_NEEDS_COMMENT is
used.

* sysdeps/unix/sysv/linux/mips/mips32/waitid.c: New file.

9 years agoFix MIPS sigaction build.
Joseph Myers [Wed, 10 Dec 2014 18:45:03 +0000 (18:45 +0000)] 
Fix MIPS sigaction build.

Building MIPS sigaction (for ABIs other than o32) fails because of
"'restore_rt' used but never defined", arising from static functions
being defined in asms and referred to from C code.  There is no
corresponding -W option for that warning, so this patch uses
-Wno-error for building sigaction.c.

* sysdeps/unix/sysv/linux/mips/mips64/Makefile
[$(subdir) == signal] (CFLAGS-sigaction.c): New variable.
[$(subdir) == nptl] (CFLAGS-sigaction.c): Likewise.

9 years agoFix typo in changelog.
Ondřej Bílka [Wed, 10 Dec 2014 18:20:57 +0000 (19:20 +0100)] 
Fix typo in changelog.

9 years agoFix strftime wcschr namespace (bug 17634).
Joseph Myers [Wed, 10 Dec 2014 16:59:02 +0000 (16:59 +0000)] 
Fix strftime wcschr namespace (bug 17634).

Use of strftime, a C90 function, ends up bringing in wcschr, which is
not a C90 function.  Although not a conformance bug (C90 reserves
wcs*), this is still contrary to glibc practice of avoiding relying on
those reservations; this patch arranges for the internal uses to use
__wcschr instead, with wcschr being a weak alias.  This is more
complicated than some such patches because of the various IFUNC
definitions of wcschr (which include code redefining libc_hidden_def
in a way that involves creating __GI_wcschr manually and so also needs
to create __GI___wcschr after the change of internal uses to use
__wcschr).

Tested for x86_64 and 32-bit x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

2014-12-10  Joseph Myers  <joseph@codesourcery.com>
    Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

[BZ #17634]
* wcsmbs/wcschr.c [!WCSCHR] (wcschr): Define as __wcschr.
Undefine after defining function.  Define as weak alias of
__wcschr.  Use libc_hidden_weak.
* include/wchar.h (__wcschr): Declare.  Use libc_hidden_proto.
* sysdeps/i386/i686/multiarch/wcschr-c.c [IS_IN (libc) && SHARED]
(libc_hidden_def): Also define __GI___wcschr alias.
* sysdeps/i386/i686/multiarch/wcschr.S (wcschr): Rename to
__wcschr and define as weak alias of __wcschr.
* sysdeps/powerpc/power6/wcschr.c [!WCSCHR] (WCSCHR): Define as
__wcschr.
[!WCSCHR] (DEFAULT_WCSCHR): Define.
[DEFAULT_WCSCHR] (__wcschr): Use libc_hidden_def.
[DEFAULT_WCSCHR] (wcschr): Define as weak alias of __wcschr.  Use
libc_hidden_weak.  Do not use libc_hidden_def.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c
[IS_IN (libc) && SHARED] (libc_hidden_def): Also define
__GI___wcschr alias.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c
[IS_IN (libc)] (wcschr): Define as macro expanding to
__redirect_wcschr.
[IS_IN (libc)] (__wcschr_ppc): Use __redirect_wcschr in typeof.
[IS_IN (libc)] (__wcschr_power6): Likewise.
[IS_IN (libc)] (__wcschr_power7): Likewise.
[IS_IN (libc)] (__libc_wcschr): New.  Define with libc_ifunc
instead of wcschr.
[IS_IN (libc)] (wcschr): Undefine and define as weak alias of
__libc_wcschr.
[!IS_IN (libc)] (libc_hidden_def): Do not undefine and redefine.
* sysdeps/powerpc/powerpc64/multiarch/wcschr.c (wcschr): Rename to
__wcschr and define as weak alias of __wcschr.  Use
libc_hidden_builtin_def.
* sysdeps/x86_64/wcschr.S (wcschr): Rename to __wcschr and define
as weak alias of __wcschr.  Use libc_hidden_weak.
* time/alt_digit.c (_nl_get_walt_digit): Use __wcschr instead of
wcschr.
* time/era.c (_nl_init_era_entries): Likewise.
* conform/Makefile (test-xfail-ISO/time.h/linknamespace): Remove
variable.
(test-xfail-XPG3/time.h/linknamespace): Likewise.
(test-xfail-XPG4/time.h/linknamespace): Likewise.

9 years agoFix tst-ftell-active-handler.c warning.
Joseph Myers [Wed, 10 Dec 2014 16:03:23 +0000 (16:03 +0000)] 
Fix tst-ftell-active-handler.c warning.

A recent change to libio/tst-ftell-active-handler.c (postdating my
last check for warnings on x86) introduced a format warning from a
long int variable used with a %zu format.  This patch fixes it by
using %ld for the format to match the variable.

Tested for x86.

* libio/tst-ftell-active-handler.c (do_ftruncate_test): Use %ld
format for long int variable.

9 years agomanual: Remove incorrect claim that qsort() can be stabilized
Anders Kaseorg [Thu, 3 Jul 2014 01:17:50 +0000 (21:17 -0400)] 
manual: Remove incorrect claim that qsort() can be stabilized

Under certain conditions on the size of the array and its items,
qsort() may fall back to an in-place quicksort if it cannot allocate
memory for a temporary array with malloc().  This algorithm is not a
stable sort even if the comparison function is written in the
described manner.

Fixes #10672.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
9 years agoUpdate NEWS
Andreas Schwab [Wed, 10 Dec 2014 15:09:45 +0000 (16:09 +0100)] 
Update NEWS

9 years agoDon't touch user-controlled stdio locks in forked child (bug 12847)
Andreas Schwab [Mon, 8 Dec 2014 14:13:38 +0000 (15:13 +0100)] 
Don't touch user-controlled stdio locks in forked child (bug 12847)

The stdio locks for streams with the _IO_USER_LOCK flag should not be
touched by internal code.

9 years ago[AArch64] Fix strchrnul clobbering v15
Richard Earnshaw [Wed, 10 Dec 2014 09:54:09 +0000 (09:54 +0000)] 
[AArch64] Fix strchrnul clobbering v15

9 years agoUse -Werror by default, add --disable-werror.
Joseph Myers [Wed, 10 Dec 2014 01:14:48 +0000 (01:14 +0000)] 
Use -Werror by default, add --disable-werror.

As discussed starting at
<https://sourceware.org/ml/libc-alpha/2014-11/msg00323.html>, this
patch makes the glibc build use -Werror by default to avoid
accidentally adding new warnings to the build.  The configure option
--disable-werror can be used to disable this.

-Wno-error=undef is temporarily used because the build isn't clean
regarding -Wundef warnings.  The idea is that once the remaining
-Wundef warnings have been cleaned up (in at least one configuration),
-Wno-error=undef will be removed.

I get a clean build and test on x86_64 (GCC 4.9 branch) with this
patch.  The expectation is that this may well break the build for some
other configurations, and people seeing such breakage should make
appropriate fixes to fix or suppress the warnings for their
configurations.  In some cases that may involve using pragmas as the
right fix (I think that will be right for the -Wno-inline issue for
MIPS I referred to in
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, for
example), in some cases -Wno-error in sysdeps makefiles (__restore_rt
in MIPS sigaction, for example), in some cases substantive fixes for
the warnings.

Note that if, with a view to listing all the warnings then fixing them
all, you just look for "warning:" in output from building and testing
with --disable-werror, you'll see lots of warnings from the linker
about functions such as tmpnam.  Those warnings can be ignored - only
compiler warnings are relevant to -Werror, not linker warnings.

* configure.ac (--disable-werror): New configure option.
(enable_werror): New AC_SUBST.
* configure: Regenerated.
* config.make.in (enable-werror): New variable.
* Makeconfig [$(enable-werror) = yes] (+gccwarn): Add -Werror
-Wno-error=undef.
(+gccwarn-c): Do not use -Werror=implicit-function-declaration.
* manual/install.texi (Configuring and compiling): Document
--disable-werror.
* INSTALL: Regenerated.
* debug/Makefile (CFLAGS-tst-chk1.c): Add -Wno-error.
(CFLAGS-tst-chk2.c): Likewise.
(CFLAGS-tst-chk3.c): Likewise.
(CFLAGS-tst-chk4.cc): Likewise.
(CFLAGS-tst-chk5.cc): Likewise.
(CFLAGS-tst-chk6.cc): Likewise.
(CFLAGS-tst-lfschk1.c): Likewise.
(CFLAGS-tst-lfschk2.c): Likewise.
(CFLAGS-tst-lfschk3.c): Likewise.
(CFLAGS-tst-lfschk4.cc): Likewise.
(CFLAGS-tst-lfschk5.cc): Likewise.
(CFLAGS-tst-lfschk6.cc): Likewise.

9 years agoDisable -Wdeprecated-declarations for register_printf_function calls in tst-printfsz.c.
Joseph Myers [Wed, 10 Dec 2014 00:44:54 +0000 (00:44 +0000)] 
Disable -Wdeprecated-declarations for register_printf_function calls in tst-printfsz.c.

This patch uses diagnostic control pragmas to disable warnings in
stdio-common/tst-printfsz.c for use of the deprecated
register_printf_function.  Because this test is testing printf_size
and printf_size_info, and the latter has the interface expected for
register_printf_function instead of the newer
register_printf_specifier, it seems correct for this test to use the
deprecated interface (wrapping printf_size_info in some way to use
register_printf_specifier would seem an excessive change to what's
tested).

Tested for x86_64.

* stdio-common/tst-printfsz.c: Include <libc-internal.h>.
(main): Disable -Wdeprecated-declarations around calls to
register_printf_function.

9 years agoDisable -Wdiv-by-zero for some tests in stdio-common/tst-unlockedio.c.
Joseph Myers [Wed, 10 Dec 2014 00:43:36 +0000 (00:43 +0000)] 
Disable -Wdiv-by-zero for some tests in stdio-common/tst-unlockedio.c.

This patch uses diagnostic control pragmas to disable some
division-by-zero warnings in stdio-common/tst-unlockedio.c.  This is
another test where disabling warnings using diagnostic pragmas seems
appropriate (the warnings are not wildly inappropriate for what the
test deliberately does; the deliberate use of unusual arguments to the
macros being tested means that changing the arguments in a way that
avoids the warning would also unduly perturb what is being tested).

Tested for x86_64.

* stdio-common/tst-unlockedio.c: Include <libc-internal.h>.
(do_test): Disable -Wdiv-by-zero around some calls to
fwrite_unlocked and fread_unlocked.

9 years agoAdd macros for diagnostic control, use for scanf %a tests.
Joseph Myers [Wed, 10 Dec 2014 00:41:19 +0000 (00:41 +0000)] 
Add macros for diagnostic control, use for scanf %a tests.

In <https://sourceware.org/ml/libc-alpha/2014-11/msg00326.html>,
Roland requested internal macros for use of "#pragma GCC diagnostic".

This patch adds such macros and uses them to disable -Wformat warnings
for some code testing GNU scanf %as where GCC expects C99 scanf %a
(several other stdio tests currently use -Wno-format to disable
warnings).  Limitations in GCC's diagnostic pragmas require separate
macros before and after the code generating the warnings, rather than
a single macro taking that code as an argument.

The macros are named DIAG_*_NEEDS_COMMENT to emphasise to reviewers
the need for a comment accompanying any use of them (such comments may
however just appear once for several uses of the macros for the same
issue in the same file).  I put a GCC version in the arguments to
DIAG_IGNORE_NEEDS_COMMENT, as that seems something useful to grep for
when obsoleting support for an old GCC version and needing to decide
if warning-disabling code is still relevant.

These macros should be usable for replacing existing -Wno-* use in
makefiles (as also suggested by Roland), though I have no plans to
work on that (only on use of the macros in cases where warnings are
currently present that need disabling to use -Werror).

Tested for x86_64.

* include/libc-internal.h (DIAG_PUSH_NEEDS_COMMENT): New macro.
(DIAG_POP_NEEDS_COMMENT): Likewise.
(_DIAG_STR1): Likewise.
(_DIAG_STR): Likewise.
(DIAG_IGNORE_NEEDS_COMMENT): Likewise.
* stdio-common/bug21.c: Include <libc-internal.h>.
(do_test): Disable -Wformat around call to sscanf.
* stdio-common/scanf14.c: Include <libc-internal.h>.
(main): Disable -Wformat around some calls to scanf functions.

9 years agoRemove custom pthread_once implementation on sh.
Torvald Riegel [Mon, 8 Dec 2014 17:29:18 +0000 (18:29 +0100)] 
Remove custom pthread_once implementation on sh.

9 years agolibio: Fix variable aligment in tst-ftell-active-handler
Adhemerval Zanella [Mon, 8 Dec 2014 12:20:07 +0000 (07:20 -0500)] 
libio: Fix variable aligment in tst-ftell-active-handler

This patch fixes a stack allocated variable to force it to have wchar_t
alignment.

9 years agoFix pthreads getrlimit, gettimeofday namespace (bug 17682).
Joseph Myers [Sat, 6 Dec 2014 23:40:48 +0000 (23:40 +0000)] 
Fix pthreads getrlimit, gettimeofday namespace (bug 17682).

Some pthreads functions use getrlimit and gettimeofday, but these
functions are XSI, not base POSIX; this is a namespace issue for
dynamic linking as well as static linking.  This patch makes them use
__getrlimit and __gettimeofday instead - the former needed to be newly
exported from libc.so at GLIBC_PRIVATE (and so now needs
libc_hidden_proto / libc_hidden_def), the latter was already exported.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

[BZ #17682]
* resource/Versions (libc): Add __getrlimit at GLIBC_PRIVATE.
* resource/getrlimit.c (__getrlimit): Use libc_hidden_def.
* sysdeps/mach/hurd/getrlimit.c (__getrlimit): Likewise.
* include/sys/resource.h (__getrlimit): Use libc_hidden_proto.
* nptl/nptl-init.c (__pthread_initialize_minimal_internal): Use
__getrlimit instead of getrlimit.
* nptl/pthread_cond_timedwait.c (__pthread_cond_timedwait): Use
__gettimeofday instead of gettimeofday.
* nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Likewise.
* nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Likewise.
* sysdeps/pthread/aio_misc.c (handle_fildes_io): Likewise.
* conform/Makefile (test-xfail-POSIX2008/aio.h/linknamespace):
Remove variable.
(test-xfail-POSIX2008/pthread.h/linknamespace): Likewise.
(test-xfail-POSIX2008/time.h/linknamespace): Likewise.

9 years agolibio: Fix buffer overrun in tst-ftell-active-handler
Adhemerval Zanella [Fri, 5 Dec 2014 12:41:22 +0000 (07:41 -0500)] 
libio: Fix buffer overrun in tst-ftell-active-handler

On 'do_ftell_test' the code:

365           if (test_modes[i].fd_mode != O_WRONLY)
366             {
367               char tmpbuf[data_len];
368
369               rewind (fp);
370
371               while (fgets_func (tmpbuf, sizeof (tmpbuf), fp) && !feof (fp));

The 'data_len' is calculated with wsclen and allocated as 'char'.  The
subsequent fgetws will then try to write at most 'data_len' wchar_t
in a buffer with just data_len 'char'.  This patch fixes it by
allocating the tmpbuf using 'wchar_t' * data_len bytes.

9 years agoDe-warning a few stubs.
Roland McGrath [Thu, 4 Dec 2014 20:31:38 +0000 (12:31 -0800)] 
De-warning a few stubs.

9 years agoFix linknamespace h_errno handling.
Joseph Myers [Thu, 4 Dec 2014 17:12:46 +0000 (17:12 +0000)] 
Fix linknamespace h_errno handling.

Some linknamespace tests were failing because of references to
h_errno.  References to this symbol should be allowed for XPG4, UNIX98
and XOPEN2K; this patch adds it to the list of allowed data symbols
for those standards.  (h_errno was removed in the 2008 edition of
POSIX, so POSIX2008 and XOPEN2K8 references to it are genuine bugs;
fortunately it's not a public data symbol - __h_errno_location is
public, TLS h_errno is GLIBC_PRIVATE - so the symbol can simply be
renamed to __h_errno to fix those bugs without the ABI complications
normally associated with namespace issues for data symbols.)

Tested for x86_64.

* conform/list-header-symbols.pl (%extra_syms): Add h_errno for
XPG4, UNIX98 and XOPEN2K.
* conform/Makefile (test-xfail-XOPEN2K/grp.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K/pwd.h/linknamespace): Likewise.

9 years agoFix another typo in the ChangeLog
Siddhesh Poyarekar [Thu, 4 Dec 2014 10:45:46 +0000 (16:15 +0530)] 
Fix another typo in the ChangeLog

9 years agoFix date in ChangeLog
Siddhesh Poyarekar [Thu, 4 Dec 2014 03:29:27 +0000 (08:59 +0530)] 
Fix date in ChangeLog

9 years agoFix up function definition style
Siddhesh Poyarekar [Thu, 4 Dec 2014 03:15:55 +0000 (08:45 +0530)] 
Fix up function definition style

Don't use K&R style for function definitions.

9 years agoReset cached offset when reading to end of stream (BZ #17653)
Siddhesh Poyarekar [Thu, 4 Dec 2014 02:43:28 +0000 (08:13 +0530)] 
Reset cached offset when reading to end of stream (BZ #17653)

POSIX allows applications to switch file handles when a read results
in an end of file.  Unset the cached offset at this point so that it
is queried again.

9 years agotst-ftell-active-handler: Open file with O_TRUNC for w modes
Siddhesh Poyarekar [Thu, 4 Dec 2014 02:41:07 +0000 (08:11 +0530)] 
tst-ftell-active-handler: Open file with O_TRUNC for w modes

The test case fails to truncate the file when a file is intended to be
opened in w or w+ mode.  Add O_TRUNC to fix this.  The test still
succeeds with this change.

9 years agoftell: seek to end only when there are unflushed bytes (BZ #17647)
Siddhesh Poyarekar [Thu, 4 Dec 2014 02:38:37 +0000 (08:08 +0530)] 
ftell: seek to end only when there are unflushed bytes (BZ #17647)

Currently we seek to end of file if there are unflushed writes or the
stream is in write mode, to get the current offset for writing in
append mode, which is the end of file.  The latter case (i.e. stream
is in write mode, but no unflushed writes) is unnecessary since it
will only happen when the stream has just been flushed, in which case
the recorded offset ought to be reliable.

Removing that case lets ftell give the correct offset when it follows
an ftruncate.  The latter truncates the file, but does not change the
file position, due to which it is permissible to call ftell without an
intervening fseek call.

Tested on x86_64 to verify that the added test case fails without the
patch and succeeds with it, and that there are no additional
regressions due to it.

[BZ #17647]
* libio/fileops.c (do_ftell): Seek only when there are
unflushed writes.
* libio/wfileops.c (do_ftell_wide): Likewise.
* libio/tst-ftell-active-handler.c (do_ftruncate_test): New
test case.
(do_one_test): Call it.

9 years agoFix linknamespace getdate_err handling.
Joseph Myers [Wed, 3 Dec 2014 15:21:28 +0000 (15:21 +0000)] 
Fix linknamespace getdate_err handling.

Some linknamespace tests were failing because of references to
getdate_err.  References to this symbol should be allowed for XPG4 and
later XSI standards; it was missing from the whitelist of data
symbols.  This patch adds it to that list.

Tested for x86_64.

* conform/list-header-symbols.pl (%extra_syms): Add getdate_err
for XPG4, UNIX98, XOPEN2K and XOPEN2K8.
* conform/Makefile (test-xfail-XOPEN2K/pthread.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K/time.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/pthread.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/time.h/linknamespace): Likewise.

9 years agoRemove some linknamespace test XFAILs.
Joseph Myers [Tue, 2 Dec 2014 23:38:47 +0000 (23:38 +0000)] 
Remove some linknamespace test XFAILs.

It seems two of the XFAILed linknamespace tests were completely fixed
by some of my recent namespace fixes in combination (although not by
any individual one of those fixes relative to the sources used for
testing each patch, or that individual fix would also have removed the
XFAIL in question).  This patch removes those XFAILs that are no
longer needed.

Tested for x86_64.

* conform/Makefile (test-xfail-XOPEN2K/aio.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K8/aio.h/linknamespace): Likewise.

9 years agoFix getifaddrs, freeifaddrs namespace (bug 17668).
Joseph Myers [Tue, 2 Dec 2014 23:11:09 +0000 (23:11 +0000)] 
Fix getifaddrs, freeifaddrs namespace (bug 17668).

Various objects in glibc bring in ifaddrs.o (via references to
__netlink_*) and thereby getifaddrs and freeifaddrs, which are not
part of any standard supported by glibc.  These should be weak aliases
of __getifaddrs and __freeifaddrs; this patch makes them so.

(The path by which these functions are brought in is Linux-specific,
but it seems less confusing to make all versions of these functions
weak aliases rather than only the Linux-specific versions that
definitely need it.)

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by this patch).

[BZ #17668]
* inet/ifaddrs.c (getifaddrs): Rename to __getifaddrs and define
as weak alias of __getifaddrs.  Use libc_hidden_weak.
(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
__freeifaddrs.  Use libc_hidden_weak.
* sysdeps/gnu/ifaddrs.c (getifaddrs): Rename to __getifaddrs and
define as weak alias of __getifaddrs.  Use libc_hidden_weak.
(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
__freeifaddrs.  Use libc_hidden_weak.
* sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Rename to
__getifaddrs and define as weak alias of __getifaddrs.  Use
libc_hidden_weak.
(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
__freeifaddrs.  Use libc_hidden_weak.
* conform/Makefile (test-xfail-XOPEN2K/net/if.h/linknamespace):
Remove variable.
(test-xfail-POSIX2008/net/if.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/net/if.h/linknamespace): Likewise.

9 years agomips: Do not use jal to reach __libc_start_main
Petar Jovanovic [Tue, 2 Dec 2014 23:04:43 +0000 (23:04 +0000)] 
mips: Do not use jal to reach __libc_start_main

Since __libc_start_main may not be in the same 256MB-aligned region as
the function __start, replace use of jal instruction with la/jalr.

This fixes linker issue reported in:
https://sourceware.org/bugzilla/show_bug.cgi?id=17601

[BZ #17601]
* sysdeps/mips/start.S (__start): Use indirect jump to call
__libc_start_main.

9 years agoFix warning in nptl/tst-stack4.c.
Joseph Myers [Tue, 2 Dec 2014 22:48:59 +0000 (22:48 +0000)] 
Fix warning in nptl/tst-stack4.c.

This patch fixes a warning in a test that was added since my recent
warning cleanup:

tst-stack4.c: In function 'dso_process':
tst-stack4.c:64:7: warning: format '%i' expects argument of type 'int', but argument 3 has type 'uintptr_t' [-Wformat=]

The original variable has type int then is cast to uintptr_t, and from
there to void *, to pass it to a thread, so reversing the process by
casting to uintptr_t and then to int is natural; this patch does so.

Tested for x86_64.

* nptl/tst-stack4.c (dso_process): Use int not uintptr_t for t.

9 years agoFix -Waddress warnings in nptl/tst-mutex1.c.
Joseph Myers [Tue, 2 Dec 2014 22:33:57 +0000 (22:33 +0000)] 
Fix -Waddress warnings in nptl/tst-mutex1.c.

This patch fixes -Waddress warnings in nptl/tst-mutex1.c from
comparing the address of an object with NULL (ATTR may either be NULL,
or the address of an object when included from other tests, and the
warning arises in the latter case).  A macro ATTR_NULL is defined
alongside ATTR and used for the tests.

Tested for x86_64.

* nptl/tst-mutex1.c: Include <stdbool.h>.
[!ATTR] (ATTR_NULL): New macro.
(do_test): Test !ATTR_NULL instead of ATTR != NULL.
* nptl/tst-mutexpi1.c (ATTR_NULL): New macro.
* nptl/tst-mutexpp1.c (ATTR_NULL): New macro.

9 years agoFix warning in posix/tst-getopt_long1.c.
Joseph Myers [Tue, 2 Dec 2014 22:03:59 +0000 (22:03 +0000)] 
Fix warning in posix/tst-getopt_long1.c.

This patch fixes a "discards qualifiers" warning in
posix/tst-getopt_long1.c.  glibc is built with -Wwrite-strings,
meaning a char * cannot be initialized directly with a string
constant; the patch casts the string constants to char *.

Tested for x86_64.

* posix/tst-getopt_long1.c (do_test): Cast elements of argv array
to char *.

9 years agoRemove excess declarations from unistd.h for XPG3/XPG4 (bug 17665).
Joseph Myers [Tue, 2 Dec 2014 21:32:48 +0000 (21:32 +0000)] 
Remove excess declarations from unistd.h for XPG3/XPG4 (bug 17665).

For XPG3/XPG4 (defined __USE_XOPEN && !defined __USE_UNIX98), unistd.h
declares many functions that should only be declared for __USE_MISC
(none of them are in XPG3/XPG4): sethostname sethostid getdomainname
setdomainname vhangup revoke profil acct getusershell endusershell
setusershell daemon.  The whole block with the [__USE_MISC ||
(__USE_XOPEN && !__USE_UNIX98)] conditional contains only functions
that are not in XPG3/XPG4, so this patch simply changes the
conditional.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by this patch).

[BZ #17665]
* posix/unistd.h [__USE_MISC || (__USE_XOPEN && !__USE_UNIX98)]:
Change conditional to [__USE_MISC].

9 years agoFix fgets_unlocked namespace issues (bug 17664).
Joseph Myers [Tue, 2 Dec 2014 21:31:24 +0000 (21:31 +0000)] 
Fix fgets_unlocked namespace issues (bug 17664).

Various POSIX functions bring in res_init.o, res_hconf.o or
mntent_r.o, which use fgets_unlocked, which is not a POSIX function.
This patch arranges for them to use __fgets_unlocked instead.  (The
IS_IN (libc) conditional in rec_hconf.c is needed because that file is
also used in nscd.)

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch except for an assertion line
number).  Note that most of the linknamespace tests that failed
because of fgets_unlocked from the resolver also fail because of other
symbols brought in by the resolver, so the number of XFAILs this
removes is limited.  Also note that fgets_unlocked failures for
unistd.h for XPG3/XPG4 showed up that actually unistd.h is declaring
too much for XPG3/XPG4 (bug 17665) - there is no actual need to make
getusershell.c use __fgets_unlocked (at least as regards formal
standards are concerned; maybe it should still change for
namespace-cleanness of _DEFAULT_SOURCE) because the functions there
aren't actually in any of the supported standards; the correct fix for
those failures will be to stop the *usershell* functions appearing in
unistd.h for XPG3/XPG4.

[BZ #17664]
* misc/mntent_r.c (__getmntent_r): Use __fgets_unlocked instead of
fgets_unlocked.
* resolv/res_hconf.c [IS_IN (libc)] (fgets_unlocked): Define to
__fgets_unlocked.
* resolv/res_init.c (__res_vinit): Use __fgets_unlocked instead of
fgets_unlocked.
* conform/Makefile (test-xfail-XPG4/sys/statvfs.h/linknamespace):
Remove variable.
(test-xfail-POSIX/sys/mman.h/linknamespace): Likewise.
(test-xfail-UNIX98/sys/mman.h/linknamespace): Likewise.
(test-xfail-UNIX98/sys/statvfs.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/sys/mman.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/sys/statvfs.h/linknamespace): Likewise.
(test-xfail-POSIX2008/sys/mman.h/linknamespace): Likewise.
(test-xfail-POSIX2008/sys/statvfs.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/sys/mman.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/sys/statvfs.h/linknamespace): Likewise.

9 years agoFix elf/tst-unique4lib.cc warning.
Joseph Myers [Tue, 2 Dec 2014 21:29:54 +0000 (21:29 +0000)] 
Fix elf/tst-unique4lib.cc warning.

This patch fixes a warning "tst-unique4lib.cc:17:12: warning: 'b'
defined but not used [-Wunused-variable]".  I'm not sure exactly what
aspects of the test are or are not significant for the issue it is
testing for; the patch makes the minimal change of marking the
variable with __attribute__ ((used)).

Tested for x86_64.

* elf/tst-unique4lib.cc (b): Mark with __attribute__ ((used)).

9 years agopowerpc: Add powerpc64 strpbrk optimization
Adhemerval Zanella [Wed, 19 Nov 2014 21:27:56 +0000 (16:27 -0500)] 
powerpc: Add powerpc64 strpbrk optimization

This patch makes the POWER7 optimized strpbrk generic by using
default doubleword stores to zero the hash, instead of VSX
instructions.  Performance on POWER7/POWER8 does not change.

9 years agopowerpc: Add powerpc64 strcspn optimization
Adhemerval Zanella [Wed, 19 Nov 2014 20:24:55 +0000 (15:24 -0500)] 
powerpc: Add powerpc64 strcspn optimization

This patch makes the POWER7 optimized strcspn generic by using
default doubleword stores to zero the hash, instead of VSX
instructions.  Performance on POWER7/POWER8 does not change.

9 years agopowerpc: Add powerpc64 strspn optimization
Adhemerval Zanella [Wed, 19 Nov 2014 19:24:18 +0000 (14:24 -0500)] 
powerpc: Add powerpc64 strspn optimization

This patch makes the POWER7 optimized strspn generic by using
default doubleword stores to zero the hash, instead of VSX
instructions. Performance on POWER7/POWER8 machines does not changed.

9 years agoFix for test "malloc_usable_size: expected 7 but got 11"
James Lemke [Wed, 26 Nov 2014 21:45:24 +0000 (13:45 -0800)] 
Fix for test "malloc_usable_size: expected 7 but got 11"

[BZ #17581] The checking chain of unused chunks was terminated by a hash of
the block pointer, which was sometimes confused with the chunk length byte.
The chain is now terminated by a NULL byte.

9 years agopowerpc: strtok{_r} optimization for powerpc64
Rajalakshmi Srinivasaraghavan [Mon, 1 Dec 2014 14:03:58 +0000 (09:03 -0500)] 
powerpc: strtok{_r} optimization for powerpc64

This patch optimizes strtok and strtok_r for POWERPC64.
A table of 256 characters is created and marked based on
the 'accept' argument and used to check for any occurance on
the input string.Loop unrolling is also used to gain improvements.

9 years agoUpdate NEWS for previous two commits
Siddhesh Poyarekar [Mon, 1 Dec 2014 10:31:29 +0000 (16:01 +0530)] 
Update NEWS for previous two commits

9 years agoNew locale raj_IN (#16857)
Pravin Satpute [Mon, 1 Dec 2014 09:53:47 +0000 (15:23 +0530)] 
New locale raj_IN (#16857)

9 years agoNew locale ce_RU (BZ #17192)
Pravin Satpute [Mon, 1 Dec 2014 09:48:33 +0000 (15:18 +0530)] 
New locale ce_RU (BZ #17192)

9 years agoFix indenting in bits/ioctl-types.h.
Carlos O'Donell [Sat, 29 Nov 2014 06:30:51 +0000 (01:30 -0500)] 
Fix indenting in bits/ioctl-types.h.

Indent the preprocessor directives correctly according
to the normal glibc style.

9 years agoUse ALIGN_UP in nptl/nptl-init.c
Carlos O'Donell [Sat, 29 Nov 2014 06:21:58 +0000 (01:21 -0500)] 
Use ALIGN_UP in nptl/nptl-init.c

Replace bespoke code to align a value with
the ALIGN_UP macro to make it easier to read.

9 years agoExpand comments in elf/ldconfig.c (search_dir)
Carlos O'Donell [Sat, 29 Nov 2014 06:04:57 +0000 (01:04 -0500)] 
Expand comments in elf/ldconfig.c (search_dir)

Developers creating development packages must take care
to have their static linker DSO link point to the actual
SONAME file. This allows ldconfig to correctly create
the required links for the SONAME. The behaviour is now
more clearly documented in a code comment added by this
patch.

9 years agoMake linknamespace tests check only relevant libraries.
Joseph Myers [Sat, 29 Nov 2014 01:46:56 +0000 (01:46 +0000)] 
Make linknamespace tests check only relevant libraries.

This patch addresses one known caveat in the linknamespace tests: with
this patch they will now only look for definitions of symbols in
relevant libraries, meaning that librt and libpthread are not checked
for ISO C standards, XPG3 and XPG4.

In particular, this means that if __pthread_initialize_minimal is
somehow brought in for one of those standards, the definition from
libc-tls.o will be considered instead of that from libpthread, so
avoiding bringing in lots of other libpthread symbols.  This should
address some of the failures reported by Carlos in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00882.html>, where
__pointer_chk_guard_local brought in __pthread_initialize_minimal.

Tested for x86_64.  The removal of one XFAIL for XPG4 actually shows
up a header bug (shm_open should not be declared for XPG4 - the
namespace issue was for symbols brought in by shm_open, which is no
longer found at all now librt isn't searched; I've filed bug 17663 for
the header bug, though it would show up eventually anyway in the
course of review of conform/ data against XPG4).

Committed.

* conform/Makefile (linknamespace-symlist-stdlibs-base): New
variable.
(linknamespace-symlist-stdlibs-tests): Likewise.
(tests-special): Append $(linknamespace-symlist-stdlibs-tests)
instead of $(objpfx)symlist-stdlibs.
(linknamespace-libs-isoc): New variable.
(linknamespace-libs): Use $(linknamespace-libs-isoc).
(linknamespace-libs-ISO): New variable.
(linknamespace-libs-ISO99): Likewise.
(linknamespace-libs-ISO11): Likewise.
(linknamespace-libs-XPG3): Likewise.
(linknamespace-libs-XPG4): Likewise.
(linknamespace-libs-POSIX): Likewise.
(linknamespace-libs-UNIX98): Likewise.
(linknamespace-libs-XOPEN2K): Likewise.
(linknamespace-libs-POSIX2008): Likewise.
(linknamespace-libs-XOPEN2K8): Likewise.
($(objpfx)symlist-stdlibs): Replace by
$(linknamespace-symlist-stdlibs-tests).  Use
$(linknamespace-libs-$*) as set of libraries.
($(linknamespace-header-tests)): Update dependencies.  Use
$(objpfx)symlist-stdlibs-$$std for --libsyms argument.
(test-xfail-XPG4/sys/mman.h/linknamespace): Remove.
* conform/linknamespace.pl: Remove comment about considering
definitions of symbols from irrelevant libraries.

9 years agoMention fix for PR 13862
H.J. Lu [Fri, 28 Nov 2014 15:59:50 +0000 (07:59 -0800)] 
Mention fix for PR 13862

9 years agoResize DTV if the current DTV isn't big enough
H.J. Lu [Fri, 28 Nov 2014 15:54:07 +0000 (07:54 -0800)] 
Resize DTV if the current DTV isn't big enough

This patch changes _dl_allocate_tls_init to resize DTV if the current DTV
isn't big enough.  Tested on X86-64, x32 and ia32.

[BZ #13862]
* elf/dl-tls.c: Include <atomic.h>.
(oom): Remove #ifdef SHARED/#endif.
(_dl_static_dtv, _dl_initial_dtv): Moved before ...
(_dl_resize_dtv): This.  Extracted from _dl_update_slotinfo.
(_dl_allocate_tls_init): Resize DTV if the current DTV isn't
big enough.
(_dl_update_slotinfo): Call _dl_resize_dtv to resize DTV.
* nptl/Makefile (tests): Add tst-stack4.
(modules-names): Add tst-stack4mod.
($(objpfx)tst-stack4): New.
(tst-stack4mod.sos): Likewise.
($(objpfx)tst-stack4.out): Likewise.
($(tst-stack4mod.sos)): Likewise.
(clean): Likewise.
* nptl/tst-stack4.c: New file.
* nptl/tst-stack4mod.c: Likewise.

9 years agoRecognize recent x86 CPUs in string.h
J. Brown [Thu, 23 Oct 2014 13:28:06 +0000 (15:28 +0200)] 
Recognize recent x86 CPUs in string.h

9 years agoAvoid deprecated sigblock in misc/tst-pselect.c.
Joseph Myers [Thu, 27 Nov 2014 16:02:26 +0000 (16:02 +0000)] 
Avoid deprecated sigblock in misc/tst-pselect.c.

misc/tst-pselect.c uses the deprecated sigblock interface, resulting
in "tst-pselect.c:42:3: warning: 'sigblock' is deprecated (declared at
../signal/signal.h:189) [-Wdeprecated-declarations]".  The choice of
sigblock rather than sigprocmask has nothing to do with what this test
is testing, so this patch changes it to use sigprocmask to avoid the
warning.

Tested for x86_64.

* misc/tst-pselect.c (do_test): Use sigprocmask instead of
sigblock.

9 years agoFix libio/bug-ungetwc1.c warning.
Joseph Myers [Thu, 27 Nov 2014 16:01:04 +0000 (16:01 +0000)] 
Fix libio/bug-ungetwc1.c warning.

This patch fixes a warning "variable 'wc' set but not used" in
libio/bug-ungetwc1.c.

The test didn't verify much about the results of the functions it
called.  This patch makes it check the result of getwc (thereby fixing
the warning), check end of file does not arrive too late in the getwc
loop, and check EOF is no longer set after ungetwc.

Tested for x86_64.

* libio/bug-ungetwc1.c (do_test): Verify results of getwc and
feof.

9 years agoFix dlfcn/failtestmod.c warning.
Joseph Myers [Thu, 27 Nov 2014 16:00:08 +0000 (16:00 +0000)] 
Fix dlfcn/failtestmod.c warning.

This patch fixes a "set but not used" warning from
dlfcn/failtestmod.c.  A variable is used only to store the return
value from dlsym.  As I understand this test, the point is simply to
do a sequence of load / unload operations in a loop, and all that
matters here is that dlsym gets called and returns without crashing,
not what its return value is.  So this patch removes the assignment to
a variable.

Tested for x86_64.

* dlfcn/failtestmod.c (constr): Do not store result of dlsym in a
variable.

9 years agoAdd missing include of libc-internal.h.
Stefan Liebler [Thu, 27 Nov 2014 10:07:16 +0000 (11:07 +0100)] 
Add missing include of libc-internal.h.

9 years agoDon't use __warn_memset_zero_len for gcc-5.0 or newer
Siddhesh Poyarekar [Thu, 27 Nov 2014 05:45:45 +0000 (11:15 +0530)] 
Don't use __warn_memset_zero_len for gcc-5.0 or newer

gcc now warns when the arguments to memset may have been accidentally
transposed (i.e. length set to zero instead of the byte), so we don't
need that bit of the code in glibc headers anymore.

Tested on x86_64.  Coe generated by gcc 4.8 is identical with or
without the patch.  I also tested gcc master, which does not result in
any new failures.  It does fail quite a few FORTIFY_SOURCE tests, but
those failures are not due to this patch.

9 years agoFix stdio-common/tst-fmemopen.c format warnings.
Joseph Myers [Thu, 27 Nov 2014 03:25:15 +0000 (03:25 +0000)] 
Fix stdio-common/tst-fmemopen.c format warnings.

Testing for 32-bit x86 shows up warnings in
stdio-common/tst-fmemopen.c where off_t values are passed to %zu
printf formats.  Since the values are in messages relating to function
calls where the relevant argument is of type size_t, it seems most
appropriate to cast explicitly to size_t when passing to printf, which
this patch does.

Tested for 32-bit x86.

* stdio-common/tst-fmemopen.c (do_test): Cast st_size values to
size_t for %zu format.

9 years agoFix nss/tst-nss-test1.c format warning.
Joseph Myers [Thu, 27 Nov 2014 03:24:18 +0000 (03:24 +0000)] 
Fix nss/tst-nss-test1.c format warning.

Testing for 32-bit x86 shows up a warning "tst-nss-test1.c:25:3:
warning: format '%ju' expects argument of type 'uintmax_t', but
argument 2 has type 'int' [-Wformat=]".  The argument is a difference
of two pointers, a signed quantity of type ptrdiff_t for which the
right format is %td; this patch makes this test use that format.

Tested for 32-bit x86.

* nss/tst-nss-test1.c (do_test): Use %td printf format for pointer
difference, not %ju.

9 years agoAvoid warnings for unused results in nscd/connections.c.
Joseph Myers [Wed, 26 Nov 2014 20:54:16 +0000 (20:54 +0000)] 
Avoid warnings for unused results in nscd/connections.c.

This patch avoids warnings for unused results of setuid and setgid in
nscd/connections.c using an ignore_value macro along the lines
suggested by Paul in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00733.html>.

Tested for x86_64.

* include/libc-internal.h (ignore_value): New macro.
* nscd/connections.c (restart): Wrap calls to setuid and setgid
with ignore_value.

9 years agoFix sysdeps/mips/__longjmp.c warning.
Joseph Myers [Wed, 26 Nov 2014 16:34:06 +0000 (16:34 +0000)] 
Fix sysdeps/mips/__longjmp.c warning.

This patch fixes

../sysdeps/mips/__longjmp.c:27:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]

which arose I think from the MIPS16 changes (renaming the function to
____longjmp with an alias __longjmp, so a prior header prototype for
__longjmp no longer sufficed to prevent a warning).  I've made the
function use a prototype definition, which is what we want for all
function definitions in glibc anyway.

Tested for MIPS.

* sysdeps/mips/__longjmp.c (____longjmp): Use prototype
definition.

9 years agoFix nptl/tst-cancel-self-cancelstate.c warning.
Joseph Myers [Wed, 26 Nov 2014 16:07:39 +0000 (16:07 +0000)] 
Fix nptl/tst-cancel-self-cancelstate.c warning.

This patch fixes "../sysdeps/nptl/pthread.h:670:26: warning:
initialization discards 'volatile' qualifier from pointer target type"
arising when building nptl/tst-cancel-self-cancelstate.c.  The problem
is passing a volatile int * to a macro expecting void *; the patch
adds an explicit cast.

Tested for x86_64.

* nptl/tst-cancel-self-cancelstate.c (do_test): Cast argument of
pthread_cleanup_push to void *.

9 years agoFix sysdeps/unix/sysv/linux/arm/libc-do-syscall.S warning.
Joseph Myers [Wed, 26 Nov 2014 15:13:27 +0000 (15:13 +0000)] 
Fix sysdeps/unix/sysv/linux/arm/libc-do-syscall.S warning.

This patch fixes a warning

../include/features.h:328:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]

seen when building for ARM.  This warning comes from libc-do-syscall.S
being built for nscd: the nscd build uses _FORTIFY_SOURCE, while .S
files aren't built with -O, and the combination produces a warning.
As _FORTIFY_SOURCE doesn't do anything for .S files, undefining it in
libc-do-syscall.S seems the simplest solution.

Tested for ARM.

* sysdeps/unix/sysv/linux/arm/libc-do-syscall.S (_FORTIFY_SOURCE):
Undefine.

9 years agoFIx ldbl-128ibm frexpl for 32-bit systems (bug 16619, bug 16740).
Joseph Myers [Wed, 26 Nov 2014 13:54:55 +0000 (13:54 +0000)] 
FIx ldbl-128ibm frexpl for 32-bit systems (bug 16619, bug 16740).

This patch fixes bugs in ldbl-128ibm frexpl for 32-bit systems shown
up by warnings:

../sysdeps/ieee754/ldbl-128ibm/s_frexpl.c:82:4: warning: left shift count >= width of type
../sysdeps/ieee754/ldbl-128ibm/s_frexpl.c:129:5: warning: left shift count >= width of type

This did in fact show up in test-ldouble.out (alongside all the other
problems there ... maybe we should again consider running the libm
tests at finer granularity from the makefiles) as already covered by
the testsuite after the previous patch that fixed these bugs for
64-bit systems.  The fix is simply using 1LL instead of 1L when
shifting by 52.

Tested for powerpc32 (soft float).

[BZ #16619]
[BZ #16740]
* sysdeps/ieee754/ldbl-128ibm/s_frexpl.c (__frexpl): Use 1LL << 52
instead of 1L << 52.

9 years agoFix warnings in fwscanf / rewind tests.
Joseph Myers [Wed, 26 Nov 2014 12:54:39 +0000 (12:54 +0000)] 
Fix warnings in fwscanf / rewind tests.

This patch fixes "set but not used" warnings in the tests
libio/bug-rewind.c and libio/bug-rewind2.c by checking the return
values from fwscanf and making the tests fail if those values aren't
as expected.

Tested for x86_64.

* libio/bug-rewind.c (do_test): Check fwscanf return values.
* libio/bug-rewind2.c (do_test): Likewise.

9 years agoRemove TEST_IFUNC, tests-ifunc and *-ifunc.c tests.
Joseph Myers [Wed, 26 Nov 2014 12:53:36 +0000 (12:53 +0000)] 
Remove TEST_IFUNC, tests-ifunc and *-ifunc.c tests.

TEST_IFUNC is only tested in two headers, bench-string.h and
test-string.h, after it gets defined by those headers, and it never
gets undefined.

Thus no defines of TEST_IFUNC are needed, and the *-ifunc.c tests that
just define TEST_IFUNC and include other tests are also redundant, as
is the code to remove $(tests-ifunc) and $(xtests-ifunc) conditionally
from tests and xtests.  This patch removes the useless defines and
tests of TEST_IFUNC and the associated useless tests and makefile
code.  It thereby fixes a series of warnings
"../string/test-string.h:21:0: warning: "TEST_IFUNC" redefined" where
test-string.h defines TEST_IFUNC to empty, other files define it to 1
and this produces warnings.

Tested for x86_64.

* debug/test-stpcpy_chk-ifunc.c: Remove file.
* debug/test-strcpy_chk-ifunc.c: Likewise.
* wcsmbs/test-wcschr-ifunc.c: Likewise.
* wcsmbs/test-wcscmp-ifunc.c: Likewise.
* wcsmbs/test-wcscpy-ifunc.c: Likewise.
* wcsmbs/test-wcslen-ifunc.c: Likewise.
* wcsmbs/test-wcsrchr-ifunc.c: Likewise.
* wcsmbs/test-wmemcmp-ifunc.c: Likewise.
* Rules [$(multi-arch) = no] (tests): Do not filter out
$(tests-ifunc).
[$(multi-arch) = no] (xtests): Do not filter out $(xtests-ifunc).
* debug/Makefile (tests-ifunc): Remove variable.
(tests): Do not add $(tests-ifunc).
* wcsmbs/Makefile (tests-ifunc): Remove variable.
(tests): Do not add $(tests-ifunc).
* benchtests/bench-string.h (TEST_IFUNC): Remove macro.
[TEST_IFUNC]: Remove conditionals.
* string/test-string.h (TEST_IFUNC): Remove macro.
[TEST_IFUNC]: Remove conditionals.

9 years agoFix test-strchr.c warnings for wide string testing.
Joseph Myers [Wed, 26 Nov 2014 12:52:08 +0000 (12:52 +0000)] 
Fix test-strchr.c warnings for wide string testing.

string/test-strchr.c is used for both wide and narrow string testing,
but produces a series of warnings for wide string testing because of
hardcoded use of narrow characters in the function check1.  This patch
fixes that function to use macros abstracting away the wide / narrow
string choice, adding a new such macro to handle the string and
character constants.

Tested for x86_64.

* string/test-strchr.c [!WIDE] (L): New macro.
[WIDE] (L): Likewise.
(check1): Use CHAR instead of char.  Use L on string and character
constants.

9 years agopowerpc: Fix missing barriers in atomic_exchange_and_add_{acq,rel}
Adhemerval Zanella [Tue, 25 Nov 2014 19:32:54 +0000 (14:32 -0500)] 
powerpc: Fix missing barriers in atomic_exchange_and_add_{acq,rel}

On powerpc, atomic_exchange_and_add is implemented without any
barriers.  This patchs adds the missing instruction and memory barrier
for acquire and release semanthics.

9 years agoFix synchronization of TPP min/max priorities.
Torvald Riegel [Tue, 25 Nov 2014 18:48:56 +0000 (19:48 +0100)] 
Fix synchronization of TPP min/max priorities.

* nptl/tpp.c (__init_sched_fifo_prio, __pthread_tpp_change_priority):
Change synchronization of __sched_fifo_min_prio and
__sched_fifo_max_prio.
* nptl/pthread_mutexattr_getprioceiling.c
(pthread_mutexattr_getprioceiling): Likewise.
* nptl/pthread_mutexattr_setprioceiling.c
(pthread_mutexattr_setprioceiling): Likewise.
* nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise.
* nptl/pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling):
Likewise.

9 years agoFix warning in setjmp/jmpbug.c.
Joseph Myers [Wed, 26 Nov 2014 00:45:19 +0000 (00:45 +0000)] 
Fix warning in setjmp/jmpbug.c.

This patch fixes a "set but not used" warning in setjmp/jmpbug.c.  A
variable is used only to store the result of alloca.  A cast to void
is added to avoid the warning, and the variable is made volatile to
ensure the call to alloca isn't optimized away for being unused.

Tested for x86_64.

* setjmp/jmpbug.c (test): Make foo volatile and cast it to
void.

9 years agoFix warning in stdio-common/tst-printf-round.c.
Joseph Myers [Tue, 25 Nov 2014 23:31:21 +0000 (23:31 +0000)] 
Fix warning in stdio-common/tst-printf-round.c.

This patch fixes warnings of the form "tst-printf-round.c:202:17:
warning: passing argument 3 of 'test_hex_in_one_mode' discards 'const'
qualifier from pointer target type", by adding an extra const to that
argument (so that after array-to-pointer conversion it's const char
*const *).

Tested for x86_64.

* stdio-common/tst-printf-round.c (test_hex_in_one_mode): Make
third argument const.

9 years agofnmatch: work around GCC compiler warning bug with uninit var
Paul Eggert [Tue, 25 Nov 2014 22:12:48 +0000 (14:12 -0800)] 
fnmatch: work around GCC compiler warning bug with uninit var

* posix/fnmatch_loop.c (FCT): Use a scalar not a one-item array.
This works around a bug with x86-64 GCC 4.9.2 and earlier
where 'gcc -O2 -Wmaybe-uninitialized' incorrectly complains
"../locale/weightwc.h:93:7: warning: '*((void *)&str+4)' may be
used uninitialized in this function [-Wmaybe-uninitialized]".

9 years agoFix warning in posix/bug-regex31.c.
Joseph Myers [Tue, 25 Nov 2014 21:40:51 +0000 (21:40 +0000)] 
Fix warning in posix/bug-regex31.c.

This patch fixes a "set but not used" warning in posix/bug-regex31.c.
A variable res stored an indication of whether the test behaved as
expected, but was then ignored and the test returned 0 unconditionally
(as an mtrace test, the auxiliary test for leaks could still have
failed if that bug was present).  This patch makes the test return
res.

Tested for x86_64.

* posix/bug-regex31.c (main): Return RES not 0.