Commit Graph

1467 Commits

Author SHA1 Message Date
Carlos O'Donell ebda2f17ff NEWS: Fix spelling. 2015-02-06 12:59:37 -05:00
Florian Weimer 46d54873c3 NEWS: Also mention CVE-2015-1473 2015-02-06 16:56:53 +01:00
Joseph Myers 1c7a4a51a3 soft-fp: Fix _FP_FMA when product is zero and third argument is finite (bug 17932).
soft-fp's _FP_FMA fails to set the result's exponent for cases where
the result of the multiplication is 0, yielding incorrect (arbitrary,
depending on uninitialized values) results for those cases.  This
affects libm for architectures using soft-fp to implement fma.  This
patch adds the exponent setting and tests for this case.

Tested for ARM soft-float (which uses soft-fp fma), x86_64 and x86 (to
verify not introducing new libm test failures there).

(This bug showed up in testing my patch to move the Linux kernel to
current soft-fp.  math/Makefile has "override CFLAGS +=
-Wno-uninitialized" which would have stopped compiler warnings from
showing up this problem, although I wouldn't be surprised if removing
that shows spurious warnings from this code, if the compiler fails to
follow that various cases where the exponent is uninitialized don't
need it initialized because the class is set to a value meaning the
uninitialized exponent isn't used.)

	[BZ #17932]
	* soft-fp/op-common.h (_FP_FMA): Set exponent of result in case
	where multiplication results in zero and third argument is finite
	and nonzero.
	* math/auto-libm-test-in: Add more tests of fma.
	* math/auto-libm-test-out: Regenerated.
2015-02-06 15:44:07 +00:00
Paul Pluzhnikov 5bd80bfe9c CVE-2015-1472: wscanf allocates too little memory
BZ #16618

Under certain conditions wscanf can allocate too little memory for the
to-be-scanned arguments and overflow the allocated buffer.  The
implementation now correctly computes the required buffer size when
using malloc.

A regression test was added to tst-sscanf.
2015-02-06 00:34:51 -05:00
H.J. Lu 5f3d0b78e0 Use AVX unaligned memcpy only if AVX2 is available
memcpy with unaligned 256-bit AVX register loads/stores are slow on older
processorsl like Sandy Bridge.  This patch adds bit_AVX_Fast_Unaligned_Load
and sets it only when AVX2 is available.

	[BZ #17801]
	* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
	Set the bit_AVX_Fast_Unaligned_Load bit for AVX2.
	* sysdeps/x86_64/multiarch/init-arch.h (bit_AVX_Fast_Unaligned_Load):
	New.
	(index_AVX_Fast_Unaligned_Load): Likewise.
	(HAS_AVX_FAST_UNALIGNED_LOAD): Likewise.
	* sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Check the
	bit_AVX_Fast_Unaligned_Load bit instead of the bit_AVX_Usable bit.
	* sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk): Likewise.
	* sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk): Likewise.
	* sysdeps/x86_64/multiarch/memmove.c (__libc_memmove): Replace
	HAS_AVX with HAS_AVX_FAST_UNALIGNED_LOAD.
	* sysdeps/x86_64/multiarch/memmove_chk.c (__memmove_chk): Likewise.
2015-01-30 15:37:58 -08:00
Siddhesh Poyarekar 3cb26316b4 Initialize nscd stats data [BZ #17892]
The padding bytes in the statsdata struct are not initialized, due to
which valgrind throws a warning:

==11384== Memcheck, a memory error detector
==11384== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==11384== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==11384== Command: nscd -d
==11384==
Fri 25 Apr 2014 10:34:53 AM CEST - 11384: handle_request: request received (Version = 2) from PID 11396
Fri 25 Apr 2014 10:34:53 AM CEST - 11384:       GETSTAT
==11384== Thread 6:
==11384== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
==11384==    at 0x4E4ACDC: send (in /lib64/libpthread-2.12.so)
==11384==    by 0x11AF6B: send_stats (in /usr/sbin/nscd)
==11384==    by 0x112F75: nscd_run_worker (in /usr/sbin/nscd)
==11384==    by 0x4E439D0: start_thread (in /lib64/libpthread-2.12.so)
==11384==    by 0x599AB6C: clone (in /lib64/libc-2.12.so)
==11384==  Address 0x15708395 is on thread 6's stack

Fix the warning by initializing the structure.
2015-01-29 10:30:09 +05:30
Adhemerval Zanella d4d0ecb244 powerpc: Fix fesetexceptflag [BZ#17885]
This patch fixes a bug introduced by 18f2945ae9, where it optimizes
the FPSCR set by just issuing a mtfs instruction if new flag is different
from older one.  The issue is a typo, where the new flag should the the
new value, instead of the old one.

It fixes BZ#17885.
2015-01-28 05:59:21 -05:00
Adhemerval Zanella 08cee2a464 powerpc: Fix fsqrt build in libm [BZ#16576]
Some powerpc64 processors (e5500 core for instance) does not provide the
fsqrt instruction, however current check to use in math_private.h is
__WORDSIZE and _ARCH_PWR4 (ISA 2.02).  This is patch change it to use
the compiler flag _ARCH_PPCSQ (which is the same condition GCC uses to
decide whether to generate fsqrt instruction).

It fixes BZ#16576.
2015-01-28 05:59:16 -05:00
Bram 9317ea653a Fix segmentation fault when LD_LIBRARY_PATH contains only non-existings paths 2015-01-25 15:12:10 +10:00
Adhemerval Zanella bea5801360 powerpc: Fix powerpc64 build failure with binutils 2.22
GLIBC memset optimization for POWER8 uses the '.machine power8'
directive, which is only supported officially on binutils 2.24+.  This
causes a build failure on older binutils.

Since the requirement of .machine power8 is to correctly assembly the
'mtvsrd' instruction and it is already handled by the MTVSRD_V1_R4
macro, there is no really needed of using it.

The patch replaces the power8 with power7 for .machine directive.

It fixes BZ#17869.
2015-01-24 08:40:04 -05:00
Adhemerval Zanella 0e87343e20 powerpc: Fix ifuncmain6pie failure with GCC 4.9
This patch fix the elf/ifuncmain6pie failure when building with GCC
4.9+.  For some reason, the compiler removes the branch taken code at
resolve_ifunc (sysdeps/powerpc/powerpc64/dl-machine.h) as dead-code
and thus the testcase fails because the ifunc resolves branches to an
invalid memory location.  It fixes by explicit adding a dependency of
value based on odp variable to avoid compiler optimization.

It fixes BZ#17868.
2015-01-24 08:38:39 -05:00
H.J. Lu 22971c35e2 Use uint64_t and (uint64_t) 1 for 64-bit int
This patch replaces unsigned long int and 1UL with uint64_t and
(uint64_t) 1 to support ILP32 targets like x32.

	[BZ #17870]
	* nptl/sem_post.c (__new_sem_post): Replace unsigned long int
	with uint64_t.
	* nptl/sem_waitcommon.c (__sem_wait_cleanup): Replace 1UL with
	(uint64_t) 1.
	(__new_sem_wait_slow): Replace unsigned long int with uint64_t.
	Replace 1UL with (uint64_t) 1.
	* sysdeps/nptl/internaltypes.h (new_sem): Replace unsigned long
	int with uint64_t.
2015-01-23 14:48:40 -08:00
Adhemerval Zanella 6b2ba95b6b BZ #16418: Fix powerpc get_clockfreq raciness
This patch fix powerpc __get_clockfreq racy and cancel-safe issues by
dropping internal static cache and by using nocancel file operations.
The vDSO failure check is also removed, since kernel code does not
return an error (it cleans cr0.so bit on function return) and the static
code (to read value /proc) now uses non-cancellable calls.
2015-01-21 10:46:49 -05:00
Carlos O'Donell ccdb048df4 Fix recursive dlopen.
The ability to recursively call dlopen is useful for malloc
implementations that wish to load other dynamic modules that
implement reentrant/AS-safe functions to use in their own
implementation.

Given that a user malloc implementation may be called by an
ongoing dlopen to allocate memory the user malloc
implementation interrupts dlopen and if it calls dlopen again
that's a reentrant call.

This patch fixes the issues with the ld.so.cache mapping
and the _r_debug assertion which prevent this from working
as expected.

See:
https://sourceware.org/ml/libc-alpha/2014-12/msg00446.html
2015-01-21 01:51:10 -05:00
Carlos O'Donell 042e1521c7 Fix semaphore destruction (bug 12674).
This commit fixes semaphore destruction by either using 64b atomic
operations (where available), or by using two separate fields when only
32b atomic operations are available.  In the latter case, we keep a
conservative estimate of whether there are any waiting threads in one
bit of the field that counts the number of available tokens, thus
allowing sem_post to atomically both add a token and determine whether
it needs to call futex_wake.

See:
https://sourceware.org/ml/libc-alpha/2014-12/msg00155.html
2015-01-21 00:46:16 -05:00
Chung-Lin Tang 522e6ee3b4 Commit nios2 port to master. 2015-01-17 22:29:12 -08:00
Stefan Liebler 026eb207ed S390: Get rid of linknamespace failures for utmp functions. 2015-01-16 09:18:58 +01:00
Stefan Liebler 1d53248326 S390: Get rid of linknamespace failures for string functions. 2015-01-16 09:17:32 +01:00
Adhemerval Zanella d3b00f468b powerpc: Optimized strncmp for POWER8/PPC64
This patch adds an optimized POWER8 strncmp.  The implementation focus
on speeding up unaligned cases follwing the ideas of power8 strcmp.

The algorithm first check the initial 16 bytes, then align the first
function source and uses unaligned loads on second argument only.
Aditional checks for page boundaries are done for unaligned cases
(where sources alignment are different).
2015-01-13 14:35:40 -05:00
Adhemerval Zanella 8bedcb5f03 powerpc: Optimized strcmp for POWER8/PPC64
This patch adds an optimized POWER8 strcmp using unaligned accesses.
The algorithm first check the initial 16 bytes, then align the first
function source and uses unaligned loads on second argument only.
Aditional checks for page boundaries are done for unaligned cases
2015-01-13 11:28:58 -05:00
Adhemerval Zanella f06a4faf8a powerpc: Optimized st{r,p}ncpy for POWER8/PPC64
This patch adds an optimized POWER8 st{r,p}ncpy using unaligned accesses.
It shows 10%-80% improvement over the optimized POWER7 one that uses
only aligned accesses, specially on unaligned inputs.

The algorithm first read and check 16 bytes (if inputs do not cross a 4K
page size).  The it realign source to 16-bytes and issue a 16 bytes read
and compare loop to speedup null byte checks for large strings.  Also,
different from POWER7 optimization, the null pad is done inline in the
implementation using possible unaligned accesses, instead of realying on
a memset call.  Special case is added for page cross reads.
2015-01-13 11:28:44 -05:00
Adhemerval Zanella 96d6fd6c40 powerpc: Optimized st{r,p}cpy for POWER8/PPC64
This patch adds an optimized POWER8 strcpy using unaligned accesses.
For strings up to 16 bytes the implementation first calculate the
string size, like strlen, and issues a memcpy.  For larger strings,
source is first aligned to 16 bytes and then tested over a loop that
reads 16 bytes am combine the cmpb results for speedup.  Special case is
added for page cross reads.

It shows 30%-60% improvement over the optimized POWER7 one that uses
only aligned accesses.
2015-01-13 11:28:30 -05:00
Leonhard Holz 0f9e585480 Fix memory handling in strxfrm_l [BZ #16009]
[Modified from the original email by Siddhesh Poyarekar]

This patch solves bug #16009 by implementing an additional path in
strxfrm that does not depend on caching the weight and rule indices.

In detail the following changed:

* The old main loop was factored out of strxfrm_l into the function
do_xfrm_cached to be able to alternativly use the non-caching version
do_xfrm.

* strxfrm_l allocates a a fixed size array on the stack. If this is not
sufficiant to store the weight and rule indices, the non-caching path is
taken. As the cache size is not dependent on the input there can be no
problems with integer overflows or stack allocations greater than
__MAX_ALLOCA_CUTOFF. Note that malloc-ing is not possible because the
definition of strxfrm does not allow an oom errorhandling.

* The uncached path determines the weight and rule index for every char
and for every pass again.

* Passing all the locale data array by array resulted in very long
parameter lists, so I introduced a structure that holds them.

* Checking for zero src string has been moved a bit upwards, it is
before the locale data initialization now.

* To verify that the non-caching path works correct I added a test run
to localedata/sort-test.sh & localedata/xfrm-test.c where all strings
are patched up with spaces so that they are too large for the caching path.
2015-01-13 11:33:56 +05:30
Joseph Myers 5a9e4c09a2 Fix ldbl-96 scalblnl underflowing results (bug 17803).
The ldbl-96 implementation of scalblnl (used for x86_64 and ia64) uses
a condition k <= -63 to determine when a standard underflowing result
tiny*__copysignl(tiny,x) should be returned.  However, that condition
corresponds to values with exponent -16446 or less, and in the case of
-16446, the correct result for round-to-nearest depends on whether the
value is exactly 0x1p-16446 (half the least subnormal) or more than
that.  This patch fixes the bug by changing the condition to k <= -64
and accordingly adjusting the exponent by 64 not 63 when converting to
a normal value.

Tested for x86_64.

	[BZ #17803]
	* sysdeps/ieee754/ldbl-96/s_scalblnl.c (twom63): Rename to
	twom64.  Adjust value to 0x1p-64L.
	(__scalblnl): Only return standard underflowing result for K <=
	-64 not K <= -63; adjust exponent for underflowing result by 64
	not 63.
	* math/libm-test.inc (scalbn_test_data): Add more tests.
	(scalbln_test_data): Likewise.
2015-01-12 23:02:14 +00:00
Joseph Myers 34e93d6c76 Fix ldbl-96 scalblnl for subnormal arguments (bug 17834).
The ldbl-96 implementation of scalblnl (used for x86_64 and ia64) is
incorrect for subnormal arguments (this is a separate bug from bug
17803, which is about underflowing results).  There are two problems
with the adjustments of subnormal arguments: the "two63" variable
multiplied by is actually 0x1p52L not 0x1p63L, so is insufficient to
make values normal, and then GET_LDOUBLE_EXP(es,x), used to extract
the new exponent, extracts it into a variable that isn't used, while
the value taken to by the new exponent is wrongly taken from the high
part of the mantissa before the adjustment (hx).  This patch fixes
both those problems and adds appropriate tests.

Tested for x86_64.

	[BZ #17834]
	* sysdeps/ieee754/ldbl-96/s_scalblnl.c (two63): Change value to
	0x1p63L.
	(__scalblnl): Get new exponent of adjusted subnormal value from ES
	not HX.
	* math/libm-test.inc (scalbn_test_data): Add more tests.
	(scalbln_test_data): Likewise.
2015-01-12 22:34:58 +00:00
Adhemerval Zanella 8d2c0a593b powerpc: Add the lock elision using HTM
This patch adds support for lock elision using ISA 2.07 hardware
transactional memory instructions for pthread_mutex primitives.
Similar to s390 version, the for elision logic defined in
'force-elision.h' is only enabled if ENABLE_LOCK_ELISION is defined.

Also, the lock elision code should be able to be built even with
a compiler that does not provide HTM support with builtins.
However I have noted the performance is sub-optimal due scheduling
pressures.
2015-01-12 06:30:19 -05:00
Andreas Schwab ec4fbd4800 Remove 17581 from NEWS 2015-01-12 10:28:09 +01:00
Matthew Fortune aee6626c30 MicroBlaze: Fix BZ17791 - Remove fixed page size macros and others
Microblaze apparently has a variable page size (see thread below) and
should not hard-code any page-size related macros.
Also remove macros that are only used for BFD's trad-core support
which is not relavant for microblaze also according to the thread
starting here:

https://sourceware.org/ml/libc-ports/2013-11/msg00028.html

This patch is neither built nor tested but mirrors a MIPS patch that
fixes the same issue.

Thanks,
Matthew

     * sysdepsysdeps/unix/sysv/linux/microblaze/sys/user.h
     (PAGE_SHIFT, PAGE_SIZE, PAGE_MASK, NBPG, UPAGES): Remove.
     (HOST_TEXT_START_ADDR, HOST_STACK_END_ADDR): Remove.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 17:34:46 +10:00
Matthew Fortune 28c38448de NEWS for MIPS ABIs
* NEWS: Announce support for new MIPS ABI extensions.
2015-01-08 10:02:27 +00:00
Joseph Myers 8116321f65 Fix libm feupdateenv namespace (bug 17748).
Concluding the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of feupdateenv by making it a weak alias for
__feupdateenv and making the affected code call __feupdateenv.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  Also tested for ARM
(soft-float) that the math.h linknamespace tests now pass.

	[BZ #17748]
	* include/fenv.h (__feupdateenv): Use libm_hidden_proto.
	* math/feupdateenv.c (__feupdateenv): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/arm/feupdateenv.c (feupdateenv): Rename to __feupdateenv
	and define as weak alias of __feupdateenv.  Use libm_hidden_weak.
	* sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/powerpc/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c
	(__feupdateenv): Likewise.
	* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/tile/math_private.h (__feupdateenv): New inline
	function.
	* sysdeps/x86_64/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/generic/math_private.h (default_libc_feupdateenv): Call
	__feupdateenv instead of feupdateenv.
	(default_libc_feupdateenv_test): Likewise.
	(libc_feresetround_ctx): Likewise.
2015-01-07 19:01:20 +00:00
Richard Earnshaw dc400d7b73 AArch64: Optimized implementations of strcpy and stpcpy. 2015-01-07 11:31:10 +00:00
Richard Earnshaw ec582ca0f3 AArch64 optimized implementation of strrchr. 2015-01-07 11:26:13 +00:00
Eric Biggers d5b1c5ed8b setenv fix memory leak when setting large, duplicate string (BZ #17658)
glibc maintains a binary tree of environment strings it malloc()ed
itself.  However, it's possible for it to malloc() a string, then find
that an identical string is already in the tree.  In this case, the
memory is leaked and is not freed if the application later calls
__libc_freeres().  Fix this by freeing 'new_value' when it's unneeded.

Test case:
	#include <stdlib.h>
	#include <string.h>

	int main()
	{
		char *p = calloc(100000, 1);
		memset(p, 'A', 99999);
		setenv("TESTVAR", p, 1);
		setenv("TESTVAR", p, 1);
		free(p);
	}

Leak that was reported by valgrind:
	100,008 bytes in 1 blocks are definitely lost in loss record 1 of 1
	   at 0x4C29F90: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
	   by 0x4E6B3D4: __add_to_environ (setenv.c:176)
	   by 0x4C31B8F: setenv (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
	   by 0x400642: main (in /mnt/tmpfs/a.out)
2015-01-07 12:10:52 +05:30
Vladimir A. Nazarenko fb87ee96d7 Fix incorrect mount table entry parsing in __getmntent_r
When mount entry contains only four fields and have more then one space or
tab at the and, mp.mnt_freq and mp.mnt_passno will be set to some specific
values as side effect from parsing of previus mount entry. It is because
sscanf(""," %d %d ", &a, &b) returns -1, but this case is unprocessed.
Values of mp.mnt_freq and  mp.mnt_passno stays unchanged. This patch is
attempt to fix described issue by removing trailing tabs and spaces.
2015-01-06 19:51:01 -08:00
H.J. Lu 1cf98e27a7 Mention bug fix for BZ #17806 2015-01-06 09:32:41 -08:00
H.J. Lu 57ada0e7e7 Define CLOCKS_PER_SEC type to the type clock_t
C99 specifies that CLOCKS_PER_SEC is an expression with the type clock_t.
This patch adds a generic <bits/time2.h> to define CLOCKS_PER_SEC and
provides the Linux/x86-64 version of <bits/time2.h> to support x32.

	[BZ #17797]
	* bits/time.h (CLOCKS_PER_SEC): Changed to ((clock_t) 1000000).
	* sysdeps/unix/sysv/linux/bits/time.h (CLOCKS_PER_SEC): Likewise.
	* sysdeps/unix/sysv/linux/clock.c (clock): _Static_assert
	CLOCKS_PER_SEC == 1000000.
	* time/clocktest.c (main): Replace %ld with %jd and cast to
	intmax_t.
2015-01-06 04:59:13 -08:00
Joseph Myers ac4c11f580 Fix MIPS n64 posix_fadvise namespace (bug 17796).
sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c defines
posix_fadvise64 as a strong alias for posix_fadvise (for
!SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) - i.e., for static
linking, which is the case when this matters), but it should be a weak
alias.  This patch makes it a weak alias.

Tested for MIPS that this fixes the observed linknamespace test
failures.

	[BZ #17796]
	* sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c
	[!SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)] (posix_fadvise64):
	Define as weak alias not strong alias.
2015-01-05 18:02:31 +00:00
Joseph Myers ab70da77ea Fix ARM posix_fadvise64 namespace (bug 17793).
ARM posix_fadvise calls __posix_fadvise64_l64, to which
posix_fadvise64 is a strong alias, but posix_fadvise is a POSIX
function and posix_fadvise64 isn't.  This patch changes it into a weak
alias.

Tested for ARM that this fixes the corresponding linknamespace test
failures.

	[BZ #17793]
	* sysdeps/unix/sysv/linux/arm/posix_fadvise64.c (posix_fadvise64):
	Define as weak alias not strong alias.
2015-01-05 16:05:34 +00:00
Joseph Myers b8986484e4 Fix isblank / isascii / toascii namespace (bug 17635).
Use of isblank brings in isascii and toascii, but isblank is a C99
function and the other two aren't; similarly, isascii and toascii are
UNIX98 functions and bring in isblank, which isn't.  (Not a
conformance issue because of the is* and to* reservation, but still
contrary to glibc practice.)  This patch fixes this by splitting
isblank out of ctype-extn.c to a separate ctype-c99.c.  isblank_l is
also moved to a separate file, ctype-c99_l.c (non-XSI POSIX.1-2008 has
isblank_l, but isascii / toascii are marked OB XSI).  (In principle
all these functions could go in separate files - that's optimal for
static linking - but they are also all very small, and splitting them
all out is not needed to fix the present bug.)

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch - the ordering in which new and
existing sources are listed in ctype/Makefile is arranged so functions
go in the same order so that this comparison works).

	[BZ #17635]
	* ctype/ctype-c99.c: New file.  isblank implementation moved from
	...
	* ctype/ctype-extn.c: ... here.
	(__isblank_l): Move to ...
	* ctype/ctype-c99_l.c: ... here.  New file.
	* ctype/Makefile (routines): Add ctype-c99 and ctype-c99_l.
	* conform/Makefile (test-xfail-ISO99/ctype.h/linknamespace):
	Remove variable.
	(test-xfail-ISO11/ctype.h/linknamespace): Likewise.
	(test-xfail-XPG3/ctype.h/linknamespace): Likewise.
	(test-xfail-XPG4/ctype.h/linknamespace): Likewise.
	(test-xfail-UNIX98/ctype.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/ctype.h/linknamespace): Likewise.
2015-01-05 15:06:57 +00:00
Joseph Myers a287953a45 Fix wordsize-64 posix_fadvise64, posix_fallocate64 namespace (bug 17777).
On systems using sysdeps/unix/sysv/linux/wordsize-64, posix_fadvise64
and posix_fallocate64 (non-POSIX) are strong aliases for posix_fadvise
and posix_fallocate (POSIX), meaning references to the latter wrongly
bring in definitions of the former.  They should be weak aliases; this
patch makes them so.

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

	[BZ #17777]
	* sysdeps/unix/sysv/linux/wordsize-64/posix_fadvise.c
	(posix_fadvise64): Define as weak alias not strong alias.
	* sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
	(posix_fallocate64): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/fcntl.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/mqueue.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/fcntl.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/mqueue.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/fcntl.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/mqueue.h/linknamespace): Likewise.
2015-01-05 14:37:07 +00:00
Matthew Fortune b1efe3bbcf Fix MIPS variable PAGE_SIZE bug (16191)
MIPS supports a variable page size but glibc defines a constant.
This causes at least two glibc tests to fail when the page size
does not match the hard-coded size:

inet/test-ifaddrs
inet/test_ifindex

	[BZ #16191]
	* NEWS: Mention bug fix.
	* sysdeps/unix/sysv/linux/mips/sys/user.h (PAGE_SHIFT): Remove.
	(PAGE_SIZE, PAGE_MASK, NBPG, UPAGES): Likewise.
	(HOST_TEXT_START_ADDR, HOST_DATA_START_ADDR): Likewise.
	(HOST_STACK_END_ADDR): Likewise.
2015-01-05 13:45:16 +00:00
Joseph Myers 253a59ccb5 Fix MIPS TIOCSER_TEMT namespace (bug 17782).
sysdeps/unix/sysv/linux/mips/bits/termios.h defines TIOCSER_TEMT
unconditionally, but it's in the user's namespace.  This patch
conditions it on __USE_MISC, as on powerpc.  I've filed bug 17783 for
the residual inconsistency in conditions on this macro (sparc defines
it for __USE_GNU only).

	[BZ #17782]
	* sysdeps/unix/sysv/linux/mips/bits/termios.h (TIOCSER_TEMT):
	Condition macro definition on [__USE_MISC].
2015-01-02 18:31:41 +00:00
Joseph Myers 27dae0113e Fix MIPS sa_flags type (bug 17781).
sysdeps/unix/sysv/linux/mips/bits/sigaction.h gives sa_flags type
unsigned int, but POSIX says it should be signed int.  This patch
gives it the correct type (the layout is unchanged, so there are no
ABI issues involved).

	[BZ #17781]
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h
	(struct sigaction): Change type of sa_flags field to int.
2015-01-02 18:30:32 +00:00
Joseph Myers 172019c0ec Fix MIPS bits/fcntl.h namespace (bug 17780).
sysdeps/unix/sysv/linux/mips/bits/fcntl.h has a structure field called
pad, which is in the user's namespace.  This patch changes it to
__glibc_reserved0.

	[BZ #17780]
	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h (struct flock)
	[!__USE_FILE_OFFSET64 && _MIPS_SIM != _ABI64]: Rename pad field to
	__glibc_reserved0.
2015-01-02 18:29:24 +00:00
Joseph Myers 9706dc5f53 Update copyright dates not handled by scripts/update-copyrights.
I've updated copyright dates in glibc for 2015.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.  Apart from the files updated
last time (of which sotruss.ksh had moved to sotruss.sh during the
year) this also updates nptl/version.c (missed from 2006 until
October) and sysdeps/unix/sysv/linux/lddlibc4.c (missed since 2009).

	* NEWS: Update copyright dates.
	* catgets/gencat.c (print_version): Likewise.
	* csu/version.c (banner): Likewise.
	* debug/catchsegv.sh: Likewise.
	* debug/pcprofiledump.c (print_version): Likewise.
	* debug/xtrace.sh (do_version): Likewise.
	* elf/ldconfig.c (print_version): Likewise.
	* elf/ldd.bash.in: Likewise.
	* elf/pldd.c (print_version): Likewise.
	* elf/sotruss.sh: Likewise.
	* elf/sprof.c (print_version): Likewise.
	* iconv/iconv_prog.c (print_version): Likewise.
	* iconv/iconvconfig.c (print_version): Likewise.
	* locale/programs/locale.c (print_version): Likewise.
	* locale/programs/localedef.c (print_version): Likewise.
	* login/programs/pt_chown.c (print_version): Likewise.
	* malloc/memusage.sh (do_version): Likewise.
	* malloc/memusagestat.c (print_version): Likewise.
	* malloc/mtrace.pl: Likewise.
	* manual/libc.texinfo: Likewise.
	* nptl/version.c (banner): Likewise.
	* nscd/nscd.c (print_version): Likewise.
	* nss/getent.c (print_version): Likewise.
	* nss/makedb.c (print_version): Likewise.
	* posix/getconf.c (main): Likewise.
	* scripts/test-installation.pl: Likewise.
	* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
2015-01-02 16:54:45 +00:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
H.J. Lu 7062bd4230 Don't check PI_STATIC_AND_HIDDEN in i386 dl-machine.h
PI_STATIC_AND_HIDDEN is always defined for i386.  There is no need to
check PI_STATIC_AND_HIDDEN in sysdeps/i386/dl-machine.h.

	[BZ #17775]
	* sysdeps/i386/dl-machine.h (PI_STATIC_AND_HIDDEN): Removed.
	(elf_machine_dynamic) [!PI_STATIC_AND_HIDDEN]: Likewise.
	(elf_machine_load_address) [!PI_STATIC_AND_HIDDEN]: Likewise.
2014-12-30 14:31:58 -08:00
H.J. Lu 0f9dfe0432 Mention i386 memcpy with SSE2 unaligned load/store 2014-12-30 09:32:50 -08:00
Joseph Myers 0747f81811 Fix libm feraiseexcept namespace (bug 17723).
Various C90 and UNIX98 libm functions call feraiseexcept, which is not
in those standards.  This causes linknamespace test failures - except
on x86 / x86_64, where feraiseexcept is inline (for the relevant
constant arguments) in bits/fenv.h.

This patch fixes this by making those functions call __feraiseexcept
instead.  All changes are applied to all architectures rather than
considering the possibility that some might not be needed in some
cases (e.g. x86) as it seems most maintainable to keep architectures
consistent.

Where __feraiseexcept does not exist, it is added, with feraiseexcept
made a weak alias; where it is a strong alias, it is made weak.
libm_hidden_def / libm_hidden_proto are used with __feraiseexcept
(this might in some cases improve code generation for existing calls
to __feraiseexcept in some code on some architectures).  Where there
are dummy feraiseexcept macros (on architectures without
floating-point exceptions support, to avoid compile errors from
references to undefined FE_* macros), corresponding dummy
__feraiseexcept macros are added.  And on x86, to ensure
__feraiseexcept calls still get inlined, the inline function in
bits/fenv.h is refactored so that most of it can be reused in an
inline __feraiseexcept in a separate include/bits/fenv.h.

Calls are changed in C90/UNIX98 functions, but generally not in
functions missing from those standards.  They are also changed in
libc_fe* functions (on the basis that those might be used in any libm
function), and in feupdateenv (on the same basis - may be used, via
default libc_*, in any libm function - of course feupdateenv will need
changing to __feupdateenv in a subsequent patch to make that fully
namespace-clean).

No __feraiseexcept is added corresponding to the feraiseexcept in
powerpc bits/fenvinline.h, because that macro definition is
conditional on !defined __NO_MATH_INLINES, and glibc libm is built
with -D__NO_MATH_INLINES, so changing internal calls to use
__feraiseexcept should make no difference.

Tested for x86_64 (testsuite; the only change in disassembly of
installed shared libraries is a slight code reordering in clog10, of
no apparent significance).  Also tested for MIPS, where (in the
configuration tested) it eliminates math.h linknamespace failures for
n32 and n64 (some for o32 remain because of other issues).

	[BZ #17723]
	* include/fenv.h (__feraiseexcept): Use libm_hidden_proto.
	* math/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/arm/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/hppa/fpu/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/i386/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/ia64/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/m68k/coldfire/fpu/fraiseexcpt.c (feraiseexcept):
	Likewise.
	* sysdeps/microblaze/math_private.h (__feraiseexcept): New macro.
	* sysdeps/mips/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/fraiseexcpt.c (__feraiseexcept): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c
	(__feraiseexcept): Likewise.
	* sysdeps/s390/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/sparc/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/tile/math_private.h (__feraiseexcept): New macro.
	* sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S (__feraiseexcept):
	Use libm_hidden_def.
	* sysdeps/x86_64/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	(feraiseexcept): Define as weak not strong alias.  Use
	libm_hidden_weak.
	* sysdeps/x86/fpu/bits/fenv.h (__feraiseexcept_invalid_divbyzero):
	New inline function.  Factored out of ...
	(feraiseexcept): ... here.  Use __feraiseexcept_invalid_divbyzero.
	* sysdeps/x86/fpu/include/bits/fenv.h: New file.
	* math/e_scalb.c (invalid_fn): Call __feraiseexcept instead of
	feraiseexcept.
	* math/w_acos.c (__acos): Likewise.
	* math/w_asin.c (__asin): Likewise.
	* math/w_ilogb.c (__ilogb): Likewise.
	* math/w_j0.c (y0): Likewise.
	* math/w_j1.c (y1): Likewise.
	* math/w_jn.c (yn): Likewise.
	* math/w_log.c (__log): Likewise.
	* math/w_log10.c (__log10): Likewise.
	* sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/aarch64/fpu/math_private.h
	(libc_feupdateenv_test_aarch64): Likewise.
	* sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/arm/fenv_private.h (libc_feupdateenv_test_vfp): Likewise.
	* sysdeps/arm/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Likewise.
	* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise.
2014-12-30 17:08:09 +00:00
H.J. Lu 63180606ee Mention fix for BZ #17732 2014-12-30 08:25:40 -08:00