]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
4 years agoFix http: URL in 'configure'
Paul Eggert [Mon, 9 Sep 2019 21:10:23 +0000 (14:10 -0700)] 
Fix http: URL in 'configure'

* configure.ac: Add URL to AC_INIT so that it generates an
https: URL instead of an http: URL.
* configure: Regenerate.

4 years agoRegenerate charmap-kw.h, locfile-kw.h
Paul Eggert [Mon, 9 Sep 2019 21:08:46 +0000 (14:08 -0700)] 
Regenerate charmap-kw.h, locfile-kw.h

This propagates the recent http->https URL changes.
Since I used gperf 3.1 to regenerate, this is also a minor
internal-to-localedef API change.
URL problem reported by Joseph Myers in:
https://www.sourceware.org/ml/libc-alpha/2019-09/msg00143.html
* locale/programs/charmap-kw.h, locale/programs/locfile-kw.h:
Regenerate with gperf 3.1.
* locale/programs/linereader.h (kw_hash_fct_t):
* locale/programs/repertoire.c (repertoiremap_hash):
2nd arg is now size_t not unsigned, for compatibility with gperf 3.1.

4 years agoFix three GNU license URLs, along with trailing-newline issues.
Paul Eggert [Sat, 7 Sep 2019 09:54:48 +0000 (02:54 -0700)] 
Fix three GNU license URLs, along with trailing-newline issues.

4 years agoPrefer https to http for gnu.org and fsf.org URLs
Paul Eggert [Sat, 7 Sep 2019 05:40:42 +0000 (22:40 -0700)] 
Prefer https to http for gnu.org and fsf.org URLs

Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:

sed -ri '
  s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
  s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
  $(find $(git ls-files) -prune -type f \
      ! -name '*.po' \
      ! -name 'ChangeLog*' \
      ! -path COPYING ! -path COPYING.LIB \
      ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
      ! -path manual/texinfo.tex ! -path scripts/config.guess \
      ! -path scripts/config.sub ! -path scripts/install-sh \
      ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
      ! -path INSTALL ! -path  locale/programs/charmap-kw.h \
      ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
      ! '(' -name configure \
            -execdir test -f configure.ac -o -f configure.in ';' ')' \
      ! '(' -name preconfigure \
            -execdir test -f preconfigure.ac ';' ')' \
      -print)

and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:

  chmod a+x sysdeps/unix/sysv/linux/riscv/configure
  # Omit irrelevant whitespace and comment-only changes,
  # perhaps from a slightly-different Autoconf version.
  git checkout -f \
    sysdeps/csky/configure \
    sysdeps/hppa/configure \
    sysdeps/riscv/configure \
    sysdeps/unix/sysv/linux/csky/configure
  # Omit changes that caused a pre-commit check to fail like this:
  # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
  git checkout -f \
    sysdeps/powerpc/powerpc64/ppc-mcount.S \
    sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
  # Omit change that caused a pre-commit check to fail like this:
  # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
  git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S

4 years agoUse __attribute_pure__ macro in bits/mathcalls.h
Gabriel F. T. Gomes [Thu, 5 Sep 2019 20:06:03 +0000 (17:06 -0300)] 
Use __attribute_pure__ macro in bits/mathcalls.h

When the const attribute of totalorder* functions was replaced with the
pure attribute, by commit ID ab41100bab12, it did not use the
__attribute_pure__ macro, but the __attribute__ ((__pure__)) statement.
All other uses of the pure attribute in glibc use the macro.

Tested for powerpc64le.

4 years agolocale: Avoid zero-length array in _nl_category_names [BZ #24962]
Florian Weimer [Thu, 5 Sep 2019 20:16:58 +0000 (22:16 +0200)] 
locale: Avoid zero-length array in _nl_category_names [BZ #24962]

The union wrapper is unnecessary because C allows to read any object
as a sequence of chars.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agomath: Replace const attribute with pure in totalorder* functions
Gabriel F. T. Gomes [Wed, 4 Sep 2019 16:36:23 +0000 (13:36 -0300)] 
math: Replace const attribute with pure in totalorder* functions

Since the commit

commit 42760d764649ad82f5fe45a26cbdf2c2500409f7
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Aug 15 15:18:34 2019 +0000

    Make totalorder and totalordermag functions take pointer arguments.

the test case math/test-totalorderl-ldbl-128ibm fails on every input
pair, when compiled with -O2, which is the case for glibc test suite.

Debugging showed that the test case is passing arguments incorrectly to
totalorderl.  This can also be inferred by the fact that compiling the
test case with -O0 hides the bug.

The documentation for the const attribute in GCC manual reads:

  Note that a function that has pointer arguments and examines the data
  pointed to must not be declared const if the pointed-to data might
  change between successive invocations of the function. In general,
  since a function cannot distinguish data that might change from data
  that cannot, const functions should never take pointer or, in C++,
  reference arguments. Likewise, a function that calls a non-const
  function usually must not be const itself.

Since the pointed-to data is likely to be changed by user code between
invocations of totalorder*, this patch removes the const attribute from
the declarations of all totalorder functions, replacing it with the pure
attribute, as suggested in the manual:

  The pure attribute imposes similar but looser restrictions on a
  function’s definition than the const attribute: pure allows the
  function to read any non-volatile memory, even if it changes in
  between successive invocations of the function.

Tested for powerpc64le and x86_64.

4 years agoy2038: Introduce the __ASSUME_TIME64_SYSCALLS define
Lukasz Majewski [Wed, 28 Aug 2019 18:27:03 +0000 (14:27 -0400)] 
y2038: Introduce the __ASSUME_TIME64_SYSCALLS define

Add a macro to linux/kernel-features.h, __ASSUME_TIME64_SYSCALLS, to
indicate whether the kernel can be assumed to provide a set of system
calls that process 64-bit time_t.

__ASSUME_TIME64_SYSCALLS does not indicate whether time_t is actually
64 bits (that's __TIMEBITS) and also does not indicate whether the
64-bit time_t system calls have "time64" suffixes on their names.

Code that uses __ASSUME_TIME64_SYSCALLS will be added in subsequent
patches.

* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_TIME64_SYSCALLS): New macro.

Reviewed-by: Alistair Francis <alistair23@gmail.com>
Reviewed-by: Joseph Myers <joseph@codesourcery.com>
Reviewed-by: Zack Weinberg <zackw@panix.com>
4 years agoFinish move of clock_* functions to libc. [BZ #24959]
Zack Weinberg [Wed, 4 Sep 2019 06:18:57 +0000 (08:18 +0200)] 
Finish move of clock_* functions to libc. [BZ #24959]

In glibc 2.17, the functions clock_getcpuclockid, clock_getres,
clock_gettime, clock_nanosleep, and clock_settime were moved from
librt.so to libc.so, leaving compatibility stubs behind.  Now that the
dynamic linker no longer insists on finding versioned symbols in the
same library that originally defined them, we do not need the stubs
anymore, and this means we don't need GLIBC_PRIVATE __-prefix aliases
for most of the functions anymore either.  (clock_gettime still needs
one.)  For ports added before 2.17, libc.so needs to provide two
symbol versions for each, the default at GLIBC_2.17 plus a compat
version matching what librt had.

While I'm at it, move the clock_*.c files and their tests from rt/ to
time/.

4 years agoUpdate Alpha libm-test-ulps
Aurelien Jarno [Tue, 3 Sep 2019 19:35:51 +0000 (21:35 +0200)] 
Update Alpha libm-test-ulps

Changelog:

* sysdeps/alpha/fpu/libm-test-ulps: Regenerated using GCC 9.2.

4 years agolocaledef: Use initializer for flexible array member [BZ #24950]
Florian Weimer [Tue, 3 Sep 2019 12:01:39 +0000 (14:01 +0200)] 
localedef: Use initializer for flexible array member [BZ #24950]

struct charseq used a zero-length array instead of a flexible array
member.  This required a strange construct to initialize struct
charseq objects, and GCC 10 warns about that:

cc1: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
In file included from programs/repertoire.h:24,
                 from programs/localedef.h:32,
                 from programs/ld-ctype.c:35:
programs/charmap.h:63:17: note: destination object declared here
   63 |   unsigned char bytes[0];
      |                 ^~~~~
cc1: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
programs/charmap.h:63:17: note: destination object declared here
cc1: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
programs/charmap.h:63:17: note: destination object declared here
cc1: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
programs/charmap.h:63:17: note: destination object declared here

The change makes the object physically const, but it is not expected
to be modified.

4 years agoAdd misc/tst-mntent-autofs, testing autofs "ignore" filtering
Florian Weimer [Mon, 2 Sep 2019 10:40:38 +0000 (12:40 +0200)] 
Add misc/tst-mntent-autofs, testing autofs "ignore" filtering

4 years agoUse autofs "ignore" mount hint in getmntent_r/getmntent
Ian Kent [Mon, 2 Sep 2019 11:26:14 +0000 (13:26 +0200)] 
Use autofs "ignore" mount hint in getmntent_r/getmntent

Historically autofs mounts were not included in mount table
listings. This is the case in other SysV autofs implementations
and was also the case with Linux autofs.

But now that /etc/mtab is a symlink to the proc filesystem
mount table the autofs mount entries appear in the mount table
on Linux.

Prior to the symlinking of /etc/mtab mount table it was
sufficient to call mount(2) and simply not update /etc/mtab
to exclude autofs mounts from mount listings.

Also, with the symlinking of /etc/mtab we have seen a shift in
usage toward using the proc mount tables directly.

But the autofs mount entries need to be retained when coming
from the proc file system for applications that need them
(largely autofs file system users themselves) so filtering out
these entries within the kernel itself can't be done. So it
needs be done in user space.

There are three reasons to omit the autofs mount entries.

One is that certain types of auto-mounts have an autofs mount
for every entry in their autofs mount map and these maps can
be quite large. This leads to mount table listings containing
a lot of unnecessary entries.

Also, this change in behaviour between autofs implementations
can cause problems for applications that use getmntent(3) in
other OS implementations as well as Linux.

Lastly, there's very little that user space can do with autofs
mount entries since this must be left to the autofs mount owner,
typically the automount daemon. But it can also lead to attempts
to access automount managed paths resulting mounts being triggered
when they aren't needed or mounts staying mounted for much longer
thay they need be. While the point of this change ins't to help
with these problems (and it can be quite a problem) it may be
a welcome side effect.

So the Linux autofs file system has been modified to accept a
pseudo mount option of "ignore" (as is used in other OS
implementations) so that user space can use this as a hint to
skip autofs entries on reading the mount table.

The Linux autofs automount daemon used getmntent(3) itself and
has been modified to use the proc file system directly so that
it can "ignore" mount option.

The use of this mount option is opt-in and a configuration
option has been added which defaults to not use this option
so if there are applications that need these entries, other
than autofs itself, they can be retained. Also, since this
filtering is based on an added mount option earlier versions
of Linux autofs iand other autofs file system users will not
use the option and so won't be affected by the change.

4 years agohurd: Fix build
Samuel Thibault [Fri, 30 Aug 2019 16:27:47 +0000 (18:27 +0200)] 
hurd: Fix build

* sysdeps/mach/hurd/i386/sigreturn.c (__sigreturn2): Spin-lock '&ss->lock',
not 'ss'.

4 years agoUse generic memset/memcpy/memmove in benchtests
Wilco Dijkstra [Thu, 29 Aug 2019 14:45:49 +0000 (15:45 +0100)] 
Use generic memset/memcpy/memmove in benchtests

Use the generic C memset/memcpy/memmove in benchtests since comparing
against a slow byte-oriented implementation makes no sense.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-08-29  Wilco Dijkstra  <wdijkstr@arm.com>

* benchtests/bench-memcpy.c (simple_memcpy): Remove.
(generic_memcpy): Include generic C memcpy.
* benchtests/bench-memmove.c (simple_memmove): Remove.
(generic_memmove): Include generic C memmove.
* benchtests/bench-memset.c (simple_memset): Remove.
(generic_memset): Include generic C memset.
* benchtests/bench-memset-large.c (simple_memset): Remove.
(generic_memset): Include generic C memset.
* benchtests/bench-memset-walk.c (simple_memset): Remove.
(generic_memset): Include generic C memset.
* string/memcpy.c (MEMCPY): Add defines to enable redirection.
* string/memset.c (MEMSET): Likewise.
* sysdeps/x86_64/memcopy.h: Remove empty file.

4 years agonptl: Move pthread_attr_getinheritsched implementation into libc
Florian Weimer [Fri, 30 Aug 2019 05:33:02 +0000 (07:33 +0200)] 
nptl: Move pthread_attr_getinheritsched implementation into libc

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agohurd: Fix SS_ONSTACK support
Samuel Thibault [Thu, 29 Aug 2019 23:48:38 +0000 (01:48 +0200)] 
hurd: Fix SS_ONSTACK support

* sysdeps/mach/hurd/i386/sigreturn.c (__sigreturn2): New function,
unlocks SS and returns to the saved PC.
(__sigreturn): Do not unlock SS, and "return" into __sigreturn2 on the
thread stack instead of the saved PC.

4 years agohurd: Remove optimizing anonymous maps as __vm_allocate.
Samuel Thibault [Thu, 29 Aug 2019 23:41:50 +0000 (01:41 +0200)] 
hurd: Remove optimizing anonymous maps as __vm_allocate.

Optimizing anonymous maps brings bugs, and does not optimize much anyway.

[BZ #19903]
* sysdeps/mach/hurd/mmap.c (__mmap): Remove optimizing anonymous maps
as __vm_allocate.

4 years agohurd: Fix poll and select POSIX compliancy details about errors
Samuel Thibault [Thu, 29 Aug 2019 23:20:23 +0000 (01:20 +0200)] 
hurd: Fix poll and select POSIX compliancy details about errors

This fixes the following:

- On error, poll must not return without polling, including EBADF, and instead
report POLLHUP/POLLERR/POLLNVAL
- Select must report EBADF if some set contains an invalid FD.

The idea is to move error management to after all select calls, in the
poll/select final treatment. The error is instead recorded in a new `error'
field, and a new SELECT_ERROR bit set.

Thanks Svante Signell for the initial version of the patch.

* hurd/hurdselect.c (SELECT_ERROR): New macro.
(_hurd_select):
- Add `error' field to `d' structures array.
- If a poll descriptor is bogus, set EBADF, but continue with a zero
timeout.
- Go through the whole fd_set, not only until _hurd_dtablesize. Return
EBADF there is any bit set above _hurd_dtablesize.
- Do not request io_select on bogus descriptors (SELECT_ERROR).
- On io_select request error, record the error.
- On io_select bogus reply, use EIO error code.
- On io_select bogus or error reply, record the error.
- Do not destroy reply port for bogus FDs.
- On error, make poll set POLLHUP in the EPIPE case, POLLNVAL in the
EBADF case, or else POLLERR.
- On error, make select simulated readiness.

4 years agohurd: Fix timeout handling in _hurd_select
Richard Braun [Thu, 29 Aug 2019 23:16:37 +0000 (01:16 +0200)] 
hurd: Fix timeout handling in _hurd_select

Rely on servers to implement timeouts, so that very short values (including
0) don't make mach_msg return before valid replies can be received. The
purpose of this scheme is to guarantee a full client-server round-trip,
whatever the timeout value.

This change depends on the new io_select_timeout RPC being implemented by
servers.

* hurd/Makefile (user-interfaces): Add io_reply and io_request.
* hurd/hurdselect.c: Include <sys/time.h>, <hurd/io_request.h> and
<limits.h>.
(_hurd_select): Replace the call to __io_select with either
__io_select_request or __io_select_timeout_request, depending on the
timeout. Count the number of ready descriptors (replies for which at
least one type bit is set). Implement the timeout locally when there is
no file descriptor.

4 years agohurd getcwd: Allow unknown root directory
Samuel Thibault [Thu, 29 Aug 2019 23:08:09 +0000 (01:08 +0200)] 
hurd getcwd: Allow unknown root directory

To be efficient, the remap translator simply returns ports from the underlying
filesystem, and thus the root directory found through browsing '..' is the
underlying root, not the remap root. This should not be a reason for getcwd to
fail.

* sysdeps/mach/hurd/getcwd.c (_hurd_canonicalize_directory_name_internal): Do
not remove the heading slash if we got an unknown root directory.
(__getcwd): Do not fail with EGRATUITOUS if we got an unknown root directory.

4 years agohurd: Fix implementation of setitimer.
Samuel Thibault [Thu, 29 Aug 2019 23:04:17 +0000 (01:04 +0200)] 
hurd: Fix implementation of setitimer.

The preemptor sigcode doesn't match since the POSIX sigcode SI_TIMER is
used when SIGALRM is sent. In addition, The inline version of
hurd_preempt_signals doesn't update _hurdsig_preempted_set. For these
reasons, the preemptor would be skipped by post_signal.

    * sysdeps/mach/hurd/setitimer.c (setitimer_locked): Fix preemptor setup.

4 years agohurd: Fix _hurd_select for single fd sets
Richard Braun [Thu, 29 Aug 2019 22:58:14 +0000 (00:58 +0200)] 
hurd: Fix _hurd_select for single fd sets

The function attempts to optimize this case by performing one IPC system
call with the timeout included among the parameters, but in the absence
of a reply, it will call mach_msg again with the same timeout later,
effectively doubling the total timeout of the select/poll call.

Remove this optimization for the time being.

* hurd/hurdselect.c (_hurd_select): Always call __io_select with no
timeout.

4 years agoMIPS support for GNU hash
Mihailo Stojanovic [Thu, 29 Aug 2019 20:11:42 +0000 (20:11 +0000)] 
MIPS support for GNU hash

This patch is a reimplementation of [1], which was submitted back in
2015. Copyright issue has been sorted [2] last year. It proposed a new
section (.gnu.xhash) and related dynamic tag (GT_GNU_XHASH). The new
section would be virtually identical to the existing .gnu.hash except
for the translation table (xlat) which would contain correct MIPS
.dynsym indexes corresponding to the hashvals in chains. This is because
MIPS ABI imposes a different ordering of the dynsyms than the one
expected by the .gnu.hash section. Another addition would be a leading
word at the beggining of the section, which would contain the number of
entries in the translation table.

In this patch, the new section name and dynamic tag are changed to
reflect the fact that the section should be treated as MIPS specific
(.MIPS.xhash and DT_MIPS_XHASH).

This patch addresses the alignment issue reported in [3] which is caused
by the leading word of the .MIPS.xhash section. Leading word is now
removed in the corresponding binutils patch, and the number of entries
in the translation table is computed using DT_MIPS_SYMTABNO dynamic tag.

Since the MIPS specific dl-lookup.c file was removed following the
initial patch submission, I opted for the definition of three new macros
in the generic ldsodefs.h. ELF_MACHINE_GNU_HASH_ADDRIDX defines the
index of the dynamic tag in the l_info array. ELF_MACHINE_HASH_SYMIDX is
used to calculate the index of a symbol in GNU hash. On MIPS, it is
defined to look up the symbol index in the translation table.
ELF_MACHINE_XHASH_SETUP is defined for MIPS only. It initializes the
.MIPS.xhash pointer in the link_map_machine struct.

The other major change is bumping the highest EI_ABIVERSION value for
MIPS to suggest that the dynamic linker now supports GNU hash.

The patch was tested by running the glibc testsuite for the three MIPS
ABIs (o32, n32 and n64) and for x86_64-linux-gnu.

[1] https://sourceware.org/ml/binutils/2015-10/msg00057.html
[2] https://sourceware.org/ml/binutils/2018-03/msg00025.html
[3] https://sourceware.org/ml/binutils/2016-01/msg00006.html

* elf/dl-addr.c (determine_info): Calculate the symbol index
using the newly defined ELF_MACHINE_HASH_SYMIDX macro.
* elf/dl-lookup.c (do_lookup_x): Ditto.
(_dl_setup_hash): Initialize MIPS xhash translation table.
* elf/elf.h (SHT_MIPS_XHASH): New define.
(DT_MIPS_XHASH): New define.
* sysdeps/generic/ldsodefs.h (ELF_MACHINE_GNU_HASH_ADDRIDX): New
define.
(ELF_MACHINE_HASH_SYMIDX): Ditto.
(ELF_MACHINE_XHASH_SETUP): Ditto.
* sysdeps/mips/ldsodefs.h (ELF_MACHINE_GNU_HASH_ADDRIDX): New
define.
(ELF_MACHINE_HASH_SYMIDX): Ditto.
(ELF_MACHINE_XHASH_SETUP): Ditto.
* sysdeps/mips/linkmap.h (struct link_map_machine): New member.
* sysdeps/unix/sysv/linux/mips/ldsodefs.h: Increment valid ABI
version.
* sysdeps/unix/sysv/linux/mips/libc-abis: New ABI version.

4 years agosh: Split BE/LE abilist
Adhemerval Zanella [Tue, 23 Jul 2019 20:25:57 +0000 (17:25 -0300)] 
sh: Split BE/LE abilist

The fix for BZ#18231 requires new symbols only for sh4eb.  This patch
adds the required folder and files for both BE and LE abilist.  No
semantic changes are expected.

Checked with check-abi for sh4eb-linux-gnu and sh4-linux-gnu.

* sysdeps/sh/preconfigure.ac: New file.
* sysdeps/sh/preconfigure: Regenerate.
* sysdeps/sh/be/sh3/Implies: New file.
* sysdeps/sh/be/sh4/Implies: Likewise.
* sysdeps/sh/le/sh3/Implies: Likewise.
* sysdeps/sh/le/sh4/Implies: Likewise.
* sysdeps/unix/sysv/linux/sh/le/sh3/Implies: Likewise.
* sysdeps/unix/sysv/linux/sh/le/sh4/Implies: Likewise.
* sysdeps/unix/sysv/linux/sh/*.abilist: Move to
sysdeps/unix/sysv/linux/sh/le/*.abilist.
* sysdeps/unix/sysv/linux/sh/be/*.abilist: New files.

4 years agomicroblaze: Split BE/LE abilist
Adhemerval Zanella [Tue, 23 Jul 2019 17:48:56 +0000 (14:48 -0300)] 
microblaze: Split BE/LE abilist

The fix for BZ#18231 requires new symbols only for microblaze.  This patch
adds the required folder and files for both BE and LE abilist.  No semantic
changes are expected.

Checked with check-abi for microblaze-linux-gnueabihf and
microblazeel-linux-gnueabihf.

* sysdeps/microblaze/preconfigure.ac: New file.
* sysdeps/microblaze/preconfigure: Regenerate.
* sysdeps/microblaze/be/implies: New file.
* sysdeps/microblaze/le/implies: Likewise.
* sysdeps/unix/sysv/linux/microblaze/be/implies: Likewise.
* sysdeps/unix/sysv/linux/microblaze/le/implies: Likewise.
* sysdeps/unix/sysv/linux/microblaze/*.abilist. Move to
sysdeps/unix/sysv/linux/microblaze/be/*.abilist.
* sysdeps/unix/sysv/linux/microblaze/le/*.abilist: New files.

4 years agoarm: Split BE/LE abilist
Adhemerval Zanella [Tue, 23 Jul 2019 17:26:49 +0000 (14:26 -0300)] 
arm: Split BE/LE abilist

The fix for BZ#18231 requires new symbols only for armeb.  This patch
adds the required folder and files for both BE and LE abilist.  No
semantic changes are expected.

Checked with check-abi for arm-linux-gnueabihf and armeb-linux-gnueabihf.

* sysdeps/arm/preconfigure.ac: Set machine based on endianness.
* sysdeps/arm/preconfigure: Regenerate.
* sysdeps/arm/be/Implies: New file.
* sysdeps/arm/be/armv6/Implies: Likewise.
* sysdeps/arm/be/armv6t2/Implies: Likewise.
* sysdeps/arm/be/armv7/Implies: Likewise.
* sysdeps/arm/le/Implies: Likewise.
* sysdeps/unix/sysv/linux/arm/be/Implies: Likewise.
* sysdeps/unix/sysv/linux/arm/le/Implies: Likewise.
* sysdeps/unix/sysv/linux/arm/*.abilist: Move to
sysdeps/unix/sysv/linux/arm/le/*.abilist.
* sysdeps/unix/sysv/linux/arm/be/l*.abilist: New files.

4 years agoCorrect the spelling of more contributors
Paul Eggert [Thu, 29 Aug 2019 09:50:04 +0000 (02:50 -0700)] 
Correct the spelling of more contributors

Correct the spellings of Rafael Ávila de Espíndola,
Uroš Bizjak, Alexandra Hájková, and Rafał Lużyński.

4 years agoFix posix/tst-regex by using UTF-8 and own test input
Paul Eggert [Thu, 29 Aug 2019 09:34:13 +0000 (02:34 -0700)] 
Fix posix/tst-regex by using UTF-8 and own test input

Problem reported by Stefan Liebler in:
https://sourceware.org/ml/libc-alpha/2019-08/msg00658.html
* posix/tst-regex.c: Convert this file from Latin-1 to UTF-8.
(do_test, test_expr): Adjust to the fact that this source file,
and the test data in ChangeLog.8, is now UTF-8 instead of Latin-1.
* posix/tst-regex.input: Copy from ChangeLog.old/ChangeLog.8,
so that it is now UTF-8.

4 years ago[powerpc] fegetenv_status: simplify instruction generation
Paul A. Clarke [Tue, 20 Aug 2019 20:57:35 +0000 (15:57 -0500)] 
[powerpc] fegetenv_status: simplify instruction generation

fegetenv_status() wants to use the lighter weight instruction 'mffsl'
for reading the Floating-Point Status and Control Register (FPSCR).
It currently will use it directly if compiled '-mcpu=power9', and will
perform a runtime check (cpu_supports("arch_3_00")) otherwise.

Nicely, it turns out that the 'mffsl' instruction will decode to
'mffs' on architectures older than "arch_3_00" because the additional
bits set for 'mffsl' are "don't care" for 'mffs'.  'mffs' is a superset
of 'mffsl'.

So, just generate 'mffsl'.

4 years ago[powerpc] fesetenv: optimize FPSCR access
Paul A. Clarke [Tue, 6 Aug 2019 04:13:45 +0000 (00:13 -0400)] 
[powerpc] fesetenv: optimize FPSCR access

fesetenv() reads the current value of the Floating-Point Status and Control
Register (FPSCR) to determine the difference between the current state of
exception enables and the newly requested state.  All of these bits are also
returned by the lighter weight 'mffsl' instruction used by fegetenv_status().
Use that instead.

Also, remove a local macro _FPU_MASK_ALL in favor of a common macro,
FPU_ENABLES_MASK from fenv_libc.h.

Finally, use a local variable ('new') in favor of a pointer dereference
('*envp').

4 years ago[powerpc] SET_RESTORE_ROUND improvements
Paul A. Clarke [Sat, 3 Aug 2019 02:47:57 +0000 (22:47 -0400)] 
[powerpc] SET_RESTORE_ROUND improvements

SET_RESTORE_ROUND uses libc_feholdsetround_ppc_ctx and
libc_feresetround_ppc_ctx to bracket a block of code where the floating point
rounding mode must be set to a certain value.

For the *prologue*, libc_feholdsetround_ppc_ctx is used and performs:
1. Read/save FPSCR.
2. Create new value for FPSCR with new rounding mode and enables cleared.
3. If new value is different than current value,
   a. If transitioning from a state where some exceptions enabled,
      enter "ignore exceptions / non-stop" mode.
   b. Write new value to FPSCR.
   c. Put a mark on the wall indicating the FPSCR was changed.

(1) uses the 'mffs' instruction.  On POWER9, the lighter weight 'mffsl'
instruction can be used, but it doesn't return all of the bits in the FPSCR.
fegetenv_status uses 'mffsl' on POWER9, 'mffs' otherwise, and can thus be
used instead of fegetenv_register.
(3b) uses 'mtfsf 0b11111111' to write the entire FPSCR, so it must
instead use 'mtfsf 0b00000011' to write just the enables and the mode,
because some of the rest of the bits are not valid if 'mffsl' was used.
fesetenv_mode uses 'mtfsf 0b00000011' on POWER9, 'mtfsf 0b11111111'
otherwise.

For the *epilogue*, libc_feresetround_ppc_ctx checks the mark on the wall, then
calls libc_feresetround_ppc, which just calls __libc_femergeenv_ppc with
parameters such that it performs:
1. Retreive saved value of FPSCR, saved in prologue above.
2. Read FPSCR.
3. Create new value of FPSCR where:
   - Summary bits and exception indicators = current OR saved.
   - Rounding mode and enables = saved.
   - Status bits = current.
4. If transitioning from some exceptions enabled to none,
   enter "ignore exceptions / non-stop" mode.
5. If transitioning from no exceptions enabled to some,
   enter "catch exceptions" mode.
6. Write new value to FPSCR.

The summary bits are hardwired to the exception indicators, so there is no
need to restore any saved summary bits.
The exception indicator bits, which are sticky and remain set unless
explicitly cleared, would only need to be restored if the code block
might explicitly clear any of them.  This is certainly not expected.

So, the only bits that need to be restored are the enables and the mode.
If it is the case that only those bits are to be restored, there is no need to
read the FPSCR.  Steps (2) and (3) are unnecessary, and step (6) only needs to
write the bits being restored.

We know we are transitioning out of "ignore exceptions" mode, so step (4) is
unnecessary, and in step (6), we only need to check the state we are
entering.

4 years ago[powerpc] fe{en,dis}ableexcept, fesetmode: optimize FPSCR accesses
Paul A. Clarke [Fri, 19 Jul 2019 00:37:13 +0000 (19:37 -0500)] 
[powerpc] fe{en,dis}ableexcept, fesetmode: optimize FPSCR accesses

Since fe{en,dis}ableexcept() and fesetmode() read-modify-write just the
"mode" (exception enable and rounding mode) bits of the Floating Point Status
Control Register (FPSCR), the lighter weight 'mffsl' instruction can be used
to read the FPSCR (enables and rounding mode), and 'mtfsf 0b00000011' can be
used to write just those bits back to the FPSCR.  The net is better performance.

In addition, fe{en,dis}ableexcept() read the FPSCR again after writing it, or
they determine that it doesn't need to be written because it is not changing.
In either case, the local variable holds the current values of the enable
bits in the FPSCR.  This local variable can be used instead of again reading
the FPSCR.

Also, that value of the FPSCR which is read the second time is validated
against the requested enables.  Since the write can't fail, this validation
step is unnecessary, and can be removed.  Instead, the exceptions to be
enabled (or disabled) are transformed into available bits in the FPSCR,
then validated after being transformed back, to ensure that all requested
bits are actually being set.  For example, FE_INVALID_SQRT can be
requested, but cannot actually be set.  This bit is not mapped during the
transformations, so a test for that bit being set before and after
transformations will show the bit would not be set, and the function will
return -1 for failure.

Finally, convert the local macros in fesetmode.c to more generally useful
macros in fenv_libc.h.

4 years ago[powerpc] fe{en,dis}ableexcept optimize bit translations
Paul A. Clarke [Sat, 13 Jul 2019 01:13:58 +0000 (20:13 -0500)] 
[powerpc] fe{en,dis}ableexcept optimize bit translations

The exceptions passed to fe{en,dis}ableexcept() are defined in the ABI
as a bitmask, a combination of FE_INVALID, FE_OVERFLOW, etc.
Within the functions, these bits must be translated to/from the corresponding
enable bits in the Floating Point Status Control Register (FPSCR).
This translation is currently done bit-by-bit.  The compiler generates
a series of conditional bit operations.  Nicely, the "FE" exception
bits are all a uniform offset from the FPSCR enable bits, so the bit-by-bit
operation can instead be performed by a shift with appropriate masking.

4 years agomisc: Use allocate_once in getmntent
Florian Weimer [Wed, 28 Aug 2019 10:01:48 +0000 (12:01 +0200)] 
misc: Use allocate_once in getmntent

Both the buffer and struct mntent are now allocated on the heap.
This results in a slight reduction of RSS usage.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agonptl: Move pthread_attr_setdetachstate implementation into libc
Florian Weimer [Wed, 28 Aug 2019 10:01:14 +0000 (12:01 +0200)] 
nptl: Move pthread_attr_setdetachstate implementation into libc

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agologin: pututxline could fail to overwrite existing entries [BZ #24902]
Florian Weimer [Wed, 28 Aug 2019 09:59:45 +0000 (11:59 +0200)] 
login: pututxline could fail to overwrite existing entries [BZ #24902]

The internal_getut_r function updates the file_offset variable and
therefore must always update last_entry as well.

Previously, if pututxline could not upgrade the read lock to a
write lock, internal_getut_r would update file_offset only,
without updating last_entry, and a subsequent call would not
overwrite the existing utmpx entry at file_offset, instead
creating a new entry.  This has been observed to cause unbounded
file growth in high-load situations.

This commit removes the buffer argument to internal_getut_r and
updates the last_entry variable directly, along with file_offset.

Initially reported and fixed by Ondřej Lysoněk.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
4 years agoFix posix/tst-regex by using a dedicated input-file.
Stefan Liebler [Wed, 28 Aug 2019 08:29:24 +0000 (10:29 +0200)] 
Fix posix/tst-regex by using a dedicated input-file.

The recent commit e6855a3bdfe147c52b29b5e7d70a95a8aa22ece0
changed the encoding of ChangeLog.old/ChangeLog.8 from ISO-8859 to UTF-8.
Unfortunately the test posix/tst-regex assumes the former encoding.
Furthermore Francesco Potortì is now written with 'ì' instead of 'i`'
which would lead to two further matches in the first call to test_expr.

This patch just copies the former ChangeLog.8 file to tst-regex.input
and adjusts the test in order to use this new input file.

ChangeLog:

* posix/tst-regex.c (do_test): Use tst-regex.input as input file.
* posix/tst-regex.input: New file.

4 years agoDon't put non-ASCII into installed headers
Paul Eggert [Fri, 23 Aug 2019 21:14:29 +0000 (14:14 -0700)] 
Don't put non-ASCII into installed headers

Move non-ASCII contributor names from installed headers
into contrib.texi when possible, and when it's not (the
copyright notice in sysdeps/unix/sysv/linux/mips/sys/user.h)
go back to ASCIIfied names.  Problem reported by Joseph Myers in:
https://www.sourceware.org/ml/libc-alpha/2019-08/msg00646.html

4 years agoFix spellings of contributor names in comments and doc
Paul Eggert [Fri, 23 Aug 2019 20:07:38 +0000 (13:07 -0700)] 
Fix spellings of contributor names in comments and doc

4 years ago[MIPS] Raise highest supported EI_ABIVERSION value [BZ #24916]
Mihailo Stojanovic [Fri, 23 Aug 2019 16:47:27 +0000 (16:47 +0000)] 
[MIPS] Raise highest supported EI_ABIVERSION value [BZ #24916]

This bumps the highest valid EI_ABIVERSION value to ABSOLUTE ABI.

New testcase loads the symbol from the GOT with the "lb" instruction
so that the EI_ABIVERSION header field of the shared object is set
to ABSOLUTE (it doesn't actually check the value of the symbol), and
makes sure that the main executable is executed without "ABI version
invalid" error.

Tested for all three ABIs (o32, n32, n64) using both static linker which
handles undefined weak symbols correctly [1] (and sets the EI_ABIVERSION
of the test module) and the one that doesn't (EI_ABIVERSION left as 0).

[1] https://sourceware.org/ml/binutils/2018-07/msg00268.html

[BZ #24916]
* sysdeps/mips/Makefile [$(subdir) = elf] (tests): Add
tst-undefined-weak.
[$(subdir) = elf] (modules-names): Add tst-undefined-weak-lib.
[$(subdir) = elf] ($(objpfx)tst-undefined-weak): Add dependency.
* sysdeps/mips/tst-undefined-weak-lib.S: New file.
* sysdeps/mips/tst-undefined-weak.c: Likewise.
* sysdeps/unix/sysv/linux/mips/ldsodefs.h (VALID_ELF_ABIVERSION):
Increment highest valid ABIVERSION value.

4 years agomips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels
Dragan Mladjenovic [Fri, 23 Aug 2019 16:38:04 +0000 (16:38 +0000)] 
mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels

Linux/Mips kernels prior to 4.8 could potentially crash the user
process when doing FPU emulation while running on non-executable
user stack.

Currently, gcc doesn't emit .note.GNU-stack for mips, but that will
change in the future. To ensure that glibc can be used with such
future gcc, without silently resulting in binaries that might crash
in runtime, this patch forces RWX stack for all built objects if
configured to run against minimum kernel version less than 4.8.

* sysdeps/unix/sysv/linux/mips/Makefile
(test-xfail-check-execstack):
Move under mips-has-gnustack != yes.
(CFLAGS-.o*, ASFLAGS-.o*): New rules.
Apply -Wa,-execstack if mips-force-execstack == yes.
* sysdeps/unix/sysv/linux/mips/configure: Regenerated.
* sysdeps/unix/sysv/linux/mips/configure.ac
(mips-force-execstack): New var.
Set to yes for hard-float builds with minimum_kernel < 4.8.0
or minimum_kernel not set at all.
(mips-has-gnustack): New var.
Use value of libc_cv_as_noexecstack
if mips-force-execstack != yes, otherwise set to no.

4 years agolinux: Make profil_counter a compat_symbol (BZ#17726)
Adhemerval Zanella [Thu, 1 Aug 2019 18:01:22 +0000 (18:01 +0000)] 
linux: Make profil_counter a compat_symbol (BZ#17726)

As indicated by Joseph's comment on BZ#17726, this symbol is most
likely a historical ABI accident.  This patch make it on both arm
and sparc ABIs a compat_symbol.

Checked against a build arm-linux-gnueabihf, sparcv9-linux-gnu, adn
sparc64-linux-gnu to see if the symbol is still present.

* gmon/Versions (libc) [GLIBC_2.31]: New entry.
* sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter):
Make a compat_symbol.
* sysdeps/unix/sysv/linux/sparc/profil-counter.h
(__profil_counter_global): Likewise.

4 years agoRefactor sigcontextinfo.h
Adhemerval Zanella [Mon, 17 Dec 2018 18:44:14 +0000 (16:44 -0200)] 
Refactor sigcontextinfo.h

This patch refactor sigcontextinfo.h header to use SA_SIGINFO as default
for both gmon and debug implementations.  This allows simplify
profil-counter.h on Linux to use a single implementation and remove the
requirements for newer ports to redefine __sigaction/sigaction to use
SA_SIGINFO.

The GET_PC macro is also replaced with a function sigcontext_get_pc that
returns an uintptr_t instead of a void pointer.  It allows easier convertion
to integer on ILP32 architecture, such as x32, without the need to suppress
compiler warnings.

The patch also requires some refactor of register-dump.h file for some
architectures (to reflect it is now called from a sa_sigaction instead of
sa_handler signal context).

   - Alpha, i386, and s390 are straighfoward to take in consideration the
     new argument type.

   - ia64 takes in consideration the kernel pass a struct sigcontextt
     as third argument for sa_sigaction.

   - sparc take in consideration the kernel pass a pt_regs struct
     as third argument for sa_sigaction.

   - m68k dummy function is removed and the FP state is dumped on
     register_dump itself.

   - For SH the register-dump.h file is consolidate on a common implementation
     and the floating-point state is checked based on ownedfp field.

The register_dump does not change its output format in any affected
architecture.

I checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
arm-linux-gnueabihf, sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu,
powerpc64-linux-gnu, and powerpc64le-linux-gnu.

I also checked the libSegFault.so through catchsegv on alpha-linux-gnu,
m68k-linux-gnu and sh4-linux-gnu to confirm the output has not changed.

Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Florian Weimer  <fweimer@redhat.com>

* debug/segfault.c (install_handler): Use SA_SIGINFO if defined.
* sysdeps/generic/profil-counter.h (__profil_counter): Cast to
uintptr_t.
* sysdeps/generic/sigcontextinfo.h (GET_PC): Rename to
sigcontext_get_pc and return aligned cast to uintptr_t.
* sysdeps/mach/hurd/i386/sigcontextinfo.h (GET_PC): Likewise.
* sysdeps/posix/profil.c (profil_count): Change PC argument to
uintptr_t.
(__profil): Use SA_SIGINFO.
* sysdeps/posix/sprofil.c (profil_count): Change PCP argument to
uintptr_t.
(__sprofil): Use SA_SIGINFO.
* sysdeps/unix/sysv/linux/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/aarch64/profil-counter.h: Remove file.
* sysdeps/unix/sysv/linux/csky/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/i386/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/mips/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/riscv/profil-counter.h: Likewise.
* sysdeps/sysv/linux/s390/s390-32/profil-counter.h: Likewise.
* sysdeps/sysv/linux/s390/s390-64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/sh/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/arm/profil-counter.h (__profil_counter):
Assume SA_SIGINFO and use sigcontext_get_pc instead of GET_PC.
* sysdeps/unix/sysv/linux/sparc/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/profil-counter.h: Remove file.
* sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h: Likewise.
* sysdpes/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT,
GET_PC, __sigaction, sigaction): Remove defines.
(sigcontext_get_pc): New function.
* sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/csky/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/s390/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/sh/sigcontextinfo.h: Likewise.
* sysdeps/sysv/linux/sparc/sparc32/sigcontextinfo.h: Likewise.
* sysdeps/sysv/linux/sparc/sparc64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/register-dump.h (register_dump):
Handle CTX argument as ucontext_t.
* sysdeps/unix/sysv/linux/i386/register-dump.h: Likewise.
Likewise.
* sysdeps/unix/sysv/linux/m68k/register-dump.h: Likewise.
* sysdeps/sysv/linux/s390/s390-32/register-dump.h: Likewise.
* sysdeps/sysv/linux/s390/s390-64/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sh/register-dump.h: New file.
* sysdeps/unix/sysv/linux/sh/sh4/register-dump.h: Remove File.
* sysdeps/unix/sysv/linux/sh/sh3/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/Makefile (tests-internal): Add
tst-sigcontextinfo-get_pc.
* sysdeps/unix/sysv/linux/tst-sigcontextinfo-get_pc.c: New file.
(CFLAGS-tst-sigcontextinfo-get_pc.c): New rule.

4 years agoAdd RTLD_SINGLE_THREAD_P on generic single-thread.h
Adhemerval Zanella [Wed, 14 Aug 2019 18:05:50 +0000 (15:05 -0300)] 
Add RTLD_SINGLE_THREAD_P on generic single-thread.h

* sysdeps/generic/single-thread.h (RTLD_SINGLE_THREAD_P): Add
definition.

4 years agoChinese locales: Set first_weekday to 2 (bug 24682).
Rafal Luzynski [Thu, 22 Aug 2019 21:50:04 +0000 (23:50 +0200)] 
Chinese locales: Set first_weekday to 2 (bug 24682).

The first day of the week in China (Mainland) should be Monday according
to the national standard GB/T 7408-2005.  References:

* https://www.doc88.com/p-1166696540287.html
* https://unicode-org.atlassian.net/browse/CLDR-11510

[BZ #24682]
* localedata/locales/bo_CN (first_weekday): Add, set to 2 (Monday).
* localedata/locales/ug_CN (first_weekday): Likewise.
* localedata/locales/zh_CN (first_weekday): Likewise.

4 years agopowerpc: Fix typos and field name in comments
Gustavo Romero [Tue, 13 Aug 2019 03:40:30 +0000 (23:40 -0400)] 
powerpc: Fix typos and field name in comments

Fix a couple of typos and v_regs field name in mcontext_t.

* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Fix typos and
field name in mcontext_t struct.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
4 years agoMark IDN tests unsupported with libidn2 before 2.0.5.
Joseph Myers [Thu, 22 Aug 2019 12:56:49 +0000 (12:56 +0000)] 
Mark IDN tests unsupported with libidn2 before 2.0.5.

When using a system (e.g. Ubuntu 18.04) with libidn2 2.0.4 or earlier,
test results include:

FAIL: resolv/tst-resolv-ai_idn
FAIL: resolv/tst-resolv-ai_idn-latin1

It was previously stated
<https://sourceware.org/ml/libc-alpha/2018-05/msg00771.html> that "It
should fail to indicate you have bugs in your system libidn.".
However, the glibc testsuite should be indicating whether there are
bugs in glibc, not whether there are bugs in other system pieces - so
unless you consider it a glibc bug that it fails to work around the
libidn issues, these FAILs are not helpful.  And as a general
principle, it's best for the expected glibc test results to be clean,
with Bugzilla used to track known bugs in glibc itself, rather than
people needing to know about the expected FAILs to tell if there are
problems with their glibc build.  So, while there is an argument that
install.texi (not just the old NEWS entries for 2.28) should explain
the use of libidn2 and that 2.0.5 or later is recommended, test FAILs
are not the right way to indicate the presence of an old libidn2
version.

This patch accordingly makes those tests return UNSUPPORTED for older
libidn2 versions, just as they do when libidn2 isn't present at all.
As implied by that past discussion, it's possible this could result in
UNSUPPORTED for systems with older versions but whatever required
fixes backported so the tests previously passed, if there are any such
systems.

Tested for x86_64 on Ubuntu 18.04, including verifying that putting an
earlier version in place of 2.0.5 results in the tests FAILing whereas
using 2.0.5 as in the patch results in UNSUPPORTED.  Florian reports
that the tests still run on Fedora 30, with libidn 2.2.0.

* resolv/tst-resolv-ai_idn-latin1.c (do_test): Mark test
unsupported with libidn2 before 2.0.5.
* resolv/tst-resolv-ai_idn.c (do_test): Likewise.

4 years agoDocument strftime %Ob and %OB as C2X features.
Joseph Myers [Thu, 22 Aug 2019 12:38:40 +0000 (12:38 +0000)] 
Document strftime %Ob and %OB as C2X features.

C2X standardizes strftime %Ob and %OB support.  This patch updates the
glibc manual to say these are C2X features, while noting that the
details of what is the alternative form of a month name are not
specified in C2X.

Note: C2X seems unclear to me about whether %h being equivalent to %b
means %Oh is thereby allowed and equivalent to %Ob; I've asked WG14.

Tested with "make info" and "make pdf".

* manual/time.texi (strftime): Document %Ob and %OB as C2X
features.

4 years agoRemove dead regex code
Paul Eggert [Wed, 21 Aug 2019 16:29:09 +0000 (09:29 -0700)] 
Remove dead regex code

* posix/regex_internal.c (re_node_set_insert):
Remove unnecessary assignment.  Reported by Tim Rühsen in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00026.html

4 years agoFix bad pointer / leak in regex code
Paul Eggert [Wed, 21 Aug 2019 16:25:22 +0000 (09:25 -0700)] 
Fix bad pointer / leak in regex code

This was found by Coverity (CID 1484201).  [BZ#24844]
* posix/regex_internal.c (create_cd_newstate): Fix use of bad
pointer and/or memory leak when storage is exhausted.

4 years agoDon't use the argument to time.
Zack Weinberg [Sat, 17 Aug 2019 01:10:11 +0000 (21:10 -0400)] 
Don't use the argument to time.

It doesn't make sense to remove all the internal uses of time.
It's still a standard ISO C function, and its callers don't need
sub-second resolution and would be unnecessarily complicated if
they had to declare a struct timespec instead of just a time_t.
However, a handful of places were using the vestigial "result"
argument instead of the return value, which is slightly less
efficient and also looks strange.  Correct this.

* misc/syslog.c (__vsyslog_internal)
* time/getdate.c (__getdate_r)
* time/tst_wcsftime.c (main):
Use return value of time, not its argument.

* string/strfry.c (strfry)
* sysdeps/mach/sleep.c (__sleep):
Remove unnecessary casts of NULL in calls to time.

4 years agoAdd tgmath.h macros for narrowing functions.
Joseph Myers [Wed, 21 Aug 2019 12:06:44 +0000 (12:06 +0000)] 
Add tgmath.h macros for narrowing functions.

When adding some of the TS 18661 narrowing functions for glibc 2.28, I
deferred adding corresponding <tgmath.h> support because of unresolved
questions about the specification for those type-generic macros,
especially in relation to _FloatN and _FloatNx types.

Those issues are now clarified in the response to Clarification
Request 13 to TS 18661-3, and this patch adds the deferred tgmath.h
support.  As with other tgmath.h macros, there are fairly
straightforward implementations based on __builtin_tgmath for GCC 8
and later, which result in exactly the right function being called in
each case, and more complicated implementations for GCC 7 and earlier,
which generally result in a function being called whose arguments have
the right format (i.e. an alias for the right function), but which
might not be exactly the function name specified by TS 18661.

In one case with older compilers (f32x* macros, where the type
_Float64x exists and all the arguments have type _Float32 or
_Float32x), there is a further relaxation and the function called may
have arguments narrower than the one specified by the TS, but still
wide enough to represent the arguments exactly, so the result of the
call is unchanged (as this does not affect any case where rounding of
integer arguments might be involved).  With GCC 6 or before this is
inherently unavoidable (but still harmless and not detectable by how
the compiled program behaves, unless it redefines the functions in
question like the testcases do) because _Float32x and _Float64 are
both typedefs for double in that case but the specified semantics
result in different functions, with different argument formats, being
called for those two argument types.

Tests for the new macros are handled through gen-tgmath-tests.py,
which deals with the special-case handling for older GCC.

Tested as follows: with the full glibc testsuite on x86_64 and x86
(with GCC 6, 7 and 8); with the math/ tests on aarch64 and arm (with
GCC 6, 7 and 8); with build-many-glibcs.py (with GCC 6, 7 and 9).

* math/tgmath.h [__HAVE_FLOAT128X]: Give error.
[(__HAVE_FLOAT64X && !__HAVE_FLOAT128)
|| (__HAVE_FLOAT128 && !__HAVE_FLOAT64X)]: Likewise.
(__TGMATH_2_NARROW_F): Likewise.
(__TGMATH_2_NARROW_D): New macro.
(__TGMATH_2_NARROW_F16): Likewise.
(__TGMATH_2_NARROW_F32): Likewise.
(__TGMATH_2_NARROW_F64): Likewise.
(__TGMATH_2_NARROW_F32X): Likewise.
(__TGMATH_2_NARROW_F64X): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F16): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F32): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F64): Likewise.
[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F32X): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (fadd): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (dadd): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (fdiv): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (ddiv): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (fmul): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (dmul): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (fsub): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (dsub): Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT16] (f16add):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT16] (f16div):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT16] (f16mul):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT16] (f16sub):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32] (f32add):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32] (f32div):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32] (f32mul):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32] (f32sub):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64
&& (__HAVE_FLOAT64X || __HAVE_FLOAT128)] (f64add): Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64
&& (__HAVE_FLOAT64X || __HAVE_FLOAT128)] (f64div): Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64
&& (__HAVE_FLOAT64X || __HAVE_FLOAT128)] (f64mul): Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64
&& (__HAVE_FLOAT64X || __HAVE_FLOAT128)] (f64sub): Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32X] (f32xadd):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32X] (f32xdiv):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32X] (f32xmul):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32X] (f32xsub):
Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64X
&& (__HAVE_FLOAT128X || __HAVE_FLOAT128)] (f64xadd): Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64X
&& (__HAVE_FLOAT128X || __HAVE_FLOAT128)] (f64xdiv): Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64X
&& (__HAVE_FLOAT128X || __HAVE_FLOAT128)] (f64xmul): Likewise.
[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64X
&& (__HAVE_FLOAT128X || __HAVE_FLOAT128)] (f64xsub): Likewise.
* math/gen-tgmath-tests.py (Type): Add members
non_standard_real_argument_types_list, long_double_type,
complex_float64_type and float32x_ext_type.
(Type.__init__): Set the new members.
(Type.floating_type): Add new argument floatn.
(Type.real_floating_type): Likewise.
(Type.can_combine_types): Likewise.
(Type.combine_types): Likewise.
(Type.init_types): Create internal Float32x_ext type.
(Tests.__init__): Define Float32x_ext in generated C code.
(Tests.add_tests): Handle narrowing functions.
(Tests.add_all_tests): Likewise.
(Tests.tests_text): Allow variation in mant_dig for narrowing
functions with compilers before GCC 8.
* math/Makefile (tgmath3-narrow-types): New variable.
(tgmath3-narrow-macros): Likewise.
(tgmath3-macros): Add $(tgmath3-narrow-macros).

4 years agoUpdate i386 libm-test-ulps
Andreas Schwab [Tue, 20 Aug 2019 15:04:05 +0000 (17:04 +0200)] 
Update i386 libm-test-ulps

4 years agonscd: Improve nscd.conf comments.
Carlos O'Donell [Thu, 21 Mar 2019 02:11:32 +0000 (22:11 -0400)] 
nscd: Improve nscd.conf comments.

This change adds a warning to nscd.conf about running multiple caching
services together and that it may lead to unexpected behaviours. Also we
add a note that enabling the 'shared' option will cause cache hit rates
to be misreported (a side effect of the implementation).

v2
- Rewrite comment to avoid implementation details.

4 years agonss: Make nsswitch.conf more distribution friendly.
Carlos O'Donell [Wed, 20 Mar 2019 16:40:18 +0000 (12:40 -0400)] 
nss: Make nsswitch.conf more distribution friendly.

The current default nsswitch.conf file provided by glibc is not very
distribution friendly. The file contains some minimal directives that no
real distribution uses. This update aims to provide a rich set of
comments which are useful for all distributions, and a broader set of
service defines which should work for all distributions.

Tested defaults on x86_64 and they work. The nsswitch.conf file more
closely matches what we have in Fedora now, and I'll adjust Fedora to
use this version with minor changes to enable Fedora-specific service
providers.

v2
- Add missing databases to manual.
- Add link to manual from default nsswitch.conf.
- Sort nsswitch.conf according to most used database first.

v3
- Only mention implemented services in 'NSS Basics.'
- Mention 'automount' in 'Services in the NSS configuration.'
- Sort services in alphabetical order.

v4
- Project name is 'Samba'.

v5
- Fix typo in manual/nss.texi.

v6
- Fix another typo in manual/nss.texi. Ran spell checker this time.

4 years agoDo not print backtraces on fatal glibc errors
Florian Weimer [Mon, 19 Aug 2019 13:41:29 +0000 (15:41 +0200)] 
Do not print backtraces on fatal glibc errors

If the process is in a bad state, we used to print backtraces in
many cases.  This is problematic because doing so could involve
a lot of work, like loading libgcc_s using the dynamic linker,
and this could itself be targeted by exploit writers.  For example,
if the crashing process was forked from a long-lived process, the
addresses in the error message could be used to bypass ASLR.

Commit ed421fca42fd9b4cab7c66e77894b8dd7ca57ed0 ("Avoid backtrace from
__stack_chk_fail [BZ #12189]"), backtraces where no longer printed
because backtrace_and_maps was always called with do_abort == 1.

Rather than fixing this logic error, this change removes the backtrace
functionality from the sources.  With the prevalence of external crash
handlers, it does not appear to be particularly useful.  The crash
handler may also destroy useful information for debugging.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agonptl: Move pthread_attr_getdetachstate implementation into libc
Florian Weimer [Fri, 16 Aug 2019 20:44:44 +0000 (22:44 +0200)] 
nptl: Move pthread_attr_getdetachstate implementation into libc

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoCorrect TEST_COMPAT conditions in totalorder compat tests.
Joseph Myers [Fri, 16 Aug 2019 19:23:30 +0000 (19:23 +0000)] 
Correct TEST_COMPAT conditions in totalorder compat tests.

I noticed that the totalorder compat tests mixed TEST_COMPAT
conditions using COMPAT_VER (computed as the first symbol version for
the symbol being tested) and those with a hardcoded GLIBC_2_25.

COMPAT_VER is logically correct here, so this patch changes the tests
to use it.  GLIBC_2_25 is harmless at present (even for _FloatN /
_FloatNx functions added in later glibc versions).  However, if in
future we support _Float16 functions in glibc for any existing
configuration, the test using GLIBC_2_25 would get things wrong
(wrongly think that there are compat versions of totalorderf16 and
totalordermagf16 to test).

(The actual definitions of the compat / versioned symbols for the
totalorder functions make no attempt to deal with the possibility of
libm function support for a new floating-point format, already
supported for other architectures in glibc, being added in some glibc
configuration in future, for which the only vaguely plausible case
would be if some architecture gets _Float128 support it previously
lacked; this is much like functions added after glibc 2.4 not
generally attempting to deal with compat support for long double
changing away from having the same format as double.)

Tested for x86_64, and with build-many-glibcs.py.

* math/libm-test-compat_totalorder.inc (do_test)
[TEST_COMPAT (libm, GLIBC_2_25, GLIBC_2_31)]: Change condition to
[TEST_COMPAT (libm, COMPAT_VER, GLIBC_2_31)].
* math/libm-test-compat_totalordermag.inc (do_test)
[TEST_COMPAT (libm, GLIBC_2_25, GLIBC_2_31)]: Likewise.

4 years agonptl: Move pthread_attr_init implementation into libc
Florian Weimer [Thu, 15 Aug 2019 17:12:21 +0000 (19:12 +0200)] 
nptl: Move pthread_attr_init implementation into libc

Both the original GLIB_2.0 version and the current GLIBC_2.1 version
need to be moved.

4 years agoelf: Self-dlopen failure with explict loader invocation [BZ #24900]
Florian Weimer [Thu, 15 Aug 2019 12:37:50 +0000 (14:37 +0200)] 
elf: Self-dlopen failure with explict loader invocation [BZ #24900]

In case of an explicit loader invocation, ld.so essentially performs
a dlopen call to load the main executable.  Since the pathname of
the executable is known at this point, it gets stored in the link
map.  In regular mode, the pathname is not known and "" is used
instead.

As a result, if a program calls dlopen on the pathname of the main
program, the dlopen call succeeds and returns a handle for the main
map.  This results in an unnecessary difference between glibc
testing (without --enable-hardcoded-path-in-tests) and production
usage.

This commit discards the names when building the link map in
_dl_new_object for the main executable, but it still determines
the origin at this point in case of an explict loader invocation.
The reason is that the specified pathname has to be used; the kernel
has a different notion of the main executable.

4 years agoMake totalorder and totalordermag functions take pointer arguments.
Joseph Myers [Thu, 15 Aug 2019 15:18:34 +0000 (15:18 +0000)] 
Make totalorder and totalordermag functions take pointer arguments.

The resolution of C floating-point Clarification Request 25
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2397.htm#dr_25> is
that the totalorder and totalordermag functions should take pointer
arguments, and this has been adopted in C2X (with const added; note
that the integration of this change into C2X is present in the C
standard git repository but postdates the most recent public PDF
draft).

This patch updates glibc accordingly.  As a defect resolution, the API
is changed unconditionally rather than supporting any sort of TS
18661-1 mode for compilation with the old version of the API.  There
are compat symbols for existing binaries that pass floating-point
arguments directly.  As a consequence of changing to pointer
arguments, there are no longer type-generic macros in tgmath.h for
these functions.

Because of the fairly complicated logic for creating libm function
aliases and determining the set of aliases to create in a given glibc
configuration, rather than duplicating all that in individual source
files to create the versioned and compat symbols, the source files for
the various versions of totalorder functions are set up to redefine
weak_alias before using libm_alias_* macros to create the symbols
required.  In turn, this requires creating a separate alias for each
symbol version pointing to the same implementation (see binutils bug
<https://sourceware.org/bugzilla/show_bug.cgi?id=23840>), which is
done automatically using __COUNTER__.  (As I noted in
<https://sourceware.org/ml/libc-alpha/2018-10/msg00631.html>, it might
well make sense for glibc's symbol versioning macros to do that alias
creation with __COUNTER__ themselves, which would somewhat simplify
the logic in the totalorder source files.)

It is of course desirable to test the compat symbols.  I did this with
the generic libm-test machinery, but didn't wish to duplicate the
actual tables of test inputs and outputs, and thought it risky to
attempt to have a single object file refer to both default and compat
versions of the same function in order to test them together.  Thus, I
created libm-test-compat_totalorder.inc and
libm-test-compat_totalordermag.inc which include the generated .c
files (with the processed version of those tables of inputs) from the
non-compat tests, and added appropriate dependencies.  I think this
provides sufficient test coverage for the compat symbols without also
needing to make the special ldbl-96 and ldbl-128ibm tests (of
peculiarities relating to the representations of those formats that
can't be covered in the generic tests) run for the compat symbols.

Tests of compat symbols need to be internal tests, meaning _ISOMAC is
not defined.  Making some libm-test tests into internal tests showed
up two other issues.  GCC diagnoses duplicate macro definitions of
__STDC_* macros, including __STDC_WANT_IEC_60559_TYPES_EXT__; I added
an appropriate conditional and filed
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91451> for this issue.
On ia64, include/setjmp.h ends up getting included indirectly from
libm-symbols.h, resulting in conflicting definitions of the STR macro
(also defined in libm-test-driver.c); I renamed the macros in
include/setjmp.h.  (It's arguable that we should have common internal
headers used everywhere for stringizing and concatenation macros.)

Tested for x86_64 and x86, and with build-many-glibcs.py.

* math/bits/mathcalls.h
[__GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN]
(totalorder): Take pointer arguments.
[__GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN]
(totalordermag): Likewise.
* manual/arith.texi (totalorder): Likewise.
(totalorderf): Likewise.
(totalorderl): Likewise.
(totalorderfN): Likewise.
(totalorderfNx): Likewise.
(totalordermag): Likewise.
(totalordermagf): Likewise.
(totalordermagl): Likewise.
(totalordermagfN): Likewise.
(totalordermagfNx): Likewise.
* math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): Remove macro.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (totalorder): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag): Likewise.
* math/Versions (GLIBC_2.31): Add totalorder, totalorderf,
totalorderl, totalordermag, totalordermagf, totalordermagl,
totalorderf32, totalorderf64, totalorderf32x, totalordermagf32,
totalordermagf64, totalordermagf32x, totalorderf64x,
totalordermagf64x, totalorderf128 and totalordermagf128.
* math/Makefile (libm-test-funcs-noauto): Add compat_totalorder
and compat_totalordermag.
(libm-test-funcs-compat): New variable.
(libm-tests-compat): Likewise.
(tests): Do not include compat tests.
(tests-internal): Add compat tests.
($(foreach t,$(libm-tests-base),
$(objpfx)$(t)-compat_totalorder.o)): Depend
on $(objpfx)libm-test-totalorder.c.
($(foreach t,$(libm-tests-base),
$(objpfx)$(t)-compat_totalordermag.o): Depend on
$(objpfx)libm-test-totalordermag.c.
(tgmath3-macros): Remove totalorder and totalordermag.
* math/libm-test-compat_totalorder.inc: New file.
* math/libm-test-compat_totalordermag.inc: Likewise.
* math/libm-test-driver.c (struct test_ff_i_data): Update comment.
(RUN_TEST_fpfp_b): New macro.
(RUN_TEST_LOOP_fpfp_b): Likewise.
* math/libm-test-totalorder.inc (totalorder_test_data): Use
TEST_fpfp_b.
(totalorder_test): Condition on [!COMPAT_TEST].
(do_test): Likewise.
* math/libm-test-totalordermag.inc (totalordermag_test_data): Use
TEST_fpfp_b.
(totalordermag_test): Condition on [!COMPAT_TEST].
(do_test): Likewise.
* math/gen-tgmath-tests.py (Tests.add_all_tests): Remove
totalorder and totalordermag.
* math/test-tgmath.c (NCALLS): Change to 132.
(F(compile_test)): Do not call totalorder or totalordermag.
(F(totalorder)): Remove.
(F(totalordermag)): Likewise.
* include/float.h (__STDC_WANT_IEC_60559_TYPES_EXT__): Do not
define if [__STDC_WANT_IEC_60559_TYPES_EXT__].
* include/setjmp.h [!_ISOMAC] (STR_HELPER): Rename to
SJSTR_HELPER.
[!_ISOMAC] (STR): Rename to SJSTR.  Update call to STR_HELPER.
[!_ISOMAC] (TEST_SIZE): Update call to STR.
[!_ISOMAC] (TEST_ALIGN): Likewise.
[!_ISOMAC] (TEST_OFFSET): Likewise.
* sysdeps/ieee754/dbl-64/s_totalorder.c: Include <shlib-compat.h>
and <first-versions.h>.
(__totalorder): Take pointer arguments.  Add symbol versions and
compat symbols.
* sysdeps/ieee754/dbl-64/s_totalordermag.c: Include
<shlib-compat.h> and <first-versions.h>.
(__totalordermag): Take pointer arguments.  Add symbol versions
and compat symbols.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include
<shlib-compat.h> and <first-versions.h>.
(__totalorder): Take pointer arguments.  Add symbol versions and
compat symbols.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include
<shlib-compat.h> and <first-versions.h>.
(__totalordermag): Take pointer arguments.  Add symbol versions
and compat symbols.
* sysdeps/ieee754/float128/float128_private.h
(__totalorder_compatl): New macro.
(__totalordermag_compatl): Likewise.
* sysdeps/ieee754/flt-32/s_totalorderf.c: Include <shlib-compat.h>
and <first-versions.h>.
(__totalorderf): Take pointer arguments.  Add symbol versions and
compat symbols.
* sysdeps/ieee754/flt-32/s_totalordermagf.c: Include
<shlib-compat.h> and <first-versions.h>.
(__totalordermagf): Take pointer arguments.  Add symbol versions
and compat symbols.
* sysdeps/ieee754/ldbl-128/s_totalorderl.c: Include
<shlib-compat.h> and <first-versions.h>.
(__totalorderl): Take pointer arguments.  Add symbol versions and
compat symbols.
* sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Include
<shlib-compat.h> and <first-versions.h>.
(__totalordermagl): Take pointer arguments.  Add symbol versions
and compat symbols.
* sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c: Include
<shlib-compat.h>.
(__totalorderl): Take pointer arguments.  Add symbol versions and
compat symbols.
* sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Include
<shlib-compat.h>.
(__totalordermagl): Take pointer arguments.  Add symbol versions
and compat symbols.
* sysdeps/ieee754/ldbl-96/s_totalorderl.c: Include
<shlib-compat.h> and <first-versions.h>.
(__totalorderl): Take pointer arguments.  Add symbol versions and
compat symbols.
* sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Include
<shlib-compat.h> and <first-versions.h>.
(__totalordermagl): Take pointer arguments.  Add symbol versions
and compat symbols.
* sysdeps/ieee754/ldbl-opt/nldbl-totalorder.c (totalorderl): Take
pointer arguments.
* sysdeps/ieee754/ldbl-opt/nldbl-totalordermag.c (totalordermagl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c
(do_test): Update calls to totalorderl and totalordermagl.
* sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c (do_test):
Update calls to totalorderl and totalordermagl.
* sysdeps/mach/hurd/i386/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/csky/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.

4 years agologin: Add nonstring attributes to struct utmp, struct utmpx [BZ #24899]
Florian Weimer [Thu, 15 Aug 2019 14:09:43 +0000 (16:09 +0200)] 
login: Add nonstring attributes to struct utmp, struct utmpx [BZ #24899]

Commit 7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c ("The
-Wstringop-truncation option new in GCC 8 detects common misuses")
added __attribute_nonstring__ to bits/utmp.h, but it did not update
the parallel bits/utmpx.h header.  In struct utmp, the nonstring
attribute for ut_id was missing.

4 years agologin: Use struct flock64 in utmp [BZ #24880]
Florian Weimer [Thu, 15 Aug 2019 14:09:20 +0000 (16:09 +0200)] 
login: Use struct flock64 in utmp [BZ #24880]

Commit 06ab719d30b01da401150068054d3b8ea93dd12f ("Fix Linux fcntl OFD
locks for non-LFS architectures (BZ#20251)") introduced the use of
fcntl64 into the utmp implementation.  However, the lock file
structure was not updated to struct flock64 at that point.

4 years agologin: Disarm timer after utmp lock acquisition [BZ #24879]
Florian Weimer [Thu, 15 Aug 2019 14:09:05 +0000 (16:09 +0200)] 
login: Disarm timer after utmp lock acquisition [BZ #24879]

If the file processing takes a long time for some reason, SIGALRM can
arrive while the file is still being processed.  At that point, file
access will fail with EINTR.  Disarming the timer after lock
acquisition avoids that.  (If there was a previous alarm, it is the
responsibility of the caller to deal with the EINTR error.)

4 years agonptl: Remove pthread_self compatibility symbol from libpthread
Florian Weimer [Thu, 15 Aug 2019 09:02:21 +0000 (11:02 +0200)] 
nptl: Remove pthread_self compatibility symbol from libpthread

The symbol is no longer needed because since glibc 2.30, the dynamic
loader continues searching for the symbol in libc.

4 years agonptl: Move pthread_attr_destroy implementation into libc
Florian Weimer [Thu, 15 Aug 2019 08:51:23 +0000 (10:51 +0200)] 
nptl: Move pthread_attr_destroy implementation into libc

4 years agoUpdate i386 libm-test-ulps
Andreas Schwab [Thu, 15 Aug 2019 10:14:35 +0000 (12:14 +0200)] 
Update i386 libm-test-ulps

4 years agomalloc: Various cleanups for malloc/tst-mxfast
Florian Weimer [Thu, 15 Aug 2019 09:37:18 +0000 (11:37 +0200)] 
malloc: Various cleanups for malloc/tst-mxfast

4 years agologin: Fix updwtmp, updwtmx unlocking
Florian Weimer [Thu, 15 Aug 2019 08:30:23 +0000 (10:30 +0200)] 
login: Fix updwtmp, updwtmx unlocking

Commit 5a3afa9738f3dbbaf8c0a35665318c1af782111b (login: Replace
macro-based control flow with function calls in utmp) introduced
a regression because after it, __libc_updwtmp attempts to unlock
the wrong file descriptor.

4 years agonptl: Move pthread_equal implementation into libc
Florian Weimer [Thu, 15 Aug 2019 06:48:31 +0000 (08:48 +0200)] 
nptl: Move pthread_equal implementation into libc

4 years agosupport: Include <support/descriptors.h> in support_descriptors.c
Florian Weimer [Wed, 14 Aug 2019 10:54:49 +0000 (12:54 +0200)] 
support: Include <support/descriptors.h> in support_descriptors.c

4 years agoaarch64: Disable using DC ZVA in emag memset
Feng Xue [Wed, 14 Aug 2019 02:48:05 +0000 (10:48 +0800)] 
aarch64: Disable using DC ZVA in emag memset

    * sysdeps/aarch64/multiarch/memset_base64.S (DC_ZVA_THRESHOLD):
    Disable DC ZVA code if this macro is defined as zero.
    * sysdeps/aarch64/multiarch/memset_emag.S (DC_ZVA_THRESHOLD):
    Change to zero to disable using DC ZVA.

4 years agoDeclare some TS 18661-4 interfaces for C2X.
Joseph Myers [Tue, 13 Aug 2019 23:04:38 +0000 (23:04 +0000)] 
Declare some TS 18661-4 interfaces for C2X.

C2X (current version in git, postdating the most recent public draft
available as a PDF on the WG14 website) adds the interfaces from TS
18661-4, other than the reduction functions, as unconditionally
required and visible in <math.h> for hosted implementations; the
__STDC_WANT_IEC_60559_FUNCS_EXT__ macro is not included in C2X at all
(as the reduction functions aren't included at all, expected to end up
in a version of the TS updated to be relative to C2X).

This patch updates the glibc headers accordingly, following the same
pattern used for 18661-1 functions.  As the only 18661-4 functions
currently supported are the exp10 functions that have been in glibc
for a very long time, this means that in fact __GLIBC_USE
(IEC_60559_FUNCS_EXT) ends up being used only to determine the
definition of __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X, not yet in any
headers other than bits/libc-header-start.h.

(I hope to add the other 18661-4 functions to glibc at some point; the
main complication is the current lack of MPFR support for many of
these functions.)

Tested for x86_64.

* bits/libc-header-start.h (__GLIBC_USE_IEC_60559_FUNCS_EXT):
Update comment.
(__GLIBC_USE_IEC_60559_FUNCS_EXT_C2X): New macro.
* bits/math-finite.h [__GLIBC_USE (IEC_60559_FUNCS_EXT)]: Change
to [__GLIBC_USE (IEC_60559_FUNCS_EXT_C2X)].
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_FUNCS_EXT)]:
Likewise.

4 years agologin: Replace macro-based control flow with function calls in utmp
Florian Weimer [Tue, 13 Aug 2019 13:53:19 +0000 (15:53 +0200)] 
login: Replace macro-based control flow with function calls in utmp

4 years agoDeclare most TS 18661-1 interfaces for C2X.
Joseph Myers [Tue, 13 Aug 2019 11:28:51 +0000 (11:28 +0000)] 
Declare most TS 18661-1 interfaces for C2X.

C2X adds the interfaces from TS 18661-1, and all except a handful in
Annex F are unconditionally visible in C2X rather than only visible
when __STDC_WANT_IEC_60559_BFP_EXT__ is defined.  This patch updates
glibc headers accordingly: most uses of __GLIBC_USE
(IEC_60559_BFP_EXT) are changed to a new __GLIBC_USE
(IEC_60559_BFP_EXT_C2X).  (Regarding totalorder and totalordermag, the
type-generic macros in tgmath.h will go away when the functions are
changed to take pointer arguments.)

* bits/libc-header-start.h (__GLIBC_USE_IEC_60559_BFP_EXT): Update
comment.
(__GLIBC_USE_IEC_60559_BFP_EXT_C2X): New macro.
* bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Change to
[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)].
* include/limits.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Likewise.
* math/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Likewise.
* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Likewise.
* stdlib/bits/stdlib-ldbl.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* stdlib/stdint.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Likewise.
* stdlib/stdlib.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Likewise.
* sysdeps/aarch64/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/alpha/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/arm/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/csky/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/hppa/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/ia64/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/m68k/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/microblaze/bits/fenv.h [__GLIBC_USE
(IEC_60559_BFP_EXT)]: Likewise.
* sysdeps/mips/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/nios2/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/powerpc/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/riscv/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/s390/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/sh/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/sparc/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* sysdeps/x86/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]:
Likewise, except for totalorder, totalordermag, getpayload,
setpayload and setpayloadsig.
* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Likewise,
except for totalorder and totalordermag.

4 years agoDeclare memccpy, strdup, strndup for C2X.
Joseph Myers [Tue, 13 Aug 2019 11:27:06 +0000 (11:27 +0000)] 
Declare memccpy, strdup, strndup for C2X.

C2X adds the memccpy, strdup and strndup functions.  This patch duly
adds __GLIBC_USE (ISOC2X) to the conditions under which <string.h>
declares them.

Tested for x86_64.

* string/string.h (memccpy): Also declare if [__GLIBC_USE (ISOC2X)].
(strdup): Likewise.
(strndup): Likewise.

4 years agoAdd feature test macro _ISOC2X_SOURCE.
Joseph Myers [Tue, 13 Aug 2019 11:26:00 +0000 (11:26 +0000)] 
Add feature test macro _ISOC2X_SOURCE.

This patch starts preparation for C2X support in glibc headers by
adding a feature test macro _ISOC2X_SOURCE and corresponding
__GLIBC_USE (ISOC2X).  (I chose to use the newer __GLIBC_USE style for
this rather than the older __USE_* macros tested with #ifdef.)  As
with other such macros, C2X features are also enabled by compiling for
a standard newer than C17, or by using _GNU_SOURCE.

This patch does not itself enable anything new in the headers for C2X;
that is to be done in followup patches.  (For example, most of the TS
18661-1 functions should be declared for C2X without any
__STDC_WANT_IEC_60559_BFP_EXT__ being needed, but the ones that
18661-1 adds to Annex F because of their close relation to IEEE 754
formats do still need the WANT macro in C2X.)

Once C2X becomes an actual standard we'll presumably move to using the
actual year in the feature test macro and __GLIBC_USE, with some
period when both macro spellings are accepted, as was done with
_ISOC9X_SOURCE.

Tested for x86_64.

* include/features.h (_ISOC2X_SOURCE): New feature test macro.
Undefine and define to 1 if [_GNU_SOURCE].
(__GLIBC_USE_ISOC2X): New macro.  Undefine and redefine depending
on [_ISOC2X_SOURCE] and [__STDC_VERSION__ > 201710L].
(__USE_ISOC11): Also define to 1 if [_ISOC2X_SOURCE].
(__USE_ISOC99): Likewise.
(__USE_ISOC95): Likewise.
* manual/creature.texi (_ISOC2X_SOURCE): Document.

4 years agologin: Assume that _HAVE_UT_* constants are true
Florian Weimer [Tue, 13 Aug 2019 10:09:32 +0000 (12:09 +0200)] 
login: Assume that _HAVE_UT_* constants are true

Make the GNU version of bits/utmp.h the generic version because
all remaining ports use it (with a sysdeps override for
Linux s390/s390x).

4 years agoelf: Support elf/tst-dlopen-aout in more configurations
Florian Weimer [Mon, 12 Aug 2019 15:33:29 +0000 (17:33 +0200)] 
elf: Support elf/tst-dlopen-aout in more configurations

dlopen can no longer open PIE binaries, so it is not necessary
to link the executable as non-PIE to trigger a dlopen failure.

If we hard-code the path to the real executable, we can run the test
with and without hard-coded paths because the dlopen path will not
be recognized as the main program in both cases.  (With an explict
loader invocation, the loader currently adds argv[0] to l_libname
for the main map and the dlopen call suceeds as a result; it does
not do that in standard mode.)

4 years agoAdd glibc.malloc.mxfast tunable
DJ Delorie [Thu, 8 Aug 2019 23:09:43 +0000 (19:09 -0400)] 
Add glibc.malloc.mxfast tunable

* elf/dl-tunables.list: Add glibc.malloc.mxfast.
* manual/tunables.texi: Document it.
* malloc/malloc.c (do_set_mxfast): New.
(__libc_mallopt): Call it.
* malloc/arena.c: Add mxfast tunable.
* malloc/tst-mxfast.c: New.
* malloc/Makefile: Add it.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agomalloc: Fix missing accounting of top chunk in malloc_info [BZ #24026]
Niklas Hambüchen [Thu, 8 Aug 2019 20:02:27 +0000 (22:02 +0200)] 
malloc: Fix missing accounting of top chunk in malloc_info [BZ #24026]

Fixes `<total type="rest" size="..."> incorrectly showing as 0 most
of the time.

The rest value being wrong is significant because to compute the
actual amount of memory handed out via malloc, the user must subtract
it from <system type="current" size="...">. That result being wrong
makes investigating memory fragmentation issues like
<https://bugzilla.redhat.com/show_bug.cgi?id=843478> close to
impossible.

4 years agoAdd SYNC_FILE_RANGE_WRITE_AND_WAIT from Linux 5.2 to bits/fcntl-linux.h.
Joseph Myers [Wed, 7 Aug 2019 17:01:13 +0000 (17:01 +0000)] 
Add SYNC_FILE_RANGE_WRITE_AND_WAIT from Linux 5.2 to bits/fcntl-linux.h.

This patch adds the SYNC_FILE_RANGE_WRITE_AND_WAIT constant from Linux
5.2 (a new name for a combination of existing bits, not actually a new
kernel interface) to bits/fcntl-linux.h.

Tested for x86_64.

* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU]
(SYNC_FILE_RANGE_WRITE_AND_WAIT): New macro.

4 years agoAdd AT_RECURSIVE from Linux 5.2 to fcntl.h.
Joseph Myers [Tue, 6 Aug 2019 21:17:59 +0000 (21:17 +0000)] 
Add AT_RECURSIVE from Linux 5.2 to fcntl.h.

This patch adds the AT_RECURSIVE constant from Linux 5.2 to glibc's
fcntl.h.  (Existing practice in glibc is that the AT_* constants go
directly in io/fcntl.h rather than somewhere OS-specific.)

Tested for x86_64.

* io/fcntl.h [__USE_GNU] (AT_RECURSIVE): New macro.

4 years agos390: Fix Enable VDSO for static linking
Stefan Liebler [Tue, 6 Aug 2019 13:49:08 +0000 (15:49 +0200)] 
s390: Fix Enable VDSO for static linking

The commit 5e855c8954014bca7b0d6f07312ec09553695ffd
"s390: Enable VDSO for static linking" removed the definition of VDSO_SETUP
which leads to not setup the vdso symbols.
Instead it jumps to false addresses.

This patch just re adds the removed VDSO_SETUP macro definition.

ChangeLog:

* sysdeps/unix/sysv/linux/s390/init-first.c (VDSO_SETUP): New define.

4 years agoAdd CLONE_PIDFD from Linux 5.2 to bits/sched.h.
Joseph Myers [Mon, 5 Aug 2019 21:30:20 +0000 (21:30 +0000)] 
Add CLONE_PIDFD from Linux 5.2 to bits/sched.h.

This patch adds the CLONE_PIDFD constant from Linux 5.2 to glibc's
bits/sched.h.

Tested for x86_64.

* sysdeps/unix/sysv/linux/bits/sched.h [__USE_GNU] (CLONE_PIDFD):
New macro.

4 years agolinux: Enable vDSO for static linking as default (BZ#19767)
Adhemerval Zanella [Thu, 13 Jun 2019 20:00:29 +0000 (20:00 +0000)] 
linux: Enable vDSO for static linking as default (BZ#19767)

This patch assumes static vDSO is supported as default, it is now supported
on all current architectures that support vDSO.  It allows removing both
ALWAYS_USE_VSYSCALL define, which an architecture requires to explicit define
and USE_VSYSCALL (which defines vDSO only for shared or if architecture defines
ALWAYS_USE_VSYSCALL).

Checked with a build against all affected ABIs.

[BZ #19767]
* sysdeps/unix/sysv/linux/aarch64/sysdep.h (ALWAYS_USE_VSYSCALL):
Remove definition.
* sysdeps/unix/sysv/linux/arm/sysdep.h (ALWAYS_USE_VSYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.h (ALWAYS_USE_VSYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (ALWAYS_USE_VSYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
(ALWAYS_USE_VSYSCALL): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
(ALWAYS_USE_VSYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
(ALWAYS_USE_VSYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
(ALWAYS_USE_VSYSCALL): Likewise.
* sysdeps/unix/sysv/linux/riscv/sysdep.h (ALWAYS_USE_VSYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
(ALWAYS_USE_VSYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
(ALWAYS_USE_VSYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/sysdep.h (ALWAYS_USE_VSYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h (ALWAYS_USE_VSYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/x86/libc-vdso.h: Remove #if USE_VSYSCALL.
* sysdeps/unix/sysv/linux/sysdep-vdso.h: Likewise.
* sysdeps/unix/sysv/linux/sysdep.h (ALWAYS_USE_VSYSCALL,
USE_VSYSCALL): Remove defitions.

4 years agosparc: Enable VDSO for static linking
Adhemerval Zanella [Thu, 30 May 2019 12:47:48 +0000 (09:47 -0300)] 
sparc: Enable VDSO for static linking

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

[BZ #19767]
* sysdeps/unix/sysv/linux/sparc/init-first.c: Remove #ifdef SHARED.
* sysdeps/unix/sysv/linux/sparc/libc-vdso.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sysdep.h (ALWAYS_USE_VSYSCALL):
Define.

4 years agos390: Enable VDSO for static linking
Adhemerval Zanella [Thu, 30 May 2019 11:04:06 +0000 (08:04 -0300)] 
s390: Enable VDSO for static linking

Although s390 only enables vDSO for dynamically linked elf binaries
(arch/s390/kernel/vdso.c:217), there is no indication in the code or
associated commit message for why not enable it for statically linked
binaries as well.  To double check, I rebuilt a kernel with the
check removed and the vDSO does work for static build for supplied
symbols.

Checked on s390x-linux-gnu and s390-linux-gnu.

[BZ #19767]
* sysdeps/unix/sysv/linux/s390/init-first.c: Remove #ifdef SHARED.
* sysdeps/unix/sysv/linux/s390/libc-vdso.h: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
(ALWAYS_USE_VSYSCALL): Define.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
(ALWAYS_USE_VSYSCALL): Likewise.

4 years agoriscv: Enable VDSO for static linking
Adhemerval Zanella [Wed, 29 May 2019 21:48:38 +0000 (18:48 -0300)] 
riscv: Enable VDSO for static linking

Checked on riscv64-linux-gnu-rv64imafdc-lp64d qemu system with
some static tests.

[BZ #19767]
* sysdeps/unix/sysv/linux/riscv/init-first.c: Remove #ifdef SHARED.
* sysdeps/unix/sysv/linux/riscv/libc-vdso.h: Likewise.
* sysdeps/unix/sysv/linux/riscv/sysdep.h (ALWAYS_USE_VSYSCALL):
Define.

4 years agosh: Update libm-tests-ulps
Adhemerval Zanella [Mon, 5 Aug 2019 18:56:39 +0000 (15:56 -0300)] 
sh: Update libm-tests-ulps

The make regen-ulps was done on a SH7785LCR.

* sysdeps/sh/libm-test-ulps: Update.

4 years agologin: Remove utmp backend jump tables [BZ #23518]
Florian Weimer [Mon, 5 Aug 2019 13:54:10 +0000 (15:54 +0200)] 
login: Remove utmp backend jump tables [BZ #23518]

There is just one file-based implementation, so this dispatch
mechanism is unnecessary.  Instead of the vtable pointer
__libc_utmp_jump_table, use a non-negative file_fd as the indicator
that the backend is initialized.

4 years agoelf: tst-ldconfig-bad-aux-cache: use support_capture_subprocess
Alexandra Hájková [Mon, 5 Aug 2019 11:18:57 +0000 (13:18 +0200)] 
elf: tst-ldconfig-bad-aux-cache: use support_capture_subprocess

4 years agoUpdate kernel version in comment in syscall-names.list.
Joseph Myers [Fri, 2 Aug 2019 15:08:02 +0000 (15:08 +0000)] 
Update kernel version in comment in syscall-names.list.

This patch updates the Linux kernel version in a comment in
syscall-names.list to agree with the following "kernel" line.

* sysdeps/unix/sysv/linux/syscall-names.list: Update comment.

4 years agoUpdate Linux kernel version number in tst-mman-consts.py to 5.2.
Joseph Myers [Fri, 2 Aug 2019 11:36:07 +0000 (11:36 +0000)] 
Update Linux kernel version number in tst-mman-consts.py to 5.2.

The tst-mman-consts.py test includes a kernel version number, to avoid
failures because of newly added constants in the kernel (if kernel
headers are newer than this version of glibc) or missing constants in
the kernel (if kernel headers are older than this version of glibc).
This patch updates it to 5.2 to reflect that the MAP_* constants in
glibc are still current as of that kernel version.

Tested with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/tst-mman-consts.py (main): Update Linux
kernel version number to 5.2.

4 years agopowerpc: Cleanup: use actual power8 assembly mnemonics
Raoni Fassina Firmino [Thu, 27 Jun 2019 18:44:17 +0000 (15:44 -0300)] 
powerpc: Cleanup: use actual power8 assembly mnemonics

Some implementations in sysdeps/powerpc/powerpc64/power8/*.S still had
pre power8 compatible binutils hardcoded macros and were not using
.machine power8.

This patch should not have semantic changes, in fact it should have the
same exact code generated.

Tested that generated stripped shared objects are identical when
using "strip --remove-section=.note.gnu.build-id".

Checked on:
- powerpc64le, power9, build-many-glibcs.py, gcc 6.4.1 20180104, binutils 2.26.2.20160726
- powerpc64le, power8, debian 9, gcc 6.3.0 20170516, binutils 2.28
- powerpc64le, power9, ubuntu 19.04, gcc 8.3.0, binutils 2.32
- powerpc64le, power9, opensuse tumbleweed, gcc 9.1.1 20190527, binutils 2.32
- powerpc64, power9, debian 10, gcc 8.3.0, binutils 2.31.1

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
4 years agohppa: Update libm-tests-ulps
Adhemerval Zanella [Thu, 1 Aug 2019 12:19:34 +0000 (09:19 -0300)] 
hppa: Update libm-tests-ulps

The make regen-ulps was done on a PA8900 with 8.3.0.

* sysdeps/hppa/fpu/libm-test-ulps: Update.

4 years agomalloc: Remove unwanted leading whitespace in malloc_info [BZ #24867]
Florian Weimer [Thu, 1 Aug 2019 12:06:24 +0000 (14:06 +0200)] 
malloc: Remove unwanted leading whitespace in malloc_info [BZ #24867]

It was introduced in commit 6c8dbf00f536d78b1937b5af6f57be47fd376344
("Reformat malloc to gnu style.").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agoGet new entropy on each attempt __gen_tempname (BZ #15813)
Adhemerval Zanella [Thu, 25 Jul 2019 14:22:17 +0000 (11:22 -0300)] 
Get new entropy on each attempt __gen_tempname (BZ #15813)

This is missing bit for fully fix BZ#15813 (the other two were fixed
by 359653aaacad463).

Checked on x86_64-linux-gnu.

[BZ #15813]
sysdeps/posix/tempname.c (__gen_tempname): get entrypy on each
attempt.

4 years agoOpen master for 2.31 development. glibc-2.30.9000
Carlos O'Donell [Thu, 1 Aug 2019 04:41:53 +0000 (00:41 -0400)] 
Open master for 2.31 development.