Commit Graph

39170 Commits

Author SHA1 Message Date
Florian Weimer
bd13cb19f5 scripts/glibcelf.py: Add hashing support
ELF and GNU hashes can now be computed using the elf_hash and
gnu_hash functions.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-08-23 19:33:38 +02:00
Samuel Thibault
af6b1cce98 hurd: Fix starting static binaries with stack protection enabled
gcc introduces gs:0x14 accesses in most functions, so we need some tcbhead
to be ready very early during initialization.  This configures a static area
which can be referenced by various protected functions, until proper TLS is
set up.
2022-08-22 22:34:31 +02:00
Samuel Thibault
4565083abc htl: Make pthread*_cond_timedwait register wref before releasing mutex
Otherwise another thread could be rightly trying to destroy the condition,
see e.g. tst-cond20.
2022-08-22 22:27:24 +02:00
Samuel Thibault
8bf0bc8350 htl: make __pthread_hurd_cond_timedwait_internal check mutex is held
Like __pthread_cond_timedwait_internal already does.
2022-08-22 22:25:27 +02:00
Joseph Myers
4c199499d6 Add AArch64 HWCAP2_* constants from Linux 5.19
Linux 5.19 adds more HWCAP2_* values for AArch64; add these to its
bits/hwcap.h header in glibc.

Tested with build-many-glibcs.py for aarch64-linux-gnu.
2022-08-22 14:59:39 +00:00
Joseph Myers
a727220b37 Add AGROUP from Linux 5.19 to sys/acct.h, remove Alpha version (bug 29502)
Linux 5.19 adds a new accounting flag AGROUP; add it to the
enumeration in sys/acct.h.

This shows up that the Alpha-specific variant of this header has a
different set of constants and struct acct, which appear to be the
constants and structure layout from Linux 2.0.  These were changed
some time between Linux 2.0 and Linux 2.2; I see no evidence of an
Alpha-specific layout or set of constants, but haven't checked the
detailed Linux kernel history between those versions.  Rather, it
looks like tha Alpha-specific header was originally needed because of
the use of types in the kernel structure (such as uid_t and gid_t)
that had different sizes on Alpha, and when glibc was updated for
changes to the structure and constants in the kernel

1998-10-02  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

        * sysdeps/unix/sysv/linux/sys/acct.h: Bring in sync with current
        linux 2.1 version.

that simply omitted to do anything about the Alpha version.

Thus, remove the Alpha version in order to get the updated definitions
into use on Alpha, as I don't think the interfaces are actually
different for Alpha with any kernel version supported by glibc.

Tested for x86_64, and with build-many-glibcs.py for alpha-linux-gnu.
2022-08-22 14:16:57 +00:00
Florian Weimer
e7ad26ee3c alpha: Fix generic brk system call emulation in __brk_call (bug 29490)
The kernel special-cases the zero argument for alpha brk, and we can
use that to restore the generic Linux error handling behavior.

Fixes commit b57ab258c1 ("Linux:
Introduce __brk_call for invoking the brk system call").
2022-08-22 11:05:42 +02:00
Samuel Thibault
f7b0fc5cc6 hurd: Assume non-suid during bootstrap
We do not have a hurd data block only when bootstrapping the system, in
which case we don't have a notion of suid yet anyway.

This is needed, otherwise init_standard_fds would check that standard
file descriptors are allocated, which is meaningless during bootstrap.
2022-08-19 02:26:21 +02:00
Joseph Myers
9125e43daf Use binutils 2.39 branch in build-many-glibcs.py
This patch makes build-many-glibcs.py use binutils 2.39 branch.

Tested with build-many-glibcs.py (compilers and glibcs builds).  Note:
binutils 2.39 shows the same failures for i686-linux-gnu-no-pie,
x86_64-linux-gnu-no-pie and x86_64-linux-gnu-x32-no-pie building the
glibc testsuite as binutils mainline does.
2022-08-18 13:16:56 +00:00
Stefan Liebler
f465b21b06 S390: Fix werror=unused-variable in ifunc-impl-list.c.
If the architecture level set is high enough, no IFUNCs are used at
all and the variable i would be unused.  Then the build fails with:
../sysdeps/s390/multiarch/ifunc-impl-list.c: In function ‘__libc_ifunc_impl_list’:
../sysdeps/s390/multiarch/ifunc-impl-list.c:76:10: error: unused variable ‘i’ [-Werror=unused-variable]
   76 |   size_t i = max;
      |          ^
cc1: all warnings being treated as errors
2022-08-18 09:10:48 +02:00
Michael Hudson-Doyle
2b274fd8c9 Ensure calculations happen with desired rounding mode in y1lf128
math/test-float128-y1 fails on x86_64 and ppc64el with gcc 12 and -O3,
because code inside a block guarded by SET_RESTORE_ROUNDL is being moved
after the rounding mode has been restored. Use math_force_eval to
prevent this (and insert some math_opt_barrier calls to prevent code
from being moved before the rounding mode is set).

Fixes #29463

Reviewed-By: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2022-08-18 12:32:18 +12:00
Florian Weimer
1d78299911 localedata: Convert French language locales (fr_*) to UTF-8 2022-08-17 11:07:00 +02:00
Florian Weimer
2955ef4b7c Linux: Fix enum fsconfig_command detection in <sys/mount.h>
The #ifdef FSOPEN_CLOEXEC check did not work because the macro
was always defined in this header prior to the check, so that
the <linux/mount.h> contents did not matter.

Fixes commit 774058d729
("linux: Fix sys/mount.h usage with kernel headers").
2022-08-16 12:03:28 +02:00
Florian Weimer
dd2315a866 elf: Run tst-audit-tlsdesc, tst-audit-tlsdesc-dlopen everywhere
The test is valid for all TLS models, but we want to make a reasonable
effort to test the GNU2 model specifically.  For example, aarch64
defaults to GNU2, but does not have -mtls-dialect=gnu2, and the test
was not run there.

Suggested-by: Martin Coufal <mcoufal@redhat.com>
2022-08-16 12:00:03 +02:00
Samuel Thibault
a2ee8c6500 Move ip_mreqn structure from Linux to generic
I.e. from sysdeps/unix/sysv/linux/bits/in.h to netinet/in.h

It is following both the BSD and Linux definitions.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-15 22:43:15 +02:00
Florian Weimer
85860ad6ea malloc: Do not use MAP_NORESERVE to allocate heap segments
Address space for heap segments is reserved in a mmap call with
MAP_ANONYMOUS | MAP_PRIVATE and protection flags PROT_NONE.  This
reservation does not count against the RSS limit of the process or
system.  Backing memory is allocated using mprotect in alloc_new_heap
and grow_heap, and at this point, the allocator expects the kernel
to provide memory (subject to memory overcommit).

The SIGSEGV that might generate due to MAP_NORESERVE (according to
the mmap manual page) does not seem to occur in practice, it's always
SIGKILL from the OOM killer.  Even if there is a way that SIGSEGV
could be generated, it is confusing to applications that this only
happens for secondary heaps, not for large mmap-based allocations,
and not for the main arena.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-08-15 16:45:40 +02:00
Florian Weimer
f82e05ebb2 Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485)
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-15 16:43:59 +02:00
Samuel Thibault
af6e07dad7 non-linux: bits/in.h: Add more RFC options 2022-08-15 11:27:04 +02:00
Adhemerval Zanella
453b88efe6 arm: Remove nested functionf rom relocate_pc24
Checked on arm-linux-gnueabihf.
2022-08-12 09:46:22 -03:00
Adhemerval Zanella
774058d729 linux: Fix sys/mount.h usage with kernel headers
Now that kernel exports linux/mount.h and includes it on linux/fs.h,
its definitions might clash with glibc exports sys/mount.h.  To avoid
the need to rearrange the Linux header to be always after glibc one,
the glibc sys/mount.h is changed to:

  1. Undefine the macros also used as enum constants.  This covers prior
     inclusion of <linux/mount.h> (for instance MS_RDONLY).

  2. Include <linux/mount.h> based on the usual __has_include check
     (needs to use __has_include ("linux/mount.h") to paper over GCC
     bugs.

  3. Define enum fsconfig_command only if FSOPEN_CLOEXEC is not defined.
     (FSOPEN_CLOEXEC should be a very close proxy.)

  4. Define struct mount_attr if MOUNT_ATTR_SIZE_VER0 is not defined.
     (Added in the same commit on the Linux side.)

This patch also adds some tests to check if including linux/fs.h and
linux/mount.h after and before sys/mount.h does work.

Checked on x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12 09:15:28 -03:00
Adhemerval Zanella
e1226cdc6b linux: Use compile_c_snippet to check linux/mount.h availability
Checked on x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12 09:15:23 -03:00
Adhemerval Zanella
c68b6044bc linux: Mimic kernel defition for BLOCK_SIZE
To avoid possible warnings if the kernel header is included before
sys/mount.h.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12 09:15:21 -03:00
Adhemerval Zanella
1542019b69 linux: Use compile_c_snippet to check linux/pidfd.h availability
Instead of tying to a specific kernel version.

Checked on x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12 09:15:11 -03:00
Adhemerval Zanella
841afa116e glibcextract.py: Add compile_c_snippet
It might be used on tests to check if a snippet build with the provided
compiler and flags.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12 09:15:03 -03:00
caiyinyu
1c9bc1b6e5 LoongArch: Add pointer mangling support. 2022-08-12 09:30:56 +08:00
Wilco Dijkstra
12182ba18d AArch64: Fix typo in sve configure check (BZ# 29394)
Fix a typo in the SVE configure check. This fixes [BZ# 29394].
2022-08-11 17:52:00 +01:00
Wilco Dijkstra
c51c483d2b libio: Improve performance of IO locks
Improve performance of recursive IO locks by adding a fast path for
the single-threaded case. To reduce the number of memory accesses for
locking/unlocking, only increment the recursion counter if the lock
is already taken.

On Neoverse V1, a microbenchmark with many small freads improved by
2.9x. Multithreaded performance improved by 2%.

Reviewed-by: Cristian Rodríguez  <crrodriguez@opensuse.org>
2022-08-11 16:47:45 +01:00
Stefan Liebler
11f09947f3 tst-process_madvise: Check process_madvise-syscall support.
So far this test checks if pidfd_open-syscall is supported,
which was introduced with linux 5.3.

The process_madvise-syscall was introduced with linux 5.10.
Thus you'll get FAILs if you are running a kernel in between.

This patch adds a check if the first process_madvise-syscall
returns ENOSYS and in this case will fail with UNSUPPORTED.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-11 12:21:05 +02:00
Fangrui Song
61d2066c19 elf.h: Add ELFCOMPRESS_ZSTD
From the approved generic ABI proposal
https://groups.google.com/g/generic-abi/c/satyPkuMisk
("Add new ch_type value: ELFCOMPRESS_ZSTD").

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-10 21:46:09 -07:00
Florian Weimer
2ed26bca99 inet: Turn __ivaliduser into a compatibility symbol
It is not declared in a header file, and as the comment indicates,
it is not expected to be used.
2022-08-10 08:40:15 +02:00
Noah Goldstein
312ded0d63 x86: Fix #define STRCPY guard in strcpy-sse2.S
`#ifndef STPCPY` is incorrect for checking if `STRCPY` is already
defined.  It doesn't end up mattering as the whole check is
guarded by `#if IS_IN (libc)` but is incorrect none the less.
2022-08-09 17:00:03 +08:00
Noah Goldstein
483cfe1a6a elf: Replace strcpy call with memcpy [BZ #29454]
GCC normally does this optimization for us in
strlen_pass::handle_builtin_strcpy but only for optimized
build. To avoid needing to include strcpy.S in the rtld build to
support the debug build, just do the optimization by hand.
2022-08-09 17:00:03 +08:00
Kito Cheng
8bc3f94a06 soft-fp: Add fixhf[uns][di|si] and float[uns][di|si]hf
Add more IEEE half conversion routines:

- Convert 32-bit/64-bit integer to IEEE half.
- Convert IEEE half to 32-bit/64-bit integer.

They are required by RISC-V _Float16 support, tested with RISC-V GCC.
2022-08-08 11:28:40 -03:00
Adhemerval Zanella
26a3499cdb i386: Use cmpl instead of cmp
Clang cannot assemble cmp in the AT&T dialect mode.
2022-08-05 09:28:39 -03:00
Adhemerval Zanella
1ed5869c4c i386: Use fldt instead of fld on e_logl.S
Clang cannot assemble fldt in the AT&T dialect mode.
2022-08-05 09:28:33 -03:00
Fangrui Song
525ca33a61 i386: Replace movzx with movzbl
Similar to 6720d36b66 for x86-64.

Clang cannot assemble movzx in the AT&T dialect mode.  Change movzx to
movzbl, which follows the AT&T dialect and is used elsewhere in the
file.
2022-08-04 14:06:50 -07:00
Florian Weimer
ed0185e412 dlfcn: Pass caller pointer to static dlopen implementation (bug 29446)
Fixes commit 0c1c3a771e ("dlfcn: Move
dlopen into libc").
2022-08-04 17:54:48 +02:00
Florian Weimer
6c93af6b45 malloc: Correct the documentation of the top_pad default
DEFAULT_TOP_PAD is defined as 131072 in
sysdeps/generic/malloc-machine.h.
2022-08-04 17:20:48 +02:00
Adhemerval Zanella
3698f5a9dd i386: Remove RELA support
Now that prelink is not support, there is no need to keep supporting
rela for non bootstrap.
2022-08-04 10:03:46 -03:00
Adhemerval Zanella
c3f5682215 arm: Remove RELA support
Now that prelink is not support, there is no need to keep supporting
rela for non bootstrap.
2022-08-04 10:03:46 -03:00
Adhemerval Zanella
36676f5e5d Remove ldd libc4 support
The older libc versions are obsolete for over twenty years now.
2022-08-04 10:03:45 -03:00
Lucas A. M. Magalhaes
8ee878592c Assume only FLAG_ELF_LIBC6 suport
The older libc versions are obsolete for over twenty years now.
This patch removes the special flags for libc5 and libc4 and assumes
that all libraries cached are libc6 compatible and use FLAG_ELF_LIBC6.

Checked with a build for all affected architectures.

Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-08-04 09:09:48 -03:00
Adhemerval Zanella
5a57ad23ba Remove left over LD_LIBRARY_VERSION usages
The environment variable was removed by
d2db60d8d8.
2022-08-04 09:09:48 -03:00
Florian Weimer
8fabe0e632 Linux: Remove exit system call from _exit
exit only terminates the current thread, not the whole process, so it
is the wrong fallback system call in this context.  All supported
Linux versions implement the exit_group system call anyway.
2022-08-04 06:17:50 +02:00
caiyinyu
3e83843637 LoongArch: Add vdso support for gettimeofday. 2022-08-04 09:19:36 +08:00
Joseph Myers
085030b957 Update kernel version to 5.19 in header constant tests
This patch updates the kernel version in the tests tst-mman-consts.py,
tst-mount-consts.py and tst-pidfd-consts.py to 5.18.  (There are no
new constants covered by these tests in 5.19, or in 5.17 or 5.18 in
the case of tst-mount-consts.py that previously used version 5.16,
that need any other header changes.)

Tested with build-many-glibcs.py.
2022-08-03 16:31:58 +00:00
Florian Weimer
9001cb1102 assert: Do not use stderr in libc-internal assert
Redirect internal assertion failures to __libc_assert_fail, based on
based on __libc_message, which writes directly to STDERR_FILENO
and calls abort.  Also disable message translation and reword the
error message slightly (adjusting stdlib/tst-bz20544 accordingly).

As a result of these changes, malloc no longer needs its own
redefinition of __assert_fail.

__libc_assert_fail needs to be stubbed out during rtld dependency
analysis because the rtld rebuilds turn __libc_assert_fail into
__assert_fail, which is unconditionally provided by elf/dl-minimal.c.

This change is not possible for the public assert macro and its
__assert_fail function because POSIX requires that the diagnostic
is written to stderr.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-08-03 11:43:04 +02:00
Florian Weimer
68e036f27f nptl: Remove uses of assert_perror
__pthread_sigmask cannot actually fail with valid pointer arguments
(it would need a really broken seccomp filter), and we do not check
for errors elsewhere.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-08-03 11:42:49 +02:00
Florian Weimer
cca9684f2d stdio: Clean up __libc_message after unconditional abort
Since commit ec2c1fcefb ("malloc:
Abort on heap corruption, without a backtrace [BZ #21754]"),
__libc_message always terminates the process.  Since commit
a289ea09ea ("Do not print backtraces
on fatal glibc errors"), the backtrace facility has been removed.
Therefore, remove enum __libc_message_action and the action
argument of __libc_message, and mark __libc_message as _No_return.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-08-03 11:42:39 +02:00
Joseph Myers
fccadcdf5b Update syscall lists for Linux 5.19
Linux 5.19 has no new syscalls, but enables memfd_secret in the uapi
headers for RISC-V.  Update the version number in syscall-names.list
to reflect that it is still current for 5.19 and regenerate the
arch-syscall.h headers with build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.
2022-08-02 21:05:07 +00:00