Florian Weimer [Wed, 14 Oct 2020 08:54:39 +0000 (10:54 +0200)]
support: Provide a way to clear the RA bit in DNS server responses
Florian Weimer [Wed, 14 Oct 2020 08:54:39 +0000 (10:54 +0200)]
support: Provide a way to reorder responses within the DNS test server
Adhemerval Zanella [Tue, 13 Oct 2020 13:08:42 +0000 (10:08 -0300)]
Add missing stat/mknod symbol on libc.abilist some ABIs
It adds the missing new symbols from
8ed005daf0 and
589260cef8 (which
added versioned symbols for {f,l}stat{at}{64} and mknod{a}t) on some
libc.abilist ABIs.
Benno Schulenberg [Mon, 12 Oct 2020 15:15:58 +0000 (17:15 +0200)]
manual: correct the spelling of "MALLOC_PERTURB_" [BZ #23015]
Reported-by: Martin Dorey <martin.dorey@hds.com>
Benno Schulenberg [Mon, 12 Oct 2020 15:11:47 +0000 (17:11 +0200)]
manual: replace an obsolete collation example with a valid one
In the Spanish language, the digraph "ll" has not been considered a
separate letter since 1994:
https://www.rae.es/consultas/exclusion-de-ch-y-ll-del-abecedario
Since January 1998 (commit
49891c106244888123557fca7fddda4fa1f96b1d),
glibc's locale data no longer specifies "ch" and "ll" as separate
collation elements. So, it's better to not use "ll" in an example.
Also, the Czech "ch" is a better example as it collates in a more
surprising place.
Rolf Eike Beer [Tue, 22 Sep 2020 12:12:59 +0000 (14:12 +0200)]
rtld: fix typo in comment
Matheus Castanho [Mon, 12 Oct 2020 09:28:18 +0000 (11:28 +0200)]
elf: Add missing <dl-procinfo.h> header to elf/dl-usage.c
Samuel Thibault [Sun, 11 Oct 2020 13:59:01 +0000 (13:59 +0000)]
hurd: support clock_gettime(CLOCK_PROCESS/THREAD_CPUTIME_ID)
* sysdeps/mach/clock_gettime.c (__clock_gettime): Add support for
CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID.
Adhemerval Zanella [Tue, 21 Jul 2020 18:53:53 +0000 (15:53 -0300)]
linux: Move xmknod{at} to compat symbols
It also decouple mknod{at} from xmknod{at}. The riscv32 ABI was added
on 2.33, so it is safe to remove the old __xmknot{at} symbols and just
provide the newer mknod{at} ones.
Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Adhemerval Zanella [Mon, 20 Jul 2020 19:02:04 +0000 (16:02 -0300)]
linux: Add {f}stat{at} y2038 support
A new struct __stat{64}_t64 type is added with the required
__timespec64 time definition. Only LFS is added, 64-bit time with
32-bit offsets is not supposed to be supported (no existing glibc
configuration supports such a combination). It is done with an extra
__NR_statx call plus a conversion to the new __stat{64}_t64 type.
The statx call is done only for 32-bit time_t ABIs.
Internally some extra routines to copy from/to struct stat{64}
to struct __stat{64} used on multiple implementations (stat, fstat,
lstat, and fstatat) are added on a extra implementation
(stat_t64_cp.c). Alse some extra routines to copy from statx to
__stat{64} is added on statx_cp.c.
Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Adhemerval Zanella [Sat, 18 Jul 2020 13:21:25 +0000 (10:21 -0300)]
linux: Move {f}xstat{at} to compat symbols
They are no interna uses anymore. The riscv32 ABI was added on 2.33,
so it is safe to remove the old __{f,l}stat{at} symbols and just
provide the newer {f,l}stat{at} ones.
Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Adhemerval Zanella [Sat, 18 Jul 2020 11:20:46 +0000 (08:20 -0300)]
linux: Disentangle fstatat from fxstatat
It implements all the required syscall for the all Linux kABIS on
fstatat{64} instead of calling fxstatat{64}.
On non-LFS implementation, it handles 3 cases:
1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and
nios): it issues __NR_fstat64 plus handle the overflow on st_ino,
st_size, or st_blocks.
2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k,
microblaze, mips32, s390, sh, powerpc, and sparc32): it issues
__NR_fstatat64 and convert the result to struct stat.
3. 64-bit kABI outliers (mips64 and mips64-n32): it issues
__NR_newfstatat and convert the result to struct stat.
The generic LFS implementation handles multiple cases:
1. XSTAT_IS_XSTAT64 being 1:
1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and
x86_64): it issues __NR_newfstatat.
1.2. 64-bit kABI outlier (alpha): it issues __NR_fstatat64.
1.3. 64-bit kABI outlier where struct stat64 does not match kernel
one (sparc64): it issues __NR_fstatat64 and convert the result
to struct stat64.
1.4. 32-bit kABI with default 64-bit time_t (arc, riscv32): it
issues __NR_statx and convert the result to struct stat64.
2. Old ABIs with XSTAT_IS_XSTAT64 being 0:
2.1. All kABIs with non-LFS support (arm, csky, i386, hppa, m68k,
microblaze, nios2, sh, powerpc32, and sparc32): it issues
__NR_fstatat64.
2.2. 64-bit kABI outliers (mips64 and mips64-n32): it issues
__NR_newfstatat and convert the result to struct stat64.
It allows to remove all the hidden definitions from the {f,l}xstat{64}
(some are still kept because Hurd requires it).
Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Adhemerval Zanella [Fri, 17 Jul 2020 16:15:37 +0000 (13:15 -0300)]
linux: Implement {l}fstat{at} in terms of fstatat
Both fstatat and fstata64 calls the old fxstatat and fxstatat64
repectivelly with _STAT_VER, the one currently exported as default
for all ABIs.
Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Adhemerval Zanella [Fri, 17 Jul 2020 12:18:39 +0000 (09:18 -0300)]
linux: Move the struct stat{64} to struct_stat.h
The common definitions are moved to a Linux generic stat.h while the
struct stat{64} definition are moved to a arch-specific struct_stat.h
header.
Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Adhemerval Zanella [Thu, 16 Jul 2020 19:46:52 +0000 (16:46 -0300)]
Remove mknod wrapper functions, move them to symbols
This patch removes the mknod and mknodat static wrapper and add the
symbols on the libc with the expected names.
Both the prototypes of the internal symbol linked by the static
wrappers and the inline redirectors are also removed from the installed
sys/stat.h header file. The wrapper implementation license LGPL
exception is also removed since it is no longer statically linked to
binaries.
Internally the _STAT_VER* definitions are moved to the arch-specific
xstatver.h file.
Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Adhemerval Zanella [Thu, 16 Jul 2020 14:06:51 +0000 (14:06 +0000)]
Remove stat wrapper functions, move them to exported symbols
This patch removes the stat, stat64, lstat, lstat64, fstat, fstat64,
fstatat, and fstatat64 static wrapper and add the symbol on the libc
with the expected names.
Both the prototypes of the internal symbol linked by the static
wrappers and the inline redirectors are also removed from the installed
sys/stat.h header file. The wrapper implementation license LGPL
exception is also removed since it is no longer statically linked to
binaries.
Internally the _STAT_VER* definitions are moved to a arch-specific
xstatver.h file. The internal defines that redirects internals
{f}stat{at} to their {f}xstat{at} counterparts are removed for Linux
(!NO_RTLD_HIDDEN). Hurd still requires them since {f}stat{at} pulls
extra objects that makes the loader build fail otherwise (I haven't
dig into why exactly).
Checked with a build for all affected ABIs. I also checked on x86_64,
i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
H.J. Lu [Thu, 8 Oct 2020 15:50:44 +0000 (08:50 -0700)]
<sys/platform/x86.h>: Add FSRCS/FSRS/FZLRM support
Add Fast Short REP CMP and SCA (FSRCS), Fast Short REP STO (FSRS) and
Fast Zero-Length REP MOV (FZLRM) support to <sys/platform/x86.h>.
H.J. Lu [Thu, 8 Oct 2020 15:38:03 +0000 (08:38 -0700)]
<sys/platform/x86.h>: Add Intel HRESET support
Add Intel HRESET support to <sys/platform/x86.h>.
H.J. Lu [Thu, 8 Oct 2020 15:33:45 +0000 (08:33 -0700)]
<sys/platform/x86.h>: Add AVX-VNNI support
Add AVX-VNNI support to <sys/platform/x86.h>.
H.J. Lu [Thu, 8 Oct 2020 15:24:47 +0000 (08:24 -0700)]
<sys/platform/x86.h>: Add AVX512_FP16 support
Add AVX512_FP16 support to <sys/platform/x86.h>.
H.J. Lu [Thu, 8 Oct 2020 15:19:15 +0000 (08:19 -0700)]
<sys/platform/x86.h>: Add Intel UINTR support
Add Intel UINTR support to <sys/platform/x86.h>.
Florian Weimer [Fri, 9 Oct 2020 08:13:14 +0000 (10:13 +0200)]
elf: Do not pass GLRO(dl_platform), GLRO(dl_platformlen) to _dl_important_hwcaps
In the current code, the function can easily obtain the information
on its own.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Fri, 9 Oct 2020 08:13:14 +0000 (10:13 +0200)]
elf: Enhance ld.so --help to print HWCAP subdirectories
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Fri, 9 Oct 2020 08:13:14 +0000 (10:13 +0200)]
elf: Add library search path information to ld.so --help
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Martin Sebor [Thu, 8 Oct 2020 18:53:09 +0000 (12:53 -0600)]
sunrpc: Adjust RPC function declarations to match Sun's (bug 26686]
Building Glibc with the latest GCC 11 shows a number of instances
of the new -Warray-parameter warning designed to encourage
consistency in the forms of array arguments in redeclarations of
the same function (and, ultimately, to enable the detection of out
of bounds accesses via such arguments).
To avoid the subset of these warnings for the RPC APIs, this patch
changes the declarations of these functions to match both their
definitions and the Oracle RPC documentation.
Besides avoiding the -Warray-parameter warnings the effect of this
change is for GCC to issue warnings when either the functions are
passed an array with fewer than MAXNETNAMELEN + 1 elements, or when
the functions themselves access elements outside the array bounds.
Martin Sebor [Thu, 8 Oct 2020 18:46:03 +0000 (12:46 -0600)]
Avoid GCC 11 -Warray-parameter warnings [BZ #26686].
Building Glibc with the latest GCC 11 also shows a couple of instances
of the new -Warray-parameter warning in the thread db APIs.
To avoid these, this patch changes the deefinitions of the two functions
to match their definitions.
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
elf: Make __rtld_env_path_list and __rtld_search_dirs global variables
They have been renamed from env_path_list and rtld_search_dirs to
avoid linknamespace issues.
This change will allow future use these variables in diagnostics.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
elf: Print the full name of the dynamic loader in the ld.so help message
This requires defining a macro for the full path, matching the
-Wl,--dynamic-link= arguments used for linking glibc programs,
and ldd script.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
elf: Use the term "program interpreter" in the ld.so help message
This is the term that the ELF standard itself uses.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
scripts/update-copyrights: Update csu/version.c, elf/dl-usage.c
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 8 Oct 2020 13:33:00 +0000 (15:33 +0200)]
elf: Implement ld.so --version
This prints out version information for the dynamic loader and
exits immediately, without further command line processing
(which seems to match what some GNU tools do).
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Adhemerval Zanella [Thu, 8 Oct 2020 13:27:40 +0000 (10:27 -0300)]
nptl: Add missing cancellation flags on lockf
It also removes CFLAGS-lockf.c duplicate rule. It fixes
nptl/tst-cancelx16 on mips64-linux-gnu.
Adhemerval Zanella [Thu, 8 Oct 2020 12:46:00 +0000 (09:46 -0300)]
Update mips64 libm-test-ulps
Adhemerval Zanella [Thu, 8 Oct 2020 12:45:26 +0000 (09:45 -0300)]
Update alpha libm-test-ulps
Florian Weimer [Thu, 8 Oct 2020 08:57:10 +0000 (10:57 +0200)]
elf: Implement ld.so --help
--help processing is deferred to the point where the executable has
been loaded, so that it is possible to eventually include information
from the main executable in the help output.
As suggested in the GNU command-line interface guidelines, the help
message is printed to standard output, and the exit status is
successful.
Handle usage errors closer to the GNU command-line interface
guidelines.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 8 Oct 2020 08:57:10 +0000 (10:57 +0200)]
elf: Record whether paths come from LD_LIBRARY_PATH or --library-path
This allows more precise LD_DEBUG diagnostics.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 8 Oct 2020 08:57:10 +0000 (10:57 +0200)]
elf: Move ld.so error/help output to _dl_usage
Also add a comment to elf/Makefile, explaining why we cannot use
config.status for autoconf template processing.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 8 Oct 2020 08:57:09 +0000 (10:57 +0200)]
elf: Extract command-line/environment variables state from rtld.c
Introduce struct dl_main_state and move it to <dl-main.h>. Rename
enum mode to enum rtld_mode and add the rtld_mode_ prefix to the enum
constants.
This avoids the need for putting state that is only needed during
startup into the ld.so data segment.
Florian Weimer [Thu, 8 Oct 2020 08:57:09 +0000 (10:57 +0200)]
elf: Implement __rtld_malloc_is_complete
In some cases, it is difficult to determine the kind of malloc
based on the execution context, so a function to determine that
is helpful.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Andreas Schwab [Thu, 1 Oct 2020 11:59:13 +0000 (13:59 +0200)]
__vfscanf_internal: fix aliasing violation (bug 26690)
As noted in <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97264>, the cast
in the call to the read_int function is an aliasing violation. Change the
type of local variable f to a pointer to unsigned, which allows to
eliminate most casts while only adding three new ones.
Andreas Schwab [Thu, 1 Oct 2020 13:42:38 +0000 (15:42 +0200)]
Revert "Fix missing redirects in testsuite targets"
This reverts commit
d5afb38503. The log files are actually created by the
various shell scripts that drive the tests.
Adhemerval Zanella [Wed, 7 Oct 2020 18:24:04 +0000 (15:24 -0300)]
nptl: Add missing cancellation flags on futex_internal and pselect32
It fixes the tst-cancelx{4,5} and tst-cancel24-{static} regression on
some platforms (arm and sparc32).
Checked on arm-linux-gnueabihf and sparcv9-linux-gnu.
Florian Weimer [Wed, 7 Oct 2020 14:39:50 +0000 (16:39 +0200)]
elf: Implement _dl_write
The generic version is parallel to _dl_writev. It cannot use
_dl_writev directly because the errno value needs to be obtained
under a lock.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Wed, 7 Oct 2020 14:40:23 +0000 (16:40 +0200)]
elf: Do not search HWCAP subdirectories in statically linked binaries
This functionality does not seem to be useful since static dlopen
is mostly used for iconv/character set conversion and NSS support.
gconv modules are loaded with full paths anyway, so that the
HWCAP subdirectory logic does not apply.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Wed, 7 Oct 2020 12:55:04 +0000 (14:55 +0200)]
Linux: Require properly configured /dev/pts for PTYs
Current systems do not have BSD terminals, so the fallback code in
posix_openpt/getpt does not do anything. Also remove the file system
check for /dev/pts. Current systems always have a devpts file system
mounted there if /dev/ptmx exists.
grantpt is now essentially a no-op. It only verifies that the
argument is a ptmx-descriptor. Therefore, this change indirectly
addresses bug 24941.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Wed, 7 Oct 2020 08:48:10 +0000 (10:48 +0200)]
Linux: unlockpt needs to fail with EINVAL, not ENOTTY (bug 26053)
The EINVAL error code is mandated by POSIX and documented in the
manual. Also clean up the unlockpt implementation a bit, assuming
that TIOCSPTLCK is always defined.
Enhance login/tst-grantpt to cover unlockpt corner cases.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Wed, 7 Oct 2020 08:48:10 +0000 (10:48 +0200)]
login/tst-grantpt: Convert to support framework, more error checking
The test now requires working /dev/pts pseudo-terminals.
A new subtest (test_not_ptmx) attempts to call grantpt on a
pseudo-terminal that is not a ptmx device. POSIX requires an EINVAL
error in this case.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Adhemerval Zanella [Mon, 5 Oct 2020 20:30:05 +0000 (17:30 -0300)]
posix: Fix -Warray-bounds instances building timer_create [BZ #26687]
GCC 11 -Warray-bounds triggers invalid warnings when building
Linux timer_create.c:
../sysdeps/unix/sysv/linux/timer_create.c: In function '__timer_create_new':
../sysdeps/unix/sysv/linux/timer_create.c:83:17: warning: array subscript 'struct timer[0]' is partly outside array bounds of 'unsigned char[8]' [-Warray-bounds]
83 | newp->sigev_notify = (evp != NULL
| ^~
../sysdeps/unix/sysv/linux/timer_create.c:59:47: note: referencing an object of size 8 allocated by 'malloc'
59 | struct timer *newp = (struct timer *) malloc (offsetof (struct timer,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 | thrfunc));
| ~~~~~~~~~
The struct allocated for !SIGEV_THREAD timers only requires two 'int'
fields (sigev_notify and ktimerid) and the offsetof trick tries minimize
the memory usage by only allocation the required size. However,
although the resulting size is suffice for !SIGEV_THREAD time, accessing
the partially allocated object is error-prone and UB.
This patch fixes both issues by embedding the information whether
the timer if a SIGEV_THREAD in the returned 'timer_t'. For
!SIGEV_THREAD, the resulting 'timer_t' is the returned kernel timer
identifer (kernel_timer_t), while for SIGEV_THREAD it uses the fact
malloc returns at least _Alignof (max_align_t) pointers plus that
valid kernel_timer_t are always positive to set MSB bit of the returned
'timer_t' to indicate the timer handles a SIGEV_THREAD.
It allows to remove the memory allocation for !SIGEV_THREAD and also
remove the 'sigev_notify' field from 'struct timer'.
Checked on x86_64-linux-gnu and i686-linux-gnu.
H.J. Lu [Tue, 6 Oct 2020 12:15:11 +0000 (05:15 -0700)]
Replace Minumum/minumum with Minimum/minimum
Replace Minumum/minumum in comments with Minimum/minimum.
DJ Delorie [Wed, 1 Apr 2020 19:33:00 +0000 (15:33 -0400)]
Optimize scripts/merge-test-results.sh
The inner loop is called thousands of times per "make check" even
if there's otherwise nothing to do. Avoid calling /bin/head all
those times when a builtin will do.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Joseph Myers [Mon, 5 Oct 2020 16:46:46 +0000 (16:46 +0000)]
Fix GCC 11 -Warray-parameter warning for __sigsetjmp (bug 26647)
This patch fixes part of bug 26647 (-Werror=array-parameter error
building with GCC 11 because of __sigsetjmp being declared using an
array parameter in one header and a pointer parameter in another).
The fix is to split the struct __jmp_buf_tag definition out to a
separate bits/types/ header so it can be included in pthread.h, so
that pthread.h can declare __sigsetjmp with the type contents visible,
so can use an array (as in setjmp.h) rather than a pointer in the
declaration.
Note that several other build failures with GCC 11 remain. This does
not fix the jmp_buf-related -Wstringop-overflow errors (also discussed
in bug 26647), or -Warray-parameter errors for other functions (bug
26686), or -Warray-bounds errors (bug 26687).
Tested, with older compilers, natively for x86_64 and with
build-many-glibc.py for aarch64-linux-gnu. Tested with
build-many-glibcs.py with GCC mainline for aarch64-linux-gnu that this
gets past the -Warray-parameter issue for __sigsetjmp (with the next
build failure being the other one discussed in bug 26647).
Jonathan Wakely [Mon, 5 Oct 2020 16:29:38 +0000 (17:29 +0100)]
manual: Fix typo
Lukasz Majewski [Tue, 8 Sep 2020 09:51:23 +0000 (11:51 +0200)]
y2038: nptl: Convert pthread_rwlock_{clock|timed}{rd|wr}lock to support 64 bit time
The pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock,
pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock have been converted
to support 64 bit time.
This change uses new futex_abstimed_wait64 function in
./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where possible.
The pthread_rwlock_{clock|timed}{rd|wr}lock only accepts absolute time.
Moreover, there is no need to check for NULL passed as *abstime pointer to the
syscalls as those calls have exported symbols marked with __nonull attribute
for abstime.
For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
- Conversions between 64 bit time to 32 bit are necessary
- Redirection to pthread_rwlock_{clock|timed}{rd|wr}lock will provide support
for 64 bit time
Build tests:
./src/scripts/build-many-glibcs.py glibcs
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_rwlock_{clock|timed}{rd|wr}lock64
and __pthread_rwlock_{clock|timed}{rd|wr}lock.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Lukasz Majewski [Tue, 8 Sep 2020 08:54:35 +0000 (10:54 +0200)]
Y2038: nptl: Provide futex_abstimed_wait64 supporting 64 bit time
This is the helper function, which uses struct __timespec64
to provide 64 bit absolute time to futex syscalls.
The aim of this function is to move convoluted pre-processor
macro code from sysdeps/nptl/lowlevellock-futex.h to C
function in futex-internal.c
The futex_abstimed_wait64 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).
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Adhemerval Zanella [Tue, 29 Sep 2020 17:45:09 +0000 (14:45 -0300)]
sysvipc: Return EINVAL for invalid msgctl commands
It avoids regressions on possible future commands that might require
additional libc support. The downside is new commands added by newer
kernels will need further glibc support.
Checked on x86_64-linux-gnu and i686-linux-gnu (Linux v4.15 and v5.4).
Adhemerval Zanella [Tue, 29 Sep 2020 17:39:56 +0000 (14:39 -0300)]
sysvipc: Fix IPC_INFO and MSG_INFO handling [BZ #26639]
Both commands are Linux extensions where the third argument is a
'struct msginfo' instead of 'struct msqid_ds' and its information
does not contain any time related fields (so there is no need to
extra conversion for __IPC_TIME64.
The regression testcase checks for Linux specifix SysV ipc message
control extension. For IPC_INFO/MSG_INFO it tries to match the values
against the tunable /proc values and for MSG_STAT/MSG_STAT_ANY it
check if the create message queue is within the global list returned
by the kernel.
Checked on x86_64-linux-gnu and on i686-linux-gnu (Linux v5.4 and on
Linux v4.15).
Adhemerval Zanella [Tue, 29 Sep 2020 17:29:48 +0000 (14:29 -0300)]
sysvipc: Return EINVAL for invalid semctl commands
It avoids regressions on possible future commands that might require
additional libc support. The downside is new commands added by newer
kernels will need further glibc support.
Checked on x86_64-linux-gnu and i686-linux-gnu (Linux v4.15 and v5.4).
Dmitry V. Levin [Tue, 29 Sep 2020 17:10:20 +0000 (14:10 -0300)]
sysvipc: Fix SEM_STAT_ANY kernel argument pass [BZ #26637]
Handle SEM_STAT_ANY the same way as SEM_STAT so that the buffer argument
of SEM_STAT_ANY is properly passed to the kernel and back.
The regression testcase checks for Linux specifix SysV ipc message
control extension. For IPC_INFO/SEM_INFO it tries to match the values
against the tunable /proc values and for SEM_STAT/SEM_STAT_ANY it
check if the create message queue is within the global list returned
by the kernel.
Checked on x86_64-linux-gnu and on i686-linux-gnu (Linux v5.4 and on
Linux v4.15).
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Szabolcs Nagy [Wed, 13 Dec 2017 15:50:21 +0000 (15:50 +0000)]
aarch64: enforce >=64K guard size [BZ #26691]
There are several compiler implementations that allow large stack
allocations to jump over the guard page at the end of the stack and
corrupt memory beyond that. See CVE-2017-1000364.
Compilers can emit code to probe the stack such that the guard page
cannot be skipped, but on aarch64 the probe interval is 64K by default
instead of the minimum supported page size (4K).
This patch enforces at least 64K guard on aarch64 unless the guard
is disabled by setting its size to 0. For backward compatibility
reasons the increased guard is not reported, so it is only observable
by exhausting the address space or parsing /proc/self/maps on linux.
On other targets the patch has no effect. If the stack probe interval
is larger than a page size on a target then ARCH_MIN_GUARD_SIZE can
be defined to get large enough stack guard on libc allocated stacks.
The patch does not affect threads with user allocated stacks.
Fixes bug 26691.
Adhemerval Zanella [Wed, 30 Sep 2020 19:52:19 +0000 (16:52 -0300)]
sysvipc: Fix semtimedop for Linux < 5.1 for 64-bit ABI
Both powerpc64 and s390x provides semtimedop through __NR_ipc for
pre v5.1 kernel. Neither the y2038 support (
7c437d3778) nor the
attempt to fix an issue for !__ASSUME_DIRECT_SYSVIPC_SYSCALLS
(
aaa12e9ff0) took this in consideration.
This patch fixes it by issuing __NR_semtimedop_time64 iff it is
defined, otherwise __NR_semtimeop is issued if both
__ASSUME_DIRECT_SYSVIPC_SYSCALLS it set and __NR_semtimedop is
define, other __NR_ipc is used instead. To summarize:
1. For 32-bit architetures __NR_semtimedop_time64 is always
issued. The fallback is used only for !__ASSUME_TIME64_SYSCALLS
and it issues either __NR_ipc or __NR_semtimedop.
2. For 64-bit architecture with wire-up SysV syscall
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS and __NR_semtimeop defined)
__NR_semtimeop is issued.
3. Otherwise __NR_ipc is used instead.
Checked on x86_64-linux-gnu, i686-linux-gnu (kernel 4.15 and 5.4),
powerpc64le (kernel 4.18), and s390x (kernel 4.12).
Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
Lukasz Majewski [Tue, 8 Sep 2020 08:48:13 +0000 (10:48 +0200)]
nptl: futex: Move __NR_futex_time64 alias to beginning of futex-internal.h
This alias macro shall be moved to the beginning of the futex-internal.h
to be easily reused by other functions, which would support 64 bit time.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Wed, 16 Sep 2020 07:38:52 +0000 (09:38 +0200)]
nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait
This change provides proper spelling of 32 bit __futex_abstimed_wait_cancelable32
function
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Adhemerval Zanella [Mon, 31 Aug 2020 14:53:51 +0000 (11:53 -0300)]
string: Fix strerrorname_np return value [BZ #26555]
It returns the string of the error constant, not its description (as
strerrordesc_np). To handle the Hurd error mapping, the ERR_MAP was
removed from errlist.h to errlist.c.
Also, the testcase test-strerr (added on
325081b9eb2) was not added
on the check build neither it builds correctly. This patch also
changed it to decouple from errlist.h, the expected return values
are added explicitly for both both strerrorname_np and strerrordesc_np
directly.
Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a make
check for i686-gnu.
H.J. Lu [Mon, 1 Jun 2020 21:11:32 +0000 (14:11 -0700)]
Set tunable value as well as min/max values
Some tunable values and their minimum/maximum values must be determinted
at run-time. Add TUNABLE_SET_WITH_BOUNDS and TUNABLE_SET_WITH_BOUNDS_FULL
to update tunable value together with minimum and maximum values.
__tunable_set_val is updated to set tunable value as well as min/max
values.
Vincent Mihalkovic [Tue, 29 Sep 2020 10:34:39 +0000 (12:34 +0200)]
ld.so: add an --argv0 option [BZ #16124]
Patrick McGehearty [Mon, 28 Sep 2020 20:11:28 +0000 (20:11 +0000)]
Reversing calculation of __x86_shared_non_temporal_threshold
The __x86_shared_non_temporal_threshold determines when memcpy on x86
uses non_temporal stores to avoid pushing other data out of the last
level cache.
This patch proposes to revert the calculation change made by H.J. Lu's
patch of June 2, 2017.
H.J. Lu's patch selected a threshold suitable for a single thread
getting maximum performance. It was tuned using the single threaded
large memcpy micro benchmark on an 8 core processor. The last change
changes the threshold from using 3/4 of one thread's share of the
cache to using 3/4 of the entire cache of a multi-threaded system
before switching to non-temporal stores. Multi-threaded systems with
more than a few threads are server-class and typically have many
active threads. If one thread consumes 3/4 of the available cache for
all threads, it will cause other active threads to have data removed
from the cache. Two examples show the range of the effect. John
McCalpin's widely parallel Stream benchmark, which runs in parallel
and fetches data sequentially, saw a 20% slowdown with this patch on
an internal system test of 128 threads. This regression was discovered
when comparing OL8 performance to OL7. An example that compares
normal stores to non-temporal stores may be found at
https://vgatherps.github.io/2018-09-02-nontemporal/. A simple test
shows performance loss of 400 to 500% due to a failure to use
nontemporal stores. These performance losses are most likely to occur
when the system load is heaviest and good performance is critical.
The tunable x86_non_temporal_threshold can be used to override the
default for the knowledgable user who really wants maximum cache
allocation to a single thread in a multi-threaded system.
The manual entry for the tunable has been expanded to provide
more information about its purpose.
modified: sysdeps/x86/cacheinfo.c
modified: manual/tunables.texi
Adhemerval Zanella [Mon, 6 Jul 2020 19:55:46 +0000 (16:55 -0300)]
linux: Add time64 recvmmsg support
The wire-up syscall __NR_recvmmsg_time64 (for 32-bit) or
__NR_recvmmsg (for 64-bit) is used as default. The 32-bit fallback
is used iff __ASSUME_TIME64_SYSCALLS is not defined, which assumes the
kernel ABI provides either __NR_socketcall or __NR_recvmmsg
(32-bit time_t).
It does not handle the timestamps on ancillary data (SCM_TIMESTAMPING
records).
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Adhemerval Zanella [Sun, 12 Jul 2020 17:55:30 +0000 (14:55 -0300)]
linux: Add time64 support for nanosleep
It uses __clock_nanosleep64 and adds the __nanosleep64 symbol.
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>
Adhemerval Zanella [Thu, 9 Jul 2020 19:35:28 +0000 (16:35 -0300)]
linux: Consolidate utimes
The generic version does not have time64 support and Linux default
uses utimensat. With hppa version gone, __ASSUME_UTIMES is not used
anymore.
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>
Adhemerval Zanella [Tue, 7 Jul 2020 20:25:00 +0000 (17:25 -0300)]
linux: Use 64-bit time_t syscall on clock_getcputclockid
The syscall __NR_clock_getres_time64 (for 32-bit) or __NR_clock_getres
(for 64-bit) is used as default. The 32-bit fallback is used iff
__ASSUME_TIME64_SYSCALLS is not defined, which assumes the kernel ABI
provides either __NR_rt_sigtimedwait (32-bit time_t).
Since the symbol does not use any type which might be affected by the
time_t, there is no need to add a 64-bit variant.
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>
Adhemerval Zanella [Mon, 6 Jul 2020 20:14:42 +0000 (17:14 -0300)]
linux: Add time64 sigtimedwait support
The syscall __NR_sigtimedwait_time64 (for 32-bit) or __NR_sigtimedwait
(for 64-bit) is used as default. The 32-bit fallback is used iff
__ASSUME_TIME64_SYSCALLS is not defined, which assumes the kernel ABI
provides either __NR_rt_sigtimedwait (32-bit time_t).
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Adhemerval Zanella [Mon, 6 Jul 2020 19:06:51 +0000 (16:06 -0300)]
linux: Add time64 select support
The syscall __NR_pselect6_time64 (32-bit) or __NR_pselect6 (64-bit)
is used as default. For architectures with __ASSUME_TIME64_SYSCALLS
the 32-bit fallback uses __NR_select/__NR__newselect or __NR_pselect6
(it should cover the microblaze case where older kernels do not
provide __NR_pselect6).
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>
Adhemerval Zanella [Mon, 28 Sep 2020 19:05:32 +0000 (16:05 -0300)]
nptl: Fix __futex_abstimed_wait_cancellable32
Similar to 64-bit time __futex_abstimed_wait_cancellable64, it should
check for overflow and convert to 32-bit timespec iff timeout is not
NULL.
It fixes some regression on i686-linux-gnu running on a 4.15 kernel.
Adhemerval Zanella [Fri, 25 Sep 2020 18:04:34 +0000 (15:04 -0300)]
sysvipc: Fix semtimeop for !__ASSUME_DIRECT_SYSVIPC_SYSCALLS
The __NR_ipc syscall does not support 64-bit time operations. It
fixes
7c437d3778.
Checked on i686-linux-gnu on a Linux 5.4.
Samuel Thibault [Sun, 27 Sep 2020 16:23:24 +0000 (18:23 +0200)]
hurd: add ST_RELATIME
sysdeps/mach/hurd/bits/statvfs.h (ST_RELATIME): New macro.
Arjun Shankar [Fri, 25 Sep 2020 12:47:06 +0000 (14:47 +0200)]
intl: Handle translation output codesets with suffixes [BZ #26383]
Commit
91927b7c7643 (Rewrite iconv option parsing [BZ #19519]) did not
handle cases where the output codeset for translations (via the `gettext'
family of functions) might have a caller specified encoding suffix such as
TRANSLIT or IGNORE. This led to a regression where translations did not
work when the codeset had a suffix.
This commit fixes the above issue by parsing any suffixes passed to
__dcigettext and adds two new test-cases to intl/tst-codeset.c to
verify correct behaviour. The iconv-internal function __gconv_create_spec
and the static iconv-internal function gconv_destroy_spec are now visible
internally within glibc and used in intl/dcigettext.c.
H.J. Lu [Thu, 11 Jun 2020 16:00:12 +0000 (09:00 -0700)]
bench-strcmp.c: Add workloads on page boundary
Add strcmp workloads on page boundary.
H.J. Lu [Thu, 11 Jun 2020 15:52:42 +0000 (08:52 -0700)]
bench-strncmp.c: Add workloads on page boundary
Add strncmp workloads on page boundary.
H.J. Lu [Thu, 11 Jun 2020 16:03:56 +0000 (09:03 -0700)]
strcmp: Add a testcase for page boundary
Add a strcmp testcase to cover cases where both strings end on the page
boundary.
H.J. Lu [Thu, 7 May 2020 14:29:46 +0000 (07:29 -0700)]
strncmp: Add a testcase for page boundary [BZ #25933]
Add a strncmp testcase to cover cases where one of strings ends on the
page boundary with the maximum string length less than the number bytes
of each AVX2 loop iteration and different offsets from page boundary.
The updated string/test-strncmp fails on Intel Core i7-8559U without
ommit
1c6432316bc434a72108d7b0c7cfbfdde64c3124
Author: Sunil K Pandey <skpgkp1@gmail.com>
Date: Fri Jun 12 08:57:16 2020 -0700
Fix avx2 strncmp offset compare condition check [BZ #25933]
Arjun Shankar [Thu, 24 Sep 2020 12:58:36 +0000 (14:58 +0200)]
Set locale related environment variables in debugglibc.sh
Tests and binaries that use locale related functions need to run in the
correct locale environment when being debugged via debugglibc.sh. This
commit sets up the environment, specifically: GCONV_PATH, LOCPATH, and
LC_ALL for such tests and binaries when they are being debugged outside
of a test container.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Arjun Shankar [Wed, 23 Sep 2020 14:11:57 +0000 (16:11 +0200)]
benchtests: Run _Float128 tests only on architectures that support it
__float128 is a non-standard name and is not available on some architectures
(like aarch64 or s390x) even though they may support the standard _Float128
type. Other architectures (like armv7) don't support quad-precision
floating-point operations at all.
This commit replaces benchtests references to __float128 with _Float128 and
runs the corresponding tests only on architectures that support it.
Raphael Moreira Zinsly [Mon, 14 Sep 2020 14:59:24 +0000 (11:59 -0300)]
powerpc: Protect dl_powerpc_cpu_features on INIT_ARCH() [BZ #26615]
dl_powerpc_cpu_features also needs to be protected by __GLRO to check
for the _rtld_global_ro realocation before accessing it.
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Florian Weimer [Tue, 22 Sep 2020 17:07:48 +0000 (19:07 +0200)]
x86: Harden printf against non-normal long double values (bug 26649)
The behavior of isnan/__builtin_isnan on bit patterns that do not
correspond to something that the CPU would produce from valid inputs
is currently under-defined in the toolchain. (The GCC built-in and
glibc disagree.)
The isnan check in PRINTF_FP_FETCH in stdio-common/printf_fp.c
assumes the GCC behavior that returns true for non-normal numbers
which are not specified as NaN. (The glibc implementation returns
false for such numbers.)
At present, passing non-normal numbers to __mpn_extract_long_double
causes this function to produce irregularly shaped multi-precision
integers, triggering undefined behavior in __printf_fp_l.
With GCC 10 and glibc 2.32, this behavior is not visible because
__builtin_isnan is used, which avoids calling
__mpn_extract_long_double in this case. This commit updates the
implementation of __mpn_extract_long_double so that regularly shaped
multi-precision integers are produced in this case, avoiding
undefined behavior in __printf_fp_l.
Florian Weimer [Tue, 22 Sep 2020 15:29:35 +0000 (17:29 +0200)]
x86: Use one ldbl2mpn.c file for both i386 and x86_64
Jonathan Wakely [Tue, 22 Sep 2020 10:54:38 +0000 (11:54 +0100)]
Define __THROW to noexcept for C++11 and later
The __THROW macro and friends expand to "throw ()" for C++ code, but
that syntax is deprecated in C++11 and no longer supported at all since
C++20. In order for glibc headers to be compatible with C++20,
"noexcept" should be used instead.
This patch uses "noexcept (true)" rather than just "noexcept", which is
semantically equivalent, but avoids any possibility of parsing
ambiguities if the next preprocessor token happens to be an opening
parenthesis. This is probably unnecessary, but it seems safer to be
cautious.
DJ Delorie [Tue, 1 Sep 2020 20:17:25 +0000 (16:17 -0400)]
Update mallinfo2 ABI, and test
This patch adds the ABI-related bits to reflect the new mallinfo2
function, and adds a test case to verify basic functionality.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Alistair Francis [Fri, 19 Jun 2020 16:00:23 +0000 (09:00 -0700)]
Allow memset local PLT reference for RISC-V.
This is similar to commit
a26e2e9feab87d4f745c31411458b048742ac733
"Allow memset local PLT reference for powerpc soft-float.".
GCC 10.1 results in the localplt test failing for RISC-V.
From the original commit for power-pc:
Since memset is documented as a function GCC may always implicitly
generate calls to, it seems reasonable to allow that local PLT
reference (just like those for libgcc functions that GCC implicitly
generates calls to and that are also exported from libc.so), which
this patch does.
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>
Raphael Moreira Zinsly [Thu, 17 Sep 2020 14:16:36 +0000 (11:16 -0300)]
powerpc: fix ifunc implementation list for POWER9 strlen and stpcpy
__strlen_power9 and __stpcpy_power9 were added to their ifunc lists
using the wrong function names.
Andreas Schwab [Wed, 17 Jun 2020 14:05:13 +0000 (16:05 +0200)]
nscd: bump GC cycle during cache pruning (bug 26130)
While nscd prunes a cache it becomes inconsistent temporarily, which is
visible to clients if that cache is shared. Bump the GC cycle counter so
that the clients notice the modification window.
Uniformly use atomic_fetch_add to modify the GC cycle counter.
H.J. Lu [Wed, 16 Sep 2020 12:27:32 +0000 (05:27 -0700)]
x86: Use HAS_CPU_FEATURE with IBT and SHSTK [BZ #26625]
commit
04bba1e5d84b6fd8d3a3b006bc240cd5d241ee30
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Aug 5 13:51:56 2020 -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.
no longer turns on the usable bits of IBT and SHSTK since we don't know
if IBT and SHSTK are usable until much later. Use HAS_CPU_FEATURE to
check if the processor supports IBT and SHSTK.
H.J. Lu [Tue, 15 Sep 2020 12:49:27 +0000 (05:49 -0700)]
<sys/platform/x86.h>: Add Intel Key Locker support
Add Intel Key Locker:
https://software.intel.com/content/www/us/en/develop/download/intel-key-locker-specification.html
support to <sys/platform/x86.h>. Intel Key Locker has
1. KL: AES Key Locker instructions.
2. WIDE_KL: AES wide Key Locker instructions.
3. AESKLE: AES Key Locker instructions are enabled by OS.
Applications should use
if (CPU_FEATURE_USABLE (KL))
and
if (CPU_FEATURE_USABLE (WIDE_KL))
to check if AES Key Locker instructions and AES wide Key Locker
instructions are usable.
Andreas Schwab [Wed, 16 Sep 2020 10:41:14 +0000 (12:41 +0200)]
Fix handling of collating symbols in fnmatch (bug 26620)
The variable idx contains the index into the extra array, whereas wextra
points into the extra array at this index, containing the length of the
following collating sequence in the wide character representation.
H.J. Lu [Sat, 12 Sep 2020 02:36:12 +0000 (19:36 -0700)]
pselect.c: Pass a pointer to SYSCALL_CANCEL [BZ #26606]
commit
a92f4e6299fe0e3cb6f77e79de00817aece501ce
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon Jul 6 13:27:12 2020 -0300
linux: Add time64 pselect support
changed pselect.c to
r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds,
timeout,
((__syscall_ulong_t[]){ (uintptr_t) sigmask,
__NSIG_BYTES }));
which doesn't work with x32's ARGIFY and data passed to syscall isn't
initialized with sigmask and __NSIG_BYTES. Change to
__syscall_ulong_t data[2] =
{
(uintptr_t) sigmask, __NSIG_BYTES
};
r = SYSCALL_CANCEL (pselect6_time64, nfds, readfds, writefds, exceptfds,
timeout, data);
fixes [BZ #26606].
Lukasz Majewski [Mon, 7 Sep 2020 08:22:21 +0000 (10:22 +0200)]
y2038: nptl: Convert sem_{clock|timed}wait to support 64 bit time
The sem_clockwait and sem_timedwait have been converted to support 64 bit time.
This change reuses futex_abstimed_wait_cancelable64 function introduced earlier.
The sem_{clock|timed}wait only accepts absolute time. Moreover, there is no
need to check for NULL passed as *abstime pointer to the syscalls as both calls
have exported symbols marked with __nonull attribute for abstime.
For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
- Conversion from 32 bit time to 64 bit struct __timespec64 was necessary
- Redirection to __sem_{clock|timed}wait64 will provide support for 64 bit
time
Build tests:
./src/scripts/build-many-glibcs.py glibcs
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 __sem_{clock|timed}wait64 and
__sem_{clock|timed}wait.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
H.J. Lu [Sun, 13 Sep 2020 12:30:11 +0000 (05:30 -0700)]
hurd: Add __x86_get_cpu_features to ld.abilist
Add __x86_get_cpu_features to ld.abilist for <sys/platform/x86.h>.
H.J. Lu [Tue, 30 Jun 2020 01:30:54 +0000 (18:30 -0700)]
x86: Install <sys/platform/x86.h> [BZ #26124]
Install <sys/platform/x86.h> so that programmers can do
#if __has_include(<sys/platform/x86.h>)
#include <sys/platform/x86.h>
#endif
...
if (CPU_FEATURE_USABLE (SSE2))
...
if (CPU_FEATURE_USABLE (AVX2))
...
<sys/platform/x86.h> exports only:
enum
{
COMMON_CPUID_INDEX_1 = 0,
COMMON_CPUID_INDEX_7,
COMMON_CPUID_INDEX_80000001,
COMMON_CPUID_INDEX_D_ECX_1,
COMMON_CPUID_INDEX_80000007,
COMMON_CPUID_INDEX_80000008,
COMMON_CPUID_INDEX_7_ECX_1,
/* Keep the following line at the end. */
COMMON_CPUID_INDEX_MAX
};
struct cpuid_features
{
struct cpuid_registers cpuid;
struct cpuid_registers usable;
};
struct cpu_features
{
struct cpu_features_basic basic;
struct cpuid_features features[COMMON_CPUID_INDEX_MAX];
};
/* Get a pointer to the CPU features structure. */
extern const struct cpu_features *__x86_get_cpu_features
(unsigned int max) __attribute__ ((const));
Since all feature checks are done through macros, programs compiled with
a newer <sys/platform/x86.h> are compatible with the older glibc binaries
as long as the layout of struct cpu_features is identical. The features
array can be expanded with backward binary compatibility for both .o and
.so files. When COMMON_CPUID_INDEX_MAX is increased to support new
processor features, __x86_get_cpu_features in the older glibc binaries
returns NULL and HAS_CPU_FEATURE/CPU_FEATURE_USABLE return false on the
new processor feature. No new symbol version is neeeded.
Both CPU_FEATURE_USABLE and HAS_CPU_FEATURE are provided. HAS_CPU_FEATURE
can be used to identify processor features.
Note: Although GCC has __builtin_cpu_supports, it only supports a subset
of <sys/platform/x86.h> and it is equivalent to CPU_FEATURE_USABLE. It
doesn't support HAS_CPU_FEATURE.
Adhemerval Zanella [Mon, 6 Jul 2020 16:27:12 +0000 (13:27 -0300)]
linux: Add time64 pselect support
The syscall __NR_pselect6_time64 (32-bit) or __NR_pselect6 (64-bit)
is used as default. For architectures with __ASSUME_TIME64_SYSCALLS
the 32-bit fallback uses __NR_pselec6.
To accomodate microblaze missing pselect6 support on kernel older
than 3.15 the fallback is moved to its own function to the microblaze
specific implementation can override it.
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>
Adhemerval Zanella [Mon, 6 Jul 2020 20:40:34 +0000 (17:40 -0300)]
linux: Add time64 semtimedop support
Either the __NR_semtimedop_time64 (for 32-bit) or the __NR_semtimedop
(for 64-bit) syscall is used as default. The 32-bit fallback is used
iff __ASSUME_TIME64_SYSCALLS is not defined, which assumes the kernel
ABI provides either __NR_ipc or __NR_semtimeop (for 32-bit time_t).
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>
Adhemerval Zanella [Fri, 10 Jul 2020 16:50:56 +0000 (13:50 -0300)]
linux: Add ppoll time64 optimization
It avoid continuing issue the __NR_ppoll_time64 syscall once the kernel
advertise it does not support it.
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>