Commit Graph

38300 Commits

Author SHA1 Message Date
Adhemerval Zanella
716c4027b0 elf: Fix tst-align3
The elf/tst-align3.c declares the function using a wrong prototype.

Checked on aarch64-linux-gnu.
2022-01-18 14:38:15 -03:00
Florian Weimer
c90363403b elf: Move _dl_setup_hash to its own file
And compile it with the early CFLAGS.  _dl_setup_hash is called
very early for the ld.so link map, so it should be compiled
differently.

Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
Tested-by: Stefan Liebler <stli@linux.ibm.com>
2022-01-18 14:40:21 +01:00
Samuel Thibault
f8b765bec4 htl: Fix build error in annexc
We were getting

../scripts/evaluate-test.sh posix/annexc $? true false > /usr/src/glibc-upstream/build/posix/annexc.test-result
In file included from ../include/pthread.h:1,
                 from <stdin>:1:
../sysdeps/htl/include/pthread.h:7:62: error: missing binary operator before token "("
    7 | # if defined __USE_EXTERN_INLINES && defined _LIBC && !IS_IN (libsupport)
      |                                                              ^
2022-01-17 23:18:27 +00:00
Adhemerval Zanella
3a5aeba87a elf: Reinstate tst-audit17
9926f6e2ee ("elf: Skip tst-auditlogmod-* if the linker doesn't support
--depaudit [BZ #28 151]") dropped the test by mistake.
2022-01-17 17:16:33 -03:00
Aurelien Jarno
c242fcce06 x86: use default cache size if it cannot be determined [BZ #28784]
In some cases (e.g QEMU, non-Intel/AMD CPU) the cache information can
not be retrieved and the corresponding values are set to 0.

Commit 2d651eb926 ("x86: Move x86 processor cache info to
cpu_features") changed the behaviour in such case by defining the
__x86_shared_cache_size and __x86_data_cache_size variables to 0 instead
of using the default values. This cause an issue with the i686 SSE2
optimized bzero/routine which assumes that the cache size is at least
128 bytes, and otherwise tries to zero/set the whole address space minus
128 bytes.

Fix that by restoring the original code to only update
__x86_shared_cache_size and __x86_data_cache_size variables if the
corresponding cache sizes are not zero.

Fixes bug 28784
Fixes commit 2d651eb926

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-01-17 19:42:46 +01:00
Samuel Thibault
9702a41cee rt/tst-mqueue*: Return UNSUPPORTED when mq_open fails with ENOSYS
Rather than returning 0 or a failure.
2022-01-17 19:17:41 +01:00
Adhemerval Zanella
5f3a7ebc35 Linux: Add epoll_pwait2 (BZ #27359)
It is similar to epoll_wait, with the difference the timeout has
nanosecond resoluting by using struct timespec instead of int.

Although Linux interface only provides 64 bit time_t support, old
32 bit interface is also provided (so keep in sync with current
practice and to no force opt-in on 64 bit time_t).

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

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-01-17 14:34:54 -03:00
H.J. Lu
ded3aeb202 Properly handle --disable-default-pie [BZ #28780]
When --disable-default-pie is used, all glibc programs and the testsuite
should be built as position dependent executables (non-PIE), regardless
if the build compiler supports PIE or static PIE.

When --disable-default-pie is used, don't build static PIE by default.

This fixes BZ #28780.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-01-17 07:27:25 -08:00
Adhemerval Zanella
9fe6f63638 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.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-01-17 10:57:09 -03:00
Adhemerval Zanella
cedd498dbc Revert "elf: Fix 64 time_t support for installed statically binaries"
This reverts commit 0b8e83eb14.
2022-01-17 10:56:58 -03:00
Florian Weimer
f545ad4928 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>
2022-01-17 10:47:58 +01:00
Martin Sebor
ef972a4c50 sunrpc: Test case for clnt_create "unix" buffer overflow (bug 22542)
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-01-17 10:22:07 +01:00
Florian Weimer
226b46770c 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>
2022-01-17 10:22:00 +01:00
Florian Weimer
e368b12f6c socket: Add the __sockaddr_un_set function
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-01-17 10:21:53 +01:00
Florian Weimer
06200aac9b elf/tst-dl_find_object: Disable subtests for non-contiguous maps (bug 28732)
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-01-17 09:58:27 +01:00
Florian Weimer
8eb2510d38 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>
2022-01-17 09:58:27 +01:00
Florian Weimer
b4d4ff8963 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>
2022-01-17 09:58:27 +01:00
Samuel Thibault
0eb230ccce hurd: Make RPC input array parameters const
This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server
side")
2022-01-16 18:48:08 +00:00
Samuel Thibault
41a11a5e83 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.
2022-01-16 00:02:16 +01:00
Samuel Thibault
54dda2cdba 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).
2022-01-15 23:42:35 +01:00
Samuel Thibault
84a9d5835a hurd: Fix exec() leak on proc_task2proc failure
env is allocated after args, so should be freed before it.
2022-01-15 21:58:39 +01:00
Samuel Thibault
1bd7a06a95 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.
2022-01-15 21:31:08 +01:00
Samuel Thibault
c1105e34ac htl: Clear kernel_thread field before releasing the thread structure
Otherwise this is a use-after-free.
2022-01-15 21:31:08 +01:00
Samuel Thibault
630d2568a1 hurd: drop SA_SIGINFO availability xfail
BZ #23089 was fixed by d865ff74ba ("hurd: implement SA_SIGINFO signal
handlers")
2022-01-15 17:43:07 +01:00
Samuel Thibault
67ca1c5560 hurd: Fix timer/clock_getres crash on NULL res parameter
POSIX allows res to be NULL.
2022-01-15 15:37:03 +01:00
Samuel Thibault
2c040d0b90 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.
2022-01-15 15:11:54 +01:00
Samuel Thibault
dfb204d87f [hurd] Drop spurious #ifdef SHARED
The whole file is already #ifdef SHARED
2022-01-15 14:23:37 +01:00
Samuel Thibault
f05faf5f22 [hurd] Call _dl_sort_maps_init in _dl_sysdep_start
This follows 15a0c5730d ("elf: Fix slow DSO sorting behavior in
dynamic loader (BZ #17645)").
2022-01-15 14:21:53 +01:00
Samuel Thibault
4974c7cd8f elf tst-dl_find_object: Fix typo
mod1 was xdlclose()d a few lines above.
2022-01-15 13:58:56 +01:00
Florian Weimer
f01d482f03 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>
2022-01-14 20:17:58 +01:00
Florian Weimer
990c953bce 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>
2022-01-14 20:17:49 +01:00
Florian Weimer
5501164866 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>
2022-01-14 20:17:40 +01:00
Florian Weimer
9ba202c78f Add --with-rtld-early-cflags configure option
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-01-14 20:17:15 +01:00
Florian Weimer
b693d75f0c 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>
2022-01-14 20:17:05 +01:00
Florian Weimer
7de01e60c2 elf/Makefile: Reflow and sort most variable assignments
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-01-14 20:16:35 +01:00
Florian Weimer
ef7c6d42fe 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>
2022-01-14 16:09:20 +01:00
Florian Weimer
5732a881aa 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>
2022-01-14 16:09:20 +01:00
Sunil K Pandey
047512374a 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>
2022-01-14 06:00:06 -08:00
H.J. Lu
7de501f941 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>
2022-01-14 05:07:29 -08:00
Joseph Myers
4997a533ae 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.
2022-01-13 22:18:13 +00:00
Florian Weimer
a78e6a10d0 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>
2022-01-13 14:59:44 +01:00
Siddhesh Poyarekar
f9dab1b5f2 stdlib: Fix formatting of tests list in Makefile
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-01-13 18:50:55 +05:30
Siddhesh Poyarekar
5b766603ef stdlib: Sort tests in Makefile
Put one test per line and sort them.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-01-13 10:34:37 +05:30
Sunil K Pandey
49e2bf58d5 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>
2022-01-12 13:23:22 -08:00
Siddhesh Poyarekar
fcfc908681 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>
2022-01-12 23:34:48 +05:30
Siddhesh Poyarekar
db27f1251b 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>
2022-01-12 23:34:23 +05:30
Adhemerval Zanella
f0ed50e1c7 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.
2022-01-12 12:48:20 -03:00
Adhemerval Zanella
572e0c8554 Revert "linux: Fix ancillary 64-bit time timestamp conversion (BZ #28349, BZ #28350)"
This reverts commit 21e0f45c7d.
2022-01-12 10:35:06 -03:00
Adhemerval Zanella
5bd83aa836 Revert "support: Add support_socket_so_timestamp_time64"
This reverts commit a4cf12360f.
2022-01-12 10:35:02 -03:00
Adhemerval Zanella
62db87ab24 timezone: Fix tst-bz28707 Makefile rule
The $(testdata)/XT5 rule is ambiguous and it may not be correct
evaluated.
2022-01-12 10:30:10 -03:00