]> sourceware.org Git - glibc.git/log
glibc.git
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.

4 years agoTag 2.30 release. glibc-2.30
Carlos O'Donell [Thu, 1 Aug 2019 04:29:13 +0000 (00:29 -0400)]
Tag 2.30 release.

4 years agoUpdate install and NEWS for 2.30 release.
Carlos O'Donell [Thu, 1 Aug 2019 04:22:46 +0000 (00:22 -0400)]
Update install and NEWS for 2.30 release.

4 years agoUpdate translations.
Carlos O'Donell [Thu, 1 Aug 2019 03:38:15 +0000 (23:38 -0400)]
Update translations.

Update translations from translationproject.org for 2.29.9000.

4 years agoiconv: Revert steps array reference counting changes
Florian Weimer [Wed, 31 Jul 2019 09:43:59 +0000 (11:43 +0200)]
iconv: Revert steps array reference counting changes

The changes introduce a memory leak for gconv steps arrays whose
first element is an internal conversion, which has a fixed
reference count which is not decremented.  As a result, after the
change in commit 50ce3eae5ba304650459d4441d7d246a7cefc26f, the steps
array is never freed, resulting in an unbounded memory leak.

This reverts commit 50ce3eae5ba304650459d4441d7d246a7cefc26f
("gconv: Check reference count in __gconv_release_cache
[BZ #24677]") and commit 7e740ab2e7be7d83b75513aa406e0b10875f7f9c
("libio: Fix gconv-related memory leak [BZ #24583]").  It
reintroduces bug 24583.  (Bug 24677 was just a regression caused by
the second commit.)

4 years agoRestore r31 setting in powerpc32 swapcontext.
Joseph Myers [Tue, 30 Jul 2019 14:05:11 +0000 (14:05 +0000)]
Restore r31 setting in powerpc32 swapcontext.

Commit ffe8a9a8318e1db225b22da8bc067408494bac5c, "powerpc: Remove
rt_sigreturn usage on context function", removed from powerpc32
swapcontext a setting of r31 that is relied upon in subsequent code.
I'm not sure why this didn't produce test failures in Adhemerval's
32-bit testing; in my (soft-float) testing in preparation for 2.30
release, I see several context-related failures

FAIL: stdlib/tst-makecontext2
FAIL: stdlib/tst-makecontext3
FAIL: stdlib/tst-setcontext
FAIL: stdlib/tst-setcontext2
FAIL: stdlib/tst-setcontext4
FAIL: stdlib/tst-setcontext7
FAIL: stdlib/tst-setcontext9
FAIL: stdlib/tst-swapcontext1

that did not appear in 2.29 testing.  This patch restores the removed
register setting in question, and thus fixes those failures.

Tested for powerpc (soft-float).

* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
(__CONTEXT_FUNC_NAME): Restore setting of r31.

4 years agonptl: Use uintptr_t for address diagnostic in nptl/tst-pthread-getattr
Florian Weimer [Tue, 30 Jul 2019 08:35:08 +0000 (10:35 +0200)]
nptl: Use uintptr_t for address diagnostic in nptl/tst-pthread-getattr

Recent GCC versions warn about the attempt to return the address of a
local variable:

tst-pthread-getattr.c: In function ‘allocate_and_test’:
tst-pthread-getattr.c:54:10: error: function returns address of local variable [-Werror=return-local-addr]
   54 |   return mem;
      |          ^~~
In file included from ../include/alloca.h:3,
                 from tst-pthread-getattr.c:26:
../stdlib/alloca.h:35:23: note: declared here
   35 | # define alloca(size) __builtin_alloca (size)
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
tst-pthread-getattr.c:51:9: note: in expansion of macro ‘alloca’
   51 |   mem = alloca ((size_t) (mem - target));
      |         ^~~~~~

The address itself is used in a check in the caller, so using
uintptr_t instead is reasonable.

4 years agoLinux: Move getdents64 to <dirent.h>
Florian Weimer [Mon, 29 Jul 2019 19:02:46 +0000 (21:02 +0200)]
Linux: Move getdents64 to <dirent.h>

This matches the location of the declaration in musl.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agotest-container: Install with $(sorted-subdirs) [BZ #24794]
Tulio Magno Quites Machado Filho [Wed, 24 Jul 2019 22:49:00 +0000 (19:49 -0300)]
test-container: Install with $(sorted-subdirs) [BZ #24794]

Commit 35e038c1d2ccb3a75395662f9c4f28d85a61444f started to use an
incomplete list of subdirs based on $(all-subdirs) causing
testroot.pristine to miss files from nss.

Tested if the list of files in testroot.pristine remains the same.

[BZ #24794]
* Makeconfig (all-subdirs): Improved source comments.
* Makefile (testroot.pristine/install.stamp): Pass
subdirs='$(sorted-subdirs)' to make install.

4 years agogconv: Check reference count in __gconv_release_cache [BZ #24677]
Florian Weimer [Thu, 18 Jul 2019 15:27:24 +0000 (17:27 +0200)]
gconv: Check reference count in __gconv_release_cache  [BZ #24677]

This fixes a regression introduced in commit
7e740ab2e7be7d83b75513aa406e0b10875f7f9c ("libio: Fix gconv-related
memory leak [BZ #24583]").

__gconv_release_cache is only ever called with heap-allocated
arrays which contain at least one member.  The statically allocated
ASCII steps are filtered out by __wcsmbs_close_conv.

4 years agox86-64: Compile branred.c with -mprefer-vector-width=128 [BZ #24603]
H.J. Lu [Wed, 24 Jul 2019 21:48:33 +0000 (14:48 -0700)]
x86-64: Compile branred.c with -mprefer-vector-width=128 [BZ #24603]

When compiled with -O3 and AVX, GCC 8 and 9 optimize some loops in
sysdeps/ieee754/dbl-64/branred.c with 256-bit vector instructions,
which leads to store forward stall:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90579

There is no easy fix in compiler.  This patch limits vector width to
128 bits to work around this issue.  It improves performance of sin
and cos by more than 40% on Skylake compiled with -O3 -march=skylake.

Tested with GCC 7/8/9 on x86-64.

[BZ #24603]
* sysdeps/x86_64/configure.ac: Check if -mprefer-vector-width=128
works.
* sysdeps/x86_64/configure: Regenerated.
* sysdeps/x86_64/fpu/Makefile (CFLAGS-branred.c): New.  Set
to -mprefer-vector-width=128 if supported.

4 years agobuild-many-glibcs.py: Use Linux 5.2 by default
Florian Weimer [Wed, 24 Jul 2019 08:59:45 +0000 (10:59 +0200)]
build-many-glibcs.py: Use Linux 5.2 by default

4 years agoLinux: Use in-tree copy of SO_ constants for !__USE_MISC [BZ #24532]
Florian Weimer [Wed, 24 Jul 2019 08:59:34 +0000 (10:59 +0200)]
Linux: Use in-tree copy of SO_ constants for !__USE_MISC [BZ #24532]

The kernel changes for a 64-bit time_t on 32-bit architectures
resulted in <asm/socket.h> indirectly including <linux/posix_types.h>.
The latter is not namespace-clean for the POSIX version of
<sys/socket.h>.

This issue has persisted across several Linux releases, so this commit
creates our own copy of the SO_* definitions for !__USE_MISC mode.

The new test socket/tst-socket-consts ensures that the copy is
consistent with the kernel definitions (which vary across
architectures).  The test is tricky to get right because CPPFLAGS
includes include/libc-symbols.h, which in turn defines _GNU_SOURCE
unconditionally.

Tested with build-many-glibcs.py.  I verified that a discrepancy in
the definitions actually results in a failure of the
socket/tst-socket-consts test.

4 years agotest-container: Install with $(all-subdirs) [BZ #24794]
Tulio Magno Quites Machado Filho [Mon, 22 Jul 2019 20:34:13 +0000 (17:34 -0300)]
test-container: Install with $(all-subdirs) [BZ #24794]

Whenever a sub-make is created, it inherits the variable subdirs from its
parent.  This is also true when make check is called with a restricted
list of subdirs.  In this scenario, make install is executed "partially"
and testroot.pristine ends up with an incomplete installation.

[BZ #24794]
* Makefile (testroot.pristine/install.stamp): Pass
subdirs='$(all-subdirs)' to make install.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agotest-container: Avoid copying unintended system libraries
Tulio Magno Quites Machado Filho [Mon, 22 Jul 2019 19:30:45 +0000 (16:30 -0300)]
test-container: Avoid copying unintended system libraries

Some DSOs are distributed in hardware capability directories, e.g.
/usr/lib64/power7/libc.so.6
Whenever the processor is able to use one of these hardware-enabled
DSOs, testroot.pristine ends up with copies of glibc-provided libraries
from the system because it can't overwrite or remove them.

This patch avoids the unintended copies by executing ld.so with the same
arguments passed to each glibc test.

* Makefile (testroot.pristine/install.stamp): Execute ld.so with
the same arguments used in all tests.

5 years agoAdd NEWS entry about the new AArch64 IFUNC resolver call ABI
Szabolcs Nagy [Mon, 22 Jul 2019 09:14:16 +0000 (10:14 +0100)]
Add NEWS entry about the new AArch64 IFUNC resolver call ABI

The new IFUNC resolver call ABI was introduced in

commit 2b8a3c86e7606cf1b0a997dad8af2d45ae8989c3
Commit:     Szabolcs Nagy <szabolcs.nagy@arm.com>
CommitDate: 2019-07-04 11:13:32 +0100

    aarch64: new ifunc resolver ABI

See the commit log and the comments in sys/ifunc.h for details.

5 years agolocale/C-translit.h.in: Cyrillic -> ASCII transliteration [BZ #2872]
Egor Kobylkin [Wed, 2 Jan 2019 04:50:13 +0000 (05:50 +0100)]
locale/C-translit.h.in: Cyrillic -> ASCII transliteration [BZ #2872]

This patch adds Cyrillic to plain ASCII transliteration table according
to GOST 7.79-2000 System B standard to the C locale.

[BZ #2872]
* locale/C-translit.h.in: Add Cyrillic transliteration.

5 years agoLinux: Update syscall-names.list to Linux 5.2
Florian Weimer [Fri, 19 Jul 2019 06:53:04 +0000 (08:53 +0200)]
Linux: Update syscall-names.list to Linux 5.2

This adds the system call names fsconfig, fsmount, fsopen, fspick,
move_mount, open_tree.

Tested with build-many-glibcs.py.

5 years agoRegenerate po/libc.pot for 2.30 release.
Carlos O'Donell [Thu, 18 Jul 2019 17:30:00 +0000 (13:30 -0400)]
Regenerate po/libc.pot for 2.30 release.

5 years agonptl: Add POSIX-proposed _clock functions to hppa pthread.h
Adhemerval Zanella [Wed, 17 Jul 2019 17:56:51 +0000 (14:56 -0300)]
nptl: Add POSIX-proposed _clock functions to hppa pthread.h

The pthread _clock functions that were recently added to nptl need to be
declared in hppa's pthread.h too. After this change, the function
declaration part of sysdeps/nptl/pthread.h and
sysdeps/unix/sysv/linux/hppa/pthread.h are identical.

* sysdeps/unix/sysv/linux/hppa/pthread.h: Add declarations of
functions recently added to sysdeps/nptl/pthread.h:
pthread_mutex_clocklock, pthread_rwlock_clockrdlock,
pthread_rwlock_clockwrlock and pthread_cond_clockwait.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: Remove unnecessary forwarding of pthread_cond_clockwait from libc
Mike Crowe [Wed, 17 Jul 2019 17:51:08 +0000 (14:51 -0300)]
nptl: Remove unnecessary forwarding of pthread_cond_clockwait from libc

In afe4de7d283ebd88157126c5494ce1796194c16e, I added forwarding functions
from libc to libpthread for __pthread_cond_clockwait and
pthread_cond_clockwait to mirror those for pthread_cond_timedwait. These
are unnecessary[1], since these functions aren't (yet) being called from
within libc itself. Let's remove them.

      * nptl/forward.c: Remove unnecessary __pthread_cond_clockwait and
pthread_cond_clockwait forwarding functions.  There are no internal
users, so it is unnecessary to expose these functions in libc.so.
* sysdeps/nptl/pthread-functions.h (pthread_functions): Remove
unnecessary ptr___pthread_cond_clockwait member.
* nptl/nptl-init.c (pthread_functions): Remove assignment of
removed member.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
[1] https://sourceware.org/ml/libc-alpha/2017-10/msg00082.html

5 years agoAfar locales: Months and days updated from CLDR (bug 21897).
Rafal Luzynski [Mon, 8 Jul 2019 21:49:42 +0000 (23:49 +0200)]
Afar locales: Months and days updated from CLDR (bug 21897).

This commit updates month and weekday names (full and abbreviated)
from CLDR 35.1 with the following exceptions.

It was not clear why the full name of February in aa_DJ and aa_ER was
"Kudo" while the abbreviated version is "Nah" but some additional
sources [1] [2] as well as the content of aa_ER and aa_ER@saaho
suggest it should be "Naharsi Kudo".  This commit consequently sets
the translation of February to "Naharsi Kudo" in aa_DJ and aa_ET.

aa_ER@saaho is not supported by CLDR but since the month names were
identical to aa_ER before this commit, the same values have been copied
from aa_ER.

Links:

[1] https://fr.wiktionary.org/wiki/naharsi_kudo
[2] http://www.mcit.gov.et/web/guest/-/localization-standard-for-afaraf

[BZ #21897]
* localedata/locales/aa_DJ (abday): Update from CLDR, all words
begin with an uppercase letter now.
(abmon): Likewise.
(mon): Update from CLDR, reword February from "Kudo" to
"Naharsi Kudo", April from "Agda Baxisso" to "Agda Baxis",
and August from "Liiqen" to "Leqeeni".
* localedata/locales/aa_ER (mon): Update from CLDR, reword
April from "Agda Baxisso" to "Agda Baxis" and August from
"Leqeeni" to "Liiqen".
* localedata/locales/aa_ER@saaho (mon): Likewise.
* localedata/locales/aa_ET (abmon): Update from CLDR, reword
abbreviated February from "Kud" to "Nah".
(mon): Update from CLDR, reword February from "Kudo" to
"Naharsi Kudo" and April from "Agda Baxisso" to "Agda Baxis".

5 years agonl_BE locale: Use "copy "nl_NL"" in LC_NAME (bug 23996).
Rafal Luzynski [Tue, 9 Jul 2019 09:53:43 +0000 (11:53 +0200)]
nl_BE locale: Use "copy "nl_NL"" in LC_NAME (bug 23996).

The content of the section is identical in both languages.

[BZ #23996]
* localedata/locales/nl_BE (LC_NAME): Replace with “copy "nl_NL"”.

5 years agonl_BE and nl_NL locales: Dutch salutations (bug 23996).
PanderMusubi [Sun, 16 Dec 2018 20:09:07 +0000 (20:09 +0000)]
nl_BE and nl_NL locales: Dutch salutations (bug 23996).

[BZ #23996]
* localedata/locales/nl_BE (LC_NAME): Add name_gen, name_mr,
name_mrs, name_miss, and name_ms.
* localedata/locales/nl_NL (LC_NAME): Likewise.

5 years agoga_IE and en_IE locales: Revert first_weekday removal (bug 24200).
Daniil Zhilin [Sun, 27 Nov 2016 19:46:26 +0000 (22:46 +0300)]
ga_IE and en_IE locales: Revert first_weekday removal (bug 24200).

These values were removed by the commit 0a410e76f5.

[BZ #24200]
* localedata/locales/ga_IE (first_weekday): Add, set to 2 (Monday).
* localedata/locales/en_IE (first_weekday): Likewise.

5 years agonptl: Remove futex_supports_exact_relative_timeouts
Mike Crowe [Mon, 24 Jun 2019 20:18:00 +0000 (20:18 +0000)]
nptl: Remove futex_supports_exact_relative_timeouts

The only implementation of futex_supports_exact_relative_timeouts always
returns true. Let's remove it and all its callers.

* nptl/pthread_cond_wait.c: (__pthread_cond_clockwait): Remove code
that is only useful if futex_supports_exact_relative_timeouts ()
returns false.
* nptl/pthread_condattr_setclock.c: (pthread_condattr_setclock):
Likewise.
* sysdeps/nptl/futex-internal.h: Remove comment about relative
timeouts potentially being imprecise since it's no longer true.
Remove declaration of futex_supports_exact_relative_timeouts.
* sysdeps/unix/sysv/linux/futex-internal.h: Remove implementation
of futex_supports_exact_relative_timeouts.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agoUpdate NEWS for new _clockwait and _clocklock functions
Mike Crowe [Mon, 24 Jun 2019 19:51:03 +0000 (19:51 +0000)]
Update NEWS for new _clockwait and _clocklock functions

* NEWS: Mention recently-added pthread_cond_clockwait,
pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock and
sem_clockwait functions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: Add POSIX-proposed pthread_mutex_clocklock
Mike Crowe [Mon, 24 Jun 2019 19:48:14 +0000 (19:48 +0000)]
nptl: Add POSIX-proposed pthread_mutex_clocklock

Add POSIX-proposed pthread_mutex_clocklock function that works like
pthread_mutex_timedlock but takes a clockid parameter to measure the
abstime parameter against.

* sysdeps/nptl/pthread.h: Add pthread_mutex_clocklock.
* nptl/DESIGN-systemtap-probes.txt: Likewise.
* nptl/pthread_mutex_timedlock.c
(__pthread_mutex_clocklock_common): Rename from
__pthread_mutex_timedlock and add clockid parameter. Pass this
parameter to lll_clocklock and lll_clocklock_elision in place of
CLOCK_REALTIME. (__pthread_mutex_clocklock): New function to add
LIBC_PROBE and validate clockid parameter before calling
__pthread_mutex_clocklock_common. (__pthread_mutex_timedlock): New
implementation to add LIBC_PROBE and calls
__pthread_mutex_clocklock_common passing CLOCK_REALTIME as the
clockid.
* nptl/Makefile: Add tst-mutex11.c.
* nptl/tst-abstime.c (th): Add tests for pthread_mutex_clocklock.
* nptl/tst-mutex11.c: New tests for passing invalid and unsupported
clockid parameters to pthread_mutex_clocklock.
* nptl/tst-mutex5.c (do_test_clock): Rename from do_test and take
clockid parameter to indicate which clock to be used. Call
pthread_mutex_timedlock or pthread_mutex_clocklock as appropriate.
(do_test): Call do_test_clock to separately test
pthread_mutex_timedlock, pthread_mutex_clocklock(CLOCK_REALTIME)
and pthread_mutex_clocklock(CLOCK_MONOTONIC).
* nptl/tst-mutex9.c: Likewise.
* nptl/Versions (GLIBC_2.30): Add pthread_mutex_clocklock.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
(GLIBC_2.30): Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: Rename lll_timedlock to lll_clocklock and add clockid parameter
Mike Crowe [Mon, 24 Jun 2019 13:08:25 +0000 (13:08 +0000)]
nptl: Rename lll_timedlock to lll_clocklock and add clockid parameter

Rename lll_timedlock to lll_clocklock and add clockid
parameter to indicate the clock that the abstime parameter should
be measured against in preparation for adding
pthread_mutex_clocklock.

The name change mirrors the naming for the exposed pthread functions:

 timed => absolute timeout measured against CLOCK_REALTIME (or clock
          specified by attribute in the case of pthread_cond_timedwait.)

 clock => absolute timeout measured against clock specified in preceding
          parameter.

* sysdeps/nptl/lowlevellock.h (lll_clocklock): Rename from
lll_timedlock and add clockid parameter. (__lll_clocklock): Rename
from __lll_timedlock and add clockid parameter.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_clocklock):
Likewise.
* nptl/lll_timedlock_wait.c (__lll_clocklock_wait): Rename from
__lll_timedlock_wait and add clockid parameter. Use __clock_gettime
rather than __gettimeofday so that clockid can be used. This means
that conversion from struct timeval is no longer required.
* sysdeps/sparc/sparc32/lowlevellock.c (lll_clocklock_wait):
Likewise.
* sysdeps/sparc/sparc32/lll_timedlock_wait.c: Update comment to
refer to __lll_clocklock_wait rather than __lll_timedlock_wait.
* nptl/pthread_mutex_timedlock.c (lll_clocklock_elision): Rename
from lll_timedlock_elision, add clockid parameter and use
meaningful names for other parameters. (__pthread_mutex_timedlock):
Pass CLOCK_REALTIME where necessary to lll_clocklock and
lll_clocklock_elision.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
(lll_clocklock_elision): Rename from lll_timedlock_elision and add
clockid parameter. (__lll_clocklock_elision): Rename from
__lll_timedlock_elision and add clockid parameter.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/x86/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/elision-timed.c
(__lll_lock_elision): Call __lll_clocklock_elision rather than
__lll_timedlock_elision. (EXTRAARG): Add clockid parameter.
(LLL_LOCK): Likewise.
* sysdeps/unix/sysv/linux/s390/elision-timed.c: Likewise.
* sysdeps/unix/sysv/linux/x86/elision-timed.c: Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: Add POSIX-proposed pthread_rwlock_clockrdlock & pthread_rwlock_clockwrlock
Mike Crowe [Mon, 24 Jun 2019 13:05:27 +0000 (13:05 +0000)]
nptl: Add POSIX-proposed pthread_rwlock_clockrdlock & pthread_rwlock_clockwrlock

Add:
 int pthread_rwlock_clockrdlock (pthread_rwlock_t *rwlock,
                                 clockid_t clockid,
                                 const struct timespec *abstime)
and:
 int pthread_rwlock_clockwrlock (pthread_rwlock_t *rwlock,
                                 clockid_t clockid,
                                 const struct timespec *abstime)

which behave like pthread_rwlock_timedrdlock and
pthread_rwlock_timedwrlock respectively, except they always measure
abstime against the supplied clockid. The functions currently support
CLOCK_REALTIME and CLOCK_MONOTONIC and return EINVAL if any other
clock is specified.

* sysdeps/nptl/pthread.h: Add pthread_rwlock_clockrdlock and
pthread_wrlock_clockwrlock.
* nptl/Makefile: Build pthread_rwlock_clockrdlock.c and
pthread_rwlock_clockwrlock.c.
* nptl/pthread_rwlock_clockrdlock.c: Implement
pthread_rwlock_clockrdlock.
* nptl/pthread_rwlock_clockwrlock.c: Implement
pthread_rwlock_clockwrlock.
* nptl/pthread_rwlock_common.c (__pthread_rwlock_rdlock_full): Add
clockid parameter and verify that it indicates a supported clock on
entry so that we fail even if it doesn't end up being used. Pass
that clock on to futex_abstimed_wait when necessary.
(__pthread_rwlock_wrlock_full): Likewise.
* nptl/pthread_rwlock_rdlock.c: (__pthread_rwlock_rdlock): Pass
CLOCK_REALTIME to __pthread_rwlock_rdlock_full even though it won't
be used because there's no timeout.
* nptl/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Pass
CLOCK_REALTIME to __pthread_rwlock_wrlock_full even though it won't
be used because there is no timeout.
* nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Pass CLOCK_REALTIME to __pthread_rwlock_rdlock_full since abstime
uses that clock.
* nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Pass CLOCK_REALTIME to __pthread_rwlock_wrlock_full since abstime
uses that clock.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
(GLIBC_2.30): Likewise.
* nptl/tst-abstime.c (th): Add pthread_rwlock_clockrdlock and
pthread_rwlock_clockwrlock timeout tests to match the existing
pthread_rwlock_timedrdloock and pthread_rwlock_timedwrlock tests.
* nptl/tst-rwlock14.c (do_test): Likewise.
* nptl/tst-rwlock6.c Invent verbose_printf macro, and use for
ancillary output throughout. (tf): Accept thread_args structure so
that rwlock, a clockid and function name can be passed to the
thread. (do_test_clock): Rename from do_test. Accept clockid
parameter to specify test clock. Use the magic clockid value of
CLOCK_USE_TIMEDLOCK to indicate that pthread_rwlock_timedrdlock and
pthread_rwlock_timedwrlock should be tested, otherwise pass the
specified clockid to pthread_rwlock_clockrdlock and
pthread_rwlock_clockwrlock. Use xpthread_create and xpthread_join.
(do_test): Call do_test_clock to test each clockid in turn.
* nptl/tst-rwlock7.c: Likewise.
* nptl/tst-rwlock9.c (writer_thread, reader_thread): Accept
thread_args structure so that the (now int) thread number, the
clockid and the function name can be passed to the thread.
(do_test_clock): Renamed from do_test. Pass the necessary
thread_args when creating the reader and writer threads. Use
xpthread_create and xpthread_join.
(do_test): Call do_test_clock to test each clockid in turn.
* manual/threads.texi: Add documentation for
pthread_rwlock_clockrdlock and pthread_rwlock_clockwrclock.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: pthread_rwlock: Move timeout validation into _full functions
Mike Crowe [Mon, 24 Jun 2019 12:39:02 +0000 (12:39 +0000)]
nptl: pthread_rwlock: Move timeout validation into _full functions

As recommended by the comments in the implementations of
pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock, let's move
the timeout validity checks into the corresponding pthread_rwlock_rdlock_full
and pthread_rwlock_wrlock_full functions. Since these functions may be
called with abstime == NULL, an extra check for that is necessary too.

* nptl/pthread_rwlock_common.c (__pthread_rwlock_rdlock_full):
Check validity of abstime parameter.
(__pthread_rwlock_rwlock_full): Likewise.
* nptl/pthread_rwlock_timedrdlock.c
* (pthread_rwlock_timedrdlock):
Remove check for validity of abstime parameter.
* nptl/pthread_rwlock_timedwrlock.c
* (pthread_rwlock_timedwrlock):
Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: Add POSIX-proposed pthread_cond_clockwait
Mike Crowe [Fri, 21 Jun 2019 17:36:56 +0000 (17:36 +0000)]
nptl: Add POSIX-proposed pthread_cond_clockwait

Add:

 int pthread_cond_clockwait (pthread_cond_t *cond,
                             pthread_mutex_t *mutex,
                             clockid_t clockid,
                             const struct timespec *abstime)

which behaves just like pthread_cond_timedwait except it always measures
abstime against the supplied clockid. Currently supports CLOCK_REALTIME
and
CLOCK_MONOTONIC and returns EINVAL if any other clock is specified.

Includes feedback from many others. This function was originally
proposed[1] as pthread_cond_timedwaitonclock_np, but The Austin Group
preferred the new name.

* nptl/Makefile: Add tst-cond26 and tst-cond27
* nptl/Versions (GLIBC_2.30): Add pthread_cond_clockwait
* sysdeps/nptl/pthread.h: Likewise
* nptl/forward.c: Add __pthread_cond_clockwait
* nptl/forward.c: Likewise
* nptl/pthreadP.h: Likewise
* sysdeps/nptl/pthread-functions.h: Likewise
* nptl/pthread_cond_wait.c (__pthread_cond_wait_common): Add
clockid parameter and comment describing why we don't need to
check
its value. Use that value when calling
futex_abstimed_wait_cancelable rather than reading the clock
from
the flags. (__pthread_cond_wait): Pass unused clockid parameter.
(__pthread_cond_timedwait): Read clock from flags and pass it to
__pthread_cond_wait_common. (__pthread_cond_clockwait): Add new
function with weak alias from pthread_cond_clockwait.
* sysdeps/mach/hurd/i386/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
* (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
(GLIBC_2.30): Likewise.
* nptl/tst-cond11.c (run_test): Support testing
pthread_cond_clockwait too by using a special magic
CLOCK_USE_ATTR_CLOCK value to determine whether to call
pthread_cond_timedwait or pthread_cond_clockwait. (do_test):
Pass
CLOCK_USE_ATTR_CLOCK for existing tests, and add new tests using
all combinations of CLOCK_MONOTONIC and CLOCK_REALTIME.
* ntpl/tst-cond26.c: New test for passing unsupported and
* invalid
clocks to pthread_cond_clockwait.
* nptl/tst-cond27.c: Add test similar to tst-cond5.c, but using
struct timespec and pthread_cond_clockwait.
* manual/threads.texi: Document pthread_cond_clockwait. The
* comment
was provided by Carlos O'Donell.

[1] https://sourceware.org/ml/libc-alpha/2015-07/msg00193.html

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: Add POSIX-proposed sem_clockwait
Mike Crowe [Fri, 21 Jun 2019 15:57:41 +0000 (15:57 +0000)]
nptl: Add POSIX-proposed sem_clockwait

Add:

 int sem_clockwait (sem_t *sem, clockid_t clock, const struct timespec
*abstime)

which behaves just like sem_timedwait, but measures abstime against the
specified clock. Currently supports CLOCK_REALTIME and CLOCK_MONOTONIC
and sets errno == EINVAL if any other clock is specified.

* nptl/sem_waitcommon.c (do_futex_wait, __new_sem_wait_slow): Add
clockid parameters to indicate the clock which abstime should be
measured against.
* nptl/sem_timedwait.c (sem_timedwait), nptl/sem_wait.c
(__new_sem_wait): Pass CLOCK_REALTIME as clockid to
__new_sem_wait_slow.
* nptl/sem_clockwait.c: New file to implement sem_clockwait based
on sem_timedwait.c.
* nptl/Makefile: Add sem_clockwait.c source file. Add CFLAGS for
sem_clockwait.c to match those used for sem_timedwait.c.
* sysdeps/pthread/semaphore.h: Add sem_clockwait.
* nptl/Versions (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
(GLIBC_2.30): Likewise.
* nptl/tst-sem17.c: Add new test for passing invalid clock to
sem_clockwait.
* nptl/tst-sem13.c, nptl/tst-sem5.c: Modify existing sem_timedwait
tests to also test sem_clockwait.
* manual/threads.texi: Document sem_clockwait.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: Add clockid parameter to futex timed wait calls
Mike Crowe [Fri, 21 Jun 2019 14:53:40 +0000 (14:53 +0000)]
nptl: Add clockid parameter to futex timed wait calls

In preparation for adding POSIX clockwait variants of timedwait functions,
add a clockid_t parameter to futex_abstimed_wait functions and pass
CLOCK_REALTIME from all callers for the time being.

Replace lll_futex_timed_wait_bitset with lll_futex_clock_wait_bitset
which takes a clockid_t parameter rather than the magic clockbit.

* sysdeps/nptl/lowlevellock-futex.h,
sysdeps/unix/sysv/linux/lowlevellock-futex.h: Replace
lll_futex_timed_wait_bitset with lll_futex_clock_wait_bitset that
takes a clockid rather than a special clockbit.
* sysdeps/nptl/lowlevellock-futex.h: Add
lll_futex_supported_clockid so that client functions can check
whether their clockid parameter is valid even if they don't
ultimately end up calling lll_futex_clock_wait_bitset.
* sysdeps/nptl/futex-internal.h,
sysdeps/unix/sysv/linux/futex-internal.h
(futex_abstimed_wait, futex_abstimed_wait_cancelable): Add
clockid_t parameter to indicate which clock the absolute time
passed should be measured against. Pass that clockid onto
lll_futex_clock_wait_bitset. Add invalid clock as reason for
returning -EINVAL.
* sysdeps/nptl/futex-internal.h,
sysdeps/unix/sysv/linux/futex-internal.h: Introduce
futex_abstimed_supported_clockid so that client functions can check
whether their clockid parameter is valid even if they don't
ultimately end up calling futex_abstimed_wait.
* nptl/pthread_cond_wait.c (__pthread_cond_wait_common): Remove
code to calculate relative timeout for
__PTHREAD_COND_CLOCK_MONOTONIC_MASK and just pass CLOCK_MONOTONIC
or CLOCK_REALTIME as required to futex_abstimed_wait_cancelable.
* nptl/pthread_rwlock_common (__pthread_rwlock_rdlock_full)
(__pthread_wrlock_full), nptl/sem_waitcommon (do_futex_wait): Pass
additional CLOCK_REALTIME to futex_abstimed_wait_cancelable.
* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock):
Switch to lll_futex_clock_wait_bitset and pass CLOCK_REALTIME

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agoposix: Fix large mmap64 offset for mips64n32 (BZ#24699)
Adhemerval Zanella [Tue, 18 Jun 2019 17:09:09 +0000 (14:09 -0300)]
posix: Fix large mmap64 offset for mips64n32 (BZ#24699)

The fix for BZ#21270 (commit 158d5fa0e19) added a mask to avoid offset larger
than 1^44 to be used along __NR_mmap2.  However mips64n32 users __NR_mmap,
as mips64n64, but still defines off_t as old non-LFS type (other ILP32, such
x32, defines off_t being equal to off64_t).  This leads to use the same
mask meant only for __NR_mmap2 call for __NR_mmap, thus limiting the maximum
offset it can use with mmap64.

This patch fixes by setting the high mask only for __NR_mmap2 usage. The
posix/tst-mmap-offset.c already tests it and also fails for mips64n32. The
patch also change the test to check for an arch-specific header that defines
the maximum supported offset.

Checked on x86_64-linux-gnu, i686-linux-gnu, and I also tests tst-mmap-offset
on qemu simulated mips64 with kernel 3.2.0 kernel for both mips-linux-gnu and
mips64-n32-linux-gnu.

[BZ #24699]
* posix/tst-mmap-offset.c: Mention BZ #24699.
(do_test_bz21270): Rename to do_test_large_offset and use
mmap64_maximum_offset to check for maximum expected offset value.
* sysdeps/generic/mmap_info.h: New file.
* sysdeps/unix/sysv/linux/mips/mmap_info.h: Likewise.
* sysdeps/unix/sysv/linux/mmap64.c (MMAP_OFF_HIGH_MASK): Define iff
__NR_mmap2 is used.

5 years agonss_db: fix endent wrt NULL mappings [BZ #24695] [BZ #24696]
DJ Delorie [Fri, 28 Jun 2019 23:30:00 +0000 (18:30 -0500)]
nss_db: fix endent wrt NULL mappings [BZ #24695] [BZ #24696]

nss_db allows for getpwent et al to be called without a set*ent,
but it only works once.  After the last get*ent a set*ent is
required to restart, because the end*ent did not properly reset
the module.  Resetting it to NULL allows for a proper restart.

If the database doesn't exist, however, end*ent erroniously called
munmap which set errno.

The test case runs "makedb" inside the testroot, so needs selinux
DSOs installed.

5 years agoaarch64: simplify the DT_AARCH64_VARIANT_PCS handling code
Szabolcs Nagy [Tue, 9 Jul 2019 11:11:39 +0000 (12:11 +0100)]
aarch64: simplify the DT_AARCH64_VARIANT_PCS handling code

Remove unnecessary variant_pcs field: the dynamic tag can be checked
directly.

* sysdeps/aarch64/dl-machine.h (elf_machine_runtime_setup): Remove the
DT_AARCH64_VARIANT_PCS check.
(elf_machine_lazy_rel): Use l_info[DT_AARCH64 (VARIANT_PCS)].
* sysdeps/aarch64/linkmap.h (struct link_map_machine): Remove
variant_pcs.

5 years agoDon't declare __malloc_check_init in <malloc.h> (bug 23352)
Andreas Schwab [Tue, 9 Jul 2019 14:44:02 +0000 (16:44 +0200)]
Don't declare __malloc_check_init in <malloc.h> (bug 23352)

The function was never part of the malloc API.

5 years agolocale/tst-locale-locpath: Fix arguments passing
Mao Han [Wed, 10 Jul 2019 06:09:51 +0000 (14:09 +0800)]
locale/tst-locale-locpath: Fix arguments passing

The arguments passed by Makefile are missing match with the arguments
taken by locale/tst-locale-locpath.sh. Without this patch
cross-test-ssh.sh will be called twice in a single command while
doing the make check test wish ssh test wrapper.

* locale/Makefile: Fix tst-locale-locpath arguments passing.

5 years ago[powerpc] fenv_libc.h: protect use of __builtin_cpu_supports
Paul A. Clarke [Mon, 8 Jul 2019 22:06:19 +0000 (17:06 -0500)]
[powerpc] fenv_libc.h: protect use of __builtin_cpu_supports

Using __builtin_cpu_supports() requires support in GCC and Glibc.
My recent patch to fenv_libc.h added an unprotected use of
__builtin_cpu_supports().  Compilation of Glibc itself will fail
with a sufficiently new GCC and sufficiently old Glibc:

../sysdeps/powerpc/fpu/fegetexcept.c: In function ‘__fegetexcept’:
../sysdeps/powerpc/fpu/fenv_libc.h:52:20: error: builtin ‘__builtin_cpu_supports’ needs GLIBC (2.23 and newer) that exports hardware capability bits [-Werror]

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Fixes 3db85a9814784a74536a1f0e7b7ddbfef7dc84bb.

5 years agonftw: fill in stat buf for dangling links [BZ #23501]
DJ Delorie [Wed, 19 Jun 2019 21:07:41 +0000 (17:07 -0400)]
nftw: fill in stat buf for dangling links [BZ #23501]

As per Austin Group interpretation, "the object" wrt a
dangling symlink is the symlink itself, despite FTW_PHYS.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agoNEWS: clarify copy_file_range
DJ Delorie [Mon, 8 Jul 2019 21:10:52 +0000 (17:10 -0400)]
NEWS: clarify copy_file_range

Minor tweak to clarify what applications must do.

5 years agopowerpc: refactor logb{f,l}
Adhemerval Zanella [Tue, 19 Mar 2019 12:22:21 +0000 (12:22 +0000)]
powerpc: refactor logb{f,l}

The power7 logb implementation does not show a performance gain on
ISA 2.07+ chips with faster floating-point to GRP instructions
(currently POWER8 and POWER9).

This patch moves the POWER7 implementation to generic one and enables
it for POWER7.  It also add some cleanup to use inline floating-point
number instead of define them using static const.

The performance difference is for POWER9:

  - Without patch:
  "logb": {
   "subnormal": {
    "duration": 4.99202e+09,
    "iterations": 8.83662e+08,
    "max": 75.194,
    "min": 5.501,
    "mean": 5.64925
   },
   "normal": {
    "duration": 4.97063e+09,
    "iterations": 9.97094e+08,
    "max": 46.489,
    "min": 4.956,
    "mean": 4.98512
   }
  }

  - With patch:
  "logb": {
   "subnormal": {
    "duration": 4.97226e+09,
    "iterations": 9.92036e+08,
    "max": 77.209,
    "min": 4.892,
    "mean": 5.01218
   },
   "normal": {
    "duration": 4.96192e+09,
    "iterations": 1.07545e+09,
    "max": 12.361,
    "min": 4.593,
    "mean": 4.61382
   }
  }

The ifunc implementation is also enabled only for powerpc64.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/power7/fpu/s_logb.c: Move to ...
* sysdeps/powerpc/fpu/s_logb.c: ... here.  Use inline FP constants.
* sysdeps/powerpc/power7/fpu/s_logbf.c: Move to ...
* sysdeps/powerpc/fpu/s_logbf.c: ... here.  Use inline FP constants.
* sysdeps/powerpc/power7/fpu/s_logbl.c: Move to ...
* sysdeps/powerpc/fpu/s_logbl.c: ... here.  Use inline FP constants.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c:
Adjust implementation path.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c:
Adjust implementation path.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c:
Adjust implementation path.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
(libm-sysdep_routines): Add s_log* objects.
(CFLAGS-s_logbf-power7.c, CFLAGS-s_logbl-power7.c,
CFLAGS-s_logb-power7.c): New fule.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-power7.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-ppc64.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-power7.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-ppc64.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-power7.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-ppc64.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Remove file.
* sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c: Remove file.
* sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agomath: Use wordsize-64 version for s_logb
Adhemerval Zanella [Thu, 28 Mar 2019 19:14:04 +0000 (19:14 +0000)]
math: Use wordsize-64 version for s_logb

  - The resulting binary difference on 32 bits architecture is
    minimum.  On i686-linux-gnu (with architecture optimization
    routine removed) there is no different using logb benchtests

  - It helps wordsize-64 architectures that use ldbl-opt.

  - It add some code simplification with reduction of duplicated
    implementations.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c: Move to ...
* sysdeps/ieee754/dbl-64/s_logb.c: ... here.  Add work around for
powerpc32 integer 0 converting to -0.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agobenchtests: Add logb{f} benchmark
Adhemerval Zanella [Thu, 14 Mar 2019 11:55:04 +0000 (11:55 +0000)]
benchtests: Add logb{f} benchmark

* benchtests/Makefile (bench-math): Add logb.
* benchtests/logb-inputs: New file.
* benchtests/logbf-inputs: New file.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agopowerpc: Refactor modf{f}
Adhemerval Zanella [Mon, 18 Mar 2019 20:18:49 +0000 (20:18 +0000)]
powerpc: Refactor modf{f}

The modf{f} optimization is not an optimization for ISA 2.07+.  This
patch move the IFUNC for powerpc64 only, move the power5+ to generic
location, and include the generic implementation for ISA 2.07+.

The performance changes are based on modf benchtests:

  * POWER9 - ppc64
  "modf": {
   "": {
    "duration": 4.97057e+09,
    "iterations": 1.00688e+09,
    "max": 28.76,
    "min": 4.912,
    "mean": 4.9366
   }
  }
  * POWER9 - power5+
  "modf": {
   "": {
    "duration": 4.98291e+09,
    "iterations": 9.32818e+08,
    "max": 15.058,
    "min": 5.107,
    "mean": 5.34178
   }
  }

  * POWER8 - ppc64
   "modf": {
   "": {
    "duration": 5.05329e+09,
    "iterations": 8.38814e+08,
    "max": 518.051,
    "min": 5.79,
    "mean": 6.02433
   }
  }
  * POWER8 - power5+
  "modf": {
   "": {
    "duration": 5.05573e+09,
    "iterations": 8.35254e+08,
    "max": 63.141,
    "min": 5.873,
    "mean": 6.05293
   }
  }

  * POWER7 - ppc64
  "modf": {
   "": {
    "duration": 4.89818e+09,
    "iterations": 1.08408e+09,
    "max": 57.556,
    "min": 3.953,
    "mean": 4.51827
   }
  }
  * POWER7 - power5+
  "modf": {
   "": {
    "duration": 4.83789e+09,
    "iterations": 1.33409e+09,
    "max": 46.608,
    "min": 2.224,
    "mean": 3.62636
   }
  }

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/power5+/fpu/s_modf.c: Move to ...
* sysdeps/powerpc/fpu/s_modf.c: ... here.  Add ISA 2.07 optimization.
* sysdeps/powerpc/power5+/fpu/s_modff.c: Move to ...
* sysdeps/powerpc/fpu/s_modff.c: ... here.  Add ISA 2.07 optimization.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c:
Adjust include.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c:
Likewise.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (sysdep_calls,
sysdep_routines): Add s_modf* objects.
(CFLAGS-s_modf-power5+.c, CFLAGS-s_modff-power5+.c,
CFLAGS-s_modf-ppc64.c, CFLAGS-s_modff-ppc64.c): New rule.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c: Movo
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c: Move
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c: ... here.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agopowerpc: hypot refactor and optimization
Adhemerval Zanella [Mon, 18 Mar 2019 17:40:50 +0000 (17:40 +0000)]
powerpc: hypot refactor and optimization

The powerpc hypot is slight optimized by:

  - Commit 8df4e219e43, both isnan and isinf are always inlined and thus
    the check TEST_INF_NAN does not make sense anymore.  The generic
    check for POWER7 should be faster on all powerpc configuration.

  - The redundant check 'y > two60factor && (x / y) > two60' is removed.

Both changes leads to unrequired ifunc especialization for power7 and
thus they are removed.  Finally The code is also cleanup a bit by inlining
the constants floating points.

The performance changes using the hypot benchtests are:

  - POWER9 without patch:
    "hypot": {
     "overflow": {
      "duration": 4.98585e+09,
      "iterations": 4.84932e+08,
      "max": 46.551,
      "min": 10.229,
      "mean": 10.2815
     },
     "higher_two500": {
      "duration": 5.00192e+09,
      "iterations": 4.24843e+08,
      "max": 33.319,
      "min": 11.606,
      "mean": 11.7736
     },
     "subnormal": {
      "duration": 5.0075e+09,
      "iterations": 4.06792e+08,
      "max": 22.178,
      "min": 12.15,
      "mean": 12.3097
     },
     "less_two500": {
      "duration": 5.00685e+09,
      "iterations": 4.08772e+08,
      "max": 22.784,
      "min": 12.052,
      "mean": 12.2485
     },
     "default": {
      "duration": 5.06002e+09,
      "iterations": 4.09894e+08,
      "max": 20.648,
      "min": 11.874,
      "mean": 12.3447
     }
    }

  - POWER9 with patch:
    "hypot": {
     "overflow": {
      "duration": 4.91848e+09,
      "iterations": 7.28039e+08,
      "max": 47.958,
      "min": 6.436,
      "mean": 6.75579
     },
     "higher_two500": {
      "duration": 4.9359e+09,
      "iterations": 6.63376e+08,
      "max": 20.783,
      "min": 7.321,
      "mean": 7.44057
     },
     "subnormal": {
      "duration": 4.9479e+09,
      "iterations": 6.19772e+08,
      "max": 18.856,
      "min": 7.817,
      "mean": 7.98341
     },
     "less_two500": {
      "duration": 4.94275e+09,
      "iterations": 6.3889e+08,
      "max": 17.452,
      "min": 7.597,
      "mean": 7.73647
     },
     "default": {
      "duration": 5.03645e+09,
      "iterations": 5.70718e+08,
      "max": 18.904,
      "min": 8.55,
      "mean": 8.82476
     }
    }

  - POWER7 without patch
    "hypot": {
     "overflow": {
      "duration": 4.86637e+09,
      "iterations": 6.43196e+08,
      "max": 53.958,
      "min": 7.328,
      "mean": 7.56592
     },
     "higher_two500": {
      "duration": 4.99842e+09,
      "iterations": 3.11012e+08,
      "max": 78.227,
      "min": 15.696,
      "mean": 16.0715
     },
     "subnormal": {
      "duration": 4.99841e+09,
      "iterations": 3.08935e+08,
      "max": 51.392,
      "min": 15.983,
      "mean": 16.1795
     },
     "less_two500": {
      "duration": 5.00108e+09,
      "iterations": 2.99464e+08,
      "max": 73.247,
      "min": 16.416,
      "mean": 16.7001
     },
     "default": {
      "duration": 5.04645e+09,
      "iterations": 3.52608e+08,
      "max": 70.073,
      "min": 13.38,
      "mean": 14.3118
     }
    }

  - POWER7 with patch
    "hypot": {
     "overflow": {
      "duration": 4.80785e+09,
      "iterations": 8.00001e+08,
      "max": 66.262,
      "min": 5.888,
      "mean": 6.00981
     },
     "higher_two500": {
      "duration": 4.9859e+09,
      "iterations": 3.39449e+08,
      "max": 5148.44,
      "min": 14.539,
      "mean": 14.6882
     },
     "subnormal": {
      "duration": 4.9905e+09,
      "iterations": 3.28874e+08,
      "max": 64.905,
      "min": 14.971,
      "mean": 15.1745
     },
     "less_two500": {
      "duration": 4.99494e+09,
      "iterations": 3.19755e+08,
      "max": 103.696,
      "min": 14.972,
      "mean": 15.6211
     },
     "default": {
      "duration": 5.03951e+09,
      "iterations": 4.02502e+08,
      "max": 61.008,
      "min": 12.368,
      "mean": 12.5205
     }
    }

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/fpu/e_hypot.c (two60, two500, two600, two1022,
twoM500, twoM600, two60factor, pdnum): Remove.
(TEST_INFO_NAN, GET_TW0_HIGH_WORD): Remove macro.
(__ieee754_hypot): Replace static variables with inline definition,
remove ununsed branches.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
(libm-sysdep_routines): Remove e_hypot-* objects.
(CFLAGS-e_hypot-power7.c, CFLAGS-e_hypotf-power7.c): Remove rule.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-power7.c: Remove
file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-power7.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agobenchtests: hypot benchmark
Adhemerval Zanella [Mon, 11 Mar 2019 17:01:11 +0000 (17:01 +0000)]
benchtests: hypot benchmark

Inputs are based on argument reductions from generic and powerpc
implementation.

* benchtests/Makefile (bench-math): Add hypot.
* benchtests/hypot-inputs: New file.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agodl-vdso: Add LINUX_4 HASH CODE to support nds32 vdso mechanism
Vincent Chen [Mon, 8 Jul 2019 18:56:43 +0000 (15:56 -0300)]
dl-vdso: Add LINUX_4 HASH CODE to support nds32 vdso mechanism

* sysdeps/unix/sysv/linux/dl-vdso.h: Add LINUX_4
HASH code to support nds32 vdso mechanism.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agoriscv: restore ABI compatibility (bug 24484)
Andreas Schwab [Wed, 3 Jul 2019 11:52:49 +0000 (13:52 +0200)]
riscv: restore ABI compatibility (bug 24484)

The contents of the dynamic section are part of the ABI, thus
DL_RO_DYN_SECTION cannot be changed.

5 years agoaarch64: new ifunc resolver ABI
Szabolcs Nagy [Tue, 23 Apr 2019 14:59:34 +0000 (15:59 +0100)]
aarch64: new ifunc resolver ABI

Passing a second argument to the ifunc resolver allows accessing
AT_HWCAP2 values from the resolver. AArch64 will start using AT_HWCAP2
on linux because for ilp32 to remain compatible with lp64 ABI no more
than 32bit hwcap flags can be in AT_HWCAP which is already used up.

Currently the relocation ordering logic does not guarantee that ifunc
resolvers can call libc apis or access libc objects, so only the
resolver arguments and runtime environment dependent instructions can
be used to do the dispatch (this affects ifunc resolvers outside of
the libc).

Since ifunc resolver is target specific and only supposed to be
called by the dynamic linker, the call ABI can be changed in a
backward compatible way:

Old call ABI passed hwcap as uint64_t, new abi sets the
_IFUNC_ARG_HWCAP flag in the hwcap and passes a second argument
that's a pointer to an extendible struct. A resolver has to check
the _IFUNC_ARG_HWCAP flag before accessing the second argument.

The new sys/ifunc.h installed header has the definitions for the
new ABI, everything is in the implementation reserved namespace.

An alternative approach is to try to support extern calls from ifunc
resolvers such as getauxval, but that seems non-trivial
https://sourceware.org/ml/libc-alpha/2017-01/msg00468.html

* sysdeps/aarch64/Makefile: Install sys/ifunc.h and add tests.
* sysdeps/aarch64/dl-irel.h (elf_ifunc_invoke): Update to new ABI.
* sysdeps/aarch64/sys/ifunc.h: New file.
* sysdeps/aarch64/tst-ifunc-arg-1.c: New file.
* sysdeps/aarch64/tst-ifunc-arg-2.c: New file.

5 years agonptl: Remove vfork IFUNC-based forwarder from libpthread [BZ #20188]
Florian Weimer [Tue, 2 Jul 2019 13:12:20 +0000 (15:12 +0200)]
nptl: Remove vfork IFUNC-based forwarder from libpthread [BZ #20188]

With commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c ("ld.so:
Support moving versioned symbols between sonames [BZ #24741]"), the
dynamic linker will find the definition of vfork in libc and binds
a vfork reference to that symbol, even if the soname in the version
reference says that the symbol should be located in libpthread.

As a result, the forwarder (whether it's IFUNC-based or a duplicate
of the libc implementation) is no longer necessary.

On older architectures, a placeholder symbol is required, to make sure
that the GLIBC_2.1.2 symbol version does not go away, or is turned in
to a weak symbol definition by the link editor.  (The symbol version
needs to preserved so that the symbol coverage check in
elf/dl-version.c does not fail for old binaries.)

mips32 is an outlier: It defined __vfork@@GLIBC_2.2, but the
baseline is GLIBC_2.0.  Since there are other @@GLIBC_2.2 symbols,
the placeholder symbol is not needed there.

5 years agomalloc: Add nptl, htl dependency for the subdirectory [BZ #24757]
Florian Weimer [Tue, 2 Jul 2019 14:45:52 +0000 (16:45 +0200)]
malloc: Add nptl, htl dependency for the subdirectory [BZ #24757]

memusagestat may indirectly link against libpthread.  The built
libpthread should be used, but that is only possible if it has been
built before the malloc programs.

5 years agoFix build warnings in resolv/res_send.c
Stefan Liebler [Tue, 2 Jul 2019 12:07:44 +0000 (14:07 +0200)]
Fix build warnings in resolv/res_send.c

This patch fixes the gcc warnings seen with gcc 9 -march>=z13 on s390x:
res_send.c: In function ‘__res_context_send’:
res_send.c:498:7: error: ‘resplen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  498 |    if (n == 0 && (buf2 == NULL || *resplen2 == 0))
      |       ^

In this case send_vc is inlined into __res_context_send
and the maybe uninitialized resplen belongs to the one in send_vc.

In send_vc there is already a DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized")
and a comment which explains that this is a false-positive.
Note that resplen is used as return value.

This patch adds a further DIAG_IGNORE_NEEDS_COMMENT around the declaration of n
in __res_context_send and the comparison after n was set to the return value of send_vc.

ChangeLog:

* resolv/res_send.c (__res_context_send): Disable maybe-uninitialized
warning.

5 years agobuild-many-glibcs.py: Add v4t variant for arm-linux-gnueabi
Florian Weimer [Tue, 2 Jul 2019 11:14:58 +0000 (13:14 +0200)]
build-many-glibcs.py: Add v4t variant for arm-linux-gnueabi

5 years agoCall _dl_open_check after relocation [BZ #24259]
H.J. Lu [Mon, 1 Jul 2019 19:23:10 +0000 (12:23 -0700)]
Call _dl_open_check after relocation [BZ #24259]

This is a workaround for [BZ #20839] which doesn't remove the NODELETE
object when _dl_open_check throws an exception.  Move it after relocation
in dl_open_worker to avoid leaving the NODELETE object mapped without
relocation.

[BZ #24259]
* elf/dl-open.c (dl_open_worker): Call _dl_open_check after
relocation.
* sysdeps/x86/Makefile (tests): Add tst-cet-legacy-5a,
tst-cet-legacy-5b, tst-cet-legacy-6a and tst-cet-legacy-6b.
(modules-names): Add tst-cet-legacy-mod-5a, tst-cet-legacy-mod-5b,
tst-cet-legacy-mod-5c, tst-cet-legacy-mod-6a, tst-cet-legacy-mod-6b
and tst-cet-legacy-mod-6c.
(CFLAGS-tst-cet-legacy-5a.c): New.
(CFLAGS-tst-cet-legacy-5b.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-5a.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-5b.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-5c.c): Likewise.
(CFLAGS-tst-cet-legacy-6a.c): Likewise.
(CFLAGS-tst-cet-legacy-6b.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-6a.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-6b.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-6c.c): Likewise.
($(objpfx)tst-cet-legacy-5a): Likewise.
($(objpfx)tst-cet-legacy-5a.out): Likewise.
($(objpfx)tst-cet-legacy-mod-5a.so): Likewise.
($(objpfx)tst-cet-legacy-mod-5b.so): Likewise.
($(objpfx)tst-cet-legacy-5b): Likewise.
($(objpfx)tst-cet-legacy-5b.out): Likewise.
(tst-cet-legacy-5b-ENV): Likewise.
($(objpfx)tst-cet-legacy-6a): Likewise.
($(objpfx)tst-cet-legacy-6a.out): Likewise.
($(objpfx)tst-cet-legacy-mod-6a.so): Likewise.
($(objpfx)tst-cet-legacy-mod-6b.so): Likewise.
($(objpfx)tst-cet-legacy-6b): Likewise.
($(objpfx)tst-cet-legacy-6b.out): Likewise.
(tst-cet-legacy-6b-ENV): Likewise.
* sysdeps/x86/tst-cet-legacy-5.c: New file.
* sysdeps/x86/tst-cet-legacy-5a.c: Likewise.
* sysdeps/x86/tst-cet-legacy-5b.c: Likewise.
* sysdeps/x86/tst-cet-legacy-6.c: Likewise.
* sysdeps/x86/tst-cet-legacy-6a.c: Likewise.
* sysdeps/x86/tst-cet-legacy-6b.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-5.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-5a.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-5b.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-5c.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-6.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-6a.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-6b.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-6c.c: Likewise.

5 years agopowerpc: Use faster means to access FPSCR when possible in some cases
Paul A. Clarke [Thu, 20 Jun 2019 16:57:18 +0000 (11:57 -0500)]
powerpc: Use faster means to access FPSCR when possible in some cases

Using 'mffs' instruction to read the Floating Point Status Control Register
(FPSCR) can force a processor flush in some cases, with undesirable
performance impact.  If the values of the bits in the FPSCR which force the
flush are not needed, an instruction that is new to POWER9 (ISA version 3.0),
'mffsl' can be used instead.

Cases included:  get_rounding_mode, fegetround, fegetmode, fegetexcept.

* sysdeps/powerpc/bits/fenvinline.h (__fegetround): Use
__fegetround_ISA300() or __fegetround_ISA2() as appropriate.
(__fegetround_ISA300) New.
(__fegetround_ISA2) New.
* sysdeps/powerpc/fpu_control.h (IS_ISA300): New.
(_FPU_MFFS): Move implementation...
(_FPU_GETCW): Here.
(_FPU_MFFSL): Move implementation....
(_FPU_GET_RC_ISA300): Here. New.
(_FPU_GET_RC): Use _FPU_GET_RC_ISA300() or _FPU_GETCW() as appropriate.
* sysdeps/powerpc/fpu/fenv_libc.h (fegetenv_status_ISA300): New.
(fegetenv_status): New.
* sysdeps/powerpc/fpu/fegetmode.c (fegetmode): Use fegetenv_status()
instead of fegetenv_register().
* sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Likewise.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agoFurther improve string bench timing
Wilco Dijkstra [Fri, 28 Jun 2019 12:42:36 +0000 (13:42 +0100)]
Further improve string bench timing

Further improve the timings of the string benchmarks.  Ensure most take
between 1 and 4 seconds to improve accuracy.  Overall time taken increases
by 35%.  Tested on AArch64.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* benchtests/bench-math-inlines.c: Increase iterations.
* benchtests/bench-memcmp.c: Likewise.
* benchtests/bench-rawmemchr.c: Likewise.
* benchtests/bench-strcmp.c: Likewise.
* benchtests/bench-strcpy_chk.c: Likewise.
* benchtests/bench-string.h (INNER_LOOP_ITERS8): Add define.
(INNER_LOOP_ITERS_MEDIUM): Increase iterations.
(INNER_LOOP_ITERS_SMALL): Likewise.
* benchtests/bench-strncat.c: Increase iterations.
* benchtests/bench-strncmp.c: Increase iterations.
* benchtests/bench-strncpy.c: Reduce iterations for wide strings.
* benchtests/bench-strrchr.c: Increase iterations.
* benchtests/bench-strstr.c: Keep iterations unchanged.
* benchtests/bench-strtod.c: Increase iterations.

5 years agoBump up the runtime for "short" benchmarks
Anton Youdkevitch [Fri, 28 Jun 2019 12:38:07 +0000 (13:38 +0100)]
Bump up the runtime for "short" benchmarks

Some benchmarks with a very short runtime show significantly
different results across runs on Aarch64 - up to tens of percents.
Increasing the runtime to 100ms+ makes the deviation under 5%.

Tested on Aarch64 and x86-64.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* benchtests/bench-memccpy.c: Replace INNER_LOOP_ITERS
with INNER_LOOP_ITERS_LARGE.
* benchtests/bench-memchr.c: Likewise.
* benchtests/bench-rawmemchr.c: Likewise.
* benchtests/bench-strcat.c: Likewise.
* benchtests/bench-strchr.c: Likewise.
* benchtests/bench-string.h: Likewise.
* benchtests/bench-strlen.c: Likewise.
* benchtests/bench-strncpy.c: Likewise.
* benchtests/bench-strnlen.c: Likewise.

5 years agoLinux: Use mmap instead of malloc in dirent/tst-getdents64
Florian Weimer [Fri, 28 Jun 2019 08:48:48 +0000 (10:48 +0200)]
Linux: Use mmap instead of malloc in dirent/tst-getdents64

malloc dirties the entire allocated memory region due to M_PERTURB
in the test harness.

5 years agoReplace PREPARE_VERSION macro with inline function
Tobias Klauser [Fri, 28 Jun 2019 11:46:00 +0000 (08:46 -0300)]
Replace PREPARE_VERSION macro with inline function

* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
(prepare_version_base): New helper inline function.
(prepare_version): New macro replacing PREPARE_VERSION.
(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agold.so: Support moving versioned symbols between sonames [BZ #24741]
Florian Weimer [Fri, 28 Jun 2019 08:12:50 +0000 (10:12 +0200)]
ld.so: Support moving versioned symbols between sonames [BZ #24741]

This change should be fully backwards-compatible because the old
code aborted the load if a soname mismatch was encountered
(instead of searching further for a matching symbol).  This means
that no different symbols are found.

The soname check was explicitly disabled for the skip_map != NULL
case.  However, this only happens with dl(v)sym and RTLD_NEXT,
and those lookups do not come with a verneed entry that could be used
for the check.

The error check was already explicitly disabled for the skip_map !=
NULL case, that is, when dl(v)sym was called with RTLD_NEXT.  But
_dl_vsym always sets filename in the struct r_found_version argument
to NULL, so the check was not active anyway.  This means that
symbol lookup results for the skip_map != NULL case do not change,
either.

5 years agosupport: Add xdlvsym function
Florian Weimer [Fri, 28 Jun 2019 08:15:30 +0000 (10:15 +0200)]
support: Add xdlvsym function

This page took 0.101228 seconds and 5 git commands to generate.