]> sourceware.org Git - glibc.git/log
glibc.git
2 years agoCVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug 28768)
Florian Weimer [Mon, 17 Jan 2022 09:21:34 +0000 (10:21 +0100)]
CVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug 28768)

The sunrpc function svcunix_create suffers from a stack-based buffer
overflow with overlong pathname arguments.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agosunrpc: Test case for clnt_create "unix" buffer overflow (bug 22542)
Martin Sebor [Mon, 17 Jan 2022 09:21:34 +0000 (10:21 +0100)]
sunrpc: Test case for clnt_create "unix" buffer overflow (bug 22542)

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agoCVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix" (bug 22542)
Florian Weimer [Mon, 17 Jan 2022 09:21:34 +0000 (10:21 +0100)]
CVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix" (bug 22542)

Processing an overlong pathname in the sunrpc clnt_create function
results in a stack-based buffer overflow.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agosocket: Add the __sockaddr_un_set function
Florian Weimer [Mon, 17 Jan 2022 09:21:34 +0000 (10:21 +0100)]
socket: Add the __sockaddr_un_set function

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agoelf/tst-dl_find_object: Disable subtests for non-contiguous maps (bug 28732)
Florian Weimer [Mon, 17 Jan 2022 08:57:19 +0000 (09:57 +0100)]
elf/tst-dl_find_object: Disable subtests for non-contiguous maps (bug 28732)

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agoelf: Set l_contiguous to 1 for the main map in more cases
Florian Weimer [Mon, 17 Jan 2022 08:57:19 +0000 (09:57 +0100)]
elf: Set l_contiguous to 1 for the main map in more cases

l_contiguous was not initialized at all for the main map and
always 0.  This commit adds code to check if the LOAD segments
are adjacent to each other, and sets l_contiguous accordingly.
This helps _dl_find_object because it is more efficient if the
main mapping is contiguous.

Note that not all (PIE or non-PIE) binaries are contiguous in this
way because BFD ld creates executables with LOAD holes:

ELF LOAD segments creating holes in the process image on GNU/Linux
https://sourceware.org/pipermail/binutils/2022-January/119082.html
https://sourceware.org/bugzilla/show_bug.cgi?id=28743

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agoelf: Introduce rtld_setup_main_map
Florian Weimer [Mon, 17 Jan 2022 08:57:19 +0000 (09:57 +0100)]
elf: Introduce rtld_setup_main_map

This function collects most of the processing needed to initialize
the link map for the main executable.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agohurd: Make RPC input array parameters const
Samuel Thibault [Sun, 16 Jan 2022 18:28:40 +0000 (18:28 +0000)]
hurd: Make RPC input array parameters const

This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server
side")

2 years agohurd: optimize exec cleanup
Samuel Thibault [Sat, 15 Jan 2022 23:02:16 +0000 (00:02 +0100)]
hurd: optimize exec cleanup

When ports are nul we do not need to request their deallocation. It is
also useless to look for them in portnames.

2 years agohurd: Add __rtld_execve
Samuel Thibault [Sat, 15 Jan 2022 22:41:14 +0000 (23:41 +0100)]
hurd: Add __rtld_execve

It trivially execs with the same dtable, portarray and intarray, and only
has to take care of deallocating / destroying ports (file, notably).

2 years agohurd: Fix exec() leak on proc_task2proc failure
Samuel Thibault [Sat, 15 Jan 2022 20:58:39 +0000 (21:58 +0100)]
hurd: Fix exec() leak on proc_task2proc failure

env is allocated after args, so should be freed before it.

2 years agohtl: Hide __pthread_attr's __schedparam type [BZ #23088]
Samuel Thibault [Sat, 15 Jan 2022 16:35:51 +0000 (17:35 +0100)]
htl: Hide __pthread_attr's __schedparam type [BZ #23088]

The content of the structure is only used internally, so we can make
__pthread_attr_getschedparam and __pthread_attr_setschedparam convert
between the public sched_param type and an internal __sched_param.

This allows to avoid to spuriously expose the sched_param type.

This fixes BZ #23088.

2 years agohtl: Clear kernel_thread field before releasing the thread structure
Samuel Thibault [Sat, 15 Jan 2022 20:30:17 +0000 (21:30 +0100)]
htl: Clear kernel_thread field before releasing the thread structure

Otherwise this is a use-after-free.

2 years agohurd: drop SA_SIGINFO availability xfail
Samuel Thibault [Sat, 15 Jan 2022 16:42:14 +0000 (17:42 +0100)]
hurd: drop SA_SIGINFO availability xfail

BZ #23089 was fixed by d865ff74ba09 ("hurd: implement SA_SIGINFO signal
handlers")

2 years agohurd: Fix timer/clock_getres crash on NULL res parameter
Samuel Thibault [Sat, 15 Jan 2022 14:37:03 +0000 (15:37 +0100)]
hurd: Fix timer/clock_getres crash on NULL res parameter

POSIX allows res to be NULL.

2 years agohurd: Fix pthread_kill on exiting/ted thread
Samuel Thibault [Sat, 15 Jan 2022 13:55:23 +0000 (14:55 +0100)]
hurd: Fix pthread_kill on exiting/ted thread

We have to drop the kernel_thread port from the thread structure, to
avoid pthread_kill's call to _hurd_thread_sigstate trying to reference
it and fail.

2 years ago[hurd] Drop spurious #ifdef SHARED
Samuel Thibault [Sat, 15 Jan 2022 13:23:37 +0000 (14:23 +0100)]
[hurd] Drop spurious #ifdef SHARED

The whole file is already #ifdef SHARED

2 years ago[hurd] Call _dl_sort_maps_init in _dl_sysdep_start
Samuel Thibault [Sat, 15 Jan 2022 13:21:53 +0000 (14:21 +0100)]
[hurd] Call _dl_sort_maps_init in _dl_sysdep_start

This follows 15a0c5730d1d ("elf: Fix slow DSO sorting behavior in
dynamic loader (BZ #17645)").

2 years agoelf tst-dl_find_object: Fix typo
Samuel Thibault [Sat, 15 Jan 2022 12:58:56 +0000 (13:58 +0100)]
elf tst-dl_find_object: Fix typo

mod1 was xdlclose()d a few lines above.

2 years agos390x: Use <gcc-macros.h> in early HWCAP check
Florian Weimer [Fri, 14 Jan 2022 19:16:05 +0000 (20:16 +0100)]
s390x: Use <gcc-macros.h> in early HWCAP check

This is required so that the checks still work if $(early-cflags)
selects a different ISA level.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2 years agox86: Add x86-64-vN check to early startup
Florian Weimer [Fri, 14 Jan 2022 19:16:05 +0000 (20:16 +0100)]
x86: Add x86-64-vN check to early startup

This ISA level covers the glibc build itself.  <dl-hwcap-check.h>
cannot be used because this check (by design) happens before
DL_PLATFORM_INIT and the x86 CPU flags initialization.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agopowerpc64le: Use <gcc-macros.h> in early HWCAP check
Florian Weimer [Fri, 14 Jan 2022 19:16:05 +0000 (20:16 +0100)]
powerpc64le: Use <gcc-macros.h> in early HWCAP check

This is required so that the checks still work if $(early-cflags)
selects a different ISA level.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2 years agoAdd --with-rtld-early-cflags configure option
Florian Weimer [Fri, 14 Jan 2022 19:16:05 +0000 (20:16 +0100)]
Add --with-rtld-early-cflags configure option

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 years agoelf: Split dl-printf.c from dl-misc.c
Florian Weimer [Fri, 14 Jan 2022 19:16:05 +0000 (20:16 +0100)]
elf: Split dl-printf.c from dl-misc.c

This allows to use different compiler flags for the diagnostics
code.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agoelf/Makefile: Reflow and sort most variable assignments
Florian Weimer [Fri, 14 Jan 2022 19:16:05 +0000 (20:16 +0100)]
elf/Makefile: Reflow and sort most variable assignments

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agoGenerate gcc-macros.h
Florian Weimer [Fri, 14 Jan 2022 15:09:20 +0000 (16:09 +0100)]
Generate gcc-macros.h

The file can be used to check the effect of the default compiler
flags on code generation even in areas of the build that uses
non-default compiler flags.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: HAVE_X86_LAHF_SAHF, HAVE_X86_MOVBE and -march=x86-64-vN (bug 28782)
Florian Weimer [Fri, 14 Jan 2022 15:09:20 +0000 (16:09 +0100)]
x86: HAVE_X86_LAHF_SAHF, HAVE_X86_MOVBE and -march=x86-64-vN (bug 28782)

HAVE_X86_LAHF_SAHF is implied by x86-64-v2, and HAVE_X86_MOVBE by
x86-64-v3.

The individual flag does not appear in -fverbose-asm flag output
even if the ISA level implies it.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agomath: Add more inputs to atan2 accuracy tests [BZ #28765]
Sunil K Pandey [Wed, 12 Jan 2022 20:26:35 +0000 (12:26 -0800)]
math: Add more inputs to atan2 accuracy tests [BZ #28765]

This patch adds following inputs:

0x1.bcab29da0e947p-54 0x1.bc41f4d2294b8p-54
0x1.a11891ec004d4p-348 0x1.814830510be26p-348
0x1.b836ed678be29p-588 0x1.b7be6f5a03a8cp-588
0x1.a83f842ef3f73p-633 0x1.a799d8a6677ep-633

to atan2 tests and updates x86_64 double atan2 ulps.

This fixes BZ #28765.

Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2 years agoDisable debuginfod in printer tests [BZ #28757]
H.J. Lu [Sun, 9 Jan 2022 17:06:15 +0000 (09:06 -0800)]
Disable debuginfod in printer tests [BZ #28757]

With gdb-11.1-6.fc35.x86_64, I got

FAIL: nptl/test-cond-printers
FAIL: nptl/test-condattr-printers
FAIL: nptl/test-mutex-printers
FAIL: nptl/test-mutexattr-printers
FAIL: nptl/test-rwlock-printers
FAIL: nptl/test-rwlockattr-printers

$ cat nptl/test-condattr-printers.out
Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response:  Temporary breakpoint 1 at 0x11d5: file test-condattr-printers.c, line 43.
Starting program: /export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/nptl/test-condattr-printers

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.fedoraproject.org/
Enable debuginfod for this session? (y or [n])

Disable debuginfod to avoid GDB messages.  This fixes BZ #28757.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 years agoUpdate syscall lists for Linux 5.16
Joseph Myers [Thu, 13 Jan 2022 22:18:13 +0000 (22:18 +0000)]
Update syscall lists for Linux 5.16

Linux 5.16 has one new syscall, futex_waitv.  Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.

2 years agoi386: Remove broken CAN_USE_REGISTER_ASM_EBP (bug 28771)
Florian Weimer [Thu, 13 Jan 2022 13:59:29 +0000 (14:59 +0100)]
i386: Remove broken CAN_USE_REGISTER_ASM_EBP (bug 28771)

The configure check for CAN_USE_REGISTER_ASM_EBP tried to compile a
simple function that uses %ebp as an inline assembly operand.  If
compilation failed, CAN_USE_REGISTER_ASM_EBP was set 0, which
eventually had these consequences:

(1) %ebx was avoided as an inline assembly operand, with an
    assembler macro hack to avoid unnecessary register moves.
(2) %ebp was avoided as an inline assembly operand, using an
    out-of-line syscall function for 6-argument system calls.

(1) is no longer needed for any GCC version that is supported for
building glibc.  %ebx can be used directly as a register operand.
Therefore, this commit removes the %ebx avoidance completely.  This
avoids the assembler macro hack, which turns out to be incompatible
with the current Systemtap probe macros (which switch to .altmacro
unconditionally).

(2) is still needed in many build configurations.  The existing
configure check cannot really capture that because the simple function
succeeds to compile, while the full glibc build still fails.
Therefore, this commit removes the check, the CAN_USE_REGISTER_ASM_EBP
macro, and uses the out-of-line syscall function for 6-argument system
calls unconditionally.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agostdlib: Fix formatting of tests list in Makefile
Siddhesh Poyarekar [Thu, 13 Jan 2022 13:20:55 +0000 (18:50 +0530)]
stdlib: Fix formatting of tests list in Makefile

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 years agostdlib: Sort tests in Makefile
Siddhesh Poyarekar [Thu, 13 Jan 2022 05:04:37 +0000 (10:34 +0530)]
stdlib: Sort tests in Makefile

Put one test per line and sort them.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agox86_64: Fix SSE4.2 libmvec atan2 function accuracy [BZ #28765]
Sunil K Pandey [Wed, 12 Jan 2022 19:02:19 +0000 (11:02 -0800)]
x86_64: Fix SSE4.2 libmvec atan2 function accuracy [BZ #28765]

This patch fixes SSE4.2 libmvec atan2 function accuracy for following
inputs to less than 4 ulps.

{0x1.bcab29da0e947p-54,0x1.bc41f4d2294b8p-54}   4.19888 ulps
{0x1.b836ed678be29p-588,0x1.b7be6f5a03a8cp-588} 4.09889 ulps

This fixes BZ #28765.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agodebug: Synchronize feature guards in fortified functions [BZ #28746]
Siddhesh Poyarekar [Wed, 12 Jan 2022 18:04:48 +0000 (23:34 +0530)]
debug: Synchronize feature guards in fortified functions [BZ #28746]

Some functions (e.g. stpcpy, pread64, etc.) had moved to POSIX in the
main headers as they got incorporated into the standard, but their
fortified variants remained under __USE_GNU.  As a result, these
functions did not get fortified when _GNU_SOURCE was not defined.

Add test wrappers that check all functions tested in tst-chk0 at all
levels with _GNU_SOURCE undefined and then use the failures to (1)
exclude checks for _GNU_SOURCE functions in these tests and (2) Fix
feature macro guards in the fortified function headers so that they're
the same as the ones in the main headers.

This fixes BZ #28746.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agodebug: Autogenerate _FORTIFY_SOURCE tests
Siddhesh Poyarekar [Wed, 12 Jan 2022 18:04:23 +0000 (23:34 +0530)]
debug: Autogenerate _FORTIFY_SOURCE tests

Rename debug/tst-chk1.c to debug/tst-fortify.c and add make hackery to
autogenerate tests with different macros enabled to build and run the
same test with different configurations as well as different
fortification levels.

The change also ends up expanding the -lfs tests to include
_FORTIFY_SOURCE=3.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoDo not build libresolv module with 64 bit time_t flags
Adhemerval Zanella [Wed, 12 Jan 2022 15:48:20 +0000 (12:48 -0300)]
Do not build libresolv module with 64 bit time_t flags

It is not used to build installed programs.  It also fixes
resolv/tst-p_secstodate on big endian machines.

Checked on i686-linux-gnu and powerpc-linux-gnu-power4.

2 years agoRevert "linux: Fix ancillary 64-bit time timestamp conversion (BZ #28349, BZ #28350)"
Adhemerval Zanella [Wed, 12 Jan 2022 13:35:06 +0000 (10:35 -0300)]
Revert "linux: Fix ancillary 64-bit time timestamp conversion (BZ #28349, BZ #28350)"

This reverts commit 21e0f45c7d73df6fe30c77ffcc9f81410e2ee369.

2 years agoRevert "support: Add support_socket_so_timestamp_time64"
Adhemerval Zanella [Wed, 12 Jan 2022 13:35:02 +0000 (10:35 -0300)]
Revert "support: Add support_socket_so_timestamp_time64"

This reverts commit a4cf12360fb7a8eae4fa4923763309b7f10797c3.

2 years agotimezone: Fix tst-bz28707 Makefile rule
Adhemerval Zanella [Mon, 10 Jan 2022 13:17:18 +0000 (10:17 -0300)]
timezone: Fix tst-bz28707 Makefile rule

The $(testdata)/XT5 rule is ambiguous and it may not be correct
evaluated.

2 years agolinux: Fix ancillary 64-bit time timestamp conversion (BZ #28349, BZ #28350)
Adhemerval Zanella [Mon, 27 Sep 2021 19:07:08 +0000 (16:07 -0300)]
linux: Fix ancillary 64-bit time timestamp conversion (BZ #28349, BZ #28350)

The __convert_scm_timestamps() only updates the control message last
pointer for SOL_SOCKET type, so if the message control buffer contains
multiple ancillary message types the converted timestamp one might
overwrite a valid message.

The test check if the extra ancillary space is correctly handled
by recvmsg/recvmmsg, where if there is no extra space for the 64-bit
time_t converted message the control buffer should be marked with
MSG_TRUNC.  It also check if recvmsg/recvmmsg handle correctly multiple
ancillary data.

Checked on x86_64-linux and on i686-linux-gnu on both 5.11 and
4.15 kernel.

Co-authored-by: Fabian Vogt <fvogt@suse.de>
2 years agosupport: Add support_socket_so_timestamp_time64
Adhemerval Zanella [Mon, 19 Jul 2021 14:38:15 +0000 (11:38 -0300)]
support: Add support_socket_so_timestamp_time64

Check if the socket support 64-bit network packages timestamps
(SO_TIMESTAMP and SO_TIMESTAMPNS).  This will be used on recvmsg
and recvmmsg tests to check if the timestamp should be generated.

2 years agoelf: Fix 64 time_t support for installed statically binaries
Adhemerval Zanella [Wed, 29 Dec 2021 13:20:46 +0000 (10:20 -0300)]
elf: Fix 64 time_t support for installed statically binaries

The usage of internal static symbol for statically linked binaries
does not work correctly for objects built with -D_TIME_BITS=64,
since the internal definition does not provide the expected aliases.

This patch makes it to use the default stat functions instead (which
uses the default 64 time_t alias and types).

Checked on i686-linux-gnu.

2 years agoEnable _FORTIFY_SOURCE=3 for gcc 12 and above
Siddhesh Poyarekar [Wed, 12 Jan 2022 13:16:28 +0000 (18:46 +0530)]
Enable _FORTIFY_SOURCE=3 for gcc 12 and above

gcc 12 now has support for the __builtin_dynamic_object_size builtin.
Adapt the macro checks to enable _FORTIFY_SOURCE=3 on gcc 12 and above.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agomanual: Drop obsolete @refill
Siddhesh Poyarekar [Wed, 12 Jan 2022 08:58:44 +0000 (14:28 +0530)]
manual: Drop obsolete @refill

The @refill command has been obsolete for a while and now texinfo has
started warning about it.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agoaarch64: Add HWCAP2_ECV from Linux 5.16
Szabolcs Nagy [Tue, 14 Dec 2021 11:15:07 +0000 (11:15 +0000)]
aarch64: Add HWCAP2_ECV from Linux 5.16

Indicates the availability of enhanced counter virtualization extension
of armv8.6-a with self-synchronized virtual counter CNTVCTSS_EL0 usable
in userspace.

2 years agoUse Linux 5.16 in build-many-glibcs.py
Joseph Myers [Tue, 11 Jan 2022 15:38:06 +0000 (15:38 +0000)]
Use Linux 5.16 in build-many-glibcs.py

This patch makes build-many-glibcs.py use Linux 5.16.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

2 years agox86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
Noah Goldstein [Sun, 9 Jan 2022 22:02:28 +0000 (16:02 -0600)]
x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]

Fixes [BZ# 28755] for wcsncmp by redirecting length >= 2^56 to
__wcscmp_evex. For x86_64 this covers the entire address range so any
length larger could not possibly be used to bound `s1` or `s2`.

test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass.

Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
2 years agox86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
Noah Goldstein [Sun, 9 Jan 2022 22:02:21 +0000 (16:02 -0600)]
x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]

Fixes [BZ# 28755] for wcsncmp by redirecting length >= 2^56 to
__wcscmp_avx2. For x86_64 this covers the entire address range so any
length larger could not possibly be used to bound `s1` or `s2`.

test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass.

Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
2 years agomath: Fix float conversion regressions with gcc-12 [BZ #28713]
Szabolcs Nagy [Fri, 31 Dec 2021 09:50:50 +0000 (09:50 +0000)]
math: Fix float conversion regressions with gcc-12 [BZ #28713]

Converting double precision constants to float is now affected by the
runtime dynamic rounding mode instead of being evaluated at compile
time with default rounding mode (except static object initializers).

This can change the computed result and cause performance regression.
The known correctness issues (increased ulp errors) are already fixed,
this patch fixes remaining cases of unnecessary runtime conversions.

Add float M_* macros to math.h as new GNU extension API.  To avoid
conversions the new M_* macros are used and instead of casting double
literals to float, use float literals (only required if the conversion
is inexact).

The patch was tested on aarch64 where the following symbols had new
spurious conversion instructions that got fixed:

  __clog10f
  __gammaf_r_finite@GLIBC_2.17
  __j0f_finite@GLIBC_2.17
  __j1f_finite@GLIBC_2.17
  __jnf_finite@GLIBC_2.17
  __kernel_casinhf
  __lgamma_negf
  __log1pf
  __y0f_finite@GLIBC_2.17
  __y1f_finite@GLIBC_2.17
  cacosf
  cacoshf
  casinhf
  catanf
  catanhf
  clogf
  gammaf_positive

Fixes bug 28713.

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2 years agoelf: Simplify software TM implementation in _dl_find_object
Florian Weimer [Mon, 10 Jan 2022 12:31:39 +0000 (13:31 +0100)]
elf: Simplify software TM implementation in _dl_find_object

With the current set of fences, the version update at the start
of the TM write operation is redundant, and the version update
at the end does not need to use an atomic read-modify-write
operation.

Also use relaxed MO stores during the dlclose update, and skip any
version changes there.

Suggested-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2 years agoRestore ENTRY_POINT definition on hppa, ia64 (bug 28749)
Florian Weimer [Fri, 7 Jan 2022 13:47:31 +0000 (14:47 +0100)]
Restore ENTRY_POINT definition on hppa, ia64 (bug 28749)

ENTRY_POINT is still needed for elf/rtld.c.  Fixes commit 4fb4e7e821e3
("csu: Always use __executable_start in gmon-start.c").

2 years agoelf: Fix fences in _dl_find_object_update (bug 28745)
Florian Weimer [Fri, 7 Jan 2022 12:21:57 +0000 (13:21 +0100)]
elf: Fix fences in _dl_find_object_update (bug 28745)

As explained in Hans Boehm, Can Seqlocks Get Along with Programming
Language Memory Models?, an acquire fence is needed in
_dlfo_read_success.  The lack of a fence resulted in an observable
bug on powerpc64le compile-time load reordering.

The fence in _dlfo_mappings_begin_update has been reordered, turning
the fence/store sequence into a release MO store equivalent.

Relaxed MO loads are used on the reader side, and relaxed MO stores
on the writer side for the shared data, to avoid formal data races.
This is just to be conservative; it should not actually be necessary
given how the data is used.

This commit also fixes the test run time.  The intent was to run it
for 3 seconds, but 0.3 seconds was enough to uncover the bug very
occasionally (while 3 seconds did not reliably show the bug on every
test run).

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2 years agottydefaults.h: Fix CSTATUS to control-t
Samuel Thibault [Thu, 6 Jan 2022 23:19:42 +0000 (00:19 +0100)]
ttydefaults.h: Fix CSTATUS to control-t

4.4BSD actually defaults CSTATUS to control-t, so our generic header should
as well.

2 years agoAArch64: Check for SVE in ifuncs [BZ #28744]
Wilco Dijkstra [Thu, 6 Jan 2022 14:36:28 +0000 (14:36 +0000)]
AArch64: Check for SVE in ifuncs [BZ #28744]

Add a check for SVE in the A64FX ifuncs for memcpy, memset and memmove.
This fixes BZ #28744.

2 years agodebug: Remove catchsegv and libSegfault (BZ #14913)
Adhemerval Zanella [Mon, 20 Dec 2021 11:41:55 +0000 (08:41 -0300)]
debug: Remove catchsegv and libSegfault (BZ #14913)

Trapping SIGSEGV within the process is error-prone, adds security
issues, and modern analysis design tends to happen out of the
process (either by attaching a debugger or by post-mortem analysis).

The libSegfault also has some design problems, it uses non
async-signal-safe function (backtrace) on signal handler.

There are multiple alternatives if users do want to use similar
functionality, such as sigsegv gnulib module or libsegfault.

2 years agoDocumentation for OpenRISC port
Stafford Horne [Tue, 19 Oct 2021 21:55:18 +0000 (06:55 +0900)]
Documentation for OpenRISC port

OpenRISC architecture specification:

 https://raw.githubusercontent.com/openrisc/doc/master/openrisc-arch-1.3-rev1.pdf

Currently the port as of the 2022-01-03 rebasing there are no known
architecture specific test failures.

Writing credits for the port are:

 Stafford Horne  <shorne@gmail.com>
 Christian Svensson  <blue@cmd.nu>

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agobuild-many-glibcs.py: add OpenRISC support
Stafford Horne [Tue, 19 Oct 2021 21:54:48 +0000 (06:54 +0900)]
build-many-glibcs.py: add OpenRISC support

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: Build Infrastructure
Stafford Horne [Tue, 19 Oct 2021 21:54:11 +0000 (06:54 +0900)]
or1k: Build Infrastructure

Here we define the minumum linux kernel version at 5.4.0, as that is the
long term support version where 32-bit architectures start to support
64-bit time API's.  The OpenRISC kernel had some bugs up until version 5.8
which caused issues with glibc fork/clone, they have been backported to
5.4 but not previous versions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: ABI lists
Stafford Horne [Tue, 19 Oct 2021 21:53:23 +0000 (06:53 +0900)]
or1k: ABI lists

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: Linux ABI
Stafford Horne [Tue, 19 Oct 2021 21:52:38 +0000 (06:52 +0900)]
or1k: Linux ABI

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: Linux Syscall Interface
Stafford Horne [Tue, 19 Oct 2021 21:51:52 +0000 (06:51 +0900)]
or1k: Linux Syscall Interface

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: math soft float support
Stafford Horne [Tue, 19 Oct 2021 21:50:21 +0000 (06:50 +0900)]
or1k: math soft float support

OpenRISC support hard float but I will like to submit that after glibc
soft float goes upstream.  The hard float support depends on adding user
access to the FPCSR, which is not supported by the kernel yet.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: Atomics and Locking primitives
Stafford Horne [Tue, 19 Oct 2021 21:49:18 +0000 (06:49 +0900)]
or1k: Atomics and Locking primitives

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: Thread Local Storage support
Stafford Horne [Tue, 19 Oct 2021 21:48:48 +0000 (06:48 +0900)]
or1k: Thread Local Storage support

OpenRISC includes 3 TLS addressing models.  Local Dynamic optimizations
are not done in the linker and therefore use the same code sequences as
Global Dynamic.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: startup and dynamic linking code
Stafford Horne [Tue, 19 Oct 2021 21:48:11 +0000 (06:48 +0900)]
or1k: startup and dynamic linking code

Code for C runtime startup and dynamic loading including PLT layout.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoor1k: ABI Implementation
Stafford Horne [Tue, 19 Oct 2021 21:47:26 +0000 (06:47 +0900)]
or1k: ABI Implementation

This code deals with the OpenRISC ABI.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agolinux/syscalls: Add or1k_atomic syscall for OpenRISC
Stafford Horne [Sat, 23 May 2020 03:41:31 +0000 (12:41 +0900)]
linux/syscalls: Add or1k_atomic syscall for OpenRISC

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoelf: Add reloc for OpenRISC
Stafford Horne [Sat, 23 May 2020 03:40:35 +0000 (12:40 +0900)]
elf: Add reloc for OpenRISC

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoelf: Add a comment after trailing backslashes
H.J. Lu [Tue, 4 Jan 2022 14:58:34 +0000 (06:58 -0800)]
elf: Add a comment after trailing backslashes

2 years agoelf: Also try DT_RUNPATH for LD_AUDIT dlopen [BZ #28455]
H.J. Lu [Fri, 15 Oct 2021 17:44:49 +0000 (10:44 -0700)]
elf: Also try DT_RUNPATH for LD_AUDIT dlopen [BZ #28455]

DT_RUNPATH is only used to find the immediate dependencies of the
executable or shared object containing the DT_RUNPATH entry.  Update
LD_AUDIT dlopen call to try the DT_RUNPATH entry of the executable.

Add tst-audit14a, which is copied from tst-audit14, to DT_RUNPATH and
build tst-audit14 with -Wl,--disable-new-dtags to test DT_RPATH.

This partially fixes BZ #28455.

2 years agoelf: Fix tst-linkall-static link when pthread is not in libc
Samuel Thibault [Tue, 4 Jan 2022 10:34:29 +0000 (10:34 +0000)]
elf: Fix tst-linkall-static link when pthread is not in libc

In that case we want to link in libanl.a, thus providing getaddrinfo_a.

2 years agoelf: Sort tests and modules-names
H.J. Lu [Mon, 13 Dec 2021 17:43:52 +0000 (09:43 -0800)]
elf: Sort tests and modules-names

Sort tests and modules-names to reduce future conflicts.

2 years agohurd: nuke all unknown ports on exec
Samuel Thibault [Sun, 2 Jan 2022 03:09:30 +0000 (04:09 +0100)]
hurd: nuke all unknown ports on exec

Ports which are not in the ports table or dtable will not make sense for the
new program, so we can nuke them.  Actually we shall, otherwise we would
be leaking various ports, for instance the file_t of the executed program
itself.

2 years agohurd: Fix auth port leak
Samuel Thibault [Sun, 2 Jan 2022 03:08:11 +0000 (04:08 +0100)]
hurd: Fix auth port leak

If access() was used before exec, _hurd_id.rid_auth would cache an
"effective" auth port.  We do not want this to leak into the executed
program.

2 years agoRemove stale reference to libanl.a
Adhemerval Zanella [Mon, 3 Jan 2022 16:54:27 +0000 (13:54 -0300)]
Remove stale reference to libanl.a

Since dbb949f53d4 ("resolv: Move libanl into libc (if libpthread is in
libc)") libanl.a is empty, so linking against it no longer necessary.

2 years agoelf: Add <dl-debug.h>
H.J. Lu [Fri, 10 Dec 2021 02:24:37 +0000 (18:24 -0800)]
elf: Add <dl-debug.h>

Add <dl-debug.h> to setup debugging entry in PT_DYNAMIC segment to support
DT_DEBUG, DT_MIPS_RLD_MAP_REL and DT_MIPS_RLD_MAP.

Tested on x86-64, x32 and i686 as well as with build-many-glibcs.py.

2 years agoProperly check linker option in LIBC_LINKER_FEATURE [BZ #28738]
H.J. Lu [Sun, 2 Jan 2022 14:01:21 +0000 (06:01 -0800)]
Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738]

Update LIBC_LINKER_FEATURE to also check linker warning message since
unknown linker -z option may be ignored by linker:

$ touch x.c
$ gcc -shared -Wl,-z,foobar x.c
/usr/bin/ld: warning: -z foobar ignored
$ echo $?
0
$

This fixes BZ #28738.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 years agohurd: Implement _S_msg_get_dtable
Samuel Thibault [Sun, 2 Jan 2022 01:22:13 +0000 (02:22 +0100)]
hurd: Implement _S_msg_get_dtable

This will be needed for implementing lsof.

2 years agoUpdate automatically-generated copyright dates
Paul Eggert [Sat, 1 Jan 2022 19:29:55 +0000 (11:29 -0800)]
Update automatically-generated copyright dates

These were updated simply by running "make" to regen the files.

2 years agoSync move-if-change from Gnulib, updating copyright
Paul Eggert [Sat, 1 Jan 2022 19:07:20 +0000 (11:07 -0800)]
Sync move-if-change from Gnulib, updating copyright

2 years agoUpdate copyright dates not handled by scripts/update-copyrights.
Paul Eggert [Sat, 1 Jan 2022 19:05:05 +0000 (11:05 -0800)]
Update copyright dates not handled by scripts/update-copyrights.

I've updated copyright dates in glibc for 2022.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.  As well as the usual annual
updates, mainly dates in --version output (minus csu/version.c which
previously had to be handled manually but is now successfully updated
by update-copyrights), there is a small change to the copyright notice
in NEWS which should let NEWS get updated automatically next year.

Please remember to include 2022 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).

2 years agoUpdate copyright dates with scripts/update-copyrights
Paul Eggert [Sat, 1 Jan 2022 18:54:23 +0000 (10:54 -0800)]
Update copyright dates with scripts/update-copyrights

I used these shell commands:

../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")

and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 7061 files FOO.

I then removed trailing white space from math/tgmath.h,
support/tst-support-open-dev-null-range.c, and
sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following
obscure pre-commit check failure diagnostics from Savannah.  I don't
know why I run into these diagnostics whereas others evidently do not.

remote: *** 912-#endif
remote: *** 913:
remote: *** 914-
remote: *** error: lines with trailing whitespace found
...
remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines

2 years agohurd: Use __trivfs_server_name instead of trivfs_server_name
Samuel Thibault [Sat, 1 Jan 2022 16:51:18 +0000 (17:51 +0100)]
hurd: Use __trivfs_server_name instead of trivfs_server_name

The latter violates namespace contraints

2 years agohurd: Bump BRK_START to 0x20000000
Samuel Thibault [Fri, 31 Dec 2021 17:25:49 +0000 (18:25 +0100)]
hurd: Bump BRK_START to 0x20000000

By nowadays uses, 256MiB is not that large for the program+libraries.
Let's push the heap further to leave room for e.g. clang.

2 years agohurd: Avoid overzealous shared objects constraints
Samuel Thibault [Fri, 31 Dec 2021 17:17:40 +0000 (18:17 +0100)]
hurd: Avoid overzealous shared objects constraints

407765e9f24f ("hurd: Fix ELF_MACHINE_USER_ADDRESS_MASK value") switched
ELF_MACHINE_USER_ADDRESS_MASK from 0xf8000000UL to 0xf0000000UL to let
libraries etc. get loaded at 0x08000000. But
ELF_MACHINE_USER_ADDRESS_MASK is actually only meaningful for the main
program anyway, so keep it at 0xf8000000UL to prevent the program loader
from putting ld.so beyond 0x08000000. And conversely, drop the use of
ELF_MACHINE_USER_ADDRESS_MASK for shared objects, which don't need any
constraints since the program will have already be loaded by then.

2 years agotime: Refactor timesize.h for some ABIs
Adhemerval Zanella [Fri, 31 Dec 2021 13:58:13 +0000 (10:58 -0300)]
time: Refactor timesize.h for some ABIs

Commit a4b413135535c83a changed default __TIMESIZE to 64, however
it added sub-architecture timesize.h for powerpc, s390, and
sparc.

Also simplify mips by removing _MIPS_SIM usage (which would require
to add sgidefs inclusion.

2 years agohurd: Make getrandom a stub inside the random translator
Samuel Thibault [Thu, 30 Dec 2021 20:25:24 +0000 (21:25 +0100)]
hurd: Make getrandom a stub inside the random translator

glibc uses /dev/urandom for getrandom(), and from version 2.34 malloc
initialization uses it. We have to detect when we are running the random
translator itself, in which case we can't read ourself.

2 years agoopen64: Force O_LARGEFILE on all architectures
Stafford Horne [Sun, 26 Dec 2021 06:24:53 +0000 (15:24 +0900)]
open64: Force O_LARGEFILE on all architectures

When running tests on OpenRISC which has 32-bit wordsize but 64-bit
timesize it was found that O_LARGEFILE is not being set when calling
open64.  For 64-bit architectures the O_LARGEFILE flag is generally
implied by the kernel according to force_o_largefile.  However, for
32-bit architectures this is not done.

For this patch we unconditionally now set the O_LARGEFILE flag for
open64 class syscalls as there is no harm in doing so.

Tested on the OpenRISC the build works and timezone/tst-tzset passes
which was failing before.  I would expect this also would fix arc.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agox86-64: Add vector tan/tanf implementation to libmvec
Sunil K Pandey [Wed, 29 Dec 2021 18:19:39 +0000 (10:19 -0800)]
x86-64: Add vector tan/tanf implementation to libmvec

Implement vectorized tan/tanf containing SSE, AVX, AVX2 and
AVX512 versions for libmvec as per vector ABI.  It also contains
accuracy and ABI tests for vector tan/tanf with regenerated ulps.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86-64: Add vector erfc/erfcf implementation to libmvec
Sunil K Pandey [Wed, 29 Dec 2021 18:13:20 +0000 (10:13 -0800)]
x86-64: Add vector erfc/erfcf implementation to libmvec

Implement vectorized erfc/erfcf containing SSE, AVX, AVX2 and
AVX512 versions for libmvec as per vector ABI.  It also contains
accuracy and ABI tests for vector erfc/erfcf with regenerated ulps.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agoresolv: Do not install libanl.so symbolic link
Adhemerval Zanella [Thu, 30 Dec 2021 12:00:41 +0000 (09:00 -0300)]
resolv: Do not install libanl.so symbolic link

2 years agoresolv: Do not build libanl.so for ABIs starting at 2.35
Adhemerval Zanella [Thu, 30 Dec 2021 11:57:56 +0000 (08:57 -0300)]
resolv: Do not build libanl.so for ABIs starting at 2.35

2 years agotimezone: test-case for BZ #28707
Hans-Peter Nilsson [Fri, 17 Dec 2021 20:45:54 +0000 (21:45 +0100)]
timezone: test-case for BZ #28707

This test-case is the tzfile for Asuncion generated by
tzlib-2021e as follows, using the tzlib-2021e zic: "zic -d
DEST -r @1546300800 -L /dev/null -b slim
SOURCE/southamerica".  Note that in its type 2 header, it
has two entries in its "time-types" array (types), but only
one entry in its "transition types" array (type_idxs).

* timezone/Makefile, timezone/tst-pr28707.c,
timezone/testdata/gen-XT5.sh: New test.

Co-authored-by: Christopher Wong <Christopher.Wong@axis.com>
2 years agotimezone: handle truncated timezones from tzcode-2021d and later (BZ #28707)
Hans-Peter Nilsson [Fri, 17 Dec 2021 20:38:00 +0000 (21:38 +0100)]
timezone: handle truncated timezones from tzcode-2021d and later (BZ #28707)

When using a timezone file with a truncated starting time,
generated by the zic in IANA tzcode-2021d a.k.a. tzlib-2021d
(also in tzlib-2021e; current as of this writing), glibc
asserts in __tzfile_read (on e.g. tzset() for this file) and
you may find lines matching "tzfile.c:435: __tzfile_read:
Assertion `num_types == 1' failed" in your syslog.

One example of such a file is the tzfile for Asuncion
generated by tzlib-2021e as follows, using the tzlib-2021e zic:
"zic -d DEST -r @1546300800 -L /dev/null -b slim
SOURCE/southamerica".  Note that in its type 2 header, it has
two entries in its "time-types" array (types), but only one
entry in its "transition types" array (type_idxs).

This is valid and expected already in the published RFC8536, and
not even frowned upon: "Local time for timestamps before the
first transition is specified by the first time type (time type
0)" ... "every nonzero local time type index SHOULD appear at
least once in the transition type array".  Note the "nonzero ...
index".  Until the 2021d zic, index 0 has been shared by the
first valid transition but with 2021d it's separate, set apart
as a placeholder and only "implicitly" indexed.  (A draft update
of the RFC mandates that the entry at index 0 is a placeholder
in this case, hence can no longer be shared.)

* time/tzfile.c (__tzfile_read): Don't assert when no transitions
are found.

Co-authored-by: Christopher Wong <Christopher.Wong@axis.com>
2 years agox86-64: Add vector asinh/asinhf implementation to libmvec
Sunil K Pandey [Wed, 29 Dec 2021 18:07:02 +0000 (10:07 -0800)]
x86-64: Add vector asinh/asinhf implementation to libmvec

Implement vectorized asinh/asinhf containing SSE, AVX, AVX2 and
AVX512 versions for libmvec as per vector ABI.  It also contains
accuracy and ABI tests for vector asinh/asinhf with regenerated ulps.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86-64: Add vector tanh/tanhf implementation to libmvec
Sunil K Pandey [Wed, 29 Dec 2021 18:00:47 +0000 (10:00 -0800)]
x86-64: Add vector tanh/tanhf implementation to libmvec

Implement vectorized tanh/tanhf containing SSE, AVX, AVX2 and
AVX512 versions for libmvec as per vector ABI.  It also contains
accuracy and ABI tests for vector tanh/tanhf with regenerated ulps.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86-64: Add vector erf/erff implementation to libmvec
Sunil K Pandey [Wed, 29 Dec 2021 17:54:31 +0000 (09:54 -0800)]
x86-64: Add vector erf/erff implementation to libmvec

Implement vectorized erf/erff containing SSE, AVX, AVX2 and
AVX512 versions for libmvec as per vector ABI.  It also contains
accuracy and ABI tests for vector erf/erff with regenerated ulps.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86-64: Add vector acosh/acoshf implementation to libmvec
Sunil K Pandey [Wed, 29 Dec 2021 17:48:17 +0000 (09:48 -0800)]
x86-64: Add vector acosh/acoshf implementation to libmvec

Implement vectorized acosh/acoshf containing SSE, AVX, AVX2 and
AVX512 versions for libmvec as per vector ABI.  It also contains
accuracy and ABI tests for vector acosh/acoshf with regenerated ulps.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86-64: Add vector atanh/atanhf implementation to libmvec
Sunil K Pandey [Wed, 29 Dec 2021 17:42:04 +0000 (09:42 -0800)]
x86-64: Add vector atanh/atanhf implementation to libmvec

Implement vectorized atanh/atanhf containing SSE, AVX, AVX2 and
AVX512 versions for libmvec as per vector ABI.  It also contains
accuracy and ABI tests for vector atanh/atanhf with regenerated ulps.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
This page took 0.083726 seconds and 5 git commands to generate.