external/glibc.git
5 years agoAdd bug number to historic ChangeLog entry
Florian Weimer [Wed, 10 Apr 2019 07:12:39 +0000 (09:12 +0200)]
Add bug number to historic ChangeLog entry

5 years agomalloc: Set and reset all hooks for tracing (Bug 16573)
Carlos O'Donell [Mon, 8 Apr 2019 21:35:05 +0000 (17:35 -0400)]
malloc: Set and reset all hooks for tracing (Bug 16573)

If an error occurs during the tracing operation, particularly during a
call to lock_and_info() which calls _dl_addr, we may end up calling back
into the malloc-subsystem and relock the loader lock and deadlock. For
all intents and purposes the call to _dl_addr can call any of the malloc
family API functions and so we should disable all tracing before calling
such loader functions.  This is similar to the strategy that the new
malloc tracer takes when calling the real malloc, namely that all
tracing ceases at the boundary to the real function and any faults at
that point are the purvue of the library (though the new tracer does
this on a per-thread basis in an MT-safe fashion). Since the new tracer
and the hook deprecation are not yet complete we must fix these issues
where we can.

Tested on x86_64 with no regressions.

Co-authored-by: Kwok Cheung Yeung <kcy@codesourcery.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 years agoImprove string benchtests
Wilco Dijkstra [Tue, 9 Apr 2019 10:54:34 +0000 (11:54 +0100)]
Improve string benchtests

Replace slow byte-oriented tests in several string benchmarks with the
generic implementations from the string/ directory so the comparisons
are more realistic and useful.

* benchtests/bench-stpcpy.c (SIMPLE_STPCPY): Remove function.
(generic_stpcpy): New function.
* benchtests/bench-stpncpy.c (SIMPLE_STPNCPY): Remove function.
(generic_stpncpy): New function.
* benchtests/bench-strcat.c (SIMPLE_STRCAT): Remove function.
(generic_strcat): New function.
* benchtests/bench-strcpy.c (SIMPLE_STRCPY): Remove function.
(generic_strcpy): New function.
* benchtests/bench-strncat.c (SIMPLE_STRNCAT): Remove function.
(STUPID_STRNCAT): Remove function.
(generic_strncat): New function.
* benchtests/bench-strncpy.c (SIMPLE_STRNCPY): Remove function.
(STUPID_STRNCPY): Remove function.
(generic_strncpy): New function.
* benchtests/bench-strnlen.c (SIMPLE_STRNLEN): Remove function.
(generic_strnlen): New function.
(memchr_strnlen): New function.
* benchtests/bench-strlen.c (generic_strlen): Define for WIDE.
(memchr_strlen): Likewise.

5 years agoImprove bench-strstr
Wilco Dijkstra [Tue, 9 Apr 2019 10:49:18 +0000 (11:49 +0100)]
Improve bench-strstr

Improve bench-strstr by using an extract from the manual as the input
to make the test more realistic.  Use the same input for both found and
fail cases rather than using a memset of '0' for most of the string,
which measures performance of strchr rather than strstr.  Add result
checking to catch potential errors.  Remove the repeated tests at slightly
different alignments and add more large needle and haystack testcases.

Replace stupid_strstr with an efficient basic implementation.  Add the
Two-way implementation to simplify comparisons with much faster generic
implementations.

* benchtests/bench-strstr.c (input): Add realistic input text.
(stupid_strstr): Remove function.
(basic_strstr): Add function.
(twoway_strstr): Add function.
(do_one_test): Add result checking.
(do_test): Use new input text.  Remove accidental early matches.
(test_main): Improve range of tests, reduce unaligned cases.

5 years agoImprove bench-memmem
Wilco Dijkstra [Tue, 9 Apr 2019 10:46:28 +0000 (11:46 +0100)]
Improve bench-memmem

Improve bench-memmem by replacing simple_memmem with a more efficient
implementation.  Add the Two-way implementation to enable direct comparison
with the optimized memmem.

* benchtests/bench-memmem.c (simple_memmem): Remove function.
(basic_memmem): Add function.
(twoway_memmem): Add function.

5 years agoRemove TIMING_INIT
Wilco Dijkstra [Tue, 9 Apr 2019 10:38:24 +0000 (11:38 +0100)]
Remove TIMING_INIT

Remove TIMING_INIT since it's no longer used.

* benchtests/bench-malloc-simple.c: Remove TIMING_INIT.
* benchtests/bench-malloc-thread.c: Likewise.
* benchtests/bench-skeleton.c: Likewise.
* benchtests/bench-strtod.c: Likewise.
* benchtests/bench-timing.h: Likewise.

5 years agoresolv: Remove RES_INSECURE1, RES_INSECURE2
Florian Weimer [Mon, 8 Apr 2019 09:19:38 +0000 (11:19 +0200)]
resolv: Remove RES_INSECURE1, RES_INSECURE2

Always perform the associated security checks.

5 years agoresolv: Remove support for RES_USE_INET6 and the inet6 option
Florian Weimer [Mon, 8 Apr 2019 08:40:31 +0000 (10:40 +0200)]
resolv: Remove support for RES_USE_INET6 and the inet6 option

This functionality was deprecated in glibc 2.25.

This commit only includes the core changes to remove the
functionality.  It does not remove the RES_USE_INET6 handling in the
individual NSS service modules and the res_use_inet6 function.
These changes will happen in future commits.

5 years agoaarch64: thunderx2 memcpy implementation cleanup and streamlining
Anton Youdkevitch [Fri, 5 Apr 2019 20:59:54 +0000 (13:59 -0700)]
aarch64: thunderx2 memcpy implementation cleanup and streamlining

Here is the updated patch for improving the long unaligned
code path (the one using "ext" instruction).

1. Always taken conditional branch at the beginning is
removed.

2. Epilogue code is placed after the end of the loop to
reduce the number of branches.

3. The redundant "mov" instructions inside the loop are
gone due to the changed order of the registers in the "ext"
instructions inside the loop,  the prologue has additional
"ext" instruction.

4.Updating count in the prologue was hoisted out as
it is the same update for each prologue.

5. Invariant code of the loop epilogue was hoisted out.

6. As the current size of the ext chunk is exactly 16
instructions long "nop" was added at the beginning
of the code sequence so that the loop entry for all the
chunks be aligned.

* sysdeps/aarch64/multiarch/memcpy_thunderx2.S: Cleanup branching
and remove redundant code.

5 years agopowerpc: Use generic wcsrchr optimization
Adhemerval Zanella [Thu, 28 Feb 2019 11:33:40 +0000 (08:33 -0300)]
powerpc: Use generic wcsrchr optimization

This patch removes the power6 wcsrchr optimization and uses generic
implementation instead.  Currently, both power6 and power7 IFUNC variant
resulting binary are essentially the same and the generic implementation
with unrolling loop set to 8 also results in similar performance.

Checked on powerpc64-linux-gnu.

* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcsrchr.c):
New rule.
* sysdeps/powerpc/power6/wcsrchr.c: Remove file.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c: Likewise.
* sysdeps/powerpc/powerpc64/power6/wcsrchr.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcsrchr-power6 and
wcsrchr-power7.
(CFLAGS-wcsrchr-power7.c, CFLAGS-wcsrchr-power6.c): Remove rule.
* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
Remove wcsrchr optimizations.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.

5 years agowcsmbs: Use loop_unroll on wcsrchr
Adhemerval Zanella [Tue, 12 Mar 2019 13:05:49 +0000 (10:05 -0300)]
wcsmbs: Use loop_unroll on wcsrchr

This allows an architecture to set explicit loop unrolling.

Checked on aarch64-linux-gnu.

* wcsmbs/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize
the loop unroll.

5 years agopowerpc: Use generic wcschr optimization
Adhemerval Zanella [Wed, 27 Feb 2019 18:15:51 +0000 (15:15 -0300)]
powerpc: Use generic wcschr optimization

This patch removes the power6 wcschr optimization and uses generic
implementation instead.  Currently, both power6 and power7 IFUNC variant
resulting binary are essentially the same and the generic implementation
with unrolling loop set to 8 also results in similar performance.

Checked on powerpc64-linux-gnu.

* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcschr.c):
New rule.
* sysdeps/powerpc/power6/wcschr.c: Remove file.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise.
* sysdeps/powerpc/powerpc64/power6/wcschr.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcschr-power6 and
wcschr-power7.
(CFLAGS-wcschr-power7.c, CFLAGS-wcschr-power6.c): Remove rule.
* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
Remove wcschr optimizations.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.

5 years agowcsmbs: Use loop_unroll on wcschr
Adhemerval Zanella [Tue, 12 Mar 2019 12:33:03 +0000 (09:33 -0300)]
wcsmbs: Use loop_unroll on wcschr

This allows an architecture to set explicit loop unrolling.

Checked on aarch64-linux-gnu.

* wcsmbs/wcschr.c (WCSCHR): Use loop_unroll.h to parametrize
the loop unroll.

5 years agopowerpc: Use generic wcscpy optimization
Adhemerval Zanella [Wed, 27 Feb 2019 14:21:35 +0000 (11:21 -0300)]
powerpc: Use generic wcscpy optimization

This patch removes the power6 wcscpy optimization and uses generic
implementation instead.  Currently, both power6 and power7 IFUNC variant
resulting binary are essentially the same and the generic implementation
with unrolling loop set to 8 also results in similar performance.

Checked on powerpc64-linux-gnu.

* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcscpy.c):
New rule.
* sysdeps/powerpc/power6/wcscpy.c: Remove file.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcscpy-power6.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcscpy-power7.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcscpy.c: Likewise.
* sysdeps/powerpc/powerpc64/power6/wcscpy.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcscpy-power6 and
wcscpy-power7.
(CFLAGS-wcscpy-power7.c, CFLAGS-wcscpy-power6.c): Remove rule.
* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
Remove wcscpy optimizations.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.

5 years agowcsmbs: Add wcscpy loop unroll option
Adhemerval Zanella [Tue, 12 Mar 2019 02:39:15 +0000 (23:39 -0300)]
wcsmbs: Add wcscpy loop unroll option

This allows an architecture to use the old generic implementation
and also set explicit loop unrolling.

Checked on aarch64-linux-gnu.

* include/loop_unroll.h: New file.
* wcsmbs/wcscpy (__wcscpy): Add option to use loop unrolling
besides generic implementation.

5 years agotime/tst-strftime3.c: Disable snprintf warning.
DJ Delorie [Wed, 3 Apr 2019 21:49:43 +0000 (17:49 -0400)]
time/tst-strftime3.c: Disable snprintf warning.

snprintf will only truncate the output if the data its given
is corrupted, but a truncated buffer will not match the
"pristine" data's buffer, which is all we need.  So just
disable the warning via the DIAG macros.

5 years agoAdd Reiwa era tests to time/tst-strftime3.c
DJ Delorie [Mon, 1 Apr 2019 19:21:54 +0000 (15:21 -0400)]
Add Reiwa era tests to time/tst-strftime3.c

Also fix printf warning

5 years agoja_JP locale: Add entry for the new Japanese era [BZ #22964]
TAMUKI Shoichi [Tue, 2 Apr 2019 07:46:55 +0000 (16:46 +0900)]
ja_JP locale: Add entry for the new Japanese era [BZ #22964]

The Japanese era name will be changed on May 1, 2019.  The Japanese
government made a preliminary announcement on April 1, 2019.

The glibc ja_JP locale must be updated to include the new era name for
strftime's alternative year format support.

Checked on x86_64-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
ChangeLog:

[BZ #22964]
* localedata/locales/ja_JP (LC_TIME): Add entry for the new Japanese
era.
* time/tst-strftime2.c (dates): Add 2019-04-30 and 2019-05-01.
(mkreftable): Add rules for the new Japanese era and the new dates.

5 years agotime: Add tests for Minguo calendar [BZ #24293]
TAMUKI Shoichi [Tue, 2 Apr 2019 07:42:04 +0000 (16:42 +0900)]
time: Add tests for Minguo calendar [BZ #24293]

Co-authored-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
ChangeLog:

[BZ #24293]
* time/Makefile (LOCALES): Add zh_TW.UTF-8, cmn_TW.UTF-8,
hak_TW.UTF-8, nan_TW.UTF-8, and lzh_TW.UTF-8.
* time/tst-strftime2.c (locales): Likewise.
(dates): Add 1910-04-01, 1911-12-31, 1912-01-01, 1913-04-01,
2010-04-01, and 2011-04-01.
(mkreftable): Add rules for the new locales and the new dates.

5 years agotime/tst-strftime2.c: Make the file easier to maintain
TAMUKI Shoichi [Tue, 2 Apr 2019 07:37:03 +0000 (16:37 +0900)]
time/tst-strftime2.c: Make the file easier to maintain

Express the years as full Gregorian years (e.g., 1988 instead of 88)
and months with natural numbers (1-12 rather than 0-11).

Compare actual dates rather than indexes when selecting the era name.

Declare the local variable era as a string character pointer rather
than an array of chars where the actual string is copied which might
lead to potential buffer overflows in future.

Co-authored-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
ChangeLog:

* time/tst-strftime2.c (date_t): Explicitly define the type.
(dates): Use natural month and year numbers to express a date.
(is_before): New function to compare dates.
(mkreftable): Minor improvements to simplify maintenance.
(do_test): Reflect the changes in dates array.

5 years agoNEWS: Mention Minguo calendar support added [BZ #24293]
TAMUKI Shoichi [Tue, 2 Apr 2019 07:25:35 +0000 (16:25 +0900)]
NEWS: Mention Minguo calendar support added [BZ #24293]

Co-authored-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoAdd verbose comments to 'era' in ja_JP locale.
Carlos O'Donell [Thu, 28 Mar 2019 18:02:20 +0000 (14:02 -0400)]
Add verbose comments to 'era' in ja_JP locale.

Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
5 years agoFix strptime era handling, add more strftime tests [BZ #24394]
DJ Delorie [Wed, 27 Mar 2019 21:44:51 +0000 (17:44 -0400)]
Fix strptime era handling, add more strftime tests [BZ #24394]

Test the transition points between all the currently listed Japanese
era name changes. This includes testing the transition between the
first year date and the second year date. This test will help test
the upcoming Japanese era name change.

Also fixes a fencepost error where the era name isn't properly parsed
by strptime in the last (partial) year of the era.

Example: if an era change happens in Feb 1990, and again in Aug 1995,
that's 5.5 years long, but the 0.5 year wasn't accounted for.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoalpha: Improve sysdeps/alpha/divqu.S and sysdeps/alpha/remqu.S
Uros Bizjak [Mon, 1 Apr 2019 08:58:37 +0000 (15:58 +0700)]
alpha: Improve sysdeps/alpha/divqu.S and sysdeps/alpha/remqu.S

* sysdeps/alpha/divqu.S (__divqu): Move save of $f0 and excb after
conditional branch to DIVBYZERO.  Fix unwind info.
* sysdeps/alpha/remqu.S (__remqu): Move saves of $f0, $f1, $f2 and
excb after conditional branch to $powerof2.  Add missing unop
instructions and .align directives and reorder instructions to
match __divqu.

Signed-off-by: Uroš Bizjak <ubizjak@gmail.com>
5 years agoalpha: Do not redefine __NR_shmat or __NR_osf_shmat
Richard Henderson [Mon, 1 Apr 2019 08:54:00 +0000 (15:54 +0700)]
alpha: Do not redefine __NR_shmat or __NR_osf_shmat

Fixes build using v5.1-rc1 headers.

The kernel has cleaned up how these are defined.  Previous behavior
was to define __NR_osf_shmat as 209 and not define __NR_shmat.
Current behavior is to define __NR_shmat as 209 and then define
__NR_osf_shmat as __NR_shmat.

* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
Do not redefine.
* sysdeps/unix/sysv/linux/alpha/sysdep.h (__NR_osf_shmat):
Do not redefine.

5 years agoRISC-V: Fix `test' operand error with soft-float ABI being configured
Maciej W. Rozycki [Sat, 30 Mar 2019 01:11:31 +0000 (01:11 +0000)]
RISC-V: Fix `test' operand error with soft-float ABI being configured

Fix a:

.../sysdeps/unix/sysv/linux/riscv/configure: line 181: test: =: unary operator expected

message produced by the RISC-V configure fragment with the soft-float
ABI selected, caused by $libc_cv_riscv_float_abi evaluating to nil in
the invocation of `test $libc_cv_riscv_float_abi = no'.

* sysdeps/unix/sysv/linux/riscv/configure.ac: Quote
$libc_cv_riscv_float_abi in `test' invocation.
* sysdeps/unix/sysv/linux/riscv/configure: Regenerate.

5 years ago[powerpc] Use __builtin_{mffs,mtfsf}
Paul A. Clarke [Sat, 30 Mar 2019 00:16:34 +0000 (19:16 -0500)]
[powerpc] Use __builtin_{mffs,mtfsf}

Replace inline asm uses of the "mffs" and "mtfsf" instructions with
the analogous GCC builtins.

__builtin_mffs and __builtin_mtfsf are both available in GCC 5 and above.
Given the minimum GCC level for GLibC is now GCC 6.2, it is safe to use
these builtins without restriction.

2019-03-29  Paul A. Clarke  <pc@us.ibm.com>

* sysdeps/powerpc/fpu/fenv_libc.h (fegetenv_register): Replace inline
asm with builtin.
* sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h (FP_INIT_ROUNDMODE):
Likewise.
* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (_GET_DI_FPSCR): Likewise.
(_GET_SI_FPSCR): Likewise.
(_SET_SI_FPSCR): Likewise.

5 years agoChangeLog: Correct more dates.
Rafal Luzynski [Wed, 27 Mar 2019 23:58:53 +0000 (00:58 +0100)]
ChangeLog: Correct more dates.

5 years agoChangeLog: Correct two dates.
Rafal Luzynski [Wed, 27 Mar 2019 11:46:24 +0000 (12:46 +0100)]
ChangeLog: Correct two dates.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agomath: Enable some math builtins for clang
Adhemerval Zanella [Fri, 1 Feb 2019 12:39:57 +0000 (10:39 -0200)]
math: Enable some math builtins for clang

This patch enable the builtin usage for clang for the C99 functions
fpclassify, isfinite, isnormal, isnan, isinf, and sigbit.  This allows
clang optimize the calls on frontend instead of call the appropriate
glibc symbols.

Checked on aarch64-linux-gnu and x86_64-linux-gnu. I checked the supported
version for each builtin based on released version from clang/llvm.

* math/math.h (fpclassify, isfinite, isnormal, isnan): Use builtin for
clang 2.8.
(signbit): Use builtin for clang 3.3.
(isinf): Use builtin for clang 3.7.

5 years agopowerpc: Remove ununsed s_float_bitwise.h
Adhemerval Zanella [Mon, 25 Mar 2019 18:34:50 +0000 (15:34 -0300)]
powerpc: Remove ununsed s_float_bitwise.h

This file is not used anywhere since removal of {k,e}_rem_pio2f.c
(commit ca3aac57efa89).

Checked with a build for powerpc-linux-gnu (with --with-cpu=power4
and --with-cpu=power7), powerpc64-linux-gnu (with --with-cpu=power4
and --with-cpu=power7), and powerpc64le-linux (with --with-cpu=power8).

* sysdeps/powerpc/fpu/s_float_bitwise.h: Remove file.

5 years agonss/tst-nss-files-alias-leak: add missing opening quote in printf
Andreas K. Hüttel [Sun, 24 Mar 2019 14:49:03 +0000 (15:49 +0100)]
nss/tst-nss-files-alias-leak: add missing opening quote in printf

5 years agonptl/tst-rwlock14: Test pthread_rwlock_timedwrlock correctly
Mike Crowe [Mon, 25 Mar 2019 12:29:50 +0000 (09:29 -0300)]
nptl/tst-rwlock14: Test pthread_rwlock_timedwrlock correctly

5 years agonptl: Convert tst-sem5 & tst-sem13 to use libsupport
Mike Crowe [Mon, 25 Mar 2019 12:28:18 +0000 (09:28 -0300)]
nptl: Convert tst-sem5 & tst-sem13 to use libsupport

Checked on x86_64-linux-gnu and i686-linux-gnu.

* nptl/tst-sem5.c: Remove unused headers. Add <support/check.h>.
(do_test) Use libsupport test macros rather than hand-coded
conditionals and error messages. Ensure that sem_init returns zero
rather than not -1. Use <support/test-driver.c> rather than
test-skeleton.c.

* nptl/tst-sem13.c: Add <support/check.h>. (do_test) Use libsupport
test macros rather than hand-coded conditionals and error messages.
Use <support/test-driver.c> rather than test-skeleton.c.

5 years agoAdd UDP_GRO from Linux 5.0 to netinet/udp.h.
Joseph Myers [Mon, 25 Mar 2019 13:16:46 +0000 (13:16 +0000)]
Add UDP_GRO from Linux 5.0 to netinet/udp.h.

This patch adds the new constant UDP_GRO from Linux 5.0 to glibc.

Tested for x86_64.

* sysdeps/gnu/netinet/udp.h (UDP_GRO): New macro.

5 years agoAdd NT_ARM_PAC_MASK and NT_MIPS_MSA from Linux 5.0 to elf.h.
Joseph Myers [Mon, 25 Mar 2019 13:15:56 +0000 (13:15 +0000)]
Add NT_ARM_PAC_MASK and NT_MIPS_MSA from Linux 5.0 to elf.h.

This patch adds two new NT_* macros from Linux 5.0 to elf.h.

Tested for x86_64.

* elf/elf.h (NT_ARM_PAC_MASK): New macro.
(NT_MIPS_MSA): Likewise.

5 years agoAdd generic hp-timing support
Wilco Dijkstra [Tue, 29 Jan 2019 17:43:45 +0000 (17:43 +0000)]
Add generic hp-timing support

Add missing generic hp_timing support.  It uses clock_gettime (CLOCK_MONOTONIC)
which has unspecified starting time, nano-second accuracy, and should faster on
architectures that implementes the symbol as vDSO.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked the builds for all afected ABIs.

* benchtests/Makefile (USE_CLOCK_GETTIME) Remove.
* benchtests/README: Update description.
* benchtests/bench-timing.h: Default to hp-timing.
* sysdeps/generic/hp-timing.h (HP_TIMING_DIFF, HP_TIMING_ACCUM_NT,
HP_TIMING_PRINT): Remove.
(HP_TIMING_NOW): Add generic implementation.
(hp_timing_t): Change to uint64_t.

5 years agoRefactor hp-timing rtld usage
Adhemerval Zanella [Thu, 24 Jan 2019 12:46:59 +0000 (12:46 +0000)]
Refactor hp-timing rtld usage

This patch refactor how hp-timing is used on loader code for statistics
report.  The HP_TIMING_AVAIL and HP_SMALL_TIMING_AVAIL are removed and
HP_TIMING_INLINE is used instead to check for hp-timing avaliability.
For alpha, which only defines HP_SMALL_TIMING_AVAIL, the HP_TIMING_INLINE
is set iff for IS_IN(rtld).

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked the builds for all afected ABIs.

* benchtests/bench-timing.h: Replace HP_TIMING_AVAIL with
HP_TIMING_INLINE.
* nptl/descr.h: Likewise.
* elf/rtld.c (RLTD_TIMING_DECLARE, RTLD_TIMING_NOW, RTLD_TIMING_DIFF,
RTLD_TIMING_ACCUM_NT, RTLD_TIMING_SET): Define.
(dl_start_final_info, _dl_start_final, dl_main, print_statistics):
Abstract hp-timing usage with RTLD_* macros.
* sysdeps/alpha/hp-timing.h (HP_TIMING_INLINE): Define iff IS_IN(rtld).
(HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL): Remove.
* sysdeps/generic/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL,
HP_TIMING_NONAVAIL): Likewise.
* sysdeps/ia64/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL):
Likewise.
* sysdeps/powerpc/powerpc32/power4/hp-timing.h (HP_TIMING_AVAIL,
HP_SMALL_TIMING_AVAIL): Likewise.
* sysdeps/powerpc/powerpc64/hp-timing.h (HP_TIMING_AVAIL,
HP_SMALL_TIMING_AVAIL): Likewise.
* sysdeps/sparc/sparc32/sparcv9/hp-timing.h (HP_TIMING_AVAIL,
HP_SMALL_TIMING_AVAIL): Likewise.
* sysdeps/sparc/sparc64/hp-timing.h (HP_TIMING_AVAIL,
HP_SMALL_TIMING_AVAIL): Likewise.
* sysdeps/x86/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL):
Likewise.
* sysdeps/generic/hp-timing-common.h: Update comment with
HP_TIMING_AVAIL removal.

5 years agoDo not use HP_TIMING_NOW for random bits
Adhemerval Zanella [Wed, 16 Jan 2019 18:10:56 +0000 (18:10 +0000)]
Do not use HP_TIMING_NOW for random bits

This patch removes the HP_TIMING_BITS usage for fast random bits and replace
with clock_gettime (CLOCK_MONOTONIC).  It has unspecified starting time and
nano-second accuracy, so its randomness is significantly better than
gettimeofday.

Althoug it should incur in more overhead (specially for architecture that
support hp-timing), the symbol is also common implemented as a vDSO.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked on a i686-gnu build.

* include/random-bits.h: New file.
* resolv/res_mkquery.c [HP_TIMING_AVAIL] (RANDOM_BITS,
(__res_context_mkquery): Remove usage hp-timing usage and replace with
random_bits.
* resolv/res_send.c [HP_TIMING_AVAIL] (nameserver_offset): Likewise.
* sysdeps/posix/tempname.c [HP_TIMING_AVAIL] (__gen_tempname):
Likewise.

5 years agoRemove __get_clockfreq
Adhemerval Zanella [Fri, 8 Feb 2019 16:53:40 +0000 (16:53 +0000)]
Remove __get_clockfreq

With clock_getres, clock_gettime, and clock_settime refactor to remove the
generic CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID support through
hp-timing, there is no usage of internal __get_clockfreq.  This patch removes
both generic and Linux implementation..

Checked with a build against aarch64-linux-gnu, i686-linux-gnu, ia64-linux-gnu,
sparc64-linux-gnu, powerpc-linux-gnu-power4.

* include/libc-internal.h (__get_clockfreq): Remove prototype.
* rt/Makefile (clock-routines): Remove get_clockfreq.
* rt/get_clockfreq.c: Remove file.
* sysdeps/unix/sysv/linux/i386/get_clockfreq.c: Likewise.
* sysdeps/unix/sysv/linux/ia64/get_clockfreq.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Move code to ...
* sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c: ... here.

5 years agolinux: Assume clock_getres CLOCK_{PROCESS,THREAD}_CPUTIME_ID
Adhemerval Zanella [Wed, 16 Jan 2019 17:30:07 +0000 (17:30 +0000)]
linux: Assume clock_getres CLOCK_{PROCESS,THREAD}_CPUTIME_ID

The Linux 3.2 clock_getres kernel code (kernel/posix-cpu-timers.c)
issued for clock_getres CLOCK_PROCESS_CPUTIME_ID (process_cpu_clock_getres)
and CLOCK_THREAD_CPUTIME_ID (thread_cpu_clock_getres) call
posix_cpu_clock_getres. And it fails on check_clock only if an invalid
clock is used (not the case) or if we pass an invalid the pid/tid in
29 msb of clock_id (not the case either).

This patch assumes that clock_getres syscall always support
CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID, so there is no need
to fallback to hp-timing support for _SC_MONOTONIC_CLOCK neither to issue
the syscall to certify the clock_id is supported bt the kernel.  This
allows simplify the sysconf support to always use the syscall.

it also removes ia64 itc drift check and assume kernel handles it correctly.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu.

* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c: Remove file.
* sysdeps/unix/sysv/linux/ia64/sysconf.c: Likewise.
* sysdeps/unix/sysv/linux/sysconf.c (has_cpuclock): Remove function.
(__sysconf): Assume kernel support for _SC_MONOTONIC_CLOCK,
_SC_CPUTIME, and _SC_THREAD_CPUTIME.

5 years agonptl: Remove pthread_clock_gettime pthread_clock_settime
Adhemerval Zanella [Wed, 16 Jan 2019 16:22:29 +0000 (16:22 +0000)]
nptl: Remove pthread_clock_gettime pthread_clock_settime

This patch removes CLOCK_THREAD_CPUTIME_ID and CLOCK_PROCESS_CPUTIME_ID support
from clock_gettime and clock_settime generic implementation.  For Linux, kernel
already provides supports through the syscall and Hurd HTL lacks
__pthread_clock_gettime and __pthread_clock_settime internal implementation.

As described in clock_gettime man-page [1] on 'Historical note for SMP
system', implementing CLOCK_{THREAD,PROCESS}_CPUTIME_ID with timer registers
is error-prone and susceptible to timing and accurary issues that the libc
can not deal without kernel support.

This allows removes unused code which, however, still incur in some runtime
overhead in thread creation (the struct pthread cpuclock_offset
initialization).

If hurd eventually wants to support them it should either either implement as
a kernel facility (or something related due its architecture) or in system
specific implementation.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked on a i686-gnu build.

* nptl/Makefile (libpthread-routines): Remove pthread_clock_gettime and
pthread_clock_settime.
* nptl/pthreadP.h (__find_thread_by_id): Remove prototype.
* elf/dl-support.c [!HP_TIMING_NOAVAIL] (_dl_cpuclock_offset): Remove.
(_dl_non_dynamic_init): Remove _dl_cpuclock_offset setting.
* elf/rtld.c (_dl_start_final): Likewise.
* nptl/allocatestack.c (__find_thread_by_id): Remove function.
* sysdeps/generic/ldsodefs.h [!HP_TIMING_NOAVAIL] (_dl_cpuclock_offset):
Remove.
* sysdeps/mach/hurd/dl-sysdep.c [!HP_TIMING_NOAVAIL]
(_dl_cpuclock_offset): Remove.
* nptl/descr.h (struct pthread): Rename cpuclock_offset to
cpuclock_offset_ununsed.
* nptl/nptl-init.c (__pthread_initialize_minimal_internal): Remove
cpuclock_offset set.
* nptl/pthread_create.c (START_THREAD_DEFN): Likewise.
* sysdeps/nptl/fork.c (__libc_fork): Likewise.
* nptl/pthread_clock_gettime.c: Remove file.
* nptl/pthread_clock_settime.c: Likewise.
* sysdeps/unix/clock_gettime.c (hp_timing_gettime): Remove function.
[HP_TIMING_AVAIL] (realtime_gettime): Remove CLOCK_THREAD_CPUTIME_ID
and CLOCK_PROCESS_CPUTIME_ID support.
* sysdeps/unix/clock_settime.c (hp_timing_gettime): Likewise.
[HP_TIMING_AVAIL] (realtime_gettime): Likewise.
* sysdeps/posix/clock_getres.c (hp_timing_getres): Likewise.
[HP_TIMING_AVAIL] (__clock_getres): Likewise.
* sysdeps/unix/clock_nanosleep.c (CPUCLOCK_P, INVALID_CLOCK_P):
Likewise.
(__clock_nanosleep): Remove CPUCLOCK_P and INVALID_CLOCK_P usage.

[1] http://man7.org/linux/man-pages/man2/clock_gettime.2.html

5 years agoS390: Add arch13 memmem ifunc variant.
Stefan Liebler [Fri, 22 Mar 2019 10:14:09 +0000 (11:14 +0100)]
S390: Add arch13 memmem ifunc variant.

This patch introduces the new arch13 ifunc variant for memmem.
For needles longer than 9 bytes it is relying on the common-code
implementation.  For shorter needles it is using the new vstrs instruction
which is able to search a substring within a vector register.

ChangeLog:

* sysdeps/s390/Makefile (sysdep_routines): Add memmem-arch13.
* sysdeps/s390/ifunc-memmem.h (HAVE_MEMMEM_ARCH13, MEMMEM_ARCH13,
MEMMEM_Z13_ONLY_USED_AS_FALLBACK, HAVE_MEMMEM_IFUNC_AND_ARCH13_SUPPORT):
New defines.
* sysdeps/s390/memmem-arch13.S: New file.
* sysdeps/s390/memmem-vx.c: Omit GI symbol for z13 memmem ifunc variant
if it is only used as fallback.
* sysdeps/s390/memmem.c (memmem): Add arch13 variant in ifunc selector.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc variant for arch13 memmem.

5 years agoS390: Add arch13 strstr ifunc variant.
Stefan Liebler [Fri, 22 Mar 2019 10:14:08 +0000 (11:14 +0100)]
S390: Add arch13 strstr ifunc variant.

This patch introduces the new arch13 ifunc variant for strstr.
For needles longer than 9 charachters it is relying on the common-code
implementation.  For shorter needles it is using the new vstrs instruction
which is able to search a substring within a vector register.

ChangeLog:

* sysdeps/s390/Makefile (sysdep_routines): Add strstr-arch13.
* sysdeps/s390/ifunc-strstr.h (HAVE_STRSTR_ARCH13, STRSTR_ARCH13,
STRSTR_Z13_ONLY_USED_AS_FALLBACK, HAVE_STRSTR_IFUNC_AND_ARCH13_SUPPORT):
New defines.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc variant for arch13 strstr.
* sysdeps/s390/strstr-arch13.S: New file.
* sysdeps/s390/strstr-vx.c: Omit GI symbol for z13 strstr ifunc variant
if it is only used as fallback.
* sysdeps/s390/strstr.c (strstr): Add arch13 variant in ifunc selector.

5 years agoS390: Add arch13 memmove ifunc variant.
Stefan Liebler [Fri, 22 Mar 2019 10:14:08 +0000 (11:14 +0100)]
S390: Add arch13 memmove ifunc variant.

This patch introduces the new arch13 ifunc variant for memmove.
For the forward or non-overlapping case it is just using memcpy.
For the backward case it relies on the new instruction mvcrl.
The instruction copies up to 256 bytes at once.
In case of an overlap, it copies the bytes like copying them
one by one starting from right to left.

ChangeLog:

* sysdeps/s390/ifunc-memcpy.h (HAVE_MEMMOVE_ARCH13, MEMMOVE_ARCH13
HAVE_MEMMOVE_IFUNC_AND_ARCH13_SUPPORT): New defines.
* sysdeps/s390/memcpy-z900.S: Add arch13 memmove implementation.
* sysdeps/s390/memmove.c (memmove): Add arch13 variant in
ifunc selector.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc variant for arch13 memmove.
* sysdeps/s390/multiarch/ifunc-resolve.h (S390_STFLE_BITS_ARCH13_MIE3,
S390_IS_ARCH13_MIE3): New defines.

5 years agoS390: Add configure check to detect support for arch13.
Stefan Liebler [Fri, 22 Mar 2019 10:14:08 +0000 (11:14 +0100)]
S390: Add configure check to detect support for arch13.

Add two configure checks which detect if arch13 is supported
by the assembler at all - by explicitely setting the machine -
and if it is supported with default settings.

ChangeLog:

* config.h.in (HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT,
HAVE_S390_ARCH13_ASM_SUPPORT): New undefine.
* sysdeps/s390/configure.ac: Add checks for arch13 support.
* sysdeps/s390/configure: Regenerated.

5 years agoS390: Add new hwcap values for new cpu architecture arch13.
Stefan Liebler [Fri, 22 Mar 2019 10:14:07 +0000 (11:14 +0100)]
S390: Add new hwcap values for new cpu architecture arch13.

The new hwcap values indicate support for:
-"Vector-Enhancements Facility 2" (tag "vxe2", hwcap 2^15)
-"Vector-Packed-Decimal-Enhancement Facility" (tag "vxp", hwcap 2^16)
-"Enhanced-Sort Facility" (tag "sort", hwcap 2^17)
-"Deflate-Conversion Facility" (tag "dflt", hwcap 2^18)

The vxe2 hwcap is also marked as important hwcap.

ChangeLog:

* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags):
Add vxe2, vxp, dflt, sort flags.
* sysdeps/s390/dl-procinfo.h: Add HWCAP_S390_VXRS_EXT2,
HWCAP_S390_VXRS_PDE, HWCAP_S390_SORT, HWCAP_S390_DFLT
capabilities.
(HWCAP_IMPORTANT): Add HWCAP_S390_VXRS_EXT2.
* sysdeps/unix/sysv/linux/s390/bits/hwcap.h
(HWCAP_S390_VXRS_EXT2, HWCAP_S390_VXRS_PDE, HWCAP_S390_SORT,
HWCAP_S390_DFLT): Define.

5 years agoFix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372]
Gabriel F. T. Gomes [Thu, 21 Mar 2019 20:24:30 +0000 (17:24 -0300)]
Fix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372]

When -Werror=parentheses is in use, iconvconfig.c builds fail with:

  iconvconfig.c: In function ‘write_output’:
  iconvconfig.c:1084:34: error: suggest parentheses around ‘+’ inside ‘>>’ [-Werror=parentheses]
     hash_size = next_prime (nnames + nnames >> 1);
                             ~~~~~~~^~~~~~~~

This patch adds parentheses to the expression.  Not where suggested by
the compiler warning, but where it produces the expected result, i.e.:
where it has the effect of multiplying nnames by 1.5.

Likewise for elem_size in ld-collate.c.

Tested for powerpc64le.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoiconv, localedef: avoid floating point rounding differences [BZ #24372]
DJ Delorie [Thu, 21 Mar 2019 03:56:59 +0000 (23:56 -0400)]
iconv, localedef: avoid floating point rounding differences [BZ #24372]

Two cases of "int * 1.4" may result in imprecise results, which
in at least one case resulted in i686 and x86-64 producing
different locale files.  This replaced that floating point multiply
with integer operations.  While the hash table margin is increased
from 40% to 50%, testing shows only 2% increase in overall size
of the locale archive.

https://bugzilla.redhat.com/show_bug.cgi?id=1311954

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoS390: Mark vx and vxe as important hwcap.
Stefan Liebler [Thu, 21 Mar 2019 08:14:26 +0000 (09:14 +0100)]
S390: Mark vx and vxe as important hwcap.

This patch adds vx and vxe as important hwcaps
which allows one to provide shared libraries
tuned for platforms with non-vx/-vxe, vx or vxe.

ChangeLog:

* sysdeps/s390/dl-procinfo.h (HWCAP_IMPORTANT):
Add HWCAP_S390_VX and HWCAP_S390_VXE.

5 years agott_RU: Fix orthographic mistakes in day and abday sections [BZ #24296]
mansayk [Sat, 16 Mar 2019 08:05:22 +0000 (11:05 +0300)]
tt_RU: Fix orthographic mistakes in day and abday sections [BZ #24296]

This commit fixes some errors and converts all weekday names to lowercase.
The content is synchronized with CLDR-34 now, but trailing dots are removed
from abday values in order to maintain consistency with the previous values
and with many other locales which do the same.

[BZ #24296]
* localedata/locales/tt_RU (day): Update from CLDR-34, fix errors.
(abday): Likewise, but remove the trailing dots.

5 years agoAdd AArch64 HWCAPs from Linux 5.0.
Joseph Myers [Tue, 19 Mar 2019 14:02:17 +0000 (14:02 +0000)]
Add AArch64 HWCAPs from Linux 5.0.

This patch adds new AArch64 HWCAPs from Linux 5.0 to the AArch64
bits/hwcap.h and dl-procinfo.c.

Tested (compilation only) with build-many-glibcs.py for
aarch64-linux-gnu.

* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_SB): New
macro.
(HWCAP_PACA): Likewise.
(HWCAP_PACG): Likewise.
* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_DL_HWCAP_COUNT):
Increase to 32.
(_dl_aarch64_cap_flags): Add new entries for new HWCAPs.

5 years ago* time/mktime.c: Update obsolete URL in comment.
Paul Eggert [Sun, 17 Mar 2019 23:26:07 +0000 (16:26 -0700)]
* time/mktime.c: Update obsolete URL in comment.

5 years agoRecord CVE-2019-9169 in NEWS and ChangeLog [BZ #24114]
Aurelien Jarno [Sat, 16 Mar 2019 21:59:56 +0000 (22:59 +0100)]
Record CVE-2019-9169 in NEWS and ChangeLog [BZ #24114]

5 years agohurd: Fix comment style
Samuel Thibault [Sat, 16 Mar 2019 18:44:04 +0000 (19:44 +0100)]
hurd: Fix comment style

5 years agohurd: Document how EINTR should be handled in critical sections
Samuel Thibault [Wed, 17 Aug 2016 12:34:38 +0000 (14:34 +0200)]
hurd: Document how EINTR should be handled in critical sections

* hurd/hurd/signal.h (_hurd_critical_section_lock): Document how EINTR
should be handled.

5 years agoUpdate syscall-names.list for Linux 5.0.
Joseph Myers [Fri, 15 Mar 2019 18:18:40 +0000 (18:18 +0000)]
Update syscall-names.list for Linux 5.0.

This patch updates sysdeps/unix/sysv/linux/syscall-names.list for
Linux 5.0.  Based on testing with build-many-glibcs.py, the only new
entry needed is for old_getpagesize (a newly added __NR_* name for an
old syscall on ia64).  (Because 5.0 changes how syscall tables are
handled in the kernel, checking diffs wasn't a useful way of looking
for new syscalls in 5.0 as most of the syscall tables were moved to
the new representation without actually adding any syscalls to them.)

Tested with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
version to 5.0.
(old_getpagesize): New syscall.

5 years agolocaledata: Add Minguo calendar support to Taiwanese locales [BZ #24293]
Felix Yan [Thu, 7 Mar 2019 09:40:02 +0000 (17:40 +0800)]
localedata: Add Minguo calendar support to Taiwanese locales [BZ #24293]

Minguo calendar is the official calendar system, and very widely used in
Taiwan. This commit adds its support into glibc.

Some background information: The government website (www.gov.tw) uses it,
popular public services like Taiwan HSR also use this calendar system.

Link to Wikipedia: https://en.wikipedia.org/wiki/Minguo_calendar

        [BZ #24293]
        * localedata/locales/zh_TW (era): Add, support Minguo calendar.
        * localedata/locales/cmn_TW (era): Likewise.
        * localedata/locales/hak_TW (era): Likewise.
        * localedata/locales/lzh_TW (era): Likewise.
        * localedata/locales/nan_TW (era): Likewise.

5 years agomalloc: Check for large bin list corruption when inserting unsorted chunk
Adam Maris [Thu, 14 Mar 2019 20:51:16 +0000 (16:51 -0400)]
malloc: Check for large bin list corruption when inserting unsorted chunk

Fixes bug 24216. This patch adds security checks for bk and bk_nextsize pointers
of chunks in large bin when inserting chunk from unsorted bin. It was possible
to write the pointer to victim (newly inserted chunk) to arbitrary memory
locations if bk or bk_nextsize pointers of the next large bin chunk
got corrupted.

5 years agoRemove obsolete, never-implemented XSI STREAMS declarations
Florian Weimer [Thu, 14 Mar 2019 14:44:14 +0000 (15:44 +0100)]
Remove obsolete, never-implemented XSI STREAMS declarations

The stub implementations are turned into compat symbols.

Linux actually has two reserved system call numbers (for getpmsg
and putpmsg), but these system calls have never been implemented,
and there are no plans to implement them, so this patch replaces
the wrappers with the generic stubs.

According to <https://bugzilla.redhat.com/show_bug.cgi?id=436349>,
the presence of the XSI STREAMS declarations is a minor portability
hazard because they are not actually implemented.

This commit does not change the TIRPC support code in
sunrpc/rpc_svcout.c.  It uses additional XTI functionality and
therefore never worked with glibc.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agonss: Fix tst-nss-files-alias-truncated for default --as-needed linking
Florian Weimer [Thu, 14 Mar 2019 14:02:52 +0000 (15:02 +0100)]
nss: Fix tst-nss-files-alias-truncated for default --as-needed linking

Linking to the NSS module directly does not work if the linker defaults
to --as-needed because it will remove the apparently unused DSO
reference and not generate a DT_NEEDED entry.  Use an explicit dlopen
call, like in the other chroot tests involving NSS modules.

5 years agoscripts/check-obsolete-constructs.py: Process all headers as UTF-8.
Zack Weinberg [Thu, 14 Mar 2019 13:44:22 +0000 (09:44 -0400)]
scripts/check-obsolete-constructs.py: Process all headers as UTF-8.

A few of our installed headers contain UTF-8 in comments.
check-obsolete-constructs opened files without explicitly specifying
their encoding, so it would barf on these headers if “make check” was
run in a non-UTF-8 locale.

* scripts/check-obsolete-constructs.py (HeaderChecker.check):
Specify encoding="utf-8" when opening headers to check.

5 years agoUse Linux 5.0 in build-many-glibcs.py.
Joseph Myers [Wed, 13 Mar 2019 22:03:37 +0000 (22:03 +0000)]
Use Linux 5.0 in build-many-glibcs.py.

This patch makes build-many-glibcs.py use Linux 5.0 in place of 4.20
(now that the test change required to avoid false positives with ulong
in kernel headers has been committed).  This includes adjusting the
logic to compute a tarball URL to handle different major version
numbers (rather than changing the path to hardcode v5.x in place of
v4.x, as someone might still wish to check out a v4.x version).

Tested that build-many-glibcs.py successfully checks out Linux 5.0
sources after this patch.

* scripts/build-many-glibcs.py (Context.checkout): Default Linux
version to 5.0.
(Context.checkout_tar): Handle variable major version for Linux
kernel.

5 years agohurd: Add no-op version of __res_enable_icmp [BZ #24047]
Florian Weimer [Wed, 13 Mar 2019 13:58:58 +0000 (14:58 +0100)]
hurd: Add no-op version of __res_enable_icmp [BZ #24047]

Mach does not support IP_RECVERR, so replace this function with a
stub in a sysdeps override for Hurd.

This fixes commit 08504de71813ddbd447bfbca4a325cbe8ce8bcda
("resolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoMove inttypes.h and stdint.h to stdlib.
Zack Weinberg [Mon, 11 Mar 2019 14:59:45 +0000 (10:59 -0400)]
Move inttypes.h and stdint.h to stdlib.

inttypes.h and stdint.h are in sysdeps/generic, but there are no other
versions of these headers anywhere in the source tree, so they aren’t
actually system-dependent.  Move them to the subdirectory that
installs them (stdlib).

Reviewed-by: Joseph Myers <joseph@codesourcery.com>
* sysdeps/generic/inttypes.h, sysdeps/generic/stdint.h:
Move to stdlib.
* include/inttypes.h: Adjust to match.
* include/stdint.h: New wrapper.

5 years agoUse a proper C tokenizer to implement the obsolete typedefs test.
Zack Weinberg [Mon, 11 Mar 2019 14:59:27 +0000 (10:59 -0400)]
Use a proper C tokenizer to implement the obsolete typedefs test.

The test for obsolete typedefs in installed headers was implemented
using grep, and could therefore get false positives on e.g. “ulong”
in a comment.  It was also scanning all of the headers included by
our headers, and therefore testing headers we don’t control, e.g.
Linux kernel headers.

This patch splits the obsolete-typedef test from
scripts/check-installed-headers.sh to a separate program,
scripts/check-obsolete-constructs.py.  Being implemented in Python,
it is feasible to make it tokenize C accurately enough to avoid false
positives on the contents of comments and strings.  It also only
examines $(headers) in each subdirectory--all the headers we install,
but not any external dependencies of those headers.  Headers whose
installed name starts with finclude/ are ignored, on the assumption
that they contain Fortran.

It is also feasible to make the new test understand the difference
between _defining_ the obsolete typedefs and _using_ the obsolete
typedefs, which means posix/{bits,sys}/types.h no longer need to be
exempted.  This uncovered an actual bug in bits/types.h: __quad_t and
__u_quad_t were being used to define __S64_TYPE, __U64_TYPE,
__SQUAD_TYPE and __UQUAD_TYPE.  These are changed to __int64_t and
__uint64_t respectively.  This is a safe change, despite the comments
in bits/types.h claiming a difference between __quad_t and __int64_t,
because those comments are incorrect.  In all current ABIs, both
__quad_t and __int64_t are ‘long’ when ‘long’ is a 64-bit type, and
‘long long’ when ‘long’ is a 32-bit type, and similarly for __u_quad_t
and __uint64_t.  (Changing the types to be what the comments say they
are would be an ABI break, as it affects C++ name mangling.)  This
patch includes a minimal change to make the comments not completely
wrong.

sys/types.h was defining the legacy BSD u_intN_t typedefs using a
construct that was not necessarily consistent with how the C99 uintN_t
typedefs are defined, and is also too complicated for the new script to
understand (it lexes C relatively accurately, but it does not attempt
to expand preprocessor macros, nor does it do any actual parsing).
This patch cuts all of that out and uses bits/types.h's __uintN_t typedefs
to define u_intN_t instead.  This is verified to not change the ABI on
any supported architecture, via the c++-types test, which means u_intN_t
and uintN_t were, in fact, consistent on all supported architectures.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* scripts/check-obsolete-constructs.py: New test script.
* scripts/check-installed-headers.sh: Remove tests for
obsolete typedefs, superseded by check-obsolete-constructs.py.
* Rules: Run scripts/check-obsolete-constructs.py over $(headers)
as a special test.  Update commentary.
* posix/bits/types.h (__SQUAD_TYPE, __S64_TYPE): Define as __int64_t.
(__UQUAD_TYPE, __U64_TYPE): Define as __uint64_t.
Update commentary.
* posix/sys/types.h (__u_intN_t): Remove.
(u_int8_t): Typedef using __uint8_t.
(u_int16_t): Typedef using __uint16_t.
(u_int32_t): Typedef using __uint32_t.
(u_int64_t): Typedef using __uint64_t.

5 years agoFix output of LD_SHOW_AUXV=1.
Stefan Liebler [Wed, 13 Mar 2019 09:45:35 +0000 (10:45 +0100)]
Fix output of LD_SHOW_AUXV=1.

Starting with commit 1616d034b61622836d3a36af53dcfca7624c844e
the output was corrupted on some platforms as _dl_procinfo
was called for every auxv entry and on some architectures like s390
all entries were represented as "AT_HWCAP".

This patch is removing the condition and let _dl_procinfo decide if
an entry is printed in a platform specific or generic way.
This patch also adjusts all _dl_procinfo implementations which assumed
that they are only called for AT_HWCAP or AT_HWCAP2. They are now just
returning a non-zero-value for entries which are not handled platform
specifc.

ChangeLog:

* elf/dl-sysdep.c (_dl_show_auxv): Remove condition and always
call _dl_procinfo.
* sysdeps/unix/sysv/linux/s390/dl-procinfo.h (_dl_procinfo):
Ignore types other than AT_HWCAP.
* sysdeps/sparc/dl-procinfo.h (_dl_procinfo): Likewise.
* sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_procinfo):
Likewise.
* sysdeps/powerpc/dl-procinfo.h (_dl_procinfo): Adjust comment
in the case of falling back to generic output mechanism.
* sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_dl_procinfo):
Likewise.

5 years agoelf: Add DF_1_KMOD, DF_1_WEAKFILTER, DF_1_NOCOMMON to <elf.h>
Florian Weimer [Tue, 12 Mar 2019 11:06:01 +0000 (12:06 +0100)]
elf: Add DF_1_KMOD, DF_1_WEAKFILTER, DF_1_NOCOMMON to <elf.h>

These constants (originally from Solaris) were part of the binutils
2.31 release.

5 years agoresolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]
Florian Weimer [Tue, 12 Mar 2019 10:40:47 +0000 (11:40 +0100)]
resolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]

The Linux kernel suppresses some ICMP error messages by default for
UDP sockets.  This commit enables full ICMP error reporting,
hopefully resulting in faster failover to working name servers.

5 years agoC-SKY: add elf header definition for elfutils
Mao Han [Mon, 11 Mar 2019 01:54:34 +0000 (09:54 +0800)]
C-SKY: add elf header definition for elfutils

This patch adds some defines relate to machine flag and section information,
which is used by elfutils elflint check. A C-SKY typo is also fixed with
this patch.

* elf/elf.h (EF_CSKY_ABIMASK, EF_CSKY_OTHER, EF_CSKY_PROCESSOR)
(EF_CSKY_ABIV1, EF_CSKY_ABIV2, SHT_CSKY_ATTRIBUTES): New defines.

5 years agoC-SKY: mark lr as undefined to stop unwinding
Mao Han [Mon, 11 Mar 2019 01:51:14 +0000 (09:51 +0800)]
C-SKY: mark lr as undefined to stop unwinding

Mark the lr register as undefined at the start of execution, so unwind
will stop at this frame. run-backtrace-*.sh from elfutils testsuite will
fail without this patch.

* sysdeps/csky/abiv2/start.S: Mark lr as undefined.
* sysdeps/unix/sysv/linux/csky/abiv2/clone.S: Likewise.
* sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise.

5 years agoC-SKY: remove user_regs definition
Mao Han [Mon, 11 Mar 2019 01:48:51 +0000 (09:48 +0800)]
C-SKY: remove user_regs definition

C-SKY GDB dose not use this file for ptrace and coredump.  ptrace can use
pt_regs definition from linux kernel directly.  The old definition only
got 34 regs instead of 38 regs from linux kernel, which will corrupted
the memory after ptrace PTRACE_GETREGSET call.

* sysdeps/unix/sysv/linux/csky/sys/procfs.h: Use linux definition
directly.
* sysdeps/unix/sysv/linux/csky/sys/user.h: Remove user_regs
definition.

5 years agoC-SKY: fix sigcontext miss match
Mao Han [Mon, 11 Mar 2019 01:45:15 +0000 (09:45 +0800)]
C-SKY: fix sigcontext miss match

C-SKY defines SIGCONTEXT as siginfo_t *_si, struct ucontext_t * for
__profil_counter.  ucontext_t get an extra __mask field which is miss
match with the struct sigcontext from linux kernel.  The time value
from gprof report will be always zero without this patch.  This
patch also fix the registers sequence in register-dump.h.

* sysdeps/unix/sysv/linux/csky/register-dump.h: Adjust offset change.
* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Remove __mask field
in mcontext_t

5 years agoBug 24307: Update to Unicode 12.0.0
Mike FABIAN [Wed, 6 Mar 2019 09:39:26 +0000 (10:39 +0100)]
Bug 24307: Update to Unicode 12.0.0

Unicode 12.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 12.0.0, using
the generator scripts contributed by Mike FABIAN (Red Hat).

Some info about the number of characters added or changed:

Total added characters in newly generated CHARMAP: 554
Total added characters in newly generated WIDTH: 106
alpha: Missing 8 characters of old ctype in new ctype
       (These are combining marks, apparently they were removed from alpha
       on purpose)
alpha: Added 295 characters in new ctype which were not in old ctype
combining: Missing 2 characters of old ctype in new ctype
       (U+1CF2 VEDIC SIGN ARDHAVISARGA and U+1CF3 VEDIC SIGN ROTATED ARDHAVISARGA,
       these are now "Alphabetic" in Unicode 12.0.0)
combining: Added 37 characters in new ctype which were not in old ctype
combining_level3: Missing 2 characters of old ctype in new ctype
       (U+1CF2 VEDIC SIGN ARDHAVISARGA and U+1CF3 VEDIC SIGN ROTATED ARDHAVISARGA,
       these are now "Alphabetic" in Unicode 12.0.0)
combining_level3: Added 26 characters in new ctype which were not in old ctype
graph: Added 554 characters in new ctype which were not in old ctype
lower: Added 6 characters in new ctype which were not in old ctype
print: Added 554 characters in new ctype which were not in old ctype
punct: Missing 29 characters of old ctype in new ctype
       (These characters have all  become "Alphabetic" in Unicode 12.0.0.
       Therefore, they are not in "punct" anymore (see: is_punct() in unicode_utils.py))
punct: Added 296 characters in new ctype which were not in old ctype
tolower: Added 7 characters in new ctype which were not in old ctype
totitle: Added 7 characters in new ctype which were not in old ctype
toupper: Added 7 characters in new ctype which were not in old ctype
upper: Added 7 characters in new ctype which were not in old ctype

[BZ #24307]
* localedata/unicode-gen/Makefile (UNICODE_VERSION): Set to 12.0.0.
* localedata/unicode-gen/DerivedCoreProperties.txt: Update to Unicode 12.0.0.
* localedata/unicode-gen/EastAsianWidth.txt: Likewise.
* localedata/unicode-gen/PropList.txt: Likewise.
* localedata/unicode-gen/UnicodeData.txt: Likewise.
* localedata/unicode-gen/ctype_compatibility_test_cases.py: U+108D became
        "Alphabetic" in Unicode 12.0.0. Adapt test case.
* localedata/charmaps/UTF-8: Regenerate.
* localedata/locales/i18n_ctype: Likewise.
* localedata/locales/tr_TR: Likewise.
* localedata/locales/translit_circle: Likewise.
* localedata/locales/translit_cjk_compat: Likewise.
* localedata/locales/translit_combining: Likewise.
* localedata/locales/translit_compat: Likewise.
* localedata/locales/translit_font: Likewise.
* localedata/locales/translit_fraction: Likewise.

5 years agoBreak lines before not after operators, batch 4.
Joseph Myers [Thu, 7 Mar 2019 20:20:25 +0000 (20:20 +0000)]
Break lines before not after operators, batch 4.

This patch fixes further coding style issues where code should have
broken lines before operators in accordance with the GNU Coding
Standards but instead was breaking lines after them.

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

* stdio-common/vfscanf-internal.c (ARG): Break lines before rather
than after operators.
* sysdeps/mach/hurd/setitimer.c (timer_thread): Likewise.
(setitimer_locked): Likewise.
* sysdeps/mach/hurd/sigaction.c (__sigaction): Likewise.
* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
* sysdeps/mach/pagecopy.h (PAGE_COPY_FWD): Likewise.
* sysdeps/mach/thread_state.h (machine_get_basic_state): Likewise.
* sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
(PPC_CPU_SUPPORTED): Likewise.
* sysdeps/unix/sysv/linux/alpha/a.out.h (N_TXTOFF): Likewise.
* sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
(stat_overflow): Likewise.
(statfs_overflow): Likewise.
* sysdeps/unix/sysv/linux/tst-personality.c (do_test): Likewise.
* sysdeps/unix/sysv/linux/tst-ttyname.c (eq_ttyname): Likewise.
(eq_ttyname_r): Likewise.
(run_chroot_tests): Likewise.

5 years agocheck-wrapper-headers test: Adjust Fortran include file directory
Florian Weimer [Thu, 7 Mar 2019 16:28:13 +0000 (17:28 +0100)]
check-wrapper-headers test: Adjust Fortran include file directory

The check for "/finclude/" fails with the actual location of
Fortran headers because they are now stored in the "finclude"
subdirectory of the top-level include directory, so a relative path
does not contain a slash '/' before the "finclude" string.

5 years agoFix location where math-vector-fortran.h is installed.
marxin [Thu, 7 Mar 2019 08:39:55 +0000 (09:39 +0100)]
Fix location where math-vector-fortran.h is installed.

2019-03-07  Martin Liska  <mliska@suse.cz>

* math/Makefile: Change location where math-vector-fortran.h is
installed.
* math/finclude/math-vector-fortran.h: Move from bits/math-vector-fortran.h.
* sysdeps/x86/fpu/finclude/math-vector-fortran.h: Move
from sysdeps/x86/fpu/bits/math-vector-fortran.h.
* scripts/check-installed-headers.sh: Skip Fortran header files.
* scripts/check-wrapper-headers.py: Likewise.

5 years agonptl: Assume __ASSUME_FUTEX_CLOCK_REALTIME support
Adhemerval Zanella [Thu, 28 Feb 2019 14:33:22 +0000 (11:33 -0300)]
nptl: Assume __ASSUME_FUTEX_CLOCK_REALTIME support

This patch assumes realtime clock support for nptl and thus removes
all the associated code.

For __pthread_mutex_timedlock the fallback usage for the case where
lll_futex_timed_wait_bitset it not set define is also removed. The
generic lowlevellock-futex.h always define it, so for NPTL code the
check always yield true.

Checked on x86_64-linux-gnu and i686-linux-gnu.

* nptl/nptl-init.c (__have_futex_clock_realtime,
__have_futex_clock_realtime): Remove definition.
(__pthread_initialize_minimal_internal): Remove FUTEX_CLOCK_REALTIME
check test for !__ASSUME_FUTEX_CLOCK_REALTIME.
* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Assume
__ASSUME_FUTEX_CLOCK_REALTIME support.
* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_FUTEX_CLOCK_REALTIME): Remove.
* sysdeps/nptl/lowlevellock-futex.h (lll_futex_timed_wait_bitset):
Adjust comment.

5 years agopowerpc: Fix build of wcscpy with --disable-multi-arch
Gabriel F. T. Gomes [Sat, 2 Mar 2019 19:57:13 +0000 (16:57 -0300)]
powerpc: Fix build of wcscpy with --disable-multi-arch

Since the commit

commit 81a14439417552324ec6ca71f65ddf8e7cdd51c7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 17:35:12 2019 -0200

    wcsmbs: optimize wcscat

powerpc64 and powerpc64le builds fail when configured with
--disable-multi-arch and --with-cpu=power6 (or newer), due to an
undefined reference to __GI___wcscpy.  This patch fixes this on
sysdeps/powerpc/powerpc64/power6/wcscpy.c, which is only used when
multi-arch is disabled.

This patch does nothing for the failures on 32-bits powerpc builds,
because the file is under the powerpc64 subdirectory, however, powerpc
builds were already failing with --disable-multi-arch, with multiple
error messages, even before the aforementioned commit.

Tested for powerpc, powerpc64, and powerpc64le with multi-arch enabled
(all pass) and disabled (powerpc still fails as explained above).

5 years agoelf: Remove remnants of MAP_ANON emulation
Florian Weimer [Mon, 4 Mar 2019 16:54:14 +0000 (17:54 +0100)]
elf: Remove remnants of MAP_ANON emulation

Most of the code was removed in commit
20739e5454c12acbc0479387fe795c5b19a4166f ("* elf/dl-load.c:
Remove support for systems without MAP_ANON.").

5 years agoS390: Increase function alignment to 16 bytes.
Stefan Liebler [Mon, 4 Mar 2019 09:48:42 +0000 (10:48 +0100)]
S390: Increase function alignment to 16 bytes.

Set the default function alignment to 16 bytes in order to
get rid of some unwanted performance effects.

Please see also GCC commit "S/390: Set default function
alignment to 16." (Subversion revision 262817)

ChangeLog:

* sysdeps/s390/s390-64/sysdep.h(ENTRY): Use alignment of 16byte.
* sysdeps/s390/s390-32/sysdep.h: Likewise.

5 years agoja_JP: Change the offset for Taisho gan-nen from 2 to 1 [BZ #24162]
TAMUKI Shoichi [Sat, 2 Mar 2019 12:00:28 +0000 (21:00 +0900)]
ja_JP: Change the offset for Taisho gan-nen from 2 to 1 [BZ #24162]

The offset in era-string format for Taisho gan-nen (1912) is currently
defined as 2, but it should be 1.  So fix it.  "Gan-nen" means the 1st
(origin) year, Taisho started on July 30, 1912.

Reported-by: Morimitsu, Junji <junji.morimitsu@hpe.com>
Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>
ChangeLog:

[BZ #24162]
* localedata/locales/ja_JP (LC_TIME): Change the offset for Taisho
gan-nen from 2 to 1.  Problem reported by Morimitsu, Junji.

5 years agoldbl-opt: Reuse test cases from misc/ that check long double
Gabriel F. T. Gomes [Tue, 7 Aug 2018 21:06:58 +0000 (18:06 -0300)]
ldbl-opt: Reuse test cases from misc/ that check long double

This patch adds test cases for the compatibility versions of the
functions: err, errx, verr, verrx, warn, warnx, vwarn, vwarnx (from
err.h), error, and error_at_line (from error.h), when long double has
the same format as double (-mlong-double-64).

Tested for powerpc, powerpc64 and powerpc64le.

5 years agoldbl-opt: Add error and error_at_line (bug 23984)
Gabriel F. T. Gomes [Wed, 8 Aug 2018 20:26:22 +0000 (17:26 -0300)]
ldbl-opt: Add error and error_at_line (bug 23984)

On platforms where long double may have the same format as double
(-mlong-double-64), error and error_at_line do not take that into
account and might produce wrong output if a long double conversion is
requested by the format string ('%Lf').  This patch adds compatibility
functions for this situation and redirects calls via header magic.

Tested for powerpc, powerpc64 and powerpc64le.

5 years agoldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)
Gabriel F. T. Gomes [Wed, 8 Aug 2018 12:58:36 +0000 (09:58 -0300)]
ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)

When support for long double format with 128-bits (-mlong-double-128)
was added for platforms where long double had the same format as double,
such as powerpc, compatibility versions for the functions listed in the
commit title were missed.  Since the older format of long double can
still be used (with -mlong-double-64), using these functions with a
format string that requests the printing of long double variables will
produce wrong outputs.

This patch adds the missing compatibility functions and header magic to
redirect calls to them when -mlong-double-64 is in use.

Tested for powerpc, powerpc64 and powerpc64le.

5 years agoldbl-opt: Reuse argp tests that print long double
Gabriel F. T. Gomes [Tue, 3 Jul 2018 13:43:13 +0000 (10:43 -0300)]
ldbl-opt: Reuse argp tests that print long double

The test case tst-ldbl-argp checks that the conversion specifier '%Lf'
correctly prints long double values with the default long double format
for a platform.  This patch reuses the test case for long double with
the same format as double (-mlong-double-64).

Tested for powerpc, powerpc64 and powerpc64le.

5 years agoldbl-opt: Add argp_error and argp_failure (bug 23983)
Gabriel F. T. Gomes [Wed, 4 Jul 2018 14:54:11 +0000 (11:54 -0300)]
ldbl-opt: Add argp_error and argp_failure (bug 23983)

The functions argp_error and argp_failure are missing support for
printing long double values when long double has the same format as
double.  This patch adds the new functions __nldbl_argp_error and
__nldbl_argp_failure, as well as header magic to redirect calls to them
when -mlong-double-64 is in use.

Tested for powerpc, powerpc64 and powerpc64le.

5 years agoelf/tst-big-note: Improve accuracy of test [BZ #20419]
Florian Weimer [Fri, 1 Mar 2019 17:53:03 +0000 (18:53 +0100)]
elf/tst-big-note: Improve accuracy of test [BZ #20419]

It is possible that the link editor injects an allocated ABI tag note
before the artificial, allocated large note in the test.  Note parsing
in open_verify stops when the first ABI tag note is encountered, so if
the ABI tag note comes first, the problematic code is not actually
exercised.

Also tweak the artificial note so that it is a syntactically valid
4-byte aligned note, in case the link editor tries to parse notes and
process them.

Improves the testing part of commit 0065aaaaae51cd60210ec3a7e13.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoS390: Fix introduction of __wcscpy and weak wcscpy symbols.
Stefan Liebler [Fri, 1 Mar 2019 15:30:30 +0000 (16:30 +0100)]
S390: Fix introduction of __wcscpy and weak wcscpy symbols.

The recent commit 81a14439417552324ec6ca71f65ddf8e7cdd51c7
has introduced __wcscpy, __GI___wcscpy and the weak alias wcscpy.
This patch also introduces those symbols if glibc is build
with CFLAGS="-march=z13" where the ifunc is omitted.

ChangeLog:

* sysdeps/s390/wcscpy-vx.S: Add strong aliases to
__wcscpy, __GI___wcscpy and weak alias to wcscpy.

5 years ago__netlink_assert_response: Add more __libc_fatal newlines [BZ #20271]
Florian Weimer [Fri, 1 Mar 2019 11:21:20 +0000 (12:21 +0100)]
__netlink_assert_response: Add more __libc_fatal newlines [BZ #20271]

Commit a6e8926f8d49a213a9abb1a61f6af964f612ab7f ("[BZ #20271] Add
newlines in __libc_fatal calls.") missed two places that need
changing.

5 years agoAdd more spaces before '('.
Joseph Myers [Thu, 28 Feb 2019 15:02:09 +0000 (15:02 +0000)]
Add more spaces before '('.

This patch fixes more places where a space should have been present
before '(' in accordance with the GNU Coding Standards (as with the
previous patch, mainly for calls to sizeof).

Tested with build-many-glibcs.py.

* sysdeps/powerpc/powerpc32/dl-machine.c
(__elf_machine_fixup_plt): Use space before '('.
(__process_machine_rela): Likewise.
* sysdeps/powerpc/powerpc32/register-dump.h (register_dump):
Likewise.
* sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h (TI_BITS):
Likewise.
* sysdeps/powerpc/powerpc64/register-dump.h (register_dump):
Likewise.
* sysdeps/powerpc/test-arith.c (union_t): Likewise.
(pattern): Likewise.
(delta): Likewise.
(check_result): Likewise.
(check_excepts): Likewise.
(check_op): Likewise.
(fail_xr): Likewise.
* sysdeps/unix/alpha/sysdep.h (syscall_promote): Likewise.
* sysdeps/unix/sysv/linux/alpha/a.out.h (AOUTHSZ): Likewise.
(SCNHSZ): Likewise.
* sysdeps/unix/sysv/linux/hppa/makecontext.c (FRAME_SIZE_BYTES):
Likewise.
(ARGS): Likewise.
(__makecontext): Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (ucontext_t):
Likewise.

5 years agoelf: Add tests with a local IFUNC resolver [BZ #23937]
Florian Weimer [Thu, 28 Feb 2019 10:52:44 +0000 (11:52 +0100)]
elf: Add tests with a local IFUNC resolver [BZ #23937]

The existing tests all use global symbols (but with different
visibility).  Local symbols could be treated differently by the
compiler and linker (as was the case on POWER ELFv2, causing
bug 23937), and we did not have test coverage for this.

Tested on x86-64 and POWER ELFv2 little-endian, with and without
--disable-multi-arch.  On POWER, the test cases elf/ifuncmain9,
elf/ifuncmain9pic, elf/ifuncmain9pie reproduce bug 23937 with older
binutils.

5 years agoelf/Makefile: Run IFUNC tests if binutils supports IFUNC
H.J. Lu [Wed, 27 Feb 2019 21:21:46 +0000 (13:21 -0800)]
elf/Makefile: Run IFUNC tests if binutils supports IFUNC

We should run IFUNC tests with --disable-multi-arch if the toolchain
supports IFUNCs.  For correctness, --disable-multi-arch must not
remove IFUNC support from the loader.

Tested on x86-64, x32 and i686 with and without --disable-multi-arch.

* configure.ac (have-ifunc): New LIBC_CONFIG_VAR.
* configure: Regenerated.
* elf/Makefile: Run IFUNC tests if binutils supports IFUNC.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agopowerpc: Fix linknamespace introduced by 4d8015639a75
Adhemerval Zanella [Wed, 27 Feb 2019 18:56:58 +0000 (15:56 -0300)]
powerpc: Fix linknamespace introduced by 4d8015639a75

This patch fixes the linknamespace issues add on wcscpy refactor
for powerpc-linux-gnu-power4 as shown by the tests:

FAIL: conform/POSIX/fnmatch.h/linknamespace
FAIL: conform/POSIX/glob.h/linknamespace
FAIL: conform/POSIX/wordexp.h/linknamespace
FAIL: conform/XPG4/fnmatch.h/linknamespace
FAIL: conform/XPG4/glob.h/linknamespace
FAIL: conform/XPG4/wordexp.h/linknamespace
FAIL: conform/XPG42/fnmatch.h/linknamespace
FAIL: conform/XPG42/glob.h/linknamespace
FAIL: conform/XPG42/wordexp.h/linknamespace

[initial] wordexp -> [libc.a(wordexp.o)] fnmatch -> [libc.a(fnmatch.o)] __wcscat -> [libc.a(wcscat.o)] __wcscpy -> [libc.a(wcscpy.o)] wcscpy

Checked on powerpc-linux-gnu-power4.

* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c: Define ifunc
symbol as __wcspcy instead of wcscpy.

5 years agohurd: Add renameat2 support for RENAME_NOREPLACE
Samuel Thibault [Wed, 27 Feb 2019 15:53:13 +0000 (07:53 -0800)]
hurd: Add renameat2 support for RENAME_NOREPLACE

* include/stdio.h (__renameat2): New hidden prototype.
* stdio-common/renameat2.c (__renameat2): Add hidden definition.
* sysdeps/mach/hurd/renameat.c (__renameat): Move implementation to...
* sysdeps/mach/hurd/renameat2.c (__renameat2): ... new function, and
add support for RENAME_NOREPLACE.
* sysdeps/unix/sysv/linux/renameat2.c (__renameat2): Add hidden definition.

5 years agoFix -Wempty-body warnings in Hurd-specific code.
Joseph Myers [Wed, 27 Feb 2019 13:58:56 +0000 (13:58 +0000)]
Fix -Wempty-body warnings in Hurd-specific code.

This patch fixes -Wempty-body warnings in Hurd-specific code that show
up building glibc with -Wextra.

Note: there also such warnings on many platforms arising from the
default definition of HP_TIMING_NOW in sysdeps/generic/hp-timing.h,
but no change there is proposed in this patch because of other changes
under discussion in that area that would result in a nonempty
definition.

Tested with build-many-glibcs.py.

* hurd/hurdinit.c (_hurd_init): Use braces around empty body of an
if statement.

5 years agoAdd some spaces before '('.
Joseph Myers [Wed, 27 Feb 2019 13:55:45 +0000 (13:55 +0000)]
Add some spaces before '('.

This patch fixes various places where a space should have been present
before '(' in accordance with the GNU Coding Standards.  Most but not
all of the fixes in this patch are for calls to sizeof (but it's not
exhaustive regarding such calls that should be fixed).

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

* benchtests/bench-strcpy.c (do_test): Use space before '('.
* benchtests/bench-string.h (cmdline_process_function): Likewise.
* benchtests/bench-strlen.c (do_test): Likewise.
(test_main): Likewise.
* catgets/gencat.c (read_old): Likewise.
* elf/cache.c (load_aux_cache): Likewise.
* iconvdata/bug-iconv8.c (do_test): Likewise.
* math/test-tgmath-ret.c (do_test): Likewise.
* nis/nis_call.c (rec_dirsearch): Likewise.
* nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
* nptl/tst-audit-threads.c (do_test): Likewise.
* nptl/tst-cancel4-common.h (set_socket_buffer): Likewise.
* nss/nss_test1.c (init): Likewise.
* nss/test-netdb.c (test_hosts): Likewise.
* posix/execvpe.c (maybe_script_execute): Likewise.
* stdio-common/tst-fmemopen4.c (do_test): Likewise.
* stdio-common/tst-printf.c (do_test): Likewise.
* stdio-common/vfscanf-internal.c (__vfscanf_internal): Likewise.
* stdlib/fmtmsg.c (NKEYWORDS): Likewise.
* stdlib/qsort.c (STACK_SIZE): Likewise.
* stdlib/test-canon.c (do_test): Likewise.
* stdlib/tst-swapcontext1.c (do_test): Likewise.
* string/memcmp.c (OPSIZ): Likewise.
* string/test-strcpy.c (do_test): Likewise.
(do_random_tests): Likewise.
* string/test-strlen.c (do_test): Likewise.
(test_main): Likewise.
* string/test-strrchr.c (do_test): Likewise.
(do_random_tests): Likewise.
* string/tester.c (test_memrchr): Likewise.
(test_memchr): Likewise.
* sysdeps/generic/memcopy.h (OPSIZ): Likewise.
* sysdeps/generic/unwind-dw2.c (execute_stack_op): Likewise.
* sysdeps/generic/unwind-pe.h (read_sleb128): Likewise.
(read_encoded_value_with_base): Likewise.
* sysdeps/hppa/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/hppa/fpu/feupdateenv.c (__feupdateenv): Likewise.
* sysdeps/ia64/fpu/sfp-machine.h (TI_BITS): Likewise.
* sysdeps/mach/hurd/spawni.c (__spawni): Likewise.
* sysdeps/posix/spawni.c (maybe_script_execute): Likewise.
* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (query_auxv):
Likewise.
* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h (ELF_NGREG):
Likewise.
* sysdeps/unix/sysv/linux/arm/bits/procfs.h (ELF_NGREG): Likewise.
* sysdeps/unix/sysv/linux/arm/ioperm.c (init_iosys): Likewise.
* sysdeps/unix/sysv/linux/csky/bits/procfs.h (ELF_NGREG):
Likewise.
* sysdeps/unix/sysv/linux/m68k/bits/procfs.h (ELF_NGREG):
Likewise.
* sysdeps/unix/sysv/linux/nios2/bits/procfs.h (ELF_NGREG):
Likewise.
* sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute):
Likewise.
* sysdeps/unix/sysv/linux/x86/bits/procfs.h (ELF_NGREG): Likewise.
* sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
(FP_XSTATE_MAGIC2_SIZE): Likewise.
* sysdeps/x86/fpu/sfp-machine.h (TI_BITS): Likewise.
* time/test_time.c (main): Likewise.

5 years agowcsmbs: optimize wcsnlen
Adhemerval Zanella [Tue, 5 Feb 2019 20:55:59 +0000 (18:55 -0200)]
wcsmbs: optimize wcsnlen

This patch rewrites wcsnlen using wmemchr.  The generic wmemchr
already uses the strategy (loop unrolling and tail handling) and
by using it it allows architectures that have optimized wmemchr
(s390 and x86_64) to optimize wcsnlen as well.

Checked on x86_64-linux-gnu.

* wcsmbs/wcsnlen.c (__wcsnlen): Rewrite using wmemchr.

5 years agowcsmbs: optimize wcsncpy
Adhemerval Zanella [Tue, 5 Feb 2019 20:48:31 +0000 (18:48 -0200)]
wcsmbs: optimize wcsncpy

This patch rewrites wcsncpy using wcsnlen, wmemset, and wmemcpy.  This is
similar to the optimization done on strncpy by f6482cf29d and 6423d4754c.

Checked on x86_64-linux-gnu.

* wcsmbs/wcsncpy.c (__wcsncpy): Rewrite using wcsnlen, wmemset, and
wmemcpy.

5 years agowcsmbs: optimize wcsncat
Adhemerval Zanella [Tue, 5 Feb 2019 20:43:18 +0000 (18:43 -0200)]
wcsmbs: optimize wcsncat

This patch rewrites wcsncat using wcslen, wcsnlen, and wmemcpy.  This is
similar to the optimization done on strncat by 3eb38795db and e80514b5a8.

Checked on x86_64-linux-gnu.

* wcsmbs/wcsncat.c (wcsncat): Rewrite using wcslen, wcsnlen, and
wmemcpy.