Joseph Myers [Mon, 7 Sep 2020 18:11:12 +0000 (18:11 +0000)]
Disable -Wstringop-overread for some string tests
Similarly to Maciej's changes to fix the build of rawmemchr in the
presence of GCC 11's -Wstringop-overread, also disable that option in
two string function tests that have similar warnings and other string
function warnings already disabled.
Tested with build-many-glibcs.py for aarch64-linux-gnu and
arm-linux-gnueabi that it fixes building the glibc testsuite.
In function '__rawmemchr',
inlined from '__rawmemchr' at rawmemchr.c:27:1:
rawmemchr.c:36:12: error: 'memchr' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overread]
36 | return memchr (s, c, (size_t)-1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
../o-iterator.mk:9: recipe for target '.../string/rawmemchr.o' failed
introduced with GCC 11 commit d14c547abd48 ("Add -Wstringop-overread
for reading past the end by string functions.").
- tst-mtx-recursive.c: mtx_init fails to use mtx_plain. Per C11
specs, using mtx_recursive alone is not supported. This isn't
catched because mtx_plain is defined as 0.
- tst-thrd-sleep.c: thrd_sleep returns 0 on success, a negative
value on failure. Testing against thrd_success is incorrect.
- tst-tss-basic.c: tss_set is incorrectly checkd for a non-0
value. The test should test aginst C11 threads error codes.
This isn't catched because thrd_success is defined as 0.
Note that all three tests fail on FreeBSD, which defines all mutex type
values, as well as all C11 threads error codes with non-0 values.
H.J. Lu [Wed, 5 Aug 2020 20:51:56 +0000 (13:51 -0700)]
x86: Set CPU usable feature bits conservatively [BZ #26552]
Set CPU usable feature bits only for CPU features which are usable in
user space and whose usability can be detected from user space, excluding
features like FSGSBASE whose enable bit can only be checked in the kernel.
This is the first of a series of patches to sync with Gnulib commit 615b43e1f9. This patch adopts most of the changes of Gnulib, except it
retains GETCWD_RETURN_TYPE and does not always use a 64-bit internal
API. These remaining discrepancies will be addressed in later patches
in this series.
Ondřej Hošek [Wed, 26 Aug 2020 02:26:50 +0000 (04:26 +0200)]
x86-64: Fix FMA4 detection in ifunc [BZ #26534]
A typo in commit 107e6a3c2212ba7a3a4ec7cae8d82d73f7c95d0b causes the
FMA4 code path to be taken on systems that support FMA, even if they do
not support FMA4. Fix this to detect FMA4.
Lukasz Majewski [Tue, 11 Aug 2020 08:49:03 +0000 (10:49 +0200)]
y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time
The pthread_cond_clockwait and pthread_cond_timedwait have been converted
to support 64 bit time.
This change introduces new futex_abstimed_wait_cancelable64 function in
./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where possible
and tries to replace low-level preprocessor macros from
lowlevellock-futex.h
The pthread_cond_{clock|timed}wait only accepts absolute time. Moreover,
there is no need to check for NULL passed as *abstime pointer as
__pthread_cond_wait_common() always passes non-NULL struct __timespec64
pointer to futex_abstimed_wait_cancellable64().
For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
- Conversions between 64 bit time to 32 bit are necessary
- Redirection to __pthread_cond_{clock|timed}wait64 will provide support
for 64 bit time
The futex_abstimed_wait_cancelable64 function has been put into a separate
file on the purpose - to avoid issues apparent on the m68k architecture
related to small number of available registers (there is not enough
registers to put all necessary arguments in them if the above function
would be added to futex-internal.h with __always_inline attribute).
In fact - new function - namely __futex_abstimed_wait_cancellable32 is
used to reduce number of needed registers (as some in-register values are
stored on the stack when function call is made).
Run-time tests:
- Run specific tests on ARM/x86 32bit systems (qemu):
https://github.com/lmajewski/meta-y2038 and run tests:
https://github.com/lmajewski/y2038-tests/commits/master
Above tests were performed with Y2038 redirection applied as well as without
to test the proper usage of both __pthread_cond_{clock|timed}wait64 and
__pthread_cond_{clock|timed}wait.
It fixes the build issue below introduced by e3960d1c57e57 (Add
mallinfo2 function that support sizes >= 4GB). It moves the
__MALLOC_DEPRECATED to the usual place for function attributes:
In file included from ../include/malloc.h:3,
from ../sysdeps/x86_64/multiarch/../../../test-skeleton.c:31,
from ../sysdeps/x86_64/multiarch/test-multiarch.c:96:
../malloc/malloc.h:118:1: error: empty declaration [-Werror]
118 | __MALLOC_DEPRECATED;
It also adds the required deprecated warning suppression on the tests.
H.J. Lu [Tue, 25 Aug 2020 12:35:45 +0000 (05:35 -0700)]
x32: Add <fixup-asm-unistd.h> and regenerate arch-syscall.h
X32 uses the same 64-bit syscall interface for set_thread_area. But
__NR_set_thread_area is missing from <asm/unistd_x32.h>. A kernel patch
was submitted:
Wilco Dijkstra [Fri, 28 Aug 2020 16:51:40 +0000 (17:51 +0100)]
AArch64: Improve backwards memmove performance
On some microarchitectures performance of the backwards memmove improves if
the stores use STR with decreasing addresses. So change the memmove loop
in memcpy_advsimd.S to use 2x STR rather than STP.
Zong Li [Fri, 30 Nov 2018 09:18:40 +0000 (17:18 +0800)]
Add RISC-V 32-bit target to build-many-glibcs.py
Support building three variants of 32-bit RISC-V glibc as follows:
- riscv32-linux-gnu-rv32imac-ilp32
- riscv32-linux-gnu-rv32imafdc-ilp32
- riscv32-linux-gnu-rv32imafdc-ilp32d
Zong Li [Fri, 30 Nov 2018 09:18:00 +0000 (17:18 +0800)]
RISC-V: Build infrastructure for 32-bit port
This patch lays out the top-level organisation of the RISC-V 32-bit port.
It provides all the Implies files as well as various other fragments of
the build infrastructure.
Alistair Francis [Sat, 21 Dec 2019 02:29:42 +0000 (18:29 -0800)]
riscv32: Specify the arch_minimum_kernel as 5.4
Specify the minimum kernel version for RISC-V 32-bit as the 5.4 kernel.
We require this commit: "waitid: Add support for waiting for the current
process group" for the kernel as it adds support for the P_PGID id for
the waitid syscall. Without this patch we can't replace the wait4
syscall on 64-bit time_t only systems.
Zong Li [Fri, 30 Nov 2018 09:18:20 +0000 (17:18 +0800)]
RISC-V: Fix llrint and llround missing exceptions on RV32
Conversions from a float to a long long on 32-bit RISC-V (RV32) may not
raise the correct exceptions on overflow, it also may raise spurious
"inexact" exceptions on non overflow cases. This patch fixes the
problem, similarly to the fix for MIPS, ARM and S390.
RISC-V: Add path of library directories for the 32-bit
With RV32 support the list of possible RISC-V system directories
increases to:
- /lib64/lp64d
- /lib64/lp64
- /lib32/ilp32d
- /lib32/ilp32
- /lib (only ld.so)
This patch changes the add_system_dir () macro to support the new ilp32d
and ilp32 directories for RV32. While refactoring this code let's split
out the confusing if statements into a loop to make it easier to
understand and extend.
Remove a duplicate inclusion of <sysdeps/unix/sysdep.h> which is already
pulled via <sysdeps/unix/sysv/linux/generic/sysdep.h>, and the inclusion
of <errno.h> whose definition of `__set_errno' is not needed here.
Alistair Francis [Fri, 21 Jun 2019 18:31:56 +0000 (11:31 -0700)]
RISC-V: Use 64-bit time_t and off_t for RV32 and RV64
Using the original glibc headers under bits/ let's make small
modifications to use 64-bit time_t and off_t for both RV32 and RV64.
For the typesizes.h, here are justifications for the changes from the
generic version (based on Arnd's very helpful feedback):
- All the !__USE_FILE_OFFSET64 types (__off_t, __ino_t, __rlim_t, ...)
are changed to match the 64-bit replacements.
- __time_t is defined to 64 bit, but no __time64_t is added. This makes
sense as we don't have the time64 support for other 32-bit
architectures yet, and it will be easy to change when that happens.
- __suseconds_t is 64-bit. This matches what we use the kernel ABI for
the few drivers that are relying on 'struct timeval' input arguments
in ioctl, as well as the adjtimex system call. It means that timeval
has to be defined without the padding, unlike timespec, which needs
padding.
Alistair Francis [Tue, 25 Aug 2020 18:15:27 +0000 (11:15 -0700)]
io/lockf: Include bits/types.h before __OFF_T_MATCHES_OFF64_T check
It's possible that although __OFF_T_MATCHES_OFF64_T is defined the
included the relevent header file. This results in a io/tst-lockf
failure for RV32 by calling the non 64-bit version of lockf. This
patch fixes the failure by including bits/types.h.
Alistair Francis [Mon, 24 Aug 2020 22:35:44 +0000 (15:35 -0700)]
elf/tst-libc_dlvsym: Add a TEST_COMPAT around some symbol tests
The _sys_errlist and _sys_siglist symbols are deprecated since 2.32.
This patch adds a TEST_COMPAT check around the tests. This fixes test
failures on new architectures (such as RV32) that don't have this
symbol defined.
With arch-syscall.h it can now assumes the existance of either
__NR_utimensat or __NR_utimensat_time64. The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_timer_settime or __NR_time_settime_time64. The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_timer_gettime or __NR_time_gettime_time64. The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_sched_rr_get_interval or __NR_sched_rr_get_interval_time64.
The 32-bit time_t support is now only build for
!__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_ppoll or __NR_ppoll_time64. The 32-bit time_t support is now
only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_mq_timedsend or __NR_mq_timedsend_time64. The 32-bit
time_t support is now only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_mq_timedreceive or __NR_mq_timedreceive_time64. The 32-bit
time_t support is now only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_clock_settime or __NR_clock_settime_time64. The 32-bit
time_t support is now only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_clock_nanosleep or __NR_clock_nanosleep_time64. The 32-bit
time_t support is now only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_clock_gettime or __NR_clock_gettime_time64. The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.
It also uses the time64-support functions to simplify it further.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
With arch-syscall.h it can now assumes the existance of either
__NR_clock_adjtime or __NR_clock_adjtime_time64. The 32-bit time_t
support is now only build for !__ASSUME_TIME64_SYSCALLS.
Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).
Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
linux: Add helper function to optimize 64-bit time_t fallback support
These helper functions are used to optimize the 64-bit time_t support on
configurations that requires support for 32-bit time_t fallback
(!__ASSUME_TIME64_SYSCALLS). The idea is once the kernel advertises that
it does not have 64-bit time_t support, glibc will stop to try issue the
64-bit time_t syscall altogether.
For instance:
#ifndef __NR_symbol_time64
# define __NR_symbol_time64 __NR_symbol
#endif
int r;
if (supports_time64 ())
{
r = INLINE_SYSCALL_CALL (symbol, ...);
if (r == 0 || errno != ENOSYS)
return r;
ProjectQuirks moved into its own file in gnulib because one cannot
import modules with hyphens in them. Adjust the quirks file to
reflect this reality.
Stefan Liebler [Thu, 20 Aug 2020 08:51:42 +0000 (10:51 +0200)]
build-many-glibcs.py: Add a s390x -O3 glibc variant.
On s390x, gcc inlines more aggresive compared to other architectures.
This occaisionally leads to build warnings / errors.
Therefore this patch adds a s390x glibc variant with optimization.
There is the ccopts field which contain ABI options which are passed
to configure as CC / CXX. Now there is also the cflags field which
contains non-ABI options like -g or -O. Those are passed to configure
as CFLAGS / CXXFLAGS.
Currently CC is passed to conformtest.py or linknamespace.py but not
the CFLAGS.
Stefan Liebler [Thu, 20 Aug 2020 08:45:26 +0000 (10:45 +0200)]
Fix namespace violation in stdio.h and sys/stat.h if build with optimization. [BZ #26376]
If build with optimization, stdio.h and sys/stat.h are defining some inlining
functions. This leads to test fails if glibc is build with the following
commands. (Note that the conformtests usually builds without optimization or
other CFLAGS):
<glibc>/configure CC="gcc -O3" --prefix=/usr
make
make subdirs=conform check
- FAIL: conform/XPG4/stdio.h/conform
- FAIL: conform/XPG42/stdio.h/conform
out-files:
...
PASSCOMBINED: Availability of variable optopt
PASSCOMBINED: Type of variable optopt
Namespace violation: "getc_unlocked"
Namespace violation: "getchar_unlocked"
Namespace violation: "putc_unlocked"
Namespace violation: "putchar_unlocked"
FAIL: Namespace of <stdio.h>
----------------------------------------------------------------------------
Total number of tests : 168
Number of failed tests : 1
Number of xfailed tests : 0
Number of skipped tests : 0
- FAIL: conform/POSIX2008/sys/stat.h/conform
out-file:
...
PASSCOMBINED: Availability of function utimensat
PASSCOMBINED: Type of function utimensat
Namespace violation: "mknodat"
FAIL: Namespace of <sys/stat.h>
----------------------------------------------------------------------------
Total number of tests : 97
Number of failed tests : 1
Number of xfailed tests : 0
Number of skipped tests : 0
For getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked in stdio.h,
those are defined "# ifdef __USE_POSIX" instead of "#ifdef __USE_POSIX199506"
for the non-inlining declaration. See also
"Bug 20014 - stdio.h namespace for pre-threads POSIX"
(https://sourceware.org/bugzilla/show_bug.cgi?id=20014).
For mknodat in sys/stat.h, those are defined "# ifdef __USE_ATFILE" instead of
the additional guard "# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED".
Joseph Myers [Wed, 19 Aug 2020 22:46:41 +0000 (22:46 +0000)]
Add C2x BOOL_MAX and BOOL_WIDTH to limits.h.
C2x adds BOOL_MAX and BOOL_WIDTH macros to <limits.h>. This patch
adds them to glibc's <limits.h> for the case when they aren't defined
by GCC's <limits.h>.
Joseph Myers [Wed, 19 Aug 2020 13:47:37 +0000 (13:47 +0000)]
Add new STATX_* constants from Linux 5.8 to bits/statx-generic.h.
This patch adds the new STATX_MNT_ID, STATX_ATTR_MOUNT_ROOT and
STATX_ATTR_DAX macros from Linux 5.8 to glibc's bits/statx-generic.h.
(As with previous such changes, this only does anything if glibc is
being used with old kernel headers.)
A comment in the Linux kernel headers indicates that STATX_ALL is
deliberately not being changed.
Andreas Schwab [Tue, 23 Jun 2020 10:55:49 +0000 (12:55 +0200)]
Correct locking and cancellation cleanup in syslog functions (bug 26100)
Properly serialize the access to the global state shared between the
syslog functions, to avoid races in multithreaded processes. Protect a
local allocation in the __vsyslog_internal function from leaking during
cancellation.
Joseph Myers [Thu, 13 Aug 2020 18:51:10 +0000 (18:51 +0000)]
Update build-many-glibcs.py for binutils ia64 obsoletion.
Since binutils has obsoleted ia64 support, use --enable-obsolete for
now when configuring binutils for ia64 in build-many-glibcs.py (which
requires adding support for architecture-specific binutils configure
options there). As with other obsoletions, the removal of support for
ia64 in any of (binutils, GCC, Linux kernel) should imply its removal
from glibc.
Tested with build-many-glibcs.py for ia64-linux-gnu (compilers and
glibcs build).
Joseph Myers [Thu, 13 Aug 2020 18:50:24 +0000 (18:50 +0000)]
Update kernel version to 5.8 in tst-mman-consts.py.
This patch updates the kernel version in the test tst-mman-consts.py
to 5.8. (There are no new MAP_* constants covered by this test in 5.8
that need any other header changes.)
y2038: nptl: Convert pthread_{clock|timed}join_np to support 64 bit time
The pthread_clockjoin_np and pthread_timedjoin_np have been converted to
support 64 bit time.
This change introduces new futex_timed_wait_cancel64 function in
./sysdeps/nptl/futex-internal.h, which uses futex_time64 where possible
and tries to replace low-level preprocessor macros from
lowlevellock-futex.h
The pthread_{timed|clock}join_np only accept absolute time. Moreover,
there is no need to check for NULL passed as *abstime pointer as
clockwait_tid() always passes struct __timespec64.
For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
- Conversions between 64 bit time to 32 bit are necessary
- Redirection to __pthread_{clock|timed}join_np64 will provide support
for 64 bit time
Run-time tests:
- Run specific tests on ARM/x86 32bit systems (qemu):
https://github.com/lmajewski/meta-y2038 and run tests:
https://github.com/lmajewski/y2038-tests/commits/master
Above tests were performed with Y2038 redirection applied as well as without
to test the proper usage of both __pthread_{timed|clock}join_np64 and
__pthread_{timed|clock}join_np.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Joseph Myers [Fri, 7 Aug 2020 14:38:43 +0000 (14:38 +0000)]
Update syscall lists for Linux 5.8.
Linux 5.8 has one new syscall, faccessat2. Update syscall-names.list
and regenerate the arch-syscall.h headers with build-many-glibcs.py
update-syscalls.
Samuel Thibault [Wed, 5 Aug 2020 21:48:58 +0000 (23:48 +0200)]
hurd: Rework sbrk
Making the brk start exactly at the end of the main application binary was
requiring to get it through the _end symbol, which does not work any more
with recent toolchains, and actually produces in libc.so a confusing
external _end symbol that produces odd results, see
https://sourceware.org/bugzilla/show_bug.cgi?id=23499
Trying to do so is quite outdated anyway with the tendency for address
randomization.
Using _end was also allowing to include the main binary data within
the RLIMIT_DATA, but this also seems outdated with dynamic library
loading, and nowadays' memory consumption via malloc and mmap rather than
statically-allocated data.
This adds a BRK_START macro in <vm_param.h> that just tells where we
want to start the brk, and thus removes the _end symbol.
* sysdeps/mach/hurd/i386/vm_param.h: New file.
* sysdeps/mach/hurd/brk.c: Use BRK_START as brk start instead of _end.
Also ignore __data_start.
* hurd/Versions: Remove _end symbol.
* sysdeps/mach/hurd/i386/libc.abilist: Remove _end symbol.
H.J. Lu [Wed, 5 Aug 2020 15:20:52 +0000 (08:20 -0700)]
x86: Rename Intel CPU feature names
Intel64 and IA-32 Architectures Software Developer’s Manual has changed
the following CPU feature names:
1. The CPU feature of Enhanced Intel SpeedStep Technology is renamed
from EST to EIST.
2. The CPU feature which supports Platform Quality of Service Monitoring
(PQM) capability is changed to Intel Resource Director Technology
(Intel RDT) Monitoring capability, i.e. PQM is renamed to RDT_M.
3. The CPU feature which supports Platform Quality of Service
Enforcement (PQE) capability is changed to Intel Resource Director
Technology (Intel RDT) Allocation capability, i.e. PQE is renamed to
RDT_A.
Paul Eggert [Wed, 5 Aug 2020 06:45:27 +0000 (23:45 -0700)]
Copy regex_internal.h from Gnulib
Sync this file from Gnulib, thus incorporating the following
fix for a bug with regexps with 16 or more subexpressions:
* posix/regex_internal.h (struct re_backref_cache_entry):
Use bitset_word_t as the type of eps_reachable_subexps_map,
instead of unsigned short int. This fixes a bug I introduced
to glibc in 2005-09-28T17:33:18Z!drepper@redhat.com (glibc commit 2c05d33f90861d074dc12808dafbde30f487b1a0, BZ #1302).
Remove unused member 'unused'.
Paul Eggert [Wed, 5 Aug 2020 06:39:20 +0000 (23:39 -0700)]
Copy regex BITSET_WORD_BITS porting from Gnulib
* posix/regex.c (__STDC_WANT_IEC_60559_BFP_EXT__):
Define, for ULONG_WIDTH. This syncs regex.c from Gnujlib.
* posix/regex_internal.h (ULONG_WIDTH):
Use a more-portable fallback, from Gnulib.
(BITSET_WORD_BITS): Now defined in terms of ULONG_WIDTH.
Paul Eggert [Wed, 5 Aug 2020 05:58:58 +0000 (22:58 -0700)]
Sync intprops.h from Gnulib
* include/intprops.h: Sync from Gnulib. This improves
performance of INT_MULTIPLY_WRAPV on recent GCC, which affects
glibc only in the support library.
Szabolcs Nagy [Wed, 29 Jul 2020 07:27:27 +0000 (08:27 +0100)]
aarch64: update NEWS about branch protection
After some discussions it seems the original news was not clear
and that it is valid to manually pass the branch protection flags
iff GCC target libs are built with them too. The main difference
between manually passing the flags and using the configure
option is that the latter also makes branch protection the
default in GCC which may not be desirable in some cases.