platform/upstream/glibc.git
6 years agoLIBC_SLIBDIR_RTLDDIR: substitute arguments in single quotes
Andreas Schwab [Thu, 25 Jan 2018 09:41:27 +0000 (10:41 +0100)]
LIBC_SLIBDIR_RTLDDIR: substitute arguments in single quotes

The arguments of the LIBC_SLIBDIR_RTLDDIR macro are used both in unquoted
and single quoted context, so that neither shell nor makefile variable
references work.  Consistently put them in single quotes so that they can
refer to makefile variables.

6 years agouk_UA: Add alternative month names (bug 10871).
Rafal Luzynski [Tue, 5 Jan 2016 02:06:25 +0000 (03:06 +0100)]
uk_UA: Add alternative month names (bug 10871).

Primary month names are in a genitive case now, alternative month names
are in a nominative case.

The alternative digits hack is no longer needed and has been removed.

[BZ #10871]
* localedata/locales/uk_UA (mon): Renamed to...
(alt_mon): This.
(alt_digits): "0" removed and then renamed to...
(mon): This.
(date_fmt): Definition changed not to use the alternative
digits hack.

6 years agobuild-many-glibcs.py: Fix hurd-vcs checkout
Samuel Thibault [Thu, 25 Jan 2018 02:14:22 +0000 (03:14 +0100)]
build-many-glibcs.py: Fix hurd-vcs checkout

* scripts/build-many-glibcs.py (checkout_vcs): Run autoconf.

6 years agobuild-many-glibcs.py: Add hurd vcs support
Samuel Thibault [Thu, 25 Jan 2018 02:01:59 +0000 (03:01 +0100)]
build-many-glibcs.py: Add hurd vcs support

* scripts/build-many-glibcs.py (checkout_vcs): Add hurd repository URL.

6 years agoAdd soft-float ColdFire to build-many-glibcs.py.
Joseph Myers [Wed, 24 Jan 2018 23:48:52 +0000 (23:48 +0000)]
Add soft-float ColdFire to build-many-glibcs.py.

Since it turns out soft-float ColdFire has a different glibc ABI to
hard-float ColdFire, as well as various differences in which glibc
code gets built, this patch adds such a configuration to
build-many-glibcs.py to (hopefully) complete the set of ABIs being
tested.  (Note that the build for soft-float ColdFire is currently
broken even with GCC mainline - I have a glibc patch to fix this, but
it needs before-and-after build-many-glibcs.py comparison of stripped
binaries for all configurations before being committed.)

* scripts/build-many-glibcs.py (Context.add_all_configs): Add
soft-float ColdFire configuration.

6 years agoAdd localplt.data for ColdFire.
Joseph Myers [Wed, 24 Jan 2018 23:43:33 +0000 (23:43 +0000)]
Add localplt.data for ColdFire.

The sole failure for ColdFire in the compilation part of the glibc
testsuite is the localplt test.  This patch adds a localplt baseline
for ColdFire to eliminate that failure.  The difference from the
existing m68k baseline is that no PLT entry for _Unwind_Find_FDE is
expected, because ColdFire does not set
libc_cv_gcc_unwind_find_fde=yes.

Tested with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/m68k/localplt.data: Move to ....
* sysdeps/unix/sysv/linux/m68k/m680x0/localplt.data: ... here.
* sysdeps/unix/sysv/linux/m68k/coldfire/localplt.data: New file.

6 years agoAdd no-FPU ColdFire math_private.h.
Joseph Myers [Wed, 24 Jan 2018 23:33:03 +0000 (23:33 +0000)]
Add no-FPU ColdFire math_private.h.

As with some other soft-float configurations, no-FPU ColdFire needs
various fenv.h functions and glibc-internal macros overridden in
math_private.h to avoid references to undefined FE_* macros when
building glibc.  This patch adds a suitable math_private.h, based on
the MicroBlaze one (Nios II and Tile also have similar files).

There's a case for having such a file in sysdeps/ieee754/soft-fp so
this logic is applied more generally to configurations without
exceptions and rounding modes, even when the relevant macros are
defined in fenv.h - the only case where that might be inappropriate is
ARM soft-float (where the fenv.h functions might or might not work at
runtime, depending on whether the processor used at runtime supports
VFP).  There's also a case that soft-float configurations (on
processors with both hard-float and soft-float) should more
consistently avoid defining FE_* macros in bits/fenv.h when not
actually supported.  But both of those are separate potential
cleanups.

This allows the no-FPU ColdFire build to get further (another fix is
needed to allow the build to complete).

* sysdeps/m68k/coldfire/nofpu/math_private.h: New file.  Based on
MicroBlaze file.

6 years agoAdd jmp_buf-macros.h for no-FPU ColdFire.
Joseph Myers [Wed, 24 Jan 2018 23:22:28 +0000 (23:22 +0000)]
Add jmp_buf-macros.h for no-FPU ColdFire.

Continuing the fixes for ColdFire glibc build with
build-many-glibcs.py, given a GCC patch for the libgcc build failure,
this patch adds jmp_buf-macros.h for no-FPU ColdFire.  This allows the
no-FPU build to progress further than without the patch (although
other fixes are still needed for the build to complete).

* sysdeps/unix/sysv/linux/m68k/coldfire/jmp_buf-macros.h: Move to
....
* sysdeps/unix/sysv/linux/m68k/coldfire/fpu/jmp_buf-macros.h:
... here.
* sysdeps/unix/sysv/linux/m68k/coldfire/nofpu/jmp_buf-macros.h:
New file.

6 years agoAdd jmp_buf-macros.h for ColdFire.
Joseph Myers [Wed, 24 Jan 2018 22:26:24 +0000 (22:26 +0000)]
Add jmp_buf-macros.h for ColdFire.

This patch adds a jmp_buf-macros.h for ColdFire.  In conjunction with
a GCC patch to fix the libgcc build failure for ColdFire
<https://gcc.gnu.org/ml/gcc-patches/2018-01/msg02064.html> this
suffices to restore the build (tested with build-many-glibcs.py).  A
further patch will be needed for soft-float ColdFire (while the
function-calling ABI is the same for hard-float and soft-float
ColdFire, it turns out the glibc ABI is not - so another ColdFire
variant will be needed in build-many-glibcs.py), but I'll deal with
that separately.

Tested with build-many-glibcs.py (m68k-linux-gnu and
m68k-linux-gnu-coldfire).  (There's a localplt test failure for
coldfire; that's the only failure in the compilation part of the
testsuite.)

* sysdeps/unix/sysv/linux/m68k/jmp_buf-macros.h: Move to ....
* sysdeps/unix/sysv/linux/m68k/m680x0/jmp_buf-macros.h: ... here.
* sysdeps/unix/sysv/linux/m68k/coldfire/jmp_buf-macros.h: New
file.

6 years agoaarch64: Revert the change of the __reserved member of mcontext_t
Szabolcs Nagy [Mon, 22 Jan 2018 11:13:31 +0000 (11:13 +0000)]
aarch64: Revert the change of the __reserved member of mcontext_t

The uc_mcontext.__reserved member of ucontext_t is a user visible API,
that should not be changed, because this is the only way to access cpu
states of various extensions of linux asm/sigcontext.h, it does not
violate namespace rules either, so revert this part of the commit

commit 4fa9b3bfe6759c82beb4b043a54a3598ca467289
Commit:     Joseph Myers <joseph@codesourcery.com>

    Fix mcontext_t sigcontext namespace (bug 21457).

(In principle the user can type cast &uc_mcontext to struct sigcontext*
to use the linux sigcontext fields, but that's not the existing practice
since mcontext_t used to be a typedef of struct sigcontext.)

[BZ #22742]
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (__glibc_reserved1):
Rename to __reserved and add comment.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (__glibc_reserved1):
Rename to __reserved.

6 years agoAdd build-many-glibcs.py support for Hurd.
Joseph Myers [Wed, 24 Jan 2018 01:18:54 +0000 (01:18 +0000)]
Add build-many-glibcs.py support for Hurd.

This patch adds build-many-glibcs.py support for GNU Hurd.  Builds of
the i686-gnu configuration will fail until sufficient support is
merged to master, so completing build-many-glibcs.py coverage of all
glibc ABIs and making results accurately reflect the broken state of
builds for Hurd.

* scripts/build-many-glibcs.py (Context.add_all_configs): Add
i686-gnu configurations.
(Context.run_builds): Include mig, gnumach and hurd in components
considered.
(Context.checkout): Add mig, gnumach and hurd to components.
(Context.checkout_tar): Add URL mappings for mig, gnumach and
hurd.
(Context.bot_cycle): Check for changes to mig, gnumach and hurd.
(Config.build): Install gnumach headers, build mig and install
hurd headers for 'gnu' OS.
(Config.install_gnumach_headers): New function.
(Config.install_hurd_headers): Likewise.
(Glibc.build_glibc): Do not use /usr for 'gnu' OS.  Specifiy MIG
when building for 'gnu' OS.

6 years agoNEWS: Fix spelling mistake: "%ob" -> "%Ob".
Rafal Luzynski [Tue, 23 Jan 2018 21:52:39 +0000 (22:52 +0100)]
NEWS: Fix spelling mistake: "%ob" -> "%Ob".

6 years agoNEWS: fix spelling mistake
Dmitry V. Levin [Tue, 23 Jan 2018 20:31:13 +0000 (20:31 +0000)]
NEWS: fix spelling mistake

6 years agoNEWS: Fix spelling mistake.
Carlos O'Donell [Tue, 23 Jan 2018 20:22:51 +0000 (12:22 -0800)]
NEWS: Fix spelling mistake.

6 years agoNEWS: Document static application consequenes of %OB/%Ob.
Carlos O'Donell [Tue, 23 Jan 2018 20:20:01 +0000 (12:20 -0800)]
NEWS: Document static application consequenes of %OB/%Ob.

6 years agomanual: Fix spelling of "Auxiliary."
Tobias Klauser [Tue, 23 Jan 2018 19:40:44 +0000 (11:40 -0800)]
manual: Fix spelling of "Auxiliary."

6 years agomanual: Touch up documentation for strftime and ALTMON_* constants.
Rical Jasan [Tue, 23 Jan 2018 03:24:24 +0000 (19:24 -0800)]
manual: Touch up documentation for strftime and ALTMON_* constants.

"%OB" is considered a conversion specifier ("B" is the format
specifier), and the list of format specifiers for months in the
description of the optional "O" modifier was incomplete.  A
cross-reference from the ALTMON_* constants to the strftime section
is also provided.  Lastly, some grammatical fixes (commas) are made
and paragraphs refactored (rewrapped).

* manual/locale.texi (ALTMON_1, ALTMON_2, ALTMON_3, ALTMON_4,
ALTMON_5, ALTMON_6, ALTMON_7, ALTMON_8, ALTMON_9, ALTMON_10,
ALTMON_11, ALTMON_12): Improve documentation.
* manual/time.texi (strftime): Likewise.

6 years agoFix the wording in NEWS to use "or later"
Szabolcs Nagy [Mon, 22 Jan 2018 15:54:02 +0000 (15:54 +0000)]
Fix the wording in NEWS to use "or later"

6 years agoUpdate NEWS with binutils version requirement for static PIE support
Szabolcs Nagy [Mon, 22 Jan 2018 10:22:24 +0000 (10:22 +0000)]
Update NEWS with binutils version requirement for static PIE support

6 years agopl_PL: Add alternative month names (bug 10871).
Rafal Luzynski [Tue, 5 Jan 2016 02:03:10 +0000 (03:03 +0100)]
pl_PL: Add alternative month names (bug 10871).

[BZ #10871]
* localedata/locales/pl_PL: Alternative month names added,
primary month names are genitive now.
* time/tst-strptime.c (day_tests): Actually use a genitive case
of a month name in Polish language.

6 years agoDocumentation to the above changes (bug 10871).
Rafal Luzynski [Mon, 18 Sep 2017 22:00:22 +0000 (00:00 +0200)]
Documentation to the above changes (bug 10871).

[BZ #10871]
* manual/locale.texi: Document ALTMON_1..12 constants for
nl_langinfo.  Specify when to use ALTMON instead of MON.
* manual/time.texi (strftime, strptime): Document GNU extension
permitting O modifier with %B and %b.  Specify when to use
%OB instead of %B.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoAbbreviated alternative month names (%Ob) also added (bug 10871).
Rafal Luzynski [Tue, 14 Nov 2017 01:22:38 +0000 (02:22 +0100)]
Abbreviated alternative month names (%Ob) also added (bug 10871).

All the previous changes also repeated to support abbreviated
alternative month names.  In most languages which have declension and
need nominative/genitive month names the abbreviated forms for both
cases are the same.  An example where they do differ is May in Russian:
this name is too short to be abbreviated so even the abbreviated form
features the declension suffixes.

[BZ #10871]
* locale/C-time.c (_nl_C_LC_TIME): Add abbreviated alternative month
names, define them as the same as abbreviated month names explicitly.
* locale/categories.def (LC_TIME): Add ab_alt_mon and wide-ab_alt_mon.
* locale/langinfo.h: (_NL_ABALTMON_1, _NL_ABALTMON_2, _NL_ABALTMON_3,
_NL_ABALTMON_4, _NL_ABALTMON_5, _NL_ABALTMON_6, _NL_ABALTMON_7,
_NL_ABALTMON_8, _NL_ABALTMON_9, _NL_ABALTMON_10, _NL_ABALTMON_11,
_NL_ABALTMON_12, _NL_WABALTMON_1, _NL_WABALTMON_2, _NL_WABALTMON_3,
_NL_WABALTMON_4, _NL_WABALTMON_5, _NL_WABALTMON_6, _NL_WABALTMON_7,
_NL_WABALTMON_8, _NL_WABALTMON_9, _NL_WABALTMON_10, _NL_WABALTMON_11,
_NL_WABALTMON_12): New enum constants.
* locale/programs/ld-time.c (struct locale_time_t): Add ab_alt_mon,
wab_alt_mon, and ab_alt_mon_defined members.
(time_output): Output ab_alt_mon and wab_alt_mon members.
(time_read): Read them, initialize them as copies of abmon and wabmon
respectively if they are missing, initialize ab_alt_mon_defined.
* locale/programs/locfile-kw.gperf (ab_alt_mon): Define.
* locale/programs/locfile-kw.h: Regenerate.
* locale/programs/locfile-token.h (tok_ab_alt_mon): New enum constant.
* time/Makefile [$(run-built-tests) = yes] (LOCALES): Add es_ES.UTF-8
and ru_RU.UTF-8.
* time/strftime_l.c (a_altmonth, aam_len): New macros.
[!COMPILE_WIDE] (ABALTMON_1): New macro.
(__strftime_internal): Handle %Ob and %Oh formats.
* time/strptime_l.c [_LIBC] (ab_alt_month_name): New macro.
(__strptime_internal): Handle %Ob and %Oh formats.
* time/tst-strptime.c (day_tests): Add more tests to parse different
forms of month names including the new %Ob format specifier.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoImplement alternative month names (bug 10871).
Rafal Luzynski [Tue, 14 Nov 2017 01:19:35 +0000 (02:19 +0100)]
Implement alternative month names (bug 10871).

Some languages (Slavic, Baltic, etc.) require a genitive case of the
month name when formatting a full date (with the day number) while
they require a nominative case when referring to the month standalone.
This requirement cannot be fulfilled without providing two forms for
each month name.  From now it is specified that nl_langinfo(MON_1)
series (up to MON_12) and strftime("%B") generate the month names in
the grammatical form used when the month is a part of a complete date.
If the grammatical form used when the month is named by itself is needed,
the new values nl_langinfo(ALTMON_1) (up to ALTMON_12) and
strftime("%OB") are supported.  This new feature is optional so the
languages which do not need it or do not yet provide the updated
locales simply do not use it and their behaviour is unchanged.

[BZ #10871]
* locale/C-time.c (_nl_C_LC_TIME): Add alternative month names,
define them as the same as primary full month names explicitly.
* locale/categories.def (LC_TIME): Add alt_mon and wide-alt_mon.
* locale/langinfo.h (__ALTMON_1, __ALTMON_2, __ALTMON_3, __ALTMON_4,
__ALTMON_5, __ALTMON_6, __ALTMON_7, __ALTMON_8, __ALTMON_9, __ALTMON_10,
__ALTMON_11, __ALTMON_12, _NL_WALTMON_1, _NL_WALTMON_2, _NL_WALTMON_3,
_NL_WALTMON_4, _NL_WALTMON_5, _NL_WALTMON_6, _NL_WALTMON_7,
_NL_WALTMON_8, _NL_WALTMON_9, _NL_WALTMON_10, _NL_WALTMON_11,
_NL_WALTMON_12): New enum constants.
[__USE_GNU] (ALTMON_1, ALTMON_2, ALTMON_3, ALTMON_4, ALTMON_5, ALTMON_6,
ALTMON_7, ALTMON_8, ALTMON_9, ALTMON_10, ALTMON_11, ALTMON_12): New
macros.
* locale/programs/ld-time.c (struct locale_time_t): Add alt_mon,
walt_mon, and alt_mon_defined members.
(time_output): Output alt_mon and walt_mon members.
(time_read): Read them, initialize them as copies of mon and wmon
respectively if they are missing, initialize alt_mon_defined.
* locale/programs/locfile-kw.gperf (alt_mon): Define.
* locale/programs/locfile-kw.h: Regenerate.
* locale/programs/locfile-token.h (tok_alt_mon): New enum constant.
* localedata/tst-langinfo.c (map): Add tests for the new constants
ALTMON_1 .. ALTMON_12.
* time/Makefile [$(run-built-tests) = yes] (LOCALES): Add fr_FR.UTF-8
and pl_PL.UTF-8.
* time/strftime_l.c (f_altmonth): New macro.
(__strftime_internal): Handle %OB format.
* time/strptime_l.c [_LIBC] (alt_month_name): New macro.
(__strptime_internal): Handle %OB format.
* time/tst-strptime.c (day_tests): Add tests to parse different forms
of month names including the new %OB format specifier.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agopowerpc: Fix syscalls during early process initialization [BZ #22685]
Tulio Magno Quites Machado Filho [Fri, 12 Jan 2018 20:50:33 +0000 (18:50 -0200)]
powerpc: Fix syscalls during early process initialization [BZ #22685]

The tunables framework needs to execute syscall early in process
initialization, before the TCB is available for consumption.  This
behavior conflicts with powerpc{|64|64le}'s lock elision code, that
checks the TCB before trying to abort transactions immediately before
executing a syscall.

This patch adds a powerpc-specific implementation of __access_noerrno
that does not abort transactions before the executing syscall.

Tested on powerpc{|64|64le}.

[BZ #22685]
* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION_IMPL): Renamed
from ABORT_TRANSACTION.
(ABORT_TRANSACTION): Redirect to ABORT_TRANSACTION_IMPL.
* sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION,
ABORT_TRANSACTION_IMPL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/not-errno.h: New file.  Reuse
Linux code, but remove the code that aborts transactions.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
6 years agogeneric if_ether.h: Fix build
Samuel Thibault [Fri, 19 Jan 2018 00:47:45 +0000 (00:47 +0000)]
generic if_ether.h: Fix build

* sysdeps/generic/netinet/if_ether.h: Include <stdint.h>.

6 years agolocales gu_IN, lo_LA: Fix obvious typos in dates.
Rafal Luzynski [Fri, 19 Jan 2018 00:09:12 +0000 (01:09 +0100)]
locales gu_IN, lo_LA: Fix obvious typos in dates.

Reported-by: Robert Pluim <rpluim@gmail.com>
* localedata/locales/gu_IN (LC_IDENTIFICATION): Fix an obvious typo
in date: "2004-14-09" should be "2004-09-14".
* localedata/locales/lo_LA: Fix an obvious typo in date in the header:
"2003-15-09" should be "2003-09-15".

6 years agoFix integer overflows in internal memalign and malloc functions [BZ #22343]
Arjun Shankar [Thu, 18 Jan 2018 16:47:06 +0000 (16:47 +0000)]
Fix integer overflows in internal memalign and malloc functions [BZ #22343]

When posix_memalign is called with an alignment less than MALLOC_ALIGNMENT
and a requested size close to SIZE_MAX, it falls back to malloc code
(because the alignment of a block returned by malloc is sufficient to
satisfy the call).  In this case, an integer overflow in _int_malloc leads
to posix_memalign incorrectly returning successfully.

Upon fixing this and writing a somewhat thorough regression test, it was
discovered that when posix_memalign is called with an alignment larger than
MALLOC_ALIGNMENT (so it uses _int_memalign instead) and a requested size
close to SIZE_MAX, a different integer overflow in _int_memalign leads to
posix_memalign incorrectly returning successfully.

Both integer overflows affect other memory allocation functions that use
_int_malloc (one affected malloc in x86) or _int_memalign as well.

This commit fixes both integer overflows.  In addition to this, it adds a
regression test to guard against false successful allocations by the
following memory allocation functions when called with too-large allocation
sizes and, where relevant, various valid alignments:
malloc, realloc, calloc, reallocarray, memalign, posix_memalign,
aligned_alloc, valloc, and pvalloc.

6 years agoChangeLog: Fix an entry for [BZ #22657]
Rafal Luzynski [Thu, 18 Jan 2018 00:40:15 +0000 (01:40 +0100)]
ChangeLog: Fix an entry for [BZ #22657]

Remove myself, give the full credit to Egmont Koblinger.

When committing someone else's changes, one should put the contributor's
name in the change log entry.

6 years agolocales bho_NP, mai_IN, mai_NP: Fix an obvious typo in date.
Rafal Luzynski [Thu, 18 Jan 2018 00:27:10 +0000 (01:27 +0100)]
locales bho_NP, mai_IN, mai_NP: Fix an obvious typo in date.

* localedata/locales/bho_NP (LC_IDENTIFICATION): Fix an obvious typo
in date: "2017-24-07" should be "2017-07-24".
* localedata/locales/mai_IN: Likewise.
* localedata/locales/mai_NP: Likewise.

6 years agoUpdate translations from the Translation Project
Dmitry V. Levin [Wed, 17 Jan 2018 22:00:50 +0000 (22:00 +0000)]
Update translations from the Translation Project

* po/ru.po: Update translations.

6 years agoFix backtrace for hppa (bug 22719).
Joseph Myers [Wed, 17 Jan 2018 13:31:47 +0000 (13:31 +0000)]
Fix backtrace for hppa (bug 22719).

The only architecture in glibc that uses the generic debug/backtrace.c
is hppa.  The debug/tst-backtrace* tests fail for hppa, so in fact the
generic debug/backtrace.c is not functional anywhere.  Instead, the
x86_64 version is a reasonably generic version that uses
_Unwind_Backtrace from libgcc to backtrace using unwind info, and is
used by several architectures.  This patch adds hppa to the
architectures using it (leaving open the possibility of a subsequent
cleanup for 2.28 of moving the x86_64 version to debug/backtrace.c,
and removing all the frame.h files that are now unused).

Reported by Adhemerval in
<https://sourceware.org/ml/libc-alpha/2018-01/msg00564.html> that this
does fix the backtrace test failures for hppa.

[BZ #22719]
* sysdeps/hppa/backtrace.c: New file.

6 years agox86-64: Properly align La_x86_64_retval to VEC_SIZE [BZ #22715]
H.J. Lu [Wed, 17 Jan 2018 12:31:51 +0000 (04:31 -0800)]
x86-64: Properly align La_x86_64_retval to VEC_SIZE [BZ #22715]

_dl_runtime_profile calls _dl_call_pltexit, passing a pointer to
La_x86_64_retval which is allocated on stack.  The lrv_vector0
field in La_x86_64_retval must be aligned to size of vector register.
When allocating stack space for La_x86_64_retval, we need to make sure
that the address of La_x86_64_retval + RV_VECTOR0_OFFSET is aligned to
VEC_SIZE.  This patch checks the alignment of the lrv_vector0 field
and pads the stack space if needed.

Tested with x32 and x86-64 on SSE4, AVX and AVX512 machines.  It fixed

FAIL: elf/tst-audit10
FAIL: elf/tst-audit4
FAIL: elf/tst-audit5
FAIL: elf/tst-audit6
FAIL: elf/tst-audit7

on x32 AVX512 machine.

[BZ #22715]
* sysdeps/x86_64/dl-trampoline.h (_dl_runtime_profile): Properly
align La_x86_64_retval to VEC_SIZE.

6 years agoUse LIBGCC_S_SO in x86_64 backtrace.
Joseph Myers [Tue, 16 Jan 2018 20:53:03 +0000 (20:53 +0000)]
Use LIBGCC_S_SO in x86_64 backtrace.

The x86_64 backtrace implementation is used as a generic
implementation (unwinding via unwind info and _Unwind_Backtrace) by
various other architectures.  This patch makes it more generic by
making it use LIBGCC_S_SO from gnu/lib-names.h instead of hardcoding
the libgcc_s.so.1 name, so that it can also be used on hppa which uses
libgcc_s.so.4.

Tested for x86_64.

* sysdeps/x86_64/backtrace.c: Include <gnu/lib-names.h>.
(init): Use LIBGCC_S_SO not hardcoded "libgcc_s.so.1".

6 years agonptl/tst-thread-exit-clobber: Run with any C++ compiler
Florian Weimer [Tue, 16 Jan 2018 15:46:00 +0000 (16:46 +0100)]
nptl/tst-thread-exit-clobber: Run with any C++ compiler

We do not need thread_local support in the C++11 comiler, and the
minimum GCC version for glibc has C++11 support (if it has C++ support).

6 years agoaarch64: Update bits/hwcap.h for Linux 4.15.
Szabolcs Nagy [Thu, 11 Jan 2018 17:08:51 +0000 (17:08 +0000)]
aarch64: Update bits/hwcap.h for Linux 4.15.

Define new HWCAP bits and add their name to dl-procinfo.c following
the linux definitions. Synchronizing with v4.15-rc8 version of linux,
these are not expected to change before the 4.15 release.

* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_SHA3): Define.
(HWCAP_SM3, HWCAP_SM4, HWCAP_ASIMDDP, HWCAP_SHA512, HWCAP_SVE): Define.
* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
(_dl_aarch64_cap_flags): Update.
(_DL_HWCAP_COUNT): Update.

6 years agoaarch64: make HWCAP updates less error prone
Szabolcs Nagy [Thu, 11 Jan 2018 17:21:46 +0000 (17:21 +0000)]
aarch64: make HWCAP updates less error prone

Remove unused _DL_HWCAP_LAST definition and move _DL_HWCAP_COUNT
where it is needed (dl-procinfo.h always includes dl-procinfo.c).

* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
(_DL_HWCAP_LAST): Remove.
(_DL_HWCAP_COUNT): Move to ...
* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
(_DL_HWCAP_COUNT): ... here.

6 years agonptl/tst-minstack-throw: Compile in C++11 mode with GNU extensions
Florian Weimer [Tue, 16 Jan 2018 06:19:28 +0000 (07:19 +0100)]
nptl/tst-minstack-throw: Compile in C++11 mode with GNU extensions

6 years agoAdd NT_ARM_SVE to elf.h
Alan Hayward [Fri, 12 Jan 2018 16:56:19 +0000 (16:56 +0000)]
Add NT_ARM_SVE to elf.h

This definition is for AArch64 SVE registers in elf core dumps.

* elf/elf.h (NT_ARM_SVE): Define.

6 years agonptl: Add PTHREAD_MIN_STACK C++ throw test [BZ #22636]
Florian Weimer [Mon, 15 Jan 2018 14:30:00 +0000 (15:30 +0100)]
nptl: Add PTHREAD_MIN_STACK C++ throw test [BZ #22636]

6 years agoUpdate build-many-glibcs.py binutils, mpfr, mpc versions.
Joseph Myers [Mon, 15 Jan 2018 14:02:54 +0000 (14:02 +0000)]
Update build-many-glibcs.py binutils, mpfr, mpc versions.

* scripts/build-many-glibcs.py (Context.checkout): Default
binutils version to 2.30 branch, MPFR version to 4.0.0 and MPC
version to 1.1.0.

6 years agoSynchronize DF_1_* flags with binutils (Bug 22707)
Carlos O'Donell [Sun, 14 Jan 2018 04:21:57 +0000 (20:21 -0800)]
Synchronize DF_1_* flags with binutils (Bug 22707)

This patch synchronizes DF_1_* flags with binutils
and ensures that all DF_1_* flags defined in binutil's
include/elf/common.h are also defined glibc's elf/elf.h.
This is a user visible change since elf/elf.h is installed
by default as /usr/include/elf.h.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
6 years agopowerpc: Fix llround spurious inexact on 32-bit POWER4 [BZ #22697]
Tulio Magno Quites Machado Filho [Fri, 12 Jan 2018 22:39:42 +0000 (20:39 -0200)]
powerpc: Fix llround spurious inexact on 32-bit POWER4 [BZ #22697]

This issue is similar to BZ #19235, where spurious exceptions are
created from adding 0.5 then converting to an integer.
The solution is based on Joseph's fix for BZ #19235.

[BZ #22697]
* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S (__llround):
Do not add 0.5 to integer or out-of-range arguments.

6 years agoUpdate translations from the Translation Project
Dmitry V. Levin [Thu, 11 Jan 2018 15:00:00 +0000 (15:00 +0000)]
Update translations from the Translation Project

* po/bg.po: Update translations.
* po/cs.po: Likewise.
* po/de.po: Likewise.
* po/ko.po: Likewise.
* po/pl.po: Likewise.
* po/sv.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.

6 years agoaarch64: fix static pie enabled libc when main is in a shared library
Szabolcs Nagy [Tue, 19 Dec 2017 18:43:04 +0000 (18:43 +0000)]
aarch64: fix static pie enabled libc when main is in a shared library

In the static pie enabled libc, crt1.o uses the same position independent
code as rcrt1.o and crt1.o is used instead of Scrt1.o when -no-pie
executables are linked.  When main is not defined in the executable, but
in a shared library crt1.o is currently broken, it assumes main is local.
(glibc has a test for this but i missed it in my previous testing.)

To make both rcrt1.o and crt1.o happy with the same code, a wrapper is
introduced around main: with this crt1.o works with extern main symbol
while rcrt1.o does not depend on GOT relocations. (The change only
affects static pie enabled libc. Further simplification of start.S is
possible in the future by using the same approach for Scrt1.o too.)

* aarch64/start.S (_start): Use __wrap_main.
(__wrap_main): New local symbol.

6 years agolinux: make getcwd(3) fail if it cannot obtain an absolute path [BZ #22679]
Dmitry V. Levin [Sun, 7 Jan 2018 02:03:41 +0000 (02:03 +0000)]
linux: make getcwd(3) fail if it cannot obtain an absolute path [BZ #22679]

Currently getcwd(3) can succeed without returning an absolute path
because the underlying getcwd syscall, starting with linux commit
v2.6.36-rc1~96^2~2, may succeed without returning an absolute path.

This is a conformance issue because "The getcwd() function shall
place an absolute pathname of the current working directory
in the array pointed to by buf, and return buf".

This is also a security issue because a non-absolute path returned
by getcwd(3) causes a buffer underflow in realpath(3).

Fix this by checking the path returned by getcwd syscall and falling
back to generic_getcwd if the path is not absolute, effectively making
getcwd(3) fail with ENOENT.  The error code is chosen for consistency
with the case when the current directory is unlinked.

[BZ #22679]
CVE-2018-1000001
* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Fall back to
generic_getcwd if the path returned by getcwd syscall is not absolute.
* io/tst-getcwd-abspath.c: New test.
* io/Makefile (tests): Add tst-getcwd-abspath.

6 years agomalloc: Ensure that the consolidated fast chunk has a sane size.
Istvan Kurucsai [Fri, 12 Jan 2018 14:26:20 +0000 (15:26 +0100)]
malloc: Ensure that the consolidated fast chunk has a sane size.

6 years agosupport: Preserve errno in write_message, TEST_VERIFY and other checks
Florian Weimer [Fri, 12 Jan 2018 07:18:30 +0000 (08:18 +0100)]
support: Preserve errno in write_message, TEST_VERIFY and other checks

These facilities could clobber errno, which makes it difficult to write
certain checks because a specific order has to be used.

6 years agoAdd missing reference to bug 20532
Florian Weimer [Fri, 12 Jan 2018 11:15:38 +0000 (12:15 +0100)]
Add missing reference to bug 20532

6 years agolibnsl: Do not install libnsl.so, libnsl.a if NIS is disabled [BZ #22701]
Florian Weimer [Fri, 12 Jan 2018 07:42:56 +0000 (08:42 +0100)]
libnsl: Do not install libnsl.so, libnsl.a if NIS is disabled [BZ #22701]

This also skips building the .o files for libnsl.a.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agohu_HU locale: Avoid double space (bug 22657).
Egmont Koblinger [Mon, 1 Jan 2018 20:40:11 +0000 (20:40 +0000)]
hu_HU locale: Avoid double space (bug 22657).

The current date format prefixes one-digit days with a space, resulting
in ugly two spaces:

$ LC_ALL=hu_HU.UTF-8 date
2018. jan.  1., hétfÅ‘, 21:25:35 CET
          ^^

The official orthography rules doesn't contain an explicit rule about
this (which already gives no sane reason for double space), and an
implicit example of "1848. március 9." under bullet point 296 at
http://helyesiras.mta.hu/helyesiras/default/akh12 contains a single
space only. It's sure not convincing on an HTML page, but I confirm
that the official book edition (e.g.
https://www.libri.hu/en/konyv/a-magyar-helyesiras-szabalyai-32.html)
also contains a single space there.

[BZ #22657]
* localedata/locales/hu_HU (d_t_fmt): Avoid a leading space
before the day number which may produce a double space.
(date_fmt): Likewise.

6 years agoFix s390 linknamespace fallout of bug 22702 patch.
Joseph Myers [Fri, 12 Jan 2018 00:12:57 +0000 (00:12 +0000)]
Fix s390 linknamespace fallout of bug 22702 patch.

My fix for bug 22702 introduced linknamespace test failures on
s390x-linux-gnu and s390-linux-gnu because it made remainder call
__feholdexcept, and the s390 __feholdexcept calls fegetenv, and
remainder is in Unix98 and XPG4.2 but fegetenv isn't.  This patch
makes __feholdexcept call __fegetenv instead to avoid that namespace
issue.

Tested (compilation) with build-many-glibcs.py for s390x-linux-gnu,
where it resolves the test failures.

* sysdeps/s390/fpu/feholdexcpt.c (__feholdexcept): Call __fegetenv
instead of fegetenv.

6 years agoMake default libc_feholdsetround_noex_ctx use __feholdexcept (bug 22702).
Joseph Myers [Thu, 11 Jan 2018 18:18:46 +0000 (18:18 +0000)]
Make default libc_feholdsetround_noex_ctx use __feholdexcept (bug 22702).

For soft-float powerpc, the math/test-nearbyint-except-2 test fails
because nearbyintl traps when traps on "inexact" are enabled on entry
(and an "inexact" exception is generated internally, though cleared
for the final return).

The problem is the default implementation of
libc_feholdsetround_noex_ctx, which does not disable exception traps.
There is some ambiguity about whether the *noex* interfaces are
required to do so or only permitted to do so.  But given that we
support fe* interfaces to enable and disable traps (on architectures
with that functionality), functions that must not raise an exception
(must not leave the flag set on exit if not set on entry) should also
not trap on it when traps on that exception are enabled.  So it is
appropriate to define these interfaces to have the feholdexcept effect
of disabling exception traps; this patch updates the default
implementation and comments accordingly.

At least some architecture versions already disable traps; there are
few uses of the *noex* interfaces at all, and while it's possible
there are bugs on any architecture versions failing to disable traps
that appear in the exp2 and remainder implementations, there are
currently no tests, other than this one for nearbyintl (where only the
ldbl-128ibm implementation uses SET_RESTORE_ROUND_NOEX), that would
fail as a result of such a bug.  (Hard-float powerpc does disable
traps here, hence the nearbyintl failure not appearing there.)

Tested for powerpc (soft-float).  This brings that configuration to
clean math/ test results, provided you build with GCC 8 to get the fix
for GCC bug 64811.

[BZ #22702]
* sysdeps/generic/math_private.h (libc_feresetround_noex): Update
comment to say exceptions are discarded.
(libc_feholdsetround_noex_ctx): Use __feholdexcept instead of
__fegetenv.
(SET_RESTORE_ROUND_NOEX): Update comment to say non-stop mode must
be enabled.

6 years agocsu: Update __libgcc_s_init comment
Florian Weimer [Thu, 11 Jan 2018 12:13:28 +0000 (13:13 +0100)]
csu: Update __libgcc_s_init comment

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agonptl: Add tst-minstack-cancel, tst-minstack-exit [BZ #22636]
Florian Weimer [Thu, 11 Jan 2018 12:13:14 +0000 (13:13 +0100)]
nptl: Add tst-minstack-cancel, tst-minstack-exit [BZ #22636]

I verified that without the guard accounting change in commit
630f4cc3aa019ede55976ea561f1a7af2f068639 (Fix stack guard size
accounting) and RTLD_NOW for libgcc_s introduced by commit
f993b8754080ac7572b692870e926d8b493db16c (nptl: Open libgcc.so with
RTLD_NOW during pthread_cancel), the tst-minstack-cancel test fails on
an AVX-512F machine.  tst-minstack-exit still passes, and either of
the mentioned commit by itself frees sufficient stack space to make
tst-minstack-cancel pass, too.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoFix ldbl-128ibm log1pl (-qNaN) spurious "invalid" exception (bug 22693).
Joseph Myers [Wed, 10 Jan 2018 17:59:01 +0000 (17:59 +0000)]
Fix ldbl-128ibm log1pl (-qNaN) spurious "invalid" exception (bug 22693).

The ldbl-128ibm implementation of log1pl does ordered comparisons on a
negative qNaN argument, so resulting in spurious "invalid" exceptions
(for soft-float powerpc; hard-float only avoids this because of GCC
bug 58684 meaning ordered comparison instructions never get
generated).  This patch fixes this by arranging for the test for NaN
or infinity arguments to handle negative arguments as well.

Tested for powerpc (soft float).

[BZ #22693]
* sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Handle
negative arguments in test for NaN or infinity argument.

6 years agoRegenerate libc.pot
Dmitry V. Levin [Wed, 10 Jan 2018 15:00:00 +0000 (15:00 +0000)]
Regenerate libc.pot

6 years agonptl: Open libgcc.so with RTLD_NOW during pthread_cancel [BZ #22636]
Florian Weimer [Wed, 10 Jan 2018 12:18:04 +0000 (13:18 +0100)]
nptl: Open libgcc.so with RTLD_NOW during pthread_cancel [BZ #22636]

Disabling lazy binding reduces stack usage during unwinding.

Note that RTLD_NOW only makes a difference if libgcc.so has not
already been loaded, so this is only a partial fix.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agohurd: Implement faccessat without AT_EACCESS flag
Samuel Thibault [Wed, 10 Jan 2018 00:58:23 +0000 (01:58 +0100)]
hurd: Implement faccessat without AT_EACCESS flag

* hurd/hurd/fd.h: Include <fcntl.h>
(__hurd_at_flags): New function.
* hurd/lookup-at.c (__file_name_lookup_at): Replace flag computation
with call to __hurd_at_flags.
* include/unistd.h (__faccessat, __faccessat_noerrno): Add declaration.
* sysdeps/mach/hurd/access.c (access_common): Move implementation to
__faccessat
(hurd_fail_seterrno, hurd_fail_noerrno): Move to sysdeps/mach/hurd/faccessat.c.
(__access_noerrno): Use __faccessat_common instead of access_common.
(__access): Likewise.
* sysdeps/mach/hurd/euidaccess.c (__euidaccess): Replace implementation
with a call to __faccessat.
* sysdeps/mach/hurd/faccessat.c (faccessat): Rename into...
(__faccessat_common): ... this. Move implementation of __access into it when
AT_FLAGS does not contain AT_EACCESS. Make it call __hurd_at_flags, add
reauthenticate_cwdir_at helper to implement AT mechanism.
(__faccessat_noerrno): New function, just calls __faccessat_common.
(__faccessat): New function, just calls __faccessat_common.
(faccessat): Define weak alias.

6 years agoFix powerpc-nofpu fmaxmagl, fminmagl spurious "invalid" exception (bug 22691).
Joseph Myers [Wed, 10 Jan 2018 00:38:12 +0000 (00:38 +0000)]
Fix powerpc-nofpu fmaxmagl, fminmagl spurious "invalid" exception (bug 22691).

For soft-float powerpc, fmaxmagl and fminmagl generate spurious
"invalid" exceptions for quiet NaN arguments.  This is another case of
the problems with fabsl inline expansion via comparisons, and so is
fixed by building those functions with -fno-builtin-fabsl.

Tested for powerpc (soft-float).

[BZ #22691]
* sysdeps/powerpc/nofpu/Makefile [$(subdir) = math]
(CFLAGS-s_fmaxmagl.c): New variable.
[$(subdir) = math] (CFLAGS-s_fminmagl.c: Likewise.

6 years agoFix ldbl-128ibm lrintl, lroundl missing "invalid" exceptions (bug 22690).
Joseph Myers [Wed, 10 Jan 2018 00:02:35 +0000 (00:02 +0000)]
Fix ldbl-128ibm lrintl, lroundl missing "invalid" exceptions (bug 22690).

The ldbl-128ibm implementations of lrintl and lroundl are missing
"invalid" exceptions for certain overflow cases when compiled with GCC
8.  The cause of this is after-the-fact integer overflow checks that
fail when the compiler optimizes on the basis of integer overflow
being undefined; GCC 8 must be able to detect new cases of
undefinedness here.

Failure: lrint (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_downward (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_towardzero (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_upward (-0x80000001p0): Exception "Invalid operation" not set

Failure: lround (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_downward (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_towardzero (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_upward (-0x80000001p0): Exception "Invalid operation" not set

(Tested that these failures occur before the patch for powerpc
soft-float, but the issue applies in principle for hard-float as well,
whether or not the particular optimizations in fact occur there at
present.)

This patch fixes the bug by ensuring the additions / subtractions in
question cast arguments to unsigned long int, or use 1UL as a constant
argument, so that the arithmetic occurs in an unsigned type with the
result then converted back to a signed type.

Tested for powerpc (soft-float).

[BZ #22690]
* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c (__lrintl): Use unsigned
long int for arguments of possibly overflowing addition or
subtraction.
* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c (__lroundl): Likewise.

6 years agoFix powerpc-nofpu remainderl wrong sign of zero result (bug 22688).
Joseph Myers [Tue, 9 Jan 2018 23:14:45 +0000 (23:14 +0000)]
Fix powerpc-nofpu remainderl wrong sign of zero result (bug 22688).

For soft-float powerpc, the remainderl function produces zero results
with the wrong sign for various inputs.  This is another instance of
the problem with incorrect built-in fabsl expansion, so is fixed by
this patch using -fno-builtin-fabsl for this function.

Tested for powerpc (soft-float).

[BZ #22688]
* sysdeps/powerpc/nofpu/Makefile [$(subdir) = math]
(CFLAGS-e_remainderl.c): New variable.

6 years agoFix powerpc-nofpu complex long double functions spurious "invalid" exception (bug...
Joseph Myers [Tue, 9 Jan 2018 22:34:35 +0000 (22:34 +0000)]
Fix powerpc-nofpu complex long double functions spurious "invalid" exception (bug 22687).

For soft-float powerpc, various _Complex long double functions
generate spurious "invalid" exceptions, even with a compiler with GCC
bug 64811 fixed.

The problem is GCC's built-in fabsl expansion.  Various files are
already built with -fno-builtin-fabsl because in this case (IBM long
double, for soft-float or e500v1) a fallback fabsl expansion based on
comparisons is used, which can produce the wrong sign of a zero
result.  Those comparisons can also produce spurious exceptions for
NaN arguments.  Furthermore, __builtin_fpclassify implemently uses
__builtin_fabsl, and is unaffected by -fno-builtin-fabsl, and the
fpclassify macro uses __builtin_fpclassify in the absence of
-fsignaling-nans.  Thus, this patch arranges for the problem files
using fpclassify to be built with -fsignaling-nans in this case, to
avoid spurious exceptions from fpclassify.

Tested for powerpc (soft-float).

[BZ #22687]
* sysdeps/powerpc/nofpu/Makefile (CFLAGS-s_cacosl.c): New
variable.
(CFLAGS-s_cacoshl.c): Likewise.
(CFLAGS-s_casinhl.c): Likewise.
(CFLAGS-s_catanl.c): Likewise.
(CFLAGS-s_catanhl.c): Likewise.
(CFLAGS-s_cexpl.c): Likewise.
(CFLAGS-s_ccoshl.c): Add -fsignaling-nans.
(CFLAGS-s_csinhl.c): Likewise.
(CFLAGS-s_clogl.c): Likewise.
(CFLAGS-s_clog10l.c): Likewise.
(CFLAGS-s_csinl.c): Likewise.
(CFLAGS-s_csqrtl.c): Likewise.

6 years agohurd: Use the new file_exec_paths RPC
Samuel Thibault [Tue, 9 Jan 2018 00:36:58 +0000 (01:36 +0100)]
hurd: Use the new file_exec_paths RPC

From: Emilio Pozuelo Monfort <pochu27@gmail.com>
From: Svante Signell <svante.signell@gmail.com>

Pass the file paths of executable to the exec server, both relative and
absolute, which exec needs to properly execute and avertise #!-scripts.
Previously, the exec server tried to guess the name from argv[0] but argv[0]
only contains the executable name by convention.

* hurd/hurdexec.c (_hurd_exec): Deprecate function.
(_hurd_exec_paths): New function.
* hurd/hurd.h (_hurd_exec): Deprecate function.
(_hurd_exec_paths): Declare function.
* hurd/Versions: Export _hurd_exec_paths.
* sysdeps/mach/hurd/execve.c: Include <stdlib.h> and <stdio.h>
(__execve): Use __getcwd to build absolute path, and use
_hurd_exec_paths instead of _hurd_exec.
* sysdeps/mach/hurd/spawni.c: Likewise.
* sysdeps/mach/hurd/fexecve.c: Use _hurd_exec_paths instead of
_hurd_exec.

6 years agotst-ttyname: skip the test when /dev/ptmx is not available
Dmitry V. Levin [Mon, 25 Dec 2017 02:30:32 +0000 (02:30 +0000)]
tst-ttyname: skip the test when /dev/ptmx is not available

* sysdeps/unix/sysv/linux/tst-ttyname.c (do_in_chroot_1): Skip the
test instead of failing in case of ENOENT returned by posix_openpt.

6 years agoresolv: Support binary labels in test framework
Florian Weimer [Mon, 8 Jan 2018 13:33:17 +0000 (14:33 +0100)]
resolv: Support binary labels in test framework

The old implementation based on hsearch_r used an ad-hoc C string
encoding and produced an incorrect format on the wire for domain
names which contained bytes which needed escaping when printed.

This commit switches to ns_name_pton for the wire format conversion
(now that we have separate tests for it) and uses a tsearch tree
with a suitable comparison function to locate compression targets.

6 years agosupport: Increase usability of TEST_COMPARE
Florian Weimer [Mon, 8 Jan 2018 12:01:36 +0000 (13:01 +0100)]
support: Increase usability of TEST_COMPARE

The previous implementation of the TEST_COMPARE macro would fail
to compile code like this:

  int ret = res_send (query, sizeof (query), buf, sizeof (buf));
  TEST_COMPARE (ret,
                sizeof (query)
                + 2             /* Compression reference.  */
                + 2 + 2 + 4 + 2 /* Type, class, TTL, RDATA length.  */
                + 1             /* Pascal-style string length.  */
                + strlen (expected_name));

This resulted in a failed static assertion, "integer conversions
may alter sign of operands".  A user of the TEST_COMPARE would have
to add a cast to fix this.

This patch reverts to the original proposed solution of a run-time
check, making TEST_COMPARE usable for comparisons of numbers with
types with different signedness in more contexts.

6 years ago[BZ #22637] Fix stack guard size accounting
Szabolcs Nagy [Wed, 6 Dec 2017 13:05:50 +0000 (13:05 +0000)]
[BZ #22637] Fix stack guard size accounting

Previously if user requested S stack and G guard when creating a
thread, the total mapping was S and the actual available stack was
S - G - static_tls, which is not what the user requested.

This patch fixes the guard size accounting by pretending the user
requested S+G stack.  This way all later logic works out except
when reporting the user requested stack size (pthread_getattr_np)
or when computing the minimal stack size (__pthread_get_minstack).

Normally this will increase thread stack allocations by one page.
TLS accounting is not affected, that will require a separate fix.

[BZ #22637]
* nptl/descr.h (stackblock, stackblock_size): Update comments.
* nptl/allocatestack.c (allocate_stack): Add guardsize to stacksize.
* nptl/nptl-init.c (__pthread_get_minstack): Remove guardsize from
stacksize.
* nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.

6 years agox86-64: Add sincosf with vector FMA
H.J. Lu [Mon, 8 Jan 2018 16:04:26 +0000 (08:04 -0800)]
x86-64: Add sincosf with vector FMA

Since the x86-64 assembly version of sincosf is higly optimized with
vector instructions, there isn't much room for improvement.  However
s_sincosf.c written in C with vector math and intrinsics can be
optimized by GCC with FMA.

On Skylake, bench-sincosf reports performance improvement:

           Assembly       FMA         improvement
max        104.042       101.008         3%
min        9.426         8.586           10%
mean       20.6209       18.2238         13%

* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
Add s_sincosf-sse2 and s_sincosf-fma.
(CFLAGS-s_sincosf-fma.c): New.
* sysdeps/x86_64/fpu/multiarch/s_sincosf-fma.c: New file.
* sysdeps/x86_64/fpu/multiarch/s_sincosf-sse2.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_sincosf.c: Likewise.
* sysdeps/x86_64/fpu/s_sincosf.S: Don't add alias if
__sincosf is defined.

6 years agonptl: Add test for callee-saved register restore in pthread_exit
Florian Weimer [Mon, 8 Jan 2018 13:57:25 +0000 (14:57 +0100)]
nptl: Add test for callee-saved register restore in pthread_exit

GCC PR 83641 results in a miscompilation of libpthread, which
causes pthread_exit not to restore callee-saved registers before
running destructors for objects on the stack.  This test detects
this situation:

info: unsigned int, direct pthread_exit call
tst-thread-exit-clobber.cc:80: numeric comparison failure
   left: 4148288912 (0xf741dd90); from: value
  right: 1600833940 (0x5f6ac994); from: magic_values.v2
info: double, direct pthread_exit call
info: unsigned int, indirect pthread_exit call
info: double, indirect pthread_exit call
error: 1 test failures

6 years agosupport: Define support_static_assert for use with C and C++
Florian Weimer [Mon, 8 Jan 2018 13:39:51 +0000 (14:39 +0100)]
support: Define support_static_assert for use with C and C++

And update TEST_COMPARE to use it, to make it usable from C++.

6 years agogetrlimit64: fix for 32-bit configurations with default version >= 2.2
Aurelien Jarno [Sun, 7 Jan 2018 19:33:26 +0000 (20:33 +0100)]
getrlimit64: fix for 32-bit configurations with default version >= 2.2

Commit 24731685 ("prlimit: Translate old_rlimit from RLIM64_INFINITY to
RLIM_INFINITY") broken the getrlimit64 for 32-bit configurations which
do no need the 2GiB limited compat getrlimit (default version >= 2.2).

This patch fixes that by restoring the weak alias in that case.

Changelog:
* sysdeps/unix/sysv/linux/getrlimit64 (getrlimit64)
[!__RLIM_T_MATCHES_RLIM64_T]
[!SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_2)]: Define as weak alias of
__getrlimit64. Add libc_hidden_weak.

6 years agohurd: Fix pwritev*
Samuel Thibault [Sun, 7 Jan 2018 12:31:36 +0000 (13:31 +0100)]
hurd: Fix pwritev*

This follows c45d78aac ('posix: Fix generic p{read,write}v buffer allocation
(BZ#22457)'), which made pwritev to use __mmap instead of __posix_memalign,
but didn't pass PROT_READ to it, while the pwrite() call does need to
read the data we have just copied over.

* sysdeps/posix/pwritev_common.c: Add PROT_READ to __mmap prot.

6 years agoAvoid race conditions when rebuilding librt.so
Palmer Dabbelt [Wed, 27 Dec 2017 04:56:44 +0000 (20:56 -0800)]
Avoid race conditions when rebuilding librt.so

`make check' sometimes triggers a rebuild of librt.so using
nptl/Makefile, which ignores librt's dependence on libpthread.  This
causes the build to blow up when we attempt to run the test suite on
RISC-V.

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

        * nptl/Makefile (/librt.so): Always depend on
        "$(shared-thread-library)".

6 years agoStrip shared objects in subdirectories of lib
Palmer Dabbelt [Sat, 6 Jan 2018 07:18:40 +0000 (23:18 -0800)]
Strip shared objects in subdirectories of lib

The RISC-V port will have libraries in subdirectories of lib, like
"lib64/lp64d".  This adds support for stripping these installed
libraries.

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

       * scripts/build-many-glibcs.py (class Glibc): Strip shared objects
       in subdirectories of lib.

6 years agoAdd linux-4.15 VDSO hash for RISC-V
Palmer Dabbelt [Wed, 27 Dec 2017 04:52:42 +0000 (20:52 -0800)]
Add linux-4.15 VDSO hash for RISC-V

The RISC-V Linux port defines VDSO symbols

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

       * sysdeps/unix/sysv/linux/dl-vdso.h (VDSO_NAME_LINUX_4_15): New
       define.
       (VDSO_HASH_LINUX_4_15): Likewise.

6 years agoAllow make-link-multidir to make subdirectories
Palmer Dabbelt [Wed, 27 Dec 2017 04:55:34 +0000 (20:55 -0800)]
Allow make-link-multidir to make subdirectories

The RISC-V Linux ABI doesn't define any libraries that go directly in
lib, instead they go into lib32/ilp32 or lib64/lp64.  This casuse
make-link-multidir to fail when attempting to make library directories
when building a static libc on multilib RISC-V systems.

This patch uses scripts/mkinstalldirs to make the base directory of the
target symlink of make-link-multidir.

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

       * Makerules (make-link-multidir): Make directories before linking into
       them.

6 years agoAdd RISC-V dynamic relocations to elf.h
Palmer Dabbelt [Wed, 27 Dec 2017 04:52:36 +0000 (20:52 -0800)]
Add RISC-V dynamic relocations to elf.h

These relocations can appear in shared objects on RISC-V ELF systems.

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

       * elf/elf.h (R_RISCV_NONE): New define.
       (R_RISCV_32): Likewise.
       (R_RISCV_64): Likewise.
       (R_RISCV_RELATIVE): Likewise.
       (R_RISCV_COPY): Likewise.
       (R_RISCV_JUMP_SLOT): Likewise.
       (R_RISCV_TLS_DTPMOD32): Likewise.
       (R_RISCV_TLS_DTPMOD64): Likewise.
       (R_RISCV_TLS_DTPREL32): Likewise.
       (R_RISCV_TLS_DTPREL64): Likewise.
       (R_RISCV_TLS_TPREL32): Likewise.
       (R_RISCV_TLS_TPREL64): Likewise.

6 years agohurd: Fix glob64 compatibility symbols
Samuel Thibault [Sat, 6 Jan 2018 21:28:36 +0000 (22:28 +0100)]
hurd: Fix glob64 compatibility symbols

This follows ccf970c7a ('posix: Add compat glob symbol to not follow
dangling symbols') by adding to gnu/ the same compatibility as for Linux.

* sysdeps/gnu/glob64.c (__glob): Define macro instead of glob macro.
(__glob64): Define GLIBC_2_27 versioned symbol instead of glob64.
* sysdeps/gnu/glob-lstat-compat.c: New file.
* sysdeps/gnu/glob64-lstat-compat.c: New file.

6 years agohurd: Fix posix glob test
Samuel Thibault [Sat, 6 Jan 2018 21:19:13 +0000 (22:19 +0100)]
hurd: Fix posix glob test

* posix/tst-glob_symlinks.c [!PATH_MAX]: Define PATH_MAX macro.

6 years agoi386: Regenerate libm-test-ulps for for gcc 7 on i686
Samuel Thibault [Sat, 6 Jan 2018 21:09:42 +0000 (22:09 +0100)]
i386: Regenerate libm-test-ulps for for gcc 7 on i686

* sysdeps/i386/fpu/libm-test-ulps: Regenerated for GCC 7 with
"-O2 -march=i686".

6 years agohurd: Fix build without NO_HIDDEN
Samuel Thibault [Sat, 6 Jan 2018 17:18:49 +0000 (18:18 +0100)]
hurd: Fix build without NO_HIDDEN

* sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_dynamic) [NO_RTLD_HIDDEN]: Call
JUMPTARGET (___tls_get_addr) instead of HIDDEN_JUMPTARGET (___tls_get_addr).
* sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Likewise.

6 years agohurd: Add jmp_buf-macros.h
Samuel Thibault [Sat, 6 Jan 2018 01:27:44 +0000 (02:27 +0100)]
hurd: Add jmp_buf-macros.h

* sysdeps/mach/hurd/i386/jmp_buf-macros.h: New file.

6 years agopowerpc: Fix error message during relocation overflow
Tulio Magno Quites Machado Filho [Fri, 5 Jan 2018 20:34:09 +0000 (18:34 -0200)]
powerpc: Fix error message during relocation overflow

The function _itoa_word() writes characters from the higher address to
the lower address, requiring the destination string to reserve that size
before calling it.

* sysdeps/powerpc/powerpc64/dl-machine.c (_dl_reloc_overflow):
Reserve 16 chars to reloc_addr before calling _itoa_word.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoresource/tst-getrlimit.c: Add copyright header
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)]
resource/tst-getrlimit.c: Add copyright header

The initial year is based on the date in the original ChangeLog entry
(2005-06-21).

6 years agoAdd test for getrlimit/setrlimit/prlimit with infinity value
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)]
Add test for getrlimit/setrlimit/prlimit with infinity value

Add a test to check that the getrlimit, setrlimit and prlimit functions
and their 64-bit equivalent behave correctly with RLIM_INFINITY and
RLIM64_INFINITY. For that it assumes that the prlimit64 function calls
the syscall directly without translating the value and that the kernel
uses the -1 value to represent infinity.

It first finds a resource with the hard limit set to infinity so the
soft limit can be manipulated easily and check for the consistency
between the value set or get by the prlimit64 and the other functions.

It is Linux specific add it uses the prlimit and prlimit64 functions.

Changelog:
* sysdeps/unix/sysv/linux/tst-rlimit-infinity.c: New file.
* sysdeps/unix/sysv/linux/Makefile (tests): Add tst-rlimit-infinity.

6 years agoprlimit: Translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY [BZ #22678]
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)]
prlimit: Translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY [BZ #22678]

prlimit called without a new value fails on 32-bit machines if any of
the soft or hard limits are infinity. This is because prlimit does not
translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY, but checks
that the value returned by the prlimit64 syscall fits into a 32-bit
value, like it is done for example in getrlimit. Note that on the
other hand new_rlimit is correctly translated from RLIM_INFINITY to
RLIM64_INFINITY before calling the syscall.

This patch fixes that.

Changelog:
[BZ #22678]
* sysdeps/unix/sysv/linux/prlimit.c (prlimit): Translate
old_rlimit from RLIM64_INFINITY to RLIM_INFINITY.

6 years agoAlpha: Fix the RLIM_INFINITY and RLIM64_INFINITY constants
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)]
Alpha: Fix the RLIM_INFINITY and RLIM64_INFINITY constants

Fix the RLIM_INFINITY and RLIM64_INFINITY constants on alpha to match
the kernel one and all other architectures. Change the getrlimit,
getrlimit64, setrlimit, setrlimit64 into old compat symbols, and provide
the Linux generic functions as GLIBC_2_27 version.

Changelog:
* sysdeps/unix/sysv/linux/getrlimit64.c [USE_VERSIONED_RLIMIT]: Do not
define getrlimit and getrlimit64 as weak aliases of __getrlimit64.
Define __GI_getrlimit64 as weak alias of __getrlimit64.
[__RLIM_T_MATCHES_RLIM64_T]: Do not redefine SHLIB_COMPAT, use #elif
instead.
* sysdeps/unix/sysv/linux/setrlimit64.c [USE_VERSIONED_RLIMIT]: Do not
define setrlimit and setrlimit64 as weak aliases of __setrlimit64.
* sysdeps/unix/sysv/linux/alpha/bits/resource.h (RLIM_INFINITY,
RLIM64_INFINITY): Fix values to match the kernel ones.
* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: Define
USE_VERSIONED_RLIMIT.  Rename __getrlimit64 into __old_getrlimit64 and
provide it as getrlimit@@GLIBC_2_0 and getrlimit64@@GLIBC_2_1.  Add a
__getrlimit64 function and provide it as getrlimit@@GLIBC_2_27 and
getrlimit64@@GLIBC_2_27.
* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Ditto with setrlimit
and setrlimit64.
* sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.27): Add
getrlimit, setrlimit, getrlimit64 and setrlimit64.
* sysdeps/unix/sysv/linux/alpha/Versions (libc): Add getrlimit,
setrlimit, getrlimit64 and setrlimit64.

6 years agoAlpha: Add wrappers to get/setrlimit64 to fix RLIM64_INFINITY constant [BZ #22648]
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)]
Alpha: Add wrappers to get/setrlimit64 to fix RLIM64_INFINITY constant [BZ #22648]

RLIM64_INFINITY was supposed to be a glibc convention rather than
anything seen by the kernel, but it ended being passed to the kernel
through the prlimit64 syscall.

* On the kernel side, the value is defined for the prlimit64 syscall for
  all architectures in include/uapi/linux/resource.h:

  #define RLIM64_INFINITY           (~0ULL)

* On the kernel side, the value is defined for getrlimit and setrlimit
  in arch/alpha/include/uapi/asm/resource.h

  #define RLIM_INFINITY            0x7ffffffffffffffful

* On the GNU libc side, the value is defined in
  sysdeps/unix/sysv/linux/alpha/bits/resource.h:

  # define RLIM64_INFINITY 0x7fffffffffffffffLL

This was not an issue until the getrlimit and setrlimit glibc functions
have been changed in commit 045c13d185 ("Consolidate Linux setrlimit and
getrlimit implementation") to use the prlimit64 syscall instead of the
getrlimit and setrlimit ones.

This patch fixes that by adding a wrapper to fix the value passed to or
received from the kernel, before or after calling the prlimit64 syscall.

Changelog:
[BZ #22648]
* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: New file.
* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Ditto.

6 years agoNEWS: Deprecate static dlopen
Florian Weimer [Fri, 5 Jan 2018 12:57:54 +0000 (13:57 +0100)]
NEWS: Deprecate static dlopen

6 years agoNEWS: Deprecate direct access libio internals
Florian Weimer [Fri, 5 Jan 2018 12:57:48 +0000 (13:57 +0100)]
NEWS: Deprecate direct access libio internals

6 years agoIncrease some test timeouts.
Joseph Myers [Thu, 4 Jan 2018 21:58:40 +0000 (21:58 +0000)]
Increase some test timeouts.

This patch increases timeouts on three tests I observed timing out on
slow systems.

* malloc/tst-malloc-tcache-leak.c (TIMEOUT): Define to 50.
* posix/tst-glob-tilde.c (TIMEOUT): Define to 200.
* resolv/tst-resolv-res_ninit.c (TIMEOUT): Define to 50.

6 years agoalpha: Remove s_trunc{f} implementation (BZ#22666)
Adhemerval Zanella [Wed, 3 Jan 2018 19:03:48 +0000 (17:03 -0200)]
alpha: Remove s_trunc{f} implementation (BZ#22666)

As discussed in libc-alpha [1], alpha trunc{f} implementation uses
addt/suc and subt/suc and although the Alpha Architecture
Handbook version 3 states that that ADDx SUBx OUTPUT Exceptions
(B.3 Mapping to IEEE Standard) should not generate Inexact if INE
bit is set, the Alpha 21264 [2] chip manual (A.8 IEEE Floating-Point
Conformance) states that ADDx SUBx OUTPUT does generate inexact
exception for inexact result regardless.

As Joseph noted [3] to correctly fix it on alpha we need to either
avoid the instruction or avoid any inexact bit from it being set
on return from the function (while preserving the inexact bit that
might be set on the entry to the function).  The later will result
mf_fpcr followed by a mt_fpcr to get and set the fpcr which will
defeat the optimization itself.

So the patch just remove the alpha optimized and rely on generic
implementation.  It fixes the math/test-*-{trunc} on alpha.

        [BZ #15479]
        [BZ #22666]
        * sysdeps/alpha/fpu/s_trunc.c: Remove file.
        * sysdeps/alpha/fpu/s_truncf.c: Likewise.

[1] https://sourceware.org/ml/libc-alpha/2018-01/msg00114.html
[2] https://www.star.bnl.gov/public/daq/HARDWARE/21264_data_sheet.pdf
[3] https://sourceware.org/ml/libc-alpha/2018-01/msg00086.html

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoalpha: Remove s_ceil{f} and s_floor{f} implementation (BZ#22665)
Adhemerval Zanella [Wed, 3 Jan 2018 17:36:53 +0000 (15:36 -0200)]
alpha: Remove s_ceil{f} and s_floor{f} implementation (BZ#22665)

As discussed in libc-alpha [1], alpha ceil{f} and floor{f}
implementation uses cvttq/svm and although the Alpha Architecture
Handbook version 3 states that that CVTfi OUTPUT Exceptions
(B.3 Mapping to IEEE Standard) should not generate Inexact if INE
bit is set on fpcr, the Alpha 21264 [1] chip manual (A.8 IEEE
Floating-Point Conformance) states that CVTfi and CVTif OUTPUT
does generate inexact exception for inexact result regardless.

As Joseph noted [2] to correctly fix it on alpha we need to either
avoid the instruction or avoid any inexact bit from it being set
on return from the function (while preserving the inexact bit that
might be set on the entry to the function).  The later will result
mf_fpcr followed by a mt_fpcr to get and set the fpcr which will
defeat the optimization itself.

So the patch just remove the alpha optimized and rely on generic
implementation.  It fixes the math/test-*-{ceil,floor} on alpha.

[BZ #15479]
[BZ #22665]
* sysdeps/alpha/fpu/s_ceil.c: Remove file.
* sysdeps/alpha/fpu/s_ceilf.c: Likewise.
* sysdeps/alpha/fpu/s_floor.c: Likewise.
* sysdeps/alpha/fpu/s_floorf.c: Likewise.

[1] https://www.star.bnl.gov/public/daq/HARDWARE/21264_data_sheet.pdf
[2] https://sourceware.org/ml/libc-alpha/2018-01/msg00086.html

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoi386: In makecontext, align the stack before calling exit [BZ #22667]
Florian Weimer [Thu, 4 Jan 2018 17:00:05 +0000 (18:00 +0100)]
i386: In makecontext, align the stack before calling exit [BZ #22667]

Before this change, if glibc was compiled with SSE instructions and a
sufficiently recent GCC, an unaligned stack access in
__run_exit_handlers would cause stdlib/tst-makecontext to crash.

6 years agoelf: Support dlvsym within libc.so
Florian Weimer [Thu, 4 Jan 2018 17:46:17 +0000 (18:46 +0100)]
elf: Support dlvsym within libc.so

This commit adds a new _dl_open_hook entry for dlvsym and implements the
function using the existing dl_lookup_symbol_x function supplied by the
dynamic loader.

A new hook variable, _dl_open_hook2, is introduced, which should make
this change suitable for backporting: For old statically linked
binaries, __libc_dlvsym will always return NULL.

6 years agosupport_enter_mount_namespace: Fix indentation
Samuel Thibault [Thu, 4 Jan 2018 14:11:41 +0000 (15:11 +0100)]
support_enter_mount_namespace: Fix indentation

* support/support_enter_mount_namespace.c: Fix indentation.

6 years agoMention CVE-2017-16997 in ChangeLog
Florian Weimer [Thu, 4 Jan 2018 12:39:21 +0000 (13:39 +0100)]
Mention CVE-2017-16997 in ChangeLog

6 years agohurd: Fix support/support_enter_mount_namespace.c build
Samuel Thibault [Wed, 3 Jan 2018 23:54:13 +0000 (00:54 +0100)]
hurd: Fix support/support_enter_mount_namespace.c build

* support/support_enter_mount_namespace.c [!CLONE_NEWNS]: Do not
include <sys/mount.h>.

6 years agoImprove math_errhandling
Wilco Dijkstra [Wed, 3 Jan 2018 13:14:10 +0000 (13:14 +0000)]
Improve math_errhandling

Currently math_errhandling is always set to MATH_ERRNO | MATH_ERREXCEPT
even if -fno-math-errno is used.  It is not defined at all when fast-math
is used.  Set it to 0 with fast-math - this is noncomforming but more
useful than not define math_errhandling at all. Also take __NO_MATH_ERRNO__
into account and update comment.

* math/math.h (math_errhandling): Set to 0 with __FAST_MATH__.
Add __NO_MATH_ERRNO__ check.

6 years agoUpdate MIPS libm-test-ulps.
Joseph Myers [Tue, 2 Jan 2018 21:55:15 +0000 (21:55 +0000)]
Update MIPS libm-test-ulps.

* sysdeps/mips/mips32/libm-test-ulps: Update.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.