Lukasz Majewski [Fri, 15 Jan 2021 15:40:39 +0000 (16:40 +0100)]
tst: Extend cross-test-ssh.sh to specify if target date can be altered
This code adds new flag - '--allow-time-setting' to cross-test-ssh.sh
script to indicate if it is allowed to alter the date on the system
on which tests are executed. This change is supposed to be used with
test systems, which use virtual machines for testing.
The GLIBC_TEST_ALLOW_TIME_SETTING env variable is exported to the
remote environment on which the eligible test is run and brings no
functional change when it is not.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
John David Anglin [Sun, 7 Mar 2021 17:23:34 +0000 (17:23 +0000)]
Update hppa libm-test-ulps
H.J. Lu [Tue, 2 Feb 2021 21:45:58 +0000 (13:45 -0800)]
x86: Set minimum x86-64 level marker [BZ #27318]
Since the full ISA set used in an ELF binary is unknown to compiler,
an x86-64 ISA level marker indicates the minimum, not maximum, ISA set
required to run such an ELF binary. We never guarantee a library with
an x86-64 ISA level v3 marker doesn't contain other ISAs beyond x86-64
ISA level v3, like AVX VNNI. We check the x86-64 ISA level marker for
the minimum ISA set. Since -march=sandybridge enables only some ISAs
in x86-64 ISA level v3, we should set the needed ISA marker to v2.
Otherwise, libc is compiled with -march=sandybridge will fail to run on
Sandy Bridge:
$ ./elf/ld.so ./libc.so
./libc.so: (p) CPU ISA level is lower than required: needed: 7; got: 3
Set the minimum, instead of maximum, x86-64 ISA level marker should have
no impact on the glibc-hwcaps directory assignment logic in ldconfig nor
ld.so.
Florian Weimer [Fri, 5 Mar 2021 11:02:20 +0000 (12:02 +0100)]
posix: glob, glob64 should not be declared __THROW [BZ #27522]
These functions invoke callbacks with GLOB_ALTDIRFUNC, so they
are not leaf functions (as implied by _THROW). Use __THROWNL
and __REDIRECT_NTHNL to express this.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Adhemerval Zanella [Wed, 17 Feb 2021 14:10:52 +0000 (11:10 -0300)]
nptl: Fix __pthread_clockjoin_np64 __pthread_timedjoin_np64 hidden proto
They are both implemented in libpthread instead of libc.
Adhemerval Zanella [Thu, 25 Feb 2021 23:43:13 +0000 (20:43 -0300)]
linux: Fix __thrd_sleep64 hidden definition
The symbol is exported by libc.
Adhemerval Zanella [Thu, 4 Mar 2021 19:12:42 +0000 (19:12 +0000)]
Update arm libm-test-ulps
Adhemerval Zanella [Thu, 4 Mar 2021 20:40:20 +0000 (14:40 -0600)]
Update sparc libm-test-ulps
Jakub Jelinek [Thu, 4 Mar 2021 14:15:33 +0000 (15:15 +0100)]
[PATCH] pthread_once hangs when init routine throws an exception [BZ #18435]
This is another attempt at making pthread_once handle throwing exceptions
from the init routine callback. As the new testcases show, just switching
to the cleanup attribute based cleanup does fix the tst-once5 test, but
breaks the new tst-oncey3 test. That is because when throwing exceptions,
only the unwind info registered cleanups (i.e. C++ destructors or cleanup
attribute), when cancelling threads and there has been unwind info from the
cancellation point up to whatever needs cleanup both unwind info registered
cleanups and THREAD_SETMEM (self, cleanup, ...) registered cleanups are
invoked, but once we hit some frame with no unwind info, only the
THREAD_SETMEM (self, cleanup, ...) registered cleanups are invoked.
So, to stay fully backwards compatible (allow init routines without
unwind info which encounter cancellation points) and handle exception throwing
we actually need to register the pthread_once cleanups in both unwind info
and in the THREAD_SETMEM (self, cleanup, ...) way.
If an exception is thrown, only the former will happen and we in that case
need to also unregister the THREAD_SETMEM (self, cleanup, ...) registered
handler, because otherwise after catching the exception the user code could
call deeper into the stack some cancellation point, get cancelled and then
a stale cleanup handler would clobber stack and probably crash.
If a thread calling init routine is cancelled and unwind info ends before
the pthread_once frame, it will be cleaned up through self->cleanup as
before. And if unwind info is present, unwind_stop first calls the
self->cleanup registered handler for the frame, then it will call the
unwind info registered handler but that will already see __do_it == 0
and do nothing.
Florian Weimer [Wed, 3 Mar 2021 17:39:17 +0000 (18:39 +0100)]
powerpc: Regenerate ulps
This time on a POWER8 machine.
Arjun Shankar [Wed, 3 Mar 2021 11:22:08 +0000 (12:22 +0100)]
s390x: Regenerate ulps
For new test cases in commit
5a051454a9b5.
DJ Delorie [Thu, 18 Feb 2021 20:26:30 +0000 (15:26 -0500)]
nss: Re-enable NSS module loading after chroot [BZ #27389]
The glibc 2.33 release enabled /etc/nsswitch.conf reloading,
and to prevent potential security issues like CVE-2019-14271
the re-loading of nsswitch.conf and all mdoules was disabled
when the root filesystem changes (see bug 27077).
Unfortunately php-lpfm and openldap both require the ability
to continue to load NSS modules after chroot. The packages
do not exec after the chroot, and so do not cause the
protections to be reset. The only solution is to re-enable
only NSS module loading (not nsswitch.conf reloading) and so
get back the previous glibc behaviour.
In the future we may introduce a way to harden applications
so they do not reload NSS modules once the root filesystem
changes, or that only files/dns are available pre-loaded
(or builtin).
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
DJ Delorie [Thu, 25 Feb 2021 21:08:21 +0000 (16:08 -0500)]
nscd: Fix double free in netgroupcache [BZ #27462]
In commit
745664bd798ec8fd50438605948eea594179fba1 a use-after-free
was fixed, but this led to an occasional double-free. This patch
tracks the "live" allocation better.
Tested manually by a third party.
Related: RHBZ 1927877
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Lukasz Majewski [Sun, 28 Feb 2021 16:28:48 +0000 (17:28 +0100)]
tst: Fix tst-timerfd test
There were following problems discovered for tst-timerfd test:
1. Do not set the struct itimerspec's it_interval tv_sec to 2 seconds.
After this change the timerfd will trigger only once (the it_value is
only set in this case).
2. The 'val1' variable (including the call to timerfd_gettime) is not
needed anymore, as it is just enough to read the struct itimerspec
after sleep. As a consequence the 'val2' has been renamed to 'val'.
3. After calling timerfd_gettime, the value of struct itimerspec time,
when timer is running, is the remaining time. In the case of this test
it would be less than 1 second.
As a result the TEST_COMPARE macro logic had to be adjusted.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 2 Mar 2021 14:41:29 +0000 (15:41 +0100)]
i386: Regenerate ulps
Florian Weimer [Wed, 24 Feb 2021 12:12:04 +0000 (13:12 +0100)]
x86: Add CPU-specific diagnostics to ld.so --list-diagnostics
Florian Weimer [Tue, 2 Mar 2021 13:58:05 +0000 (14:58 +0100)]
x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield
Use a .def file to define the bitfield layout, so that it is possible
to iterate over field members using the preprocessor.
Florian Weimer [Tue, 2 Mar 2021 13:38:42 +0000 (14:38 +0100)]
ld.so: Implement the --list-diagnostics option
Matheus Castanho [Mon, 1 Mar 2021 20:07:27 +0000 (14:07 -0600)]
powerpc: Update libm-test-ulps
Generated with 'make regen-ulps'
Tested on powerpc, powerpc64, and powerpc64le
Lukasz Majewski [Wed, 24 Feb 2021 23:58:56 +0000 (00:58 +0100)]
tst: Add test for utimes
This patch provides test for utimes. It uses wrapper to read
access and modification times to compare them with ones written by
utimes.
Moreover, access and modification times beyond the Y2038 threshold
date (i.e. 32 bit time_t overflow) are also checked.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Wed, 24 Feb 2021 21:19:06 +0000 (22:19 +0100)]
tst: Add test for utime
This patch provides test for utime. It uses wrapper to read access
and modification times to compare them with ones written by utime.
Moreover, access and modification times beyond the Y2038 threshold
date (i.e. 32 bit time_t overflow) are also checked.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Mon, 8 Feb 2021 09:58:44 +0000 (10:58 +0100)]
tst: Add test for futimens
This patch provides test for futimens. It uses wrapper, which
reads access and modification time to compare them with ones
written by futimens.
Moreover, access and modification times beyond the Y2038 threshold
date (i.e. 32 bit time_t overflow) are also checked.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 2 Mar 2021 09:49:03 +0000 (10:49 +0100)]
nptl: __libc_cleanup_push/__libc_cleanup_pop require -fexceptions
Do not define these macros if they do nothing in a particular
compilation, otherwise they can easily be used accidentally, while
not actually achieving anything.
Florian Weimer [Tue, 2 Mar 2021 09:46:45 +0000 (10:46 +0100)]
elf: Build __dl_iterate_phdr with unwinding support [BZ #27498]
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
nptl: Use <unwind-link.h> for accessing the libgcc_s unwinder
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
Implement _Unwind_Resume in libc on top of <unwind-link.h>
Temporarily move the arm _Unwind_Resume implementation to the file
used by libpthread. It will be ported to <unwind-link.h> along with
the rest of nptl.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
Move sysdeps/gnu/unwind-resume.c to sysdeps/generic/unwind-resume.c
This change allows architecture-specific sysdeps directories to override
it.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
__frame_state_for: Use <unwind-link.h> for unwinder access
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
sparc: Implement backtrace on top <unwind-link.h>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
m68k: Implement backtrace on top of <unwind-link.h>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
i386: Implement backtrace on top of <unwind-link.h>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
arm: Implement backtrace on top of <unwind-link.h>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
backtrace: Implement on top of <unwind-link.h>
This reimplements the generic version of backtrace.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 1 Mar 2021 14:56:36 +0000 (15:56 +0100)]
Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder
This will be used to consolidate the libgcc_s access for backtrace
and pthread_cancel.
Unlike the existing backtrace implementations, it provides some
hardening based on pointer mangling.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Martin Sebor [Mon, 1 Mar 2021 05:05:39 +0000 (10:35 +0530)]
Correct buffer end pointer in IO_wdefault_doallocate (BZ #26874)
An experimental build of GCC 11 with an enhanced -Warray-bounds
reports a bug in IO_wdefault_doallocate where the function forms
an invalid past-the-end pointer to an allocated wchar_t buffer
by failingf to consider the scaling by sizeof (wchar_t).
The fix path below corrects this problem. It keeps the buffer
size the same as opposed to increasing it according to what other
code like it does.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Szabolcs Nagy [Mon, 1 Mar 2021 12:29:17 +0000 (12:29 +0000)]
aarch64: update ulps.
For new test cases in
commit
5a051454a9b50c27984bbc499ee1297de48e2dc8
Paul Zimmermann [Fri, 26 Feb 2021 07:00:03 +0000 (08:00 +0100)]
Add inputs that generate larger error bounds
(Using values from https://members.loria.fr/PZimmermann/papers/accuracy.pdf)
Florian Weimer [Thu, 25 Feb 2021 11:10:57 +0000 (12:10 +0100)]
Reduce the statically linked startup code [BZ #23323]
It turns out the startup code in csu/elf-init.c has a perfect pair of
ROP gadgets (see Marco-Gisbert and Ripoll-Ripoll, "return-to-csu: A
New Method to Bypass 64-bit Linux ASLR"). These functions are not
needed in dynamically-linked binaries because DT_INIT/DT_INIT_ARRAY
are already processed by the dynamic linker. However, the dynamic
linker skipped the main program for some reason. For maximum
backwards compatibility, this is not changed, and instead, the main
map is consulted from __libc_start_main if the init function argument
is a NULL pointer.
For statically linked binaries, the old approach based on linker
symbols is still used because there is nothing else available.
A new symbol version __libc_start_main@@GLIBC_2.34 is introduced because
new binaries running on an old libc would not run their ELF
constructors, leading to difficult-to-debug issues.
Adhemerval Zanella [Mon, 4 Jan 2021 17:26:30 +0000 (14:26 -0300)]
posix: Falling back to non wide mode in case of encoding error [BZ #14185]
Gnulib has added the proposed fix with
aed23714d60 (done in 2005), but
recently with a glibc merge with 67306f6 (done in 2020 with sync back)
it has fallback to old semantic to return -1 on in case of failure.
From gnulib developer feedback it was an oversight. Although the full
fix for BZ #14185 would require to rewrite fnmatch implementation to use
mbrtowc instead of mbsrtowcs on the full input, this mitigate the issue
and it has been used by gnulib for a long time.
This patch also removes the alloca usage on the string convertion to
wide characters before calling the internal function.
Checked on x86_64-linux-gnu.
Florian Weimer [Tue, 23 Feb 2021 13:59:34 +0000 (14:59 +0100)]
nptl: Move elision implementations into libc
The elision interfaces are closely aligned between the targets that
implement them, so declare them in the generic <lowlevellock.h>
file.
Empty .c stubs are provided, so that fewer makefile updates
under sysdeps are needed. Also simplify initialization via
__libc_early_init.
The symbols __lll_clocklock_elision, __lll_lock_elision,
__lll_trylock_elision, __lll_unlock_elision, __pthread_force_elision
move into libc. For the time being, non-hidden references are used
from libpthread to access them, but once that part of libpthread
is moved into libc, hidden symbols will be used again. (Hidden
references seem desirable to reduce the likelihood of transactions
aborts.)
Samuel Thibault [Tue, 23 Feb 2021 12:35:34 +0000 (13:35 +0100)]
NEWS: Add missing bug closures
Paul Zimmermann [Tue, 23 Feb 2021 08:16:39 +0000 (09:16 +0100)]
added rt to malloc/Depend [BZ #27132]
This avoids a failure when a new glibc version is compiled with an older
system librt. Patch proposed by Florian Weimer.
H.J. Lu [Fri, 12 Feb 2021 17:57:30 +0000 (09:57 -0800)]
x86: Use x86/nptl/pthreaddef.h
1. Move sysdeps/i386/nptl/pthreaddef.h to sysdeps/x86/nptl/pthreaddef.h.
2. Remove sysdeps/x86_64/nptl/pthreaddef.h.
Reviewed-by: DJ Delorie <dj@redhat.com>
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
nptl: Move futex-internal into libc
This moves __futex_abstimed_wait64 and
__futex_abstimed_wait_cancelable64 and exports these functions as
GLIBC_PRIVATE.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
nptl: Move lowlevellock into libc [BZ #15648]
And export __lll_lock_wait and __lll_lock_wait_private as
GLIBC_PRIVATE. This should eliminate the need for the previous
riscv kludge.
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
nptl: Move futex-internal.c into main nptl directory
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
nptl: Reformat Versions
One symbol per line, lexicographically ordered.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Mon, 22 Feb 2021 17:30:52 +0000 (18:30 +0100)]
nptl: Split libpthread-routines into one routine per line
And sort the lines lexicographically. This will make it easier to review
patches which move symbols from libpthread to libc.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Mon, 22 Feb 2021 16:36:03 +0000 (17:36 +0100)]
x86: Remove unused variables for raw cache sizes from cacheinfo.h
Joseph Myers [Mon, 22 Feb 2021 16:11:21 +0000 (16:11 +0000)]
Use Linux 5.11 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.11.
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
H.J. Lu [Tue, 2 Feb 2021 14:49:02 +0000 (06:49 -0800)]
<bits/platform/x86.h>: Correct x86_cpu_TBM
x86_cpu_TBM should be x86_cpu_index_80000001_ecx + 21.
H.J. Lu [Sat, 13 Feb 2021 19:46:38 +0000 (11:46 -0800)]
x86_64/clone.S: Upate comments
H.J. Lu [Sun, 14 Feb 2021 03:02:53 +0000 (19:02 -0800)]
i386/clone.S: Remove redundant EBX load
There is no neeed for
call L(here)
L(here):
popl %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx
before
movl %eax, %ebx
Szabolcs Nagy [Thu, 18 Feb 2021 10:56:34 +0000 (10:56 +0000)]
aarch64: Remove the unused __read_tp symbol
This was likely a mistake in the original aarch64 port copied over
from arm: on aarch64 tpidr_el0 register is always available.
The __read_tp symbol is visible with static linking, but it's not
part of the public ABI so it should be safe to remove.
Florian Weimer [Mon, 22 Feb 2021 08:39:14 +0000 (09:39 +0100)]
build-many-glibcs.py: Use make -O for more consistent log output
The -O option avoids interleaving (e.g.) compiler error messages
with other build messages, and makes attribution of messages to
commands easier.
According to my tests, the impact on build time is within the noise.
Naohiro Tamura [Wed, 17 Feb 2021 01:20:17 +0000 (01:20 +0000)]
configure: Replace obsolete AC_TRY_LINK with AC_LINK_IFELSE
This patch replaces obsolete AC_TRY_LINK with AC_LINK_IFELSE.
It has been confirmed that GNU 'autoconf' 2.69 doesn't change the
'configure' file and suppressed obsolete warning.
Naohiro Tamura [Tue, 16 Feb 2021 12:01:00 +0000 (12:01 +0000)]
configure: Remove obsolete AC_CHECK_TOOL_PREFIX
This patch removes obsolete AC_CHECK_TOOL_PREFIX.
It has been confirmed that AC_CHECK_TOOL_PREFIX is defined as NOP in
GNU 'autoconf' 2.69 [1], so we can safely remove it.
The 'configure' file has been deleted one blank line by the 'autoconf'
2.69 command .
[1] autoconf-2.69/share/autoconf/autoconf/programs.m4
181 # AC_CHECK_TOOL_PREFIX
182 # --------------------
183 AU_DEFUN([AC_CHECK_TOOL_PREFIX])
Naohiro Tamura [Mon, 15 Feb 2021 12:31:37 +0000 (12:31 +0000)]
configure: Replace obsoleted AC_HELP_STRING with AS_HELP_STRING
This patch replaces obsoleted AC_HELP_STRING with AS_HELP_STRING.
As of Glibc 2.33, INSTALL says "GNU 'autoconf' 2.69 (exactly)" is
required. So we can safely replace obsoleted macro without worrying
about older autoconf.
This change doesn't affect the contents of "configure" file.
Joseph Myers [Fri, 19 Feb 2021 21:16:27 +0000 (21:16 +0000)]
Update syscall lists for Linux 5.11.
Linux 5.11 has one new syscall, epoll_pwait2. Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.
Tested with build-many-glibcs.py.
John David Anglin [Fri, 19 Feb 2021 17:08:47 +0000 (17:08 +0000)]
Correct hppa EFD_NONBLOCK, IN_NONBLOCK, SFD_NONBLOCK and TFD_NONBLOCK defines.
Florian Weimer [Fri, 19 Feb 2021 12:29:00 +0000 (13:29 +0100)]
string: Work around GCC PR 98512 in rawmemchr
Lukasz Majewski [Mon, 25 Jan 2021 12:48:13 +0000 (13:48 +0100)]
tst: time: Provide Y2038 tests for mktime (tst-mktime4.c)
This change adds new test to assess mktime's functionality.
To be more specific - following use cases are checked:
- Pass struct tm as epoch time
- Pass struct tm as value just before Y2038 threshold (returned
value shall be 0x7FFFFFFF)
- Pass struct tm as the first value after Y2038 threshold
(expected value - 0x80000000)
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Mon, 25 Jan 2021 11:51:41 +0000 (12:51 +0100)]
tst: Provide test for difftime
This change adds new test to assess difftime's functionality by
adding some arbitrary offsets to current time_t value (read via
time).
If 64 bit time_t is supported, the same procedure is applied around
the threshold of Y2038 time overflow.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Thu, 21 Jan 2021 08:33:34 +0000 (09:33 +0100)]
tst: Provide test for ctime
This change adds new test to assess ctime's functionality.
To be more specific - following use cases are checked:
- Pass time_t value as 0 to check if epoch time is converted
- Pass time_t as max value for 32 bit systems
- Pass time_t as the first value after Y2038 threshold
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Mon, 25 Jan 2021 09:26:57 +0000 (10:26 +0100)]
tst: Provide test for sched_rr_get_interval
This change adds new test to assess sched_rr_get_interval's
functionality.
To be more specific - following use cases are checked:
- If the read interval is correct
- If the proper ABI is used - to check if adjacent data is not
overwritten
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Stefan Liebler [Tue, 16 Feb 2021 15:18:56 +0000 (16:18 +0100)]
S390: Add new hwcap values.
The new hwcap values indicate support for arch14 architecture.
Szabolcs Nagy [Mon, 15 Feb 2021 13:10:03 +0000 (13:10 +0000)]
aarch64: Fix sys/ptrace.h if linux headers are included
If the linux asm/ptrace.h is included before sys/ptrace.h that
breaks the newly added declarations there, so undef the names
that may be defined as macros in the linux header.
Florian Weimer [Fri, 12 Feb 2021 17:22:59 +0000 (18:22 +0100)]
elf: Do not copy vDSO soname when setting up link map
The kernel does not put the vDSO at special addresses, so writev can
write the name directly. Also remove the incorrect comment about not
setting l_name.
Andy Lutomirski confirmed in
<https://lore.kernel.org/linux-api/
442A16C0-AE5A-4A44-B261-
FE6F817EAF3C@amacapital.net/>
that this copy is not necessary.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
H.J. Lu [Fri, 12 Feb 2021 15:46:32 +0000 (07:46 -0800)]
x86: Remove the extra space between "# endif"
Remove the extra space between "# endif" left over from
commit
f380868f6dcfdeae8d449d556298d9c41012ed8d
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Dec 24 15:43:34 2020 -0800
Remove _ISOMAC check from <cpu-features.h>
Adhemerval Zanella [Thu, 11 Feb 2021 20:42:14 +0000 (17:42 -0300)]
hurd: Fix fstatfs build failure
It was added by
1bfbaf7130 where it added a libc_hidden_proto for
__fstatfs but it didn't update the Hurd version as well.
Checked with a build for i686-gnu.
Adhemerval Zanella [Sun, 7 Feb 2021 18:45:15 +0000 (18:45 +0000)]
linux: Remove stat-check.c
The check is moved to LFS fstatat implementation (since it is the
code that actually implements the syscall).
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Sun, 7 Feb 2021 18:45:12 +0000 (18:45 +0000)]
linux: Remove overflow.h
The header is not used anywhere.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Sun, 7 Feb 2021 17:43:02 +0000 (17:43 +0000)]
linux: Consolidate internal_statvfs
Remove the internal_statvfs64.c and open code the implementation
on internal_statvfs.c. The alpha is now unrequired, the generic
implementation also handles it.
Also, remove unused includes on internal_statvfs.c, and remove
unused arguments on __internal_statvfs{64}.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Sat, 6 Feb 2021 11:26:28 +0000 (11:26 +0000)]
linux: Consolidate statvfs implementations
There is no need to handle ENOSYS on fstatfs64 call, required only
for alpha (where is already fallbacks to fstatfs).
Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Sat, 6 Feb 2021 11:32:57 +0000 (11:32 +0000)]
linux: Consolidate fstatvfs implementations
There is no need to handle ENOSYS on fstatfs64 call, required only
for alpha (where is already fallbacks to fstatfs). The wordsize
internal_statvfs64.c is removed, since how the LFS support is
provided by fstatvfs64.c (used on 64-bit architectures as well).
Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Fri, 5 Feb 2021 21:26:57 +0000 (21:26 +0000)]
linux: Consolidate statfs implementations
The __NR_statfs64 syscall is supported on all architectures but
aarch64, mips64, riscv64, and x86_64. And newer ABIs also uses
the new statfs64 interface (where the struct size is used as
second argument).
So the default implementation now uses:
1. __NR_statfs64 for non-LFS call and handle overflow directly
There is no need to handle __NR_statfs since all architectures
that only support are LFS only.
2. __NR_statfs if defined or __NR_statfs64 otherwise for LFS
call.
Alpha is the only outlier, since it is a 64-bit architecture which
provides non-LFS interface and only provides __NR_statfs64 on
newer kernels (v5.1+).
Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Fri, 5 Feb 2021 20:13:58 +0000 (20:13 +0000)]
linux: Consolidate fstatfs implementations
The __NR_fstatfs64 syscall is supported on all architectures but
aarch64, mips64, riscv64, and x86_64. And newer ABIs also uses
the new fstatfs64 interface (where the struct size is used as
first argument).
So the default implementation now uses:
1. __NR_fstatfs64 for non-LFS call and handle overflow directly
There is no need to handle __NR_fstatfs since all architectures
that only support are LFS only.
2. __NR_fstatfs if defined or __NR_fstatfs64 otherwise for LFS
call.
Alpha is the only outlier, it is a 64-bit architecture which
provides non-LFS interface and only provides __NR_fstatfs64 on
newer kernels (5.1+).
Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Fri, 5 Feb 2021 18:37:02 +0000 (18:37 +0000)]
linux: Set LFS statfs as default
Currently glibc has three different struct statfs{64} definitions:
1. Non-LFS support where non-LFS and LFS struct have different
size: alpha, arm, hppa, i686, m68k, microblaze, mips (all abis),
powerpc32, s390, sh4, and sparc.
2. Non-LFS support where non-LFS and LFS struct have the same
size: csky and nios2.
3. Only LFS support (where both struct have the same size): arc,
ia64, powerpc64 (including LE), riscv (both 32 and 64 bits),
s390x, sparc64, and x86 (including x32).
The STATFS_IS_STATFS64/__STATFS_MATCHES_STATFS64 does not tell apart
between 1. and 2. since for both the only difference is the struct
size (for 2. both non-LFS and LFS uses the same syscall, where for
1. the old non-LFS is used for [f]statfs).
This patch move the generic statfs.h for both csky and nios2, and
make the default definitions for newer ABIs to assume that only
LFS will be support (so there is no need to keep no-LFS and LFS
struct statfs with the same size, it will be implicit).
This patch does not change the code generation.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Fri, 5 Feb 2021 16:36:30 +0000 (16:36 +0000)]
linux: Set default kernel_stat.h to LFS
The XSTAT_IS_XSTAT64 and STAT_IS_KERNEL_STAT flags are now set to 1 and
STATFS_IS_STATFS64 is set to __STATFS_MATCHES_STATFS64. This makes the
default ABI for newer ports to provide only LFS calls.
A copy of non-LFS support is provided to 32-bit ABIS with non-LFS
support (arm, csky, i386, m68k, nios2, s390, and sh). Is also allows
to remove the 64-bit ports, which already uses the default values.
This patch does not change the code generation.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Adhemerval Zanella [Fri, 5 Feb 2021 14:55:45 +0000 (14:55 +0000)]
linux: Fix STATFS_IS_STATFS64 definition
aarch64, arc, ia64, mips64, powerpc64, riscv32, riscv64, s390x, sparc64,
and x86_64 defines STATFS_IS_STATFS64 to 0, but all of them alias
statfs to statfs64 and the struct statfs has the same and layout of
struct statfs64.
The correct definition will be used on the [f]statfs[64] consolidation.
This patch does not change code generation since the symbols are
implemented using the auto-generation syscall for all the aforementioned
ABIs.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Siddhesh Poyarekar [Fri, 5 Feb 2021 08:39:24 +0000 (14:09 +0530)]
tunables: Disallow negative values for some tunables
The glibc.malloc.mmap_max tunable as well as al of the INT_32 tunables
don't have use for negative values, so pin the hardcoded limits in the
non-negative range of INT. There's no real benefit in any of those
use cases for the extended range of unsigned, so I have avoided added
a new type to keep things simple.
Siddhesh Poyarekar [Wed, 3 Feb 2021 14:33:19 +0000 (20:03 +0530)]
x86: Use SIZE_MAX instead of (long int)-1 for tunable range value
The tunable types are SIZE_T, so set the ranges to the correct maximum
value, i.e. SIZE_MAX.
Siddhesh Poyarekar [Fri, 5 Feb 2021 07:48:58 +0000 (13:18 +0530)]
tunables: Simplify TUNABLE_SET interface
The TUNABLE_SET interface took a primitive C type argument, which
resulted in inconsistent type conversions internally due to incorrect
dereferencing of types, especialy on 32-bit architectures. This
change simplifies the TUNABLE setting logic along with the interfaces.
Now all numeric tunable values are stored as signed numbers in
tunable_num_t, which is intmax_t. All calls to set tunables cast the
input value to its primitive type and then to tunable_num_t for
storage. This relies on gcc-specific (although I suspect other
compilers woul also do the same) unsigned to signed integer conversion
semantics, i.e. the bit pattern is conserved. The reverse conversion
is guaranteed by the standard.
Xiaoming Ni [Mon, 4 Jan 2021 04:07:38 +0000 (12:07 +0800)]
setrlimit/getrlimit: Use __nonnull to avoid null pointer
Add __nonnull((2)) to the setrlimit()/getrlimit() function declaration
to avoid null pointer access.
-----
v2
According to the suggestions of the Adhemerval Zanella and Zack Weinberg:
use __nonnull() to check null pointers in the compilation phase.
do not add pointer check code to setrlimit()/getrlimit().
The validity of the "resource" parameter is checked in the syscall.
v1
https://public-inbox.org/libc-alpha/
20201230114131.47589-1-nixiaoming@huawei.com/
-----
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Naohiro Tamura [Mon, 8 Feb 2021 07:59:53 +0000 (07:59 +0000)]
benchtests: Updated json bench-variant attribute
This patch updates json "bench-variant" attribute of "bench-memset.c"
to "default" so that the script "benchtests/scripts/plot_strings.py"
can generate a file "memset_time_default_linear.png".
Without this patch, the script "benchtests/scripts/plot_strings.py"
generates a file "memset_time__linear.png" which has inconsistent form
with "memcpy_time_default_linear.png" and
"memmove_time_default_linear.png".
Adhemerval Zanella [Mon, 16 Jul 2018 20:39:23 +0000 (17:39 -0300)]
regex: stop using alloca
It syncs with gnulib version
87ed1f9c4. No functional changes is
expected.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Mon, 11 Jan 2021 15:23:00 +0000 (12:23 -0300)]
regexec: remove alloca usage in build_trtable
It syncs with gnulib version
1731fef3d. On build_trtable prevent
inlining, so that it doesn't bloat the caller's stack and use auto
variables instead of alloca/malloc.
After these changes, build_trtable's total stack allocation is
only 20 KiB on a 64-bit machine, and this is less than glibc's 64
KiB cutoff so there's little point to using alloca to shrink it.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Mon, 16 Jul 2018 20:31:29 +0000 (17:31 -0300)]
regex: remove alloca usage on regex set_regs
It syncs with gnulib version
b6207ab38. It replaces the regmatch_t
with a dynarray list.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Mon, 11 Jan 2021 15:03:38 +0000 (12:03 -0300)]
malloc: Sync dynarray with gnulib
It syncs with gnulib version
a8bac4d49. The main changes are:
- Remove the usage of anonymous union within DYNARRAY_STRUCT.
- Use DYNARRAY_FREE instead of DYNARRAY_NAME (free) so that
Gnulib does not change 'free' to 'rpl_free'.
- Use __nonnull instead of __attribute__ ((nonnull ())).
- Use __attribute_maybe_unused__ instead of
__attribute__ ((unused, nonnull (1))).
- Use of _Noreturn instead of _attribute__ ((noreturn)).
The only difference with gnulib is:
--- glibc
+++ gnulib
@@ -18,6 +18,7 @@
#include <dynarray.h>
#include <stdio.h>
+#include <stdlib.h>
void
__libc_dynarray_at_failure (size_t size, size_t index)
@@ -27,7 +28,6 @@
__snprintf (buf, sizeof (buf), "Fatal glibc error: "
"array index %zu not less than array length %zu\n",
index, size);
- __libc_fatal (buf);
#else
abort ();
#endif
It seems a wrong sync from gnulib (the code is used on loader and
thus it requires __libc_fatal instead of abort).
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Mon, 11 Jan 2021 14:53:32 +0000 (11:53 -0300)]
misc: Sync cdefs.h with gnulib
It adds __glibc_has_builtin, __glibc_has_extension, and
__attribute_maybe_unused__ alongsize with some fixes.
The differences are:
--- glibc
+++ gnulib
@@ -259,7 +259,9 @@
# define __attribute_const__ /* Ignore */
#endif
-#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
+#if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__
+# define __attribute_maybe_unused__ [[__maybe_unused__]]
+#elif __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
# define __attribute_maybe_unused__ __attribute__ ((__unused__))
#else
# define __attribute_maybe_unused__ /* Ignore */
@@ -485,7 +487,7 @@
/* The #ifndef lets Gnulib avoid including these on non-glibc
platforms, where the includes typically do not exist. */
-#ifdef __GLIBC__
+#ifndef __WORDSIZE
# include <bits/wordsize.h>
# include <bits/long-double.h>
#endif
The [[__attribute_maybe_unused__]] attribute removal __ is due Joseph
questioning gcc support with -std=c2x or -std=gnu2x [1].
The _WORDSIZE replacement by __GLIBC__ is because it does not play
well with internal cdefs.h that also uses
__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI.
Checked on x86_64-linux-gnu.
[1] https://sourceware.org/pipermail/libc-alpha/2021-January/121600.html
Adhemerval Zanella [Tue, 9 Feb 2021 19:09:51 +0000 (16:09 -0300)]
linux: Fix __sem_check_add_mapping search_sem
Similar to __sem_check_add_mapping fix, take in consideration the
trailling NULL.
Checked x86_64-linux-gnu.
Adhemerval Zanella [Tue, 9 Feb 2021 17:40:06 +0000 (14:40 -0300)]
linux: Fix __sem_check_add_mapping name length
Take in consideration the trailling NULL since sem_search uses
strcmp to compare entries.
Checked on x86_64-linux-gnu and powerpc-linux-gnu (where it triggered
a nptl/tst-sem7 regression).
Joseph Myers [Mon, 8 Feb 2021 22:47:04 +0000 (22:47 +0000)]
Add more ptrace constants for AArch64 and PowerPC.
Linux 5.10 adds PTRACE_PEEKMTETAGS and PTRACE_POKEMTETAGS for AArch64.
Adding those shows up that glibc is also missing PTRACE_SYSEMU and
PTRACE_SYSEMU_SINGLESTEP, for AArch64 (where they were added to Linux
in 5.3) and for PowerPC (where they were added in Linux 4.20); it
already has those two defines for x86. Add all those defines to
glibc's headers.
Tested with build-many-glibcs.py for aarch64-linux-gnu and
powerpc-linux-gnu.
noah [Wed, 3 Feb 2021 05:39:00 +0000 (00:39 -0500)]
strchr: Add additional benchmarks and tests
This patch adds additional benchmarks and tests for string size of
4096 and several benchmarks for string size 256 with different
alignments.
noah [Wed, 3 Feb 2021 05:38:59 +0000 (00:38 -0500)]
x86-64: Refactor and improve performance of strchr-avx2.S
No bug. Just seemed the performance could be improved a bit. Observed
and expected behavior are unchanged. Optimized body of main
loop. Updated page cross logic and optimized accordingly. Made a few
minor instruction selection modifications. No regressions in test
suite. Both test-strchrnul and test-strchr passed.
Adhemerval Zanella [Wed, 3 Feb 2021 17:19:27 +0000 (14:19 -0300)]
pthread: Remove alloca usage from __sem_check_add_mapping
sem_open already returns EINVAL for input names larger than NAME_MAX,
so it can assume the largest name length with tfind.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Wed, 3 Feb 2021 16:50:21 +0000 (13:50 -0300)]
pthread: Refactor semaphore code
The internal semaphore list code is moved to a specific file,
sem_routine.c, and the internal usage is simplified to only two
functions (one to insert a new semaphore and one to remove it
from the internal list). There is no need to expose the
internal locking, neither how the semaphore mapping is implemented.
No functional or semantic change is expected, tested on
x86_64-linux-gnu.
Florian Weimer [Wed, 3 Feb 2021 11:55:13 +0000 (08:55 -0300)]
linux: Require /dev/shm as the shared memory file system
Previously, glibc would pick an arbitrary tmpfs file system from
/proc/mounts if /dev/shm was not available. This could lead to
an unsuitable file system being picked for the backing storage for
shm_open, sem_open, and related functions.
This patch introduces a new function, __shm_get_name, which builds
the file name under the appropriate (now hard-coded) directory. It is
called from the various shm_* and sem_* function. Unlike the
SHM_GET_NAME macro it replaces, the callers handle the return values
and errno updates. shm-directory.c is moved directly into the posix
subdirectory because it can be implemented directly using POSIX
functionality. It resides in libc because it is needed by both
librt and nptl/htl.
In the sem_open implementation, tmpfname is initialized directly
from a string constant. This happens to remove one alloca call.
Checked on x86_64-linux-gnu.
Paul Zimmermann [Wed, 3 Feb 2021 05:45:16 +0000 (06:45 +0100)]
sunrpc: Fix typo in xdr_string comment
Lukasz Majewski [Wed, 13 Jan 2021 16:10:21 +0000 (17:10 +0100)]
tst: Provide test for ppoll
This change adds new test to assess ppoll()'s timeout related
functionality (the struct pollfd does not provide valid fd to wait
for - just wait for timeout).
To be more specific - two use cases are checked:
- if ppoll() times out immediately when passed struct timespec has zero
values of tv_nsec and tv_sec.
- if ppoll() times out after timeout specified in passed argument