platform/upstream/glibc.git
8 years agoMake shebang interpreter directives consistent
Marko Myllynen [Thu, 7 Jan 2016 08:51:53 +0000 (10:51 +0200)]
Make shebang interpreter directives consistent

8 years agohppa: fix pthread spinlock
John David Anglin [Sun, 4 May 2014 18:02:30 +0000 (14:02 -0400)]
hppa: fix pthread spinlock

URL: https://bugs.debian.org/725508

8 years agoUpdate copyright dates committed in 2016
H.J. Lu [Wed, 6 Jan 2016 22:03:10 +0000 (14:03 -0800)]
Update copyright dates committed in 2016

8 years agoMark internal unistd functions hidden in ld.so
H.J. Lu [Wed, 6 Jan 2016 20:37:04 +0000 (12:37 -0800)]
Mark internal unistd functions hidden in ld.so

Since internal unistd functions are only used internally in ld.so and
libc.so, they can be made hidden.  __close, __getcwd, __getpid,
__libc_read and __libc_write can't be hidden in ld.so on Hurd since they
will be preempted by the ones in libc.so after bootstrap.

[BZ #19122]
* include/unistd.h [IS_IN (rtld)]: Include <dl-unistd.h>.
* sysdeps/generic/dl-unistd.h: New file.
* sysdeps/mach/hurd/dl-unistd.h: Likewise.

8 years agoMark ld.so internal mmap functions hidden in ld.so
H.J. Lu [Wed, 6 Jan 2016 19:28:04 +0000 (11:28 -0800)]
Mark ld.so internal mmap functions hidden in ld.so

Since ld.so internal mmap functions are only used internally in ld.so,
they can be made hidden.  Don't hide __mmap on Hurd, since __mmap in
ld.so will be preempted by the one in libc.so after bootstrap.

 [BZ #19122]
 * include/sys/mman.h [IS_IN (rtld)]: Include <dl-mman.h>.
 * sysdeps/generic/dl-mman.h: New file.
 * sysdeps/mach/hurd/dl-mman.h: Likewise.

8 years agoUpdate miscellaneous files from upstream sources.
Joseph Myers [Tue, 5 Jan 2016 18:04:06 +0000 (18:04 +0000)]
Update miscellaneous files from upstream sources.

This patch updates texinfo.tex, config.guess, config.sub and
move-if-change from their respective upstream sources.

* manual/texinfo.tex: Update to version 2016-01-04.21 with
trailing whitespace removed.
* scripts/config.guess: Update to version 2016-01-01.
* scripts/config.sub: Update to version 2016-01-01.
* scripts/move-if-change: Update from gnulib.

8 years agoEliminate redundant sign extensions in pow()
Anton Blanchard [Mon, 4 Jan 2016 15:28:52 +0000 (13:28 -0200)]
Eliminate redundant sign extensions in pow()

When looking at the code generated for pow() on ppc64 I noticed quite
a few sign extensions. Making the array indices unsigned reduces the
number of sign extensions from 24 to 7.

Tested for powerpc64le and x86_64.

8 years agoUpdate copyright dates not handled by scripts/update-copyrights.
Joseph Myers [Mon, 4 Jan 2016 16:26:30 +0000 (16:26 +0000)]
Update copyright dates not handled by scripts/update-copyrights.

I've updated copyright dates in glibc for 2016.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.

* 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.

8 years agoUpdate copyright dates with scripts/update-copyrights.
Joseph Myers [Mon, 4 Jan 2016 16:05:18 +0000 (16:05 +0000)]
Update copyright dates with scripts/update-copyrights.

8 years agohppa: Add MAP_HUGETLB and MAP_STACK defines [BZ #19285]
Helge Deller [Sat, 2 Jan 2016 22:31:12 +0000 (23:31 +0100)]
hppa: Add MAP_HUGETLB and MAP_STACK defines [BZ #19285]

The attached patch adds some upstream defines like MAP_HUGETLB and MAP_STACK
in mman.h for the hppa architecture.

The existing MADV_xxK_PAGES defines were dropped upstream, because they were
originally added many years ago based on a proposed patch for the Linux kernel
which was never applied. So, this patch drops those unneeded defines.

8 years agoia64: fpu: fix gamma definition handling [BZ #15421]
Mike Frysinger [Tue, 29 Dec 2015 06:06:30 +0000 (01:06 -0500)]
ia64: fpu: fix gamma definition handling [BZ #15421]

The rework in commit d709042a6e5ab3c360280faad6f9538a34dc8eea broke
buiding on ia64 due to compat_symbol expanding into ... in some cases.
The common files were wrapped in a BUILD_LGAMMA check, but the ia64
ones were not.  Add that logic to the ia64 files too.

8 years agoFix linux personality syscall wrapper
Dmitry V. Levin [Sun, 27 Dec 2015 16:30:02 +0000 (16:30 +0000)]
Fix linux personality syscall wrapper

The personality system call, starting with linux kernel commit
v2.6.29-6609-g11d06b2a1e5658f448a308aa3beb97bacd64a940, always
successfully changes the personality if requested.  The syscall
wrapper, however, still can return an error in the following cases:
- the value returned by the system call looks like an error
due to architecture limitations of 32-bit kernels;
- a personality greater than 0xffffffff is passed to the system call,
and the 64-bit kernel does not have commit
v2.6.35-rc1-372-g485d527686850d68a0e9006dd9904f19f122485e
that would truncate this value to unsigned int;
- on sparc64, the value returned by the system call looks like an error
due to sparc64 kernel sign extension bug.

The solution is three-fold:
- move generic syscalls.list personality entry to generic 64-bit
syscalls.list file;
- for each 32-bit architecture that use negated errno semantics,
add a NOERRNO personality entry to their syscalls.list file;
- for sparc64 and 32-bit architectures that use dedicated registers
to flag syscall errors, add a wrapper around personality syscall;
if the system call return value is flagged as an error, this wrapper
returns the negated "would be errno" value, otherwise it returns
the system call return value; on sparc64, it also truncates the
personality argument to unsigned int before passing it to the kernel.

[BZ #19408]
* sysdeps/unix/sysv/linux/personality.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/personality.c: Likewise.
* sysdeps/unix/sysv/linux/tst-personality.c: Likewise.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == misc]
(sysdep_routines): Add personality.
(tests): Add tst-personality.
* sysdeps/unix/sysv/linux/syscalls.list (personality): Move ...
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: ... here.
* sysdeps/unix/sysv/linux/arm/syscalls.list (personality): New entry.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/i386/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/m68k/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/sh/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list (personality):
Likewise.

8 years agoCleanup ARM ioperm implementation (step 2)
Aurelien Jarno [Tue, 29 Dec 2015 14:27:56 +0000 (15:27 +0100)]
Cleanup ARM ioperm implementation (step 2)

Since GLIBC requires a minimum 2.6.32 kernel, the sysctl (CTL_BUS,
CTL_BUS_ISA, ISA_*) is always available.  We can therefore remove the
fallback code reading /etc/arm_systype or parsing /proc/cpuinfo.

Remove fscanf from localplt.data as it is no longer called from within
GLIBC.

* sysdeps/unix/sysv/linux/arm/ioperm.c: Do not include <string.h>.
(PATH_ARM_SYSTYPE): Remove.
(PATH_CPUINFO): Likewise.
(IO_BASE_FOOTBRIDGE): Likewise.
(IO_SHIFT_FOOTBRIDGE): Likewise.
(struct platform): Likewise.
(init_iosys): Remove compatibility code for 2.4 kernels.
* sysdeps/unix/sysv/linux/arm/localplt.data: Remove fscanf.

8 years agolocaledata: nl_NL@euro: copy measurement from nl_NL [BZ #19198]
Mike Frysinger [Wed, 30 Dec 2015 04:19:54 +0000 (23:19 -0500)]
localedata: nl_NL@euro: copy measurement from nl_NL [BZ #19198]

No real changes here as the output is the same.  Just making the input
a little bit nicer.

8 years agomalloc: Test various special cases related to allocation failures
Florian Weimer [Tue, 29 Dec 2015 19:32:35 +0000 (20:32 +0100)]
malloc: Test various special cases related to allocation failures

This test case exercises unusual code paths in allocation functions,
related to allocation failures.  Specifically, the test can reveal
the following bugs:

(a) calloc returns non-zero memory on fallback to sysmalloc.
(b) calloc can self-deadlock because it fails to release
    the arena lock on certain allocation failures.
(c) pvalloc can dereference a NULL arena pointer.

(a) and (b) appear specific to a faulty downstream backport.
(c) was fixed as part of commit 10ad46bc6526edc5c7afcc57112da96917ff3629.

The test for (a) was inspired by a reproducer supplied by Jeff Layton.

8 years agolocaledata: bg_BG: use colon as time separator [BZ #19385]
Damyan Ivanov [Tue, 29 Dec 2015 18:45:25 +0000 (13:45 -0500)]
localedata: bg_BG: use colon as time separator [BZ #19385]

The only official source is the "Official spelling dictionary of the
Bulgarian language, Prosveta 2012", which states there are three ways
to separate time components: comma, colon and dot. That same dictionary
doesn't say which one is preferred.

So I turned to the mailing list of the translators of free software in
Bulgarian. The consensus is that colon is the only separator that is
widely used in Bulgarian texts and everything else will just be confusing.

URL: http://lists.ludost.net/pipermail/dict/2015-December/000538.html

8 years agolist-fixed-bugs: use argparse for the commandline
Mike Frysinger [Tue, 10 Nov 2015 05:41:33 +0000 (00:41 -0500)]
list-fixed-bugs: use argparse for the commandline

This makes the interface more friendly to users.

8 years agoresolv: Reset defdname before use in __res_vinit [BZ #19369]
Rob Wu [Wed, 16 Dec 2015 11:53:27 +0000 (12:53 +0100)]
resolv: Reset defdname before use in __res_vinit [BZ #19369]

Resetting defdname (default domain name) before use in __res_vinit
ensures that the default domain name is correctly set to a default
value when it is not set by the LOCALDOMAIN environment variable or
the "domain" or "search" parameters in resolv.conf

Tested using the steps from:
https://sourceware.org/bugzilla/show_bug.cgi?id=19369

8 years agohppa: Define __NO_LONG_DOUBLE_MATH so headers are consistent with libm build [BZ...
John David Anglin [Sun, 22 Nov 2015 22:15:04 +0000 (17:15 -0500)]
hppa: Define __NO_LONG_DOUBLE_MATH so headers are consistent with libm build [BZ #19270]

The attached patch fixes BZ #19270 and the Debian gmt package now builds
successfully.  Aside from the comment, the define of __NO_LONG_DOUBLE_MATH
is similar to that in the generic version of glibc.

Build tested on hppa-unknown-linux-gnu with no observed regressions.

8 years agoia64: fpu: fix gammaf typo [BZ #15421]
Mike Frysinger [Tue, 29 Dec 2015 03:18:22 +0000 (22:18 -0500)]
ia64: fpu: fix gammaf typo [BZ #15421]

The lgamma rewrite in commit d709042a6e5ab3c360280faad6f9538a34dc8eea
used "gammaf" in this function when it should have used "gamma".

8 years agoFix getaddrinfo bug number in ChangeLog and NEWS files
Dmitry V. Levin [Wed, 23 Dec 2015 20:39:42 +0000 (20:39 +0000)]
Fix getaddrinfo bug number in ChangeLog and NEWS files

This amends commit 34a9094f49241ebb72084c536cf468fd51ebe3ec
that erroneously mentions number 11869 instead of 11884.

8 years agoDo not violate mutex destruction requirements.
Torvald Riegel [Tue, 14 Jul 2015 19:58:34 +0000 (21:58 +0200)]
Do not violate mutex destruction requirements.

POSIX and C++11 require that a thread can destroy a mutex if no other
thread owns the mutex, is blocked on the mutex, or will try to acquire
it in the future.  After destroying the mutex, it can reuse or unmap the
underlying memory.  Thus, we must not access a mutex' memory after
releasing it.  Currently, we can load the private flag after releasing
the mutex, which is fixed by this patch.
See https://sourceware.org/bugzilla/show_bug.cgi?id=13690 for more
background.

We need to call futex_wake on the lock after releasing it, however.  This
is by design, and can lead to spurious wake-ups on unrelated futex words
(e.g., when the mutex memory is reused for another mutex).  This behavior
is documented in the glibc-internal futex API and in recent drafts of the
Linux kernel's futex documentation (see the draft_futex branch of
git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git).

8 years agomalloc: Update comment for list_lock
Florian Weimer [Wed, 23 Dec 2015 16:23:33 +0000 (17:23 +0100)]
malloc: Update comment for list_lock

8 years agopowerpc: Export __parse_hwcap_and_convert_at_platform to libc.a.
Carlos Eduardo Seo [Wed, 9 Dec 2015 20:48:04 +0000 (18:48 -0200)]
powerpc: Export __parse_hwcap_and_convert_at_platform to libc.a.

Commit 67385a01d229751569b6aac067ffdcd813a15d7a added a new feature for
powerpc, where we store HWCAP/Platform bits in the TCB.  In the dynamic
linking case, we use the versioned symbol
'__parse_hwcap_and_convert_at_platform' to verify if this feature is
available.  However, the same symbol was not exported to libc.a, making
it not possible for GCC to check for it prior to link time.

8 years agopowerpc: Add basic support for POWER9 sans hwcap.
Carlos Eduardo Seo [Wed, 4 Nov 2015 21:30:49 +0000 (19:30 -0200)]
powerpc: Add basic support for POWER9 sans hwcap.

This patch adds the minimum changes for supporting the POWER9 processor.

8 years agoHarmonize generic stdio-lock support with nptl
Samuel Thibault [Tue, 22 Dec 2015 13:39:19 +0000 (14:39 +0100)]
Harmonize generic stdio-lock support with nptl

This fixes build when _IO_funlockfile is a macro, fixes build where
_IO_acquire_lock_clear_flags2 is used, and fixes unlocking on unexpected
stack unwind.

* sysdeps/generic/stdio-lock.h [__EXCEPTIONS] (_IO_acquire_lock,
_IO_release_lock ): Use cleanup attribute on new
_IO_acquire_lock_file variable instead of assuming that
_IO_release_lock will be called.
[!__EXCEPTIONS] (_IO_acquire_lock): Define to non-existing
_IO_acquire_lock_needs_exceptions_enabled.
(_IO_acquire_lock_clear_flags2): New macro.

8 years agopowerpc: Regenerate libm-test-ulps
Adhemerval Zanella [Tue, 22 Dec 2015 13:06:36 +0000 (11:06 -0200)]
powerpc: Regenerate libm-test-ulps

* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.

8 years agomalloc: Fix list_lock/arena lock deadlock [BZ #19182]
Florian Weimer [Mon, 21 Dec 2015 15:42:46 +0000 (16:42 +0100)]
malloc: Fix list_lock/arena lock deadlock [BZ #19182]

* malloc/arena.c (list_lock): Document lock ordering requirements.
(free_list_lock): New lock.
(ptmalloc_lock_all): Comment on free_list_lock.
(ptmalloc_unlock_all2): Reinitialize free_list_lock.
(detach_arena): Update comment.  free_list_lock is now needed.
(_int_new_arena): Use free_list_lock around detach_arena call.
Acquire arena lock after list_lock.  Add comment, including FIXME
about incorrect synchronization.
(get_free_list): Switch to free_list_lock.
(reused_arena): Acquire free_list_lock around detach_arena call
and attached threads counter update.  Add two FIXMEs about
incorrect synchronization.
(arena_thread_freeres): Switch to free_list_lock.
* malloc/malloc.c (struct malloc_state): Update comments to
mention free_list_lock.

8 years agoConsolidate sincos computation for 2.426265 < |x| < 105414350
Siddhesh Poyarekar [Mon, 21 Dec 2015 05:13:04 +0000 (10:43 +0530)]
Consolidate sincos computation for 2.426265 < |x| < 105414350

Like the previous change, exploit the fact that computation for sin
and cos is identical except that it is apart by a quadrant.  Also
remove csloww, csloww1 and csloww2 since they can easily be expressed
in terms of sloww, sloww1 and sloww2.

8 years agoConsolidate sin and cos code for 105414350 <|x|< 281474976710656
Siddhesh Poyarekar [Mon, 21 Dec 2015 05:11:46 +0000 (10:41 +0530)]
Consolidate sin and cos code for 105414350 <|x|< 281474976710656

The sin and cos computation for this range of input is identical
except for a difference in quadrants by 1.  Exploit that fact and the
common argument reduction to reduce computations for sincos.

8 years agoConsolidate range reduction in sincos for x > 281474976710656
Siddhesh Poyarekar [Mon, 21 Dec 2015 05:10:32 +0000 (10:40 +0530)]
Consolidate range reduction in sincos for x > 281474976710656

Range reduction needs to be done only once for sin and cos, so copy
over all of the relevant functions (__sin, __cos, reduce_and_compute)
and consolidate common code.

8 years agoFix up ChangeLog
Siddhesh Poyarekar [Mon, 21 Dec 2015 05:08:38 +0000 (10:38 +0530)]
Fix up ChangeLog

8 years agoi386: move ULPs to i686/multiarch and regenerate new ones for i386
Aurelien Jarno [Sun, 13 Dec 2015 21:55:34 +0000 (22:55 +0100)]
i386: move ULPs to i686/multiarch and regenerate new ones for i386

The i386 ULPs are actually the i686/multiarch ones. The i686/multiarch
float ULPs are more precise as the SSE2 version (when available) uses
double for the cosf and sinf functions.

On the other hand the higher precision of the x86 FPU improves the
precision for a few other math functions.

* sysdeps/i386/fpu/libm-test-ulps: Move to ....
* sysdeps/i386/i686/multiarch/fpu/libm-test-ulps: ...here.
* sysdeps/i386/fpu/libm-test-ulps: Regenerate.

8 years agoAdded memset optimized with AVX512 for KNL hardware.
Andrew Senkevich [Fri, 18 Dec 2015 23:47:28 +0000 (02:47 +0300)]
Added memset optimized with AVX512 for KNL hardware.

It shows improvement up to 28% over AVX2 memset (performance results
attached at <https://sourceware.org/ml/libc-alpha/2015-12/msg00052.html>).

    * sysdeps/x86_64/multiarch/memset-avx512-no-vzeroupper.S: New file.
    * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Added new file.
    * sysdeps/x86_64/multiarch/ifunc-impl-list.c: Added new tests.
    * sysdeps/x86_64/multiarch/memset.S: Added new IFUNC branch.
    * sysdeps/x86_64/multiarch/memset_chk.S: Likewise.
    * sysdeps/x86/cpu-features.h (bit_Prefer_No_VZEROUPPER,
    index_Prefer_No_VZEROUPPER): New.
    * sysdeps/x86/cpu-features.c (init_cpu_features): Set the
    Prefer_No_VZEROUPPER for Knights Landing.

8 years agoRemove unused variable in math/atest-exp2.c.
Torvald Riegel [Thu, 17 Dec 2015 22:30:03 +0000 (23:30 +0100)]
Remove unused variable in math/atest-exp2.c.

8 years agoFix SYSCALL_CANCEL for empty argumetns
Adhemerval Zanella [Sat, 17 Oct 2015 19:56:27 +0000 (16:56 -0300)]
Fix SYSCALL_CANCEL for empty argumetns

This patch fixes the SYSCALL_CANCEL macro for usage with zero argument
number (for instance SYSCALL_CANCEL (pause)) using a similar approach
used for SOCKETCALL_CANCEL.

GLIBC build still does not hit this issue still since SYSCALL_CANCEL
is not currently being used for zero arguments calls.

Tested on i386, x86_64, powerpc64le, aarch64.

* sysdeps/unix/sysdep.h (SYSCALL_CANCEL): Fix macro for zero argument
syscalls.
(__SYSCALL0): New macro.
(__SYSCALL1): Likewise.
(__SYSCALL2): Likewise.
(__SYSCALL3): Likewise.
(__SYSCALL4): Likewise.
(__SYSCALL5): Likewise.
(__SYSCALL6): Likewise.
(__SYSCALL7): Likewise.
(__SYSCALL_CONCAT_X): Likewise.
(__SYSCALL_CONCAT): Likewise.
(__SYSCALL_DIST): Likewise.
(__SYSCALL_CALL): Likewise.

8 years agoProvide x32 times
H.J. Lu [Thu, 17 Dec 2015 19:46:49 +0000 (11:46 -0800)]
Provide x32 times

Since times returns 64-bit clock_t on x32, we need to provide x32 times
by redefining INTERNAL_SYSCALL_NCS and INTERNAL_SYSCALL_ERROR_P with
64-bit return type for syscall.  All system calls returning 64-bit
integer, which are lseek, time and times, must be handled specially for
x32.  lseek is handled by x32 lseek.S and time doesn't check syscall
return.  times is the only missed one.  Before this patch, there are

0000000 <__times>:
   0: b8 64 00 00 40        mov    $0x40000064,%eax
   5: 0f 05                 syscall
   7: 48 63 d0              movslq %eax,%rdx
                                ^^^^^^^^^^ Incorrect signed extension
   a: 48 83 fa f2           cmp    $0xfffffffffffffff2,%rdx
   e: 75 07                 jne    17 <__times+0x17>
  10: 3d 00 f0 ff ff        cmp    $0xfffff000,%eax
                                ^^^^^^^^^^^^^^^^^^^^^ 32-bit compare
  15: 77 11                 ja     28 <__times+0x28>
  17: 48 83 fa ff           cmp    $0xffffffffffffffff,%rdx
  1b: b8 00 00 00 00        mov    $0x0,%eax
  20: 48 0f 45 c2           cmovne %rdx,%rax
  24: c3                    retq

After this patch, there are

00000000 <__times>:
   0: b8 64 00 00 40        mov    $0x40000064,%eax
   5: 0f 05                 syscall
   7: 48 83 f8 f2           cmp    $0xfffffffffffffff2,%rax
   b: 75 08                 jne    15 <__times+0x15>
   d: 48 3d 00 f0 ff ff     cmp    $0xfffffffffffff000,%rax
  13: 77 13                 ja     28 <__times+0x28>
  15: 48 83 f8 ff           cmp    $0xffffffffffffffff,%rax
  19: ba 00 00 00 00        mov    $0x0,%edx
  1e: 48 0f 44 c2           cmove  %rdx,%rax
  22: c3                    retq

The incorrect signed extension and 32-bit compare are gone.

[BZ #19363]
* sysdeps/unix/sysv/linux/x86_64/x32/times.c: New file.

8 years agoFix POWER7 logb results for negative subnormals (bug 19375)
Adhemerval Zanella [Thu, 17 Dec 2015 14:34:57 +0000 (12:34 -0200)]
Fix POWER7 logb results for negative subnormals (bug 19375)

The optimized POWER7 logb implementation does not use the absolute
value of the word extracted from the input to apply the leading 0-bits
builtin (to ignore the float sign).  This patch fixes it by
clearing the signal bit in the resulting word.

It fixes the subnormal tests failures when running on POWER7 ou
newer chip.

Tested on powerpc64le (POWER8).

[BZ# 19375]
* sysdeps/powerpc/power7/fpu/s_logb.c (__logb): Fix return for
negative subnormals.

8 years agoAdd REGISTERS_CLOBBERED_BY_SYSCALL for x86-64
H.J. Lu [Wed, 16 Dec 2015 13:19:57 +0000 (05:19 -0800)]
Add REGISTERS_CLOBBERED_BY_SYSCALL for x86-64

X86-64 system calls use a different calling convention, which clobbers
CC, %r11 an %rcx registers.  Define REGISTERS_CLOBBERED_BY_SYSCALL for
x86-64 inline asm statements.

* sysdeps/unix/sysv/linux/x86_64/sysdep.h
(REGISTERS_CLOBBERED_BY_SYSCALL): New.
(INTERNAL_SYSCALL_NCS): Use it.
(INTERNAL_SYSCALL_NCS_TYPES): Likewise.

8 years agomalloc: Fix attached thread reference count handling [BZ #19243]
Florian Weimer [Wed, 16 Dec 2015 11:39:48 +0000 (12:39 +0100)]
malloc: Fix attached thread reference count handling [BZ #19243]

reused_arena can increase the attached thread count of arenas on the
free list.  This means that the assertion that the reference count is
zero is incorrect.  In this case, the reference count initialization
is incorrect as well and could cause arenas to be put on the free
list too early (while they still have attached threads).

* malloc/arena.c (get_free_list): Remove assert and adjust
reference count handling.  Add comment about reused_arena
interaction.
(reused_arena): Add comments abount get_free_list interaction.
* malloc/tst-malloc-thread-exit.c: New file.
* malloc/Makefile (tests): Add tst-malloc-thread-exit.
(tst-malloc-thread-exit): Link against libpthread.

8 years agoAdd missing ChangeLog entries
H.J. Lu [Tue, 15 Dec 2015 21:36:34 +0000 (13:36 -0800)]
Add missing ChangeLog entries

8 years agoAdd Prefer_MAP_32BIT_EXEC to map executable pages with MAP_32BIT
H.J. Lu [Wed, 21 Oct 2015 21:44:23 +0000 (14:44 -0700)]
Add Prefer_MAP_32BIT_EXEC to map executable pages with MAP_32BIT

According to Silvermont software optimization guide, for 64-bit
applications, branch prediction performance can be negatively impacted
when the target of a branch is more than 4GB away from the branch.  Add
the Prefer_MAP_32BIT_EXEC bit so that mmap will try to map executable
pages with MAP_32BIT first.  NB: MAP_32BIT will map to lower 2GB, not
lower 4GB, address.  Prefer_MAP_32BIT_EXEC reduces bits available for
address space layout randomization (ASLR), which is always disabled for
SUID programs and can only be enabled by setting environment variable,
LD_PREFER_MAP_32BIT_EXEC.

On Fedora 23, this patch speeds up GCC 5 testsuite by 3% on Silvermont.

[BZ #19367]
* sysdeps/unix/sysv/linux/wordsize-64/mmap.c: New file.
* sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/mmap.c: Likewise.
* sysdeps/x86/cpu-features.h (bit_Prefer_MAP_32BIT_EXEC): New.
(index_Prefer_MAP_32BIT_EXEC): Likewise.

8 years agoEnable Silvermont optimizations for Knights Landing
H.J. Lu [Tue, 15 Dec 2015 19:46:54 +0000 (11:46 -0800)]
Enable Silvermont optimizations for Knights Landing

Knights Landing processor is based on Silvermont.  This patch enables
Silvermont optimizations for Knights Landing.

* sysdeps/x86/cpu-features.c (init_cpu_features): Enable
Silvermont optimizations for Knights Landing.

8 years agoDon't emit invalid extra shift character at block boundary by iconv (bug 17197)
Andreas Schwab [Thu, 24 Jul 2014 15:32:56 +0000 (17:32 +0200)]
Don't emit invalid extra shift character at block boundary by iconv (bug 17197)

8 years agoFix aliasing violation in tst-rec-dlopen
Florian Weimer [Tue, 15 Dec 2015 08:49:17 +0000 (09:49 +0100)]
Fix aliasing violation in tst-rec-dlopen

8 years agoMake obsolete syscall wrappers into compat symbols (bug 18472).
Joseph Myers [Mon, 14 Dec 2015 22:52:15 +0000 (22:52 +0000)]
Make obsolete syscall wrappers into compat symbols (bug 18472).

Various Linux kernel syscalls have become obsolete over time.
Specifically, the following are obsolete in all kernel versions
supported by glibc, are not present for architectures more recently
added to the kernel, and as such, the wrapper functions for them
should be compat symbols, not in static libc and not available for new
links with shared libc.

* bdflush: in Linux 2.6, does nothing if present.

* create_module get_kernel_syms query_module: Linux 2.4 module
  interface, syscalls not present in Linux 2.6.

* uselib: part of the mechanism for loading a.out shared libraries,
  irrelevant with ELF.

This patch adds support for syscalls.list to list syscall aliases of
the form NAME@VERSION:OBSOLETED, with SHLIB_COMPAT conditionals being
generated for such aliases.  Those five syscalls are then made into
compat symbols (obsoleted in glibc 2.23, so future ports won't have
these symbols at all), with the header <sys/kdaemon.h> declaring
bdflush being removed.  When we move to 3.2 as minimum kernel version,
the same can be done for nfsservctl (removed in Linux 3.1) as well.

Tested for x86_64 and x86 (testsuite, as well as checking that the
symbols in question indeed become compat symbols, that they are indeed
omitted from static libc, and that the generated SHLIB_COMPAT
conditionals look right).

[BZ #18472]
* sysdeps/unix/Makefile ($(objpfx)stub-syscalls.c): Handle entries
for the form NAME@VERSION:OBSOLETED and generate SHLIB_COMPAT
conditionals for them.
* sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Likewise.
* sysdeps/unix/sysv/linux/sys/kdaemon.h: Remove file.
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Remove
sys/kdaemon.h.
* sysdeps/unix/sysv/linux/syscalls.list (bdflush): Make into
compat-only syscall, obsoleted in glibc 2.23.
(create_module): Likewise.
(get_kernel_syms): Likewise.
(query_module): Likewise.
(uselib): Likewise.
* manual/sysinfo.texi (System Parameters): Do not mention bdflush.

8 years agoCleanup ARM ioperm implementation
Aurelien Jarno [Fri, 11 Dec 2015 21:16:34 +0000 (22:16 +0100)]
Cleanup ARM ioperm implementation

Since GLIBC requires a minimum 2.6.32 kernel, the patch cleanups
the ARM ioperm by removing pre-2.4.23 kernel support.

8 years agoFix indentation.
Steve Ellcey [Fri, 11 Dec 2015 17:19:37 +0000 (09:19 -0800)]
Fix indentation.

* sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
Fix indentation.

8 years ago Fix indentation.
Steve Ellcey [Fri, 11 Dec 2015 17:08:45 +0000 (09:08 -0800)]
Fix indentation.

* stdio-common/vfscanf.c (_IO_vfscanf_internal): Fix indentation.

8 years ago Fix indentation.
Steve Ellcey [Fri, 11 Dec 2015 17:02:16 +0000 (09:02 -0800)]
Fix indentation.

* stdlib/strtol_l.c (__strtol_l): Fix indentation.

8 years agoAutomate LC_CTYPE generation for tr_TR, update to Unicode 8.0.0 (bug 18491).
Joseph Myers [Fri, 11 Dec 2015 12:45:19 +0000 (12:45 +0000)]
Automate LC_CTYPE generation for tr_TR, update to Unicode 8.0.0 (bug 18491).

This patch makes the automation of Unicode LC_CTYPE generation also
support generating the modified LC_CTYPE used for Turkish (where case
conversions of 'i' and 'I' differ from ASCII conventions), so allowing
that to be more readily kept in sync for future Unicode updates.  The
patch includes the locale update generated by the scripts.

Tested for x86_64.

[BZ #18491]
* unicode-gen/unicode_utils.py (to_upper_turkish): New function.
(to_lower_turkish): Likewise.
* unicode-gen/gen_unicode_ctype.py (output_tables): Support
producing output with Turkish case conversions.
(--turkish): New command-line option.
* unicode-gen/Makefile (GENERATED): Add tr_TR.
(tr_TR): New rule.
* locales/tr_TR: Regenerate LC_CTYPE.

8 years agograntpt: trust the kernel about pty group and permission mode
Aurelien Jarno [Thu, 10 Dec 2015 21:33:10 +0000 (22:33 +0100)]
grantpt: trust the kernel about pty group and permission mode

According to POSIX the grantpt() function does the following:

  The grantpt() function shall change the mode and ownership of the
  slave pseudo-terminal device associated with its master
  pseudo-terminal counterpart. The fildes argument is a file descriptor
  that refers to a master pseudo-terminal device. The user ID of the
  slave shall be set to the real UID of the calling process and the
  group ID shall be set to an unspecified group ID. The permission
  mode of the slave pseudo-terminal shall be set to readable and
  writable by the owner, and writable by the group.

Historically the GNU libc has been responsible to setup the permission
mode to 0620 and the group to 'tty' usually number 5, using the pt_chown
helper, badly known for its security issues. With the creation of the
devpts filesytem in the Linux kernel, this responsibility has been moved
to the Linux kernel. The system is responsible to mount the devpts
filesystem in /dev/pts with the options gid=5 and mode=0620. In that
case the GNU libc has nothing to do and pt_chown is not need anymore. So
far so good.

The problem is that by default the devpts filesystem is shared between
all mounts, and that contrary to other filesystem, the mount options are
honored at the second mount, including for the default mount options.
Given it corresponds to mode=0600 without gid parameter (that is the
filesystem GID of the creating process), it's common to see systems
where the devpts filesystem is mounted using these options. It is enough
to run a "mount -t devpts devpts /mychroot/dev/pts" to come into this
situation, and it's unfortunately wrongly used in a lot of scripts
dealing with chroots, or for creating virtual machines images.

When this happens the GNU libc tries to fix the group and permission
mode of the pty nodes, and given it fails to do so for non-root users,
grantpt() almost always fail. It means users are not able to open new
terminals.

This patch changes grantpt() to not enforce this anymore, while still
enforcing minimum security measures to the permission mode. Therefore
the responsibility to follow POSIX is now shared at the system level,
i.e. kernel + system scripts + GNU libc. It stops trying to change the
group, and makes the pty node readable and writable by the owner, and
writable by the group only when originally writable and when the group
is the tty one.

As a result, on a system wrongly mounted with gid=0 and mode=0600, the
pty nodes won't be accessible by the tty group, but the grantpt()
function will succeed and users will have a working system. The system
is not fully POSIX compliant (which might be an admin choice to default
to "mesg n" mode), but the GNU libc is not to blame here, as without the
pt_chown helper it can't do anything.

With this patch there should not be any reason left to build the GNU
libc with the --enable-pt_chown configure option on a GNU/Linux system.

8 years agoSplit large string section; add truncation advice
Paul Eggert [Thu, 10 Dec 2015 16:17:18 +0000 (08:17 -0800)]
Split large string section; add truncation advice

* manual/examples/strncat.c: Remove.
This example was misleading, as the code would have undefined
behavior if "hello" was longer than SIZE.  Anyway, the manual
shouldn't encourage strncpy+strncat for this sort of thing.
* manual/string.texi (Copying Strings and Arrays): Split into
three sections Copying Strings and Arrays, Concatenating Strings,
and Truncating Strings, as this section was way too long.  All
cross-referenced changed.  Add advice about string-truncation
functions.  Remove misleading strncat example.

8 years agoDocument best practice for disconnected NSS modules.
Carlos O'Donell [Thu, 10 Dec 2015 05:48:15 +0000 (00:48 -0500)]
Document best practice for disconnected NSS modules.

NSS modules which can run in disconnected modes should
return NSS_STATUS_NOTFOUND and SUCCESS in order to follow
best practice for such modules and ensure user applications
can have these modules configured without causing problems
if the data sources are not connected.

8 years agoUpdate to Unicode 8.0.0.
Mike FABIAN [Thu, 10 Dec 2015 05:30:51 +0000 (00:30 -0500)]
Update to Unicode 8.0.0.

Update __STDC_ISO_10646__ to 201505L for Unicode 8.0.0.
Update character encoding, ctype, and transliteration tables.
New scripts autogenerate transliteration tables.

8 years agoUpdate da, nb, nn, and sv locales (Bug 89)
Mike FABIAN [Thu, 10 Dec 2015 04:08:36 +0000 (23:08 -0500)]
Update da, nb, nn, and sv locales (Bug 89)

Add transliteration rules for da, nb, nn, and sv locales.

8 years agoUpdate transliteration support to Unicode 7.0.0.
Carlos O'Donell [Thu, 10 Dec 2015 03:27:41 +0000 (22:27 -0500)]
Update transliteration support to Unicode 7.0.0.

The transliteration files are now autogenerated from upstream Unicode
data.

8 years agoRegenerate locale/C-translit.h.
Carlos O'Donell [Thu, 10 Dec 2015 03:24:26 +0000 (22:24 -0500)]
Regenerate locale/C-translit.h.

8 years agoGeneric updates to transliterations.
Mike FABIAN [Thu, 10 Dec 2015 02:51:26 +0000 (21:51 -0500)]
Generic updates to transliterations.

- Remove duplicate transliterations for U+0152 and U+0153 from
  C-translit.h.in.
- Change Ö U+00D6 LATIN CAPITAL LETTER O WITH STROKE → O
  (instead of → OE)
- Change ö U+00F6 LATIN SMALL LETTER O WITH STROKE → o
  (instead of → oe)
- Add ₹ U+20B9 INDIAN RUPEE SIGN → INR
- Add ₫ U+20AB DONG SIGN → Dong (in addition to "₫ → Đồng")
- Add many others from
  http://unicode.org/cldr/trac/browser/trunk/common/transforms/Latin-ASCII.xml
- Add some more currency signs suggested by Marko Myllynen
- Add another patch with more characters by Marko Myllynen

8 years agoFix ldbl-128ibm logl inaccuracy near 1 (bug 19351).
Joseph Myers [Wed, 9 Dec 2015 23:51:11 +0000 (23:51 +0000)]
Fix ldbl-128ibm logl inaccuracy near 1 (bug 19351).

The ldbl-128ibm implementation of logl is inaccurate for arguments
near 1, because when deciding whether to bypass a series expansion for
log(1+z), where z = x-1, it compares the square of z rather than z
itself with an epsilon value.  This patch fixes that comparison, so
eliminating the test failures for inaccuracy of logl in such cases.

Tested for powerpc.

[BZ #19351]
* sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): When
expanding log(1+z), compare z rather than its square with epsilon
to determine when to avoid evaluating the expansion.

8 years agoFix ldbl-128ibm sinhl spurious overflows (bug 19350).
Joseph Myers [Wed, 9 Dec 2015 22:37:08 +0000 (22:37 +0000)]
Fix ldbl-128ibm sinhl spurious overflows (bug 19350).

The ldbl-128ibm implementation of sinhl uses a slightly too small
overflow threshold (similar to bug 16407 for coshl).  This patch fixes
it to use a safe threshold (so that values whose high part is above
the value compared with definitely result in an overflow in all
rounding modes).

Tested for powerpc.

[BZ #19350]
* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl):
Increase overflow threshold.

8 years agoFix ldbl-128ibm tanhl inaccuracy for small arguments (bug 19349).
Joseph Myers [Wed, 9 Dec 2015 21:20:18 +0000 (21:20 +0000)]
Fix ldbl-128ibm tanhl inaccuracy for small arguments (bug 19349).

The ldbl-128ibm implementation of tanhl is inaccurate for small
arguments, because it returns x*(1+x) (maybe in an attempt to raise
"inexact") when x itself would be the accurate return value but
multiplying by 1+x introduces large errors.  This patch fixes it to
return x in that case (when the mathematical result is x plus a
negligible remainder on the order of x^3) to avoid those errors.

Tested for powerpc.

[BZ #19349]
* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Return argument
when small.

8 years agoUse direct socket syscalls for new kernels on i386, m68k, microblaze, sh.
Joseph Myers [Wed, 9 Dec 2015 20:59:43 +0000 (20:59 +0000)]
Use direct socket syscalls for new kernels on i386, m68k, microblaze, sh.

Now that we have __ASSUME_* macros for direct socket syscalls to use
them instead of socketcall when they can be assumed to be available on
socketcall architectures, this patch defines those macros when
appropriate for i386, m68k, microblaze and sh (for 4.3, 4.3, all
supported kernels and 2.6.37, respectively; the only use of socketcall
support on microblaze is it allows accept4 and sendmmsg to be
supported on a wider range of kernel versions).

David, it seems that 32-bit SPARC is the only architecture supported
by glibc that still lacks these direct syscalls.  It would be good to
get them added to the SPARC kernel so we can eventually eliminate
socketcall support in glibc (and thereby just use entries in
sysdeps/unix/syscalls.list for most of these functions) when we can
assume new-enough kernels.

Tested for i386 (testsuite, and that installed shared libraries are
unchanged by this patch - not using a new enough kernel, so this
doesn't actually test much, but the i386 and m68k code is essentially
the same as that already in use for s390).

* sysdeps/unix/sysv/linux/i386/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SOCKET_SYSCALL):
New macro.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_SOCKETPAIR_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_BIND_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_CONNECT_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_LISTEN_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_ACCEPT4_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_GETSOCKOPT_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_SETSOCKOPT_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_GETSOCKNAME_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_GETPEERNAME_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDTO_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVFROM_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SHUTDOWN_SYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SOCKET_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_SOCKETPAIR_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_BIND_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_CONNECT_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_LISTEN_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_ACCEPT4_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_GETSOCKOPT_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_SETSOCKOPT_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_GETSOCKNAME_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_GETPEERNAME_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDTO_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVFROM_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300]
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SHUTDOWN_SYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_SOCKET_SYSCALL): Likewise.
(__ASSUME_BIND_SYSCALL): Likewise.
(__ASSUME_CONNECT_SYSCALL): Likewise.
(__ASSUME_LISTEN_SYSCALL): Likewise.
(__ASSUME_ACCEPT_SYSCALL): Likewise.
(__ASSUME_GETSOCKNAME_SYSCALL): Likewise.
(__ASSUME_GETPEERNAME_SYSCALL): Likewise.
(__ASSUME_SOCKETPAIR_SYSCALL): Likewise.
(__ASSUME_SEND_SYSCALL): Likewise.
(__ASSUME_SENDTO_SYSCALL): Likewise.
(__ASSUME_RECV_SYSCALL): Likewise.
(__ASSUME_RECVFROM_SYSCALL): Likewise.
(__ASSUME_SHUTDOWN_SYSCALL): Likewise.
(__ASSUME_GETSOCKOPT_SYSCALL): Likewise.
(__ASSUME_SETSOCKOPT_SYSCALL): Likewise.
(__ASSUME_SENDMSG_SYSCALL): Likewise.
(__ASSUME_RECVMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SOCKET_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_BIND_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_CONNECT_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_LISTEN_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_ACCEPT_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625]
(__ASSUME_GETSOCKNAME_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625]
(__ASSUME_GETPEERNAME_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625]
(__ASSUME_SOCKETPAIR_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SEND_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SENDTO_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_RECV_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_RECVFROM_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SHUTDOWN_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625]
(__ASSUME_GETSOCKOPT_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625]
(__ASSUME_SETSOCKOPT_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SENDMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_RECVMSG_SYSCALL):
Likewise.

8 years agomips: fix testsuite build for O32 FPXX ABI on pre-R2 CPU
Aurelien Jarno [Mon, 7 Dec 2015 22:07:17 +0000 (23:07 +0100)]
mips: fix testsuite build for O32 FPXX ABI on pre-R2 CPU

On MIPS when the toolchain is using the O32 FPXX ABI, the testsuite
fails to build for pre-R2 CPU.

It assumes that it is possible to use the -mfp64 option to build
tst-abi-fp64amod and tst-abi-fp64mod, while this requires a CPU which
supports the mfhc1 and mthc1 instructions, ie at least a R2 CPU:

  error: '-mgp32' and '-mfp64' can only be combined if the target
  supports the mfhc1 and mthc1 instructions

The same way it assumes that it is possible to use the -modd-spreg option
to build tst-abi-fpxxomod and tst-abi-fp64mod, while this requires at
least a R1 CPU:

  warning: the 'mips2' architecture does not support odd
  single-precision registers

This patches changes that by checking the usability of -mfp64 and
-modd-spreg options in configure, and disable those tests when they can
not be used.

8 years agoFix grantpt basename namespace bug
Aurelien Jarno [Fri, 4 Dec 2015 13:49:03 +0000 (14:49 +0100)]
Fix grantpt basename namespace bug

Commit cf06a4e3 removed test-xfail-POSIX2008/unistd.h/linknamespace, but
left one basename namespace issue in grantpt. However this issue is not
visible with the default configuration buy only when configure is passed
the --enable-pt_chown option.

8 years agobenchtests: ffs and ffsll are string functions, not math
Siddhesh Poyarekar [Tue, 8 Dec 2015 18:45:14 +0000 (00:15 +0530)]
benchtests: ffs and ffsll are string functions, not math

The ffs and ffsll functions were listed as math functions when they
are actually defined in strings.h and string.h respectively.  Shuffle
around the Makefile variables a bit and make a separate space for ffs
and ffsll.

8 years agobenchtests: Add inputs from sin and cos to sincos
Siddhesh Poyarekar [Tue, 8 Dec 2015 18:40:51 +0000 (00:10 +0530)]
benchtests: Add inputs from sin and cos to sincos

The sincos benchmark has only about a dozen inputs that don't measure
the impact of changes to various passes.  Since much of the code
properties are inherited from sin and cos, copy those inputs in to get
more comprehensive coverage.

8 years agoUtilize x86_64 vector math functions w/o -fopenmp.
Andrew Senkevich [Mon, 7 Dec 2015 18:58:26 +0000 (21:58 +0300)]
Utilize x86_64 vector math functions w/o -fopenmp.

This patch allows to use x86_64 vector math functions with GCC 6.*
without OpenMP SIMD constructs.  For additional details please visit
<https://sourceware.org/glibc/wiki/libmvec#Example_2>.

    * sysdeps/x86/fpu/bits/math-vector.h: W/o -fopenmp declare vector math
    functions with GCC 6.* __attribute__ ((__simd__)).

8 years agoFix typo in strncat, wcsncat manual entries
Paul Eggert [Fri, 4 Dec 2015 23:23:18 +0000 (15:23 -0800)]
Fix typo in strncat, wcsncat manual entries

* manual/string.texi (Copying and Concatenation): Fix typos in
sample implementations of strncat and wcsncat, by having them use
the old value of the destination length, not the new one.

8 years agoFix nan functions handling of payload strings (bug 16961, bug 16962).
Joseph Myers [Fri, 4 Dec 2015 20:36:28 +0000 (20:36 +0000)]
Fix nan functions handling of payload strings (bug 16961, bug 16962).

The nan, nanf and nanl functions handle payload strings by doing e.g.:

  if (tagp[0] != '\0')
    {
      char buf[6 + strlen (tagp)];
      sprintf (buf, "NAN(%s)", tagp);
      return strtod (buf, NULL);
    }

This is an unbounded stack allocation based on the length of the
argument.  Furthermore, if the argument starts with an n-char-sequence
followed by ')', that n-char-sequence is wrongly treated as
significant for determining the payload of the resulting NaN, when ISO
C says the call should be equivalent to strtod ("NAN", NULL), without
being affected by that initial n-char-sequence.  This patch fixes both
those problems by using the __strtod_nan etc. functions recently
factored out of strtod etc. for that purpose, with those functions
being exported from libc at version GLIBC_PRIVATE.

Tested for x86_64, x86, mips64 and powerpc.

[BZ #16961]
[BZ #16962]
* math/s_nan.c (__nan): Use __strtod_nan instead of constructing a
string on the stack for strtod.
* math/s_nanf.c (__nanf): Use __strtof_nan instead of constructing
a string on the stack for strtof.
* math/s_nanl.c (__nanl): Use __strtold_nan instead of
constructing a string on the stack for strtold.
* stdlib/Versions (libc): Add __strtof_nan, __strtod_nan and
__strtold_nan to GLIBC_PRIVATE.
* math/test-nan-overflow.c: New file.
* math/test-nan-payload.c: Likewise.
* math/Makefile (tests): Add test-nan-overflow and
test-nan-payload.

8 years agoRevert "tst-res_hconf_reorder: Set RESOLV_REORDER environment variable"
Florian Weimer [Fri, 4 Dec 2015 18:25:59 +0000 (19:25 +0100)]
Revert "tst-res_hconf_reorder: Set RESOLV_REORDER environment variable"

This reverts commit 731a713b72e1281d58b3304738f04efb7bfca8b7.

This change is unnecessary because the Makefile already sets up the
environment for the test.

8 years agotst-res_hconf_reorder: Set RESOLV_REORDER environment variable
Florian Weimer [Fri, 4 Dec 2015 18:02:04 +0000 (19:02 +0100)]
tst-res_hconf_reorder: Set RESOLV_REORDER environment variable

Otherwise, the problematic code does not run.

8 years agoConsistency about byte vs character in string.texi
Paul Eggert [Fri, 4 Dec 2015 16:27:14 +0000 (08:27 -0800)]
Consistency about byte vs character in string.texi

* manual/string.texi (String and Array Utilities):
Distinguish more carefully among bytes, multibyte characters,
and wide characters.  Use "byte" when talking about C 'char',
to distinguish it more clearly from multibyte characters.
Say "wide character" or "multibyte character" instead of
"character", when a wide or multibyte character is intended.
Similarly for "multibyte string" versus "string".
Define these terms more carefully.

8 years agomath: add LDBL_CLASSIFY_COMPAT support
Chris Metcalf [Tue, 1 Dec 2015 19:59:38 +0000 (14:59 -0500)]
math: add LDBL_CLASSIFY_COMPAT support

If a platform does not define "long-double-fcts = yes" in its
Makefiles and it does define __NO_LONG_DOUBLE_MATH in its installed
headers, it will currently create exported symbols for __finitel,
__isinfl, and __isnanl that can't be reached from userspace by
correct use of the finite(), isinf(), or isnan() macros in <math.h>.

To avoid this situation, by default for such platforms we now no
longer export these symbols, thus causing appropriate link-time
errors.  However, for platforms that previously exported these
symbols, we continue to do so as compat symbols; this is enabled
by adding LDBL_CLASSIFY_COMPAT to math_private.h for the platform.

For tile, remove the now-unnecessary exports of those functions from
libc and libm.

8 years agoCorrected path to installed libmvec_nonshared.a
Andrew Senkevich [Thu, 3 Dec 2015 17:24:37 +0000 (20:24 +0300)]
Corrected path to installed libmvec_nonshared.a

    * math/Makefile ($(inst_libdir)/libm.so): Corrected path to
    libmvec_nonshared.a

8 years agopowerpc: Add hwcap/hwcap2/platform data to TCB.
Carlos Eduardo Seo [Fri, 23 Oct 2015 00:26:58 +0000 (19:26 -0500)]
powerpc: Add hwcap/hwcap2/platform data to TCB.

This patch adds a new feature for powerpc.  In order to get faster access to
the HWCAP/HWCAP2 bits and platform number (i.e. for implementing
__builtin_cpu_is () / __builtin_cpu_supports () in GCC) without the overhead of
reading from the auxiliary vector, we now reserve space for them in the TCB.
This is an ABI change for GLIBC 2.23.

A new versioned symbol '__parse_hwcap_and_convert_at_platform' is available to
get the data from the auxiliary vector and parse it, and store it for later use
in the TLS initialization code.  This function is called very early
(in _dl_sysdep_start () via DL_PLATFORM_INFO for the dynamic linking case, and
in __libc_start_main () for the static linking case) to make sure the data is
available at the time of TLS initialization.

* sysdeps/powerpc/Makefile (sysdep-dl-routines): Add hwcapinfo.
(sysdep_routines): Likewise.
(sysdep-rtld-routines): Likewise.
[$(subdir) = nptl](tests): Add test-get_hwcap and test-get_hwcap-static
[$(subdir) = nptl](tests-static): test-get_hwcap-static
* sysdeps/powerpc/Versions: Added new
__parse_hwcap_and_convert_at_platform symbol to GLIBC-2.23.
* sysdeps/powerpc/hwcapinfo.c: New file.
(__tcb_parse_hwcap_and_convert_at_platform): New function to initialize
and parse hwcap, hwcap2 and platform number information.
* sysdeps/powerpc/hwcapinfo.h: New file.  Creates global variables
to store HWCAP+HWCAP2 and platform number.
* sysdeps/powerpc/nptl/tcb-offsets.sym: Added new offsets
for HWCAP+HWCAP2 and platform number in the TCB.
* sysdeps/powerpc/nptl/tls.h: New functionality.  Stores
the HWCAP, HWCAP2 and platform number in the TCB.
(dtv): Added new fields for HWCAP+HWCAP2 and platform number.
(TLS_INIT_TP): Included calls to add the hwcap and
at_platform values in the TCB in TP initialization.
(TLS_DEFINE_INIT_TP): Likewise.
(THREAD_GET_HWCAP): New macro.
(THREAD_SET_HWCAP): Likewise.
(THREAD_GET_AT_PLATFORM): Likewise.
(THREAD_SET_AT_PLATFORM): Likewise.
* sysdeps/powerpc/powerpc32/dl-machine.h:
(dl_platform_init): New function that calls
__parse_hwcap_and_convert_at_platform for the dymanic linking case for
powerpc32.
* sysdeps/powerpc/powerpc64/dl-machine.h: Likewise, for powerpc64.
* sysdeps/powerpc/test-get_hwcap-static.c: New file.  Testcase for
this functionality, static linking case.
* sysdeps/powerpc/test-get_hwcap.c: New file.  Likewise, dynamic
linking case.
* sysdeps/unix/sysv/linux/powerpc/libc-start.c: Added call to
__parse_hwcap_and_convert_at_platform for the static linking case.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist:
Included the new __parse_hwcap_and_convert_at_platform symbol in the
ABI list for GLIBC 2.23.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist:
Likewise.

8 years agoUse shell's builtin pwd.
Ludovic Courtès [Thu, 3 Dec 2015 04:58:15 +0000 (23:58 -0500)]
Use shell's builtin pwd.

Insisting on /bin/pwd is unnecessary nowadays.  Autoconf-generated
scripts have been using the shell's built-in "pwd" for a long time.`

8 years agoComment on IBM930, IBM933, IBM935, IBM937, IBM939.
Carlos O'Donell [Thu, 3 Dec 2015 03:13:47 +0000 (22:13 -0500)]
Comment on IBM930, IBM933, IBM935, IBM937, IBM939.

Add comments for IBM930, IBM933, IBM935, IBM937, and IBM939 which
explain exactly what purpose these encodings have and provide a URL to
the upstream IBM database that further provides the details of the
encoding.

8 years agonptl: Fix racy pipe closing in tst-cancel{20,21}
Adhemerval Zanella [Wed, 14 Oct 2015 15:15:46 +0000 (12:15 -0300)]
nptl: Fix racy pipe closing in tst-cancel{20,21}

The tst-cancel20 open two pipes and creates a thread which blocks
reading the first pipe.  It then issues a signal to activate the
signal handler which in turn blocks reading the second pipe end.
Finally the cancellation cleanup-up handlers are tested by first
closing the all the pipes ends and issuing a pthread_cancel.
The tst-cancel21 have a similar behavior, but use an extra fork
after the test itself.

The race condition occurs if the cancellation handling acts after the
pipe close: in this case read will return EOF (indicating side-effects)
and thus the cancellation must not act.  However current GLIBC
cancellation behavior acts regardless the syscalls returns with
sid-effects.

This patch adjust the test by moving the pipe closing after the
cancellation handling.  This avoid spurious cancellation if the case
of the race described.

Checked on x86_64 and i386.

* nptl/tst-cancel20.c (do_one_test): Move the pipe closing after
pthread_join.
* nptl/tst-cancel21.c (tf): Likewise.

8 years agoAdd __CPU_MASK_TYPE for __cpu_mask
H.J. Lu [Tue, 1 Dec 2015 18:25:44 +0000 (10:25 -0800)]
Add __CPU_MASK_TYPE for __cpu_mask

Since x86-64 and x32 use the same set of sched_XXX system call interface:

[hjl@gnu-6 linux-stable]$ grep sched_
arch/x86/entry/syscalls/syscall_64.tbl
24 common sched_yield sys_sched_yield
142 common sched_setparam sys_sched_setparam
143 common sched_getparam sys_sched_getparam
144 common sched_setscheduler sys_sched_setscheduler
145 common sched_getscheduler sys_sched_getscheduler
146 common sched_get_priority_max sys_sched_get_priority_max
147 common sched_get_priority_min sys_sched_get_priority_min
148 common sched_rr_get_interval sys_sched_rr_get_interval
203 common sched_setaffinity sys_sched_setaffinity
204 common sched_getaffinity sys_sched_getaffinity
314 common sched_setattr sys_sched_setattr
315 common sched_getattr sys_sched_getattr
[hjl@gnu-6 linux-stable]$

__cpu_mask should be unsigned long long, instead of unsigned long, for
x32.  This patch adds __CPU_MASK_TYPE so that each architecture can
define the proper type for __cpu_mask.

[BZ #19313]
* bits/typesizes.h (__CPU_MASK_TYPE): New.
* sysdeps/mach/hurd/bits/typesizes.h (__CPU_MASK_TYPE): Likewise.
* sysdeps/nacl/bits/typesizes.h (__CPU_MASK_TYPE): Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h (__CPU_MASK_TYPE):
Likewise.
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h (__CPU_MASK_TYPE):
Likewise.
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h (__CPU_MASK_TYPE):
Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h (__CPU_MASK_TYPE):
Likewise.
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h (__CPU_MASK_TYPE):
* sysdeps/unix/sysv/linux/bits/sched.h (__cpu_mask): Replace
unsigned long int with __CPU_MASK_TYPE.

8 years ago[AArch64] Regenerate libm-test-ulps
Szabolcs Nagy [Tue, 1 Dec 2015 12:57:16 +0000 (12:57 +0000)]
[AArch64] Regenerate libm-test-ulps

* sysdeps/aarch64/libm-test-ulps: Regenerated.

8 years agoUse hex float constants in sysdeps/ieee754/dbl-64/e_sqrt.c.
Joseph Myers [Tue, 1 Dec 2015 01:01:36 +0000 (01:01 +0000)]
Use hex float constants in sysdeps/ieee754/dbl-64/e_sqrt.c.

Various sysdeps/ieee754/dbl-64 functions use double constants defined
using a union between a double and two ints, with separate big-endian
and little-endian definitions of the constants.

With modern C, this is unnecessary complication; hex float constants
(or __builtin_inf etc.) suffice to specify the exact value desired,
and so can avoid separate versions for each endianness.  Having this
complication also complicates cleanups such as removing slow paths
from these library functions, as they need to make sure to remove both
copies of variables that are no longer used after such a cleanup (and
in at least one case, proper removal of a slow path will also involve
removing slow-path-only values from the middle of an array - an array
with both big-endian and little-endian copies - and adjusting other
references to that array).

So it makes sense to clean up the code to define these constants using
hex floats and so eliminate the endianness conditional.  This patch
does so in the case of sqrt, where the two constants are such that it
makes sense just to put them directly in the code using them and
eliminate the names for them altogether.

Tested for arm (the code generated for sqrt does change, though not in
any significant way).

* sysdeps/ieee754/dbl-64/e_sqrt.c: Do not include uroot.h.
(__ieee754_sqrt): Use hex float constants instead of tm256.x and
t512.x.
* sysdeps/ieee754/dbl-64/uroot.h: Remove file.

8 years agoUpdate family and model detection for AMD CPUs
H.J. Lu [Mon, 30 Nov 2015 16:53:37 +0000 (08:53 -0800)]
Update family and model detection for AMD CPUs

AMD CPUs uses the similar encoding scheme for extended family and model
as Intel CPUs as shown in:

http://support.amd.com/TechDocs/25481.pdf

This patch updates get_common_indeces to get family and model for both
Intel and AMD CPUs when family == 0x0f.

[BZ #19214]
* sysdeps/x86/cpu-features.c (get_common_indeces): Add an
argument to return extended model.  Update family and model
with extended family and model when family == 0x0f.
(init_cpu_features): Updated.

8 years agohurd: Make mmap64 use vm_offset_t for overflow check
Samuel Thibault [Sun, 29 Nov 2015 16:25:53 +0000 (17:25 +0100)]
hurd: Make mmap64 use vm_offset_t for overflow check

The RPC interface used by mmap uses the unsigned vm_offset_t, not the
signed off_t, so 32bit bigger than 2GiB values are fine actually.

* sysdeps/mach/hurd/mmap64.c: New file.

8 years agohurd: install correct number of send rights on fork
Thomas Schwinge [Sun, 29 Nov 2015 15:41:00 +0000 (16:41 +0100)]
hurd: install correct number of send rights on fork

* sysdeps/mach/hurd/fork.c (__fork): Install correct number of send
rights for its main user thread in NEWTASK.

8 years agoMIPS: Wire FCSR.ABS2008 to FCSR.NAN2008
Maciej W. Rozycki [Sat, 28 Nov 2015 11:01:16 +0000 (11:01 +0000)]
MIPS: Wire FCSR.ABS2008 to FCSR.NAN2008

Revision 3.50 of the MIPS architecture defined FCSR ABS2008 and NAN2008
bits as optionally read/write [1][2].  No hardware implementation has
ever made use of this feature though.  For example the first processor
to implement these bits, the MIPS32r3 proAptiv core, has both bits
read-only, hardwired to 1 [3].  And as from revision 5.03 of the MIPS
architecture the bits are required to be read-only, preset by hardware
[4][5].  Additionally all hardware implementations in existence have the
bits hardwired both to the same value, either of `0' and `1'.

These bits may still be read/write or hardwired to opposite values in
simulated hardware implementations such as QEMU or the FPU emulator
included with the Linux kernel.  However to match real hardware
implementations the Linux kernel will set FCSR ABS2008 and NAN2008 bits
both to the same value where possible, reflecting the setting of the
EF_MIPS_NAN2008 ELF file header bit.

Therefore update the bit patterns in macro definitions we use for the
control word, in the 2008-NaN encoding mode, so that both bits have the
same value in a given bit pattern.  Additionally mark the FCSR ABS2008
bit as reserved, so that high-level calls to change the control word do
not affect the bit.

This covers the regular FPU configurations, only leaving exotic corner
cases with the value of FCSR control word initially set by the kernel
different to what our code thinks it is.  To address the remaining cases
the AT_FPUCW auxiliary vector entry would have to be implemented in the
Linux kernel, which currently is not.

References:

[1] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
    MIPS32 Architecture", MIPS Technologies, Inc., Document Number:
    MD00082, Revision 3.50, September 20, 2012, Table 5.5 "FCSR Register
    Field Descriptions", p. 80

[2] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
    MIPS64 Architecture", MIPS Technologies, Inc., Document Number:
    MD00083, Revision 3.50, September 20, 2012, Table 5.5 "FCSR Register
    Field Descriptions", p. 82

[3] "MIPS32 proAptiv Multiprocessing System Software User's Manual",
    MIPS Technologies, Inc., Document Number: MD00878, Revision 01.22,
    May 14, 2013, Table 12.10 "FCSR Bit Field Descriptions", p. 570

[4] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
    MIPS32 Architecture", MIPS Technologies, Inc., Document Number:
    MD00082, Revision 5.03, Sept. 9, 2013, Table 5.7 "FCSR Register
    Field Descriptions", p. 82

[5] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
    MIPS64 Architecture", MIPS Technologies, Inc., Document Number:
    MD00083, Revision 5.03, Sept. 9, 2013, Table 5.7 "FCSR Register
    Field Descriptions", p. 84

* sysdeps/mips/fpu_control.h (_FPU_RESERVED): Include ABS2008.
(_FPU_DEFAULT, _FPU_IEEE) [__mips_nan2008]: Set ABS2008.

8 years agoRename localedir to complocaledir (bug 14259).
Carlos O'Donell [Fri, 27 Nov 2015 15:09:45 +0000 (10:09 -0500)]
Rename localedir to complocaledir (bug 14259).

In preparation to fix the --localedir configure argument we must
move the existing conflicting definition of localedir to a more
appropriate name. Given that all current internal uses of localedir
relate to the compiled locales we rename to complocaledir.

8 years agoBetter workaround for aliases of *_finite symbols in vector math library.
Andrew Senkevich [Fri, 27 Nov 2015 13:22:26 +0000 (16:22 +0300)]
Better workaround for aliases of *_finite symbols in vector math library.

Old workaround based on assembly aliases can lead to link fail (bug 19058).
This patch makes workaround in another way to avoid it.

    [BZ #19058]
    * math/Makefile ($(inst_libdir)/libm.so): Added libmvec_nonshared.a
    to AS_NEEDED.
    * sysdeps/x86/fpu/bits/math-vector.h: Removed code with old workaround.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support,
    libmvec-static-only-routines): Added new file.
    * sysdeps/x86_64/fpu/svml_finite_alias.S: New file.

8 years agohurd: Initialize __libc_stack_end for hidden support
Samuel Thibault [Wed, 25 Nov 2015 16:48:51 +0000 (17:48 +0100)]
hurd: Initialize __libc_stack_end for hidden support

* sysdeps/mach/hurd/dl-sysdep.c (__libc_stack_end): Initialize to get
into initialized data instead of common.

8 years agoDo not add relro attribute to __libc_stack_end
Samuel Thibault [Wed, 25 Nov 2015 16:05:53 +0000 (17:05 +0100)]
Do not add relro attribute to __libc_stack_end

It does not actually work yet

* sysdeps/mach/hurd/dl-sysdep.c (__libc_stack_end): Remove relro attribute.

8 years agoRevert not defining NO_HIDDEN on hurd
Samuel Thibault [Wed, 25 Nov 2015 01:48:22 +0000 (02:48 +0100)]
Revert not defining NO_HIDDEN on hurd

       * sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Define.
       * sysdeps/mach/hurd/configure: Regenerate.

8 years agoFix hurd build with hidden support
Samuel Thibault [Wed, 25 Nov 2015 01:35:18 +0000 (02:35 +0100)]
Fix hurd build with hidden support

* hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Destroy reply port
of interrupted RPC instead of restoring it.

* sysdeps/i386/setjmp.S (__sigsetjmp): Add hidden_def.
* sysdeps/mach/hurd/accept4.c (__libc_accept4): Remove
libc_hidden_def.
* sysdeps/mach/hurd/dl-sysdep.c (__libc_stack_end): Add relro
attribute, define rtld_hidden_data_def.
* sysdeps/mach/hurd/fxstatat64.c (__fxstatat64): Add libc_hidden_def.
* sysdeps/mach/hurd/if_index.c (__if_freenameindex): Add
libc_hidden_def.
(if_freenameindex): Add libc_hidden_weak.
(if_nameindex): Add libc_hidden_weak.
* sysdeps/mach/hurd/open.c (_open64): Rename libc_hidden_weak into
__open64.
* sysdeps/mach/hurd/sigwait.c (__sigwait): Add libc_hidden_def.
* sysdeps/mach/hurd/xmknodat.c (__xmknodat): Add libc_hidden_def.
* sysdeps/mach/nanosleep.c: Include <time.h>
(__nanosleep): Rename to __libc_nanosleep.
(__nanosleep): Add weak_alias.
(nanosleep): Update alias.
* sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Do not define.
* sysdeps/mach/hurd/configure: Regenerate.

8 years agoFix RPC breakage when longjumping from signal handler
Samuel Thibault [Wed, 25 Nov 2015 00:09:13 +0000 (01:09 +0100)]
Fix RPC breakage when longjumping from signal handler

* hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Destroy reply port
of interrupted RPC instead of restoring it.

8 years agoRefactor strtod parsing of NaN payloads.
Joseph Myers [Tue, 24 Nov 2015 22:24:52 +0000 (22:24 +0000)]
Refactor strtod parsing of NaN payloads.

The nan* functions handle their string argument by constructing a
NAN(...) string on the stack as a VLA and passing it to strtod
functions.

This approach has problems discussed in bug 16961 and bug 16962: the
stack usage is unbounded, and it gives incorrect results in certain
cases where the argument is not a valid n-char-sequence.

The natural fix for both issues is to refactor the NaN payload parsing
out of strtod into a separate function that the nan* functions can
call directly, so that no temporary string needs constructing on the
stack at all.  This patch does that refactoring in preparation for
fixing those bugs (but without actually using the new functions from
nan* - which will also require exporting them from libc at version
GLIBC_PRIVATE).  This patch is not intended to change any user-visible
behavior, so no tests are added (fixes for the above bugs will of
course add tests for them).

This patch builds on my recent fixes for strtol and strtod issues in
Turkish locales.  Given those fixes, the parsing of NaN payloads is
locale-independent; thus, the new functions do not need to take a
locale_t argument.

Tested for x86_64, x86, mips64 and powerpc.

* stdlib/strtod_nan.c: New file.
* stdlib/strtod_nan_double.h: Likewise.
* stdlib/strtod_nan_float.h: Likewise.
* stdlib/strtod_nan_main.c: Likewise.
* stdlib/strtod_nan_narrow.h: Likewise.
* stdlib/strtod_nan_wide.h: Likewise.
* stdlib/strtof_nan.c: Likewise.
* stdlib/strtold_nan.c: Likewise.
* sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h: Likewise.
* sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h: Likewise.
* sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h: Likewise.
* wcsmbs/wcstod_nan.c: Likewise.
* wcsmbs/wcstof_nan.c: Likewise.
* wcsmbs/wcstold_nan.c: Likewise.
* stdlib/Makefile (routines): Add strtof_nan, strtod_nan and
strtold_nan.
* wcsmbs/Makefile (routines): Add wcstod_nan, wcstold_nan and
wcstof_nan.
* include/stdlib.h (__strtof_nan): Declare and use
libc_hidden_proto.
(__strtod_nan): Likewise.
(__strtold_nan): Likewise.
(__wcstof_nan): Likewise.
(__wcstod_nan): Likewise.
(__wcstold_nan): Likewise.
* include/wchar.h (____wcstoull_l_internal): Declare.
* stdlib/strtod_l.c: Do not include <ieee754.h>.
(____strtoull_l_internal): Remove declaration.
(STRTOF_NAN): Define macro.
(SET_MANTISSA): Remove macro.
(STRTOULL): Likewise.
(____STRTOF_INTERNAL): Use STRTOF_NAN to parse NaN payload.
* stdlib/strtof_l.c (____strtoull_l_internal): Remove declaration.
(STRTOF_NAN): Define macro.
(SET_MANTISSA): Remove macro.
* sysdeps/ieee754/ldbl-128/strtold_l.c (STRTOF_NAN): Define macro.
(SET_MANTISSA): Remove macro.
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c (STRTOF_NAN): Define
macro.
(SET_MANTISSA): Remove macro.
* sysdeps/ieee754/ldbl-64-128/strtold_l.c (STRTOF_NAN): Define
macro.
(SET_MANTISSA): Remove macro.
* sysdeps/ieee754/ldbl-96/strtold_l.c (STRTOF_NAN): Define macro.
(SET_MANTISSA): Remove macro.
* wcsmbs/wcstod_l.c (____wcstoull_l_internal): Remove declaration.
* wcsmbs/wcstof_l.c (____wcstoull_l_internal): Likewise.
* wcsmbs/wcstold_l.c (____wcstoull_l_internal): Likewise.

8 years agoFix strtod ("NAN(I)") in Turkish locales (bug 19266).
Joseph Myers [Tue, 24 Nov 2015 22:21:59 +0000 (22:21 +0000)]
Fix strtod ("NAN(I)") in Turkish locales (bug 19266).

The implementations of strtod and related functions use
locale-specific conversions to lower case when parsing the contents of
a string NAN(n-char-sequence_opt).  This has the consequence that
NAN(I) is not treated as being of that form (only the initial NAN part
is accepted).  The syntax of n-char-sequence directly maps to the
ASCII letters, digits and underscore as in identifiers, so it is
unambiguous that all ASCII letters must be accepted in all locales.

This patch, relative to a tree with
<https://sourceware.org/ml/libc-alpha/2015-11/msg00258.html> (pending
review) applied and depending on that patch, fixes this problem by
checking directly for ASCII letters.  This will have the side effect
of no longer accepting 'İ' (dotted 'I') inside NAN() in Turkish
locales, which seems appropriate (that letter wouldn't have been
interpreted as having any meaning in the NaN payload anyway, as not
acceptable to strtoull).

Tested for x86_64 and x86.

[BZ #19266]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Check directly for
upper case and lower case letters inside NAN(), not using TOLOWER.
* stdlib/tst-strtod-nan-locale-main.c: New file.
* stdlib/tst-strtod-nan-locale.c: Likewise.
* stdlib/Makefile (tests): Add tst-strtod-nan-locale.
[$(run-built-tests) = yes] ($(objpfx)tst-strtod-nan-locale.out):
Depend on $(gen-locales).
($(objpfx)tst-strtod-nan-locale): Depend on $(libm).
* wcsmbs/tst-wcstod-nan-locale.c: New file.
* wcsmbs/Makefile (tests): Add tst-wcstod-nan-locale.
[$(run-built-tests) = yes] ($(objpfx)tst-wcstod-nan-locale.out):
Depend on $(gen-locales).
($(objpfx)tst-wcstod-nan-locale): Depend on $(libm).

8 years agomisc/tst-tsearch.c: bump up TIMEOUT to 10 seconds.
Chris Metcalf [Tue, 24 Nov 2015 19:07:02 +0000 (14:07 -0500)]
misc/tst-tsearch.c: bump up TIMEOUT to 10 seconds.

8 years agotile: define __NO_LONG_DOUBLE_MATH
Chris Metcalf [Tue, 24 Nov 2015 15:09:16 +0000 (10:09 -0500)]
tile: define __NO_LONG_DOUBLE_MATH

This avoids build failures in the tests, and matches what is in
bits/mathdef.h.

Update the libc and libm abilist files to include __finitel,
__isinfl, and __isnanl.

8 years agomalloc: remove redundant getenv call
Gleb Fotengauer-Malinovskiy [Tue, 24 Nov 2015 16:19:32 +0000 (16:19 +0000)]
malloc: remove redundant getenv call

* malloc/memusage.c (me): Remove redundant getenv call.

8 years agoRemove CPU set size checking from affinity functions [BZ #19143]
Florian Weimer [Tue, 24 Nov 2015 16:21:01 +0000 (17:21 +0100)]
Remove CPU set size checking from affinity functions [BZ #19143]

With current kernel versions, the check does not reliably detect that
unavailable CPUs are requested, for these reasons:

(1) The kernel will silently ignore non-allowed CPUs, that is, CPUs
    which are physically present but disallowed for the thread
    based on system configuration.

(2) Similarly, CPU bits which lack an online CPU (possible CPUs)
    are ignored.

(3) The existing probing code assumes that the CPU mask size is a
    power of two and at least 1024.  Neither has it to be a power
    of two, nor is the minimum possible value 1024, so the value
    determined is often too large.  This means that the CPU set
    size check in glibc accepts CPU bits beyond the actual hard
    system limit.

(4) Future kernel versions may not even have a fixed CPU set size.

After the removal of the probing code, the kernel still returns
EINVAL if no CPU in the requested set remains which can run the
thread after the affinity change.

Applications which care about the exact affinity mask will have
to query it using sched_getaffinity after setting it.  Due to the
effects described above, this commit does not change this.

The new tests supersede tst-getcpu, which is removed.  This
addresses bug 19164 because the new tests allocate CPU sets
dynamically.

* nptl/check-cpuset.h: Remove.
* nptl/pthread_attr_setaffinity.c (__pthread_attr_setaffinity_new):
Remove CPU set size check.
* nptl/pthread_setattr_default_np.c (pthread_setattr_default_np):
Likewise.
* sysdeps/unix/sysv/linux/check-cpuset.h: Remove.
* sysdeps/unix/sysv/linux/pthread_setaffinity.c
(__kernel_cpumask_size, __determine_cpumask_size): Remove.
(__pthread_setaffinity_new): Remove CPU set size check.
* sysdeps/unix/sysv/linux/sched_setaffinity.c
(__kernel_cpumask_size): Remove.
(__sched_setaffinity_new): Remove CPU set size check.
* manual/threads.texi (Default Thread Attributes): Remove stale
reference to check_cpuset_attr, determine_cpumask_size in comment.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == posix] (tests):
Remove tst-getcpu.  Add tst-affinity, tst-affinity-pid.
[$(subdir) == nptl] (tests): Add tst-thread-affinity-pthread,
tst-thread-affinity-pthread2, tst-thread-affinity-sched.
* sysdeps/unix/sysv/linux/tst-affinity.c: New file.
* sysdeps/unix/sysv/linux/tst-affinity-pid.c: New file.
* sysdeps/unix/sysv/linux/tst-skeleton-affinity.c: New skeleton test file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-sched.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-pthread.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-pthread2.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-skeleton-affinity.c: New
skeleton test file.
* sysdeps/unix/sysv/linux/tst-getcpu.c: Remove.  Superseded by
tst-affinity-pid.

8 years agoImplement "make update-all-abi"
Florian Weimer [Tue, 24 Nov 2015 16:10:19 +0000 (17:10 +0100)]
Implement "make update-all-abi"

* scripts/update-abilist.sh: New file.
* Makefile (+subdir_targets): Add subdir_update-all-abi.
* Makerules (update-all-abi-%, update-all-abi)
(subdir_update-all-abi): New targets.
* elf/Makefile (update-all-abi): New target.