Commit Graph

36463 Commits

Author SHA1 Message Date
Florian Weimer
e0f1a58f3d 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>
2020-10-08 15:00:39 +02:00
Florian Weimer
27316f4a23 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>
2020-10-08 14:29:49 +02:00
Florian Weimer
9590a71adc 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>
2020-10-08 13:38:23 +02:00
Florian Weimer
2bf9e641fd 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.
2020-10-08 12:05:47 +02:00
Florian Weimer
72d36ffd7d 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>
2020-10-08 11:00:42 +02:00
Andreas Schwab
c0e9ddf59e __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.
2020-10-08 10:09:30 +02:00
Andreas Schwab
8f8052c2aa 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.
2020-10-08 10:09:30 +02:00
Adhemerval Zanella
a04689ee7a 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.
2020-10-07 15:24:04 -03:00
Florian Weimer
b31d4355ae 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>
2020-10-07 16:41:30 +02:00
Florian Weimer
56f8d44294 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>
2020-10-07 16:40:23 +02:00
Florian Weimer
27fe5f2e67 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>
2020-10-07 14:55:50 +02:00
Florian Weimer
0f9793a556 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>
2020-10-07 10:56:00 +02:00
Florian Weimer
c42b7058a2 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>
2020-10-07 10:53:29 +02:00
Adhemerval Zanella
7a887dd537 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.
2020-10-06 15:29:35 -03:00
H.J. Lu
862897d2ad Replace Minumum/minumum with Minimum/minimum
Replace Minumum/minumum in comments with Minimum/minimum.
2020-10-06 05:15:11 -07:00
DJ Delorie
78e09591a5 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>
2020-10-05 17:16:03 -04:00
Joseph Myers
19302b27bd 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).
2020-10-05 16:46:46 +00:00
Jonathan Wakely
5bb2e5300b manual: Fix typo 2020-10-05 17:29:46 +01:00
Lukasz Majewski
3102e28bd1 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>
2020-10-04 17:13:46 +02:00
Lukasz Majewski
b2cdadde4d 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>
2020-10-04 17:12:41 +02:00
Adhemerval Zanella
be9b0b9a01 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).
2020-10-02 16:11:59 -03:00
Adhemerval Zanella
20a00dbefc 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).
2020-10-02 16:11:55 -03:00
Adhemerval Zanella
a16d2abd49 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).
2020-10-02 16:11:55 -03:00
Dmitry V. Levin
574500a108 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>
2020-10-02 16:11:49 -03:00
Szabolcs Nagy
238032ead6 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.
2020-10-02 09:57:44 +01:00
Adhemerval Zanella
2deb779390 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>
2020-09-30 18:03:51 -03:00
Lukasz Majewski
e75fbaaa21 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>
2020-09-30 09:38:10 +02:00
Lukasz Majewski
3f9705f1fc 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>
2020-09-30 09:37:41 +02:00
Adhemerval Zanella
cef95fdc2e 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 325081b9eb) 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.
2020-09-29 13:56:06 -03:00
H.J. Lu
dfb8e514cf 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.
2020-09-29 09:03:47 -07:00
Vincent Mihalkovic
c670278934 ld.so: add an --argv0 option [BZ #16124] 2020-09-29 12:34:40 +02:00
Patrick McGehearty
d3c5702747 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
2020-09-28 22:10:39 +00:00
Adhemerval Zanella
b16f282cb0 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>
2020-09-28 17:28:39 -03:00
Adhemerval Zanella
c3a020eedd 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>
2020-09-28 16:22:03 -03:00
Adhemerval Zanella
4af88f96de 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>
2020-09-28 16:21:59 -03:00
Adhemerval Zanella
7c7671767e 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>
2020-09-28 16:21:55 -03:00
Adhemerval Zanella
94a83d8667 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>
2020-09-28 16:21:51 -03:00
Adhemerval Zanella
2433d39b69 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>
2020-09-28 16:21:48 -03:00
Adhemerval Zanella
50e19ddfcd 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.
2020-09-28 16:05:32 -03:00
Adhemerval Zanella
aaa12e9ff0 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.
2020-09-28 10:03:04 -03:00
Samuel Thibault
7424a0d009 hurd: add ST_RELATIME
sysdeps/mach/hurd/bits/statvfs.h (ST_RELATIME): New macro.
2020-09-27 18:23:27 +02:00
Arjun Shankar
7d4ec75e11 intl: Handle translation output codesets with suffixes [BZ #26383]
Commit 91927b7c76 (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.
2020-09-25 14:47:06 +02:00
H.J. Lu
06e95b93f0 bench-strcmp.c: Add workloads on page boundary
Add strcmp workloads on page boundary.
2020-09-24 10:46:38 -07:00
H.J. Lu
c4277ba234 bench-strncmp.c: Add workloads on page boundary
Add strncmp workloads on page boundary.
2020-09-24 10:46:30 -07:00
H.J. Lu
659c041188 strcmp: Add a testcase for page boundary
Add a strcmp testcase to cover cases where both strings end on the page
boundary.
2020-09-24 07:29:31 -07:00
H.J. Lu
f7e3f92b7c 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]
2020-09-24 07:06:03 -07:00
Arjun Shankar
b3b0b6916a 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>
2020-09-24 14:58:36 +02:00
Arjun Shankar
03e26098b1 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.
2020-09-23 16:11:57 +02:00
Raphael Moreira Zinsly
3322ecbfe2 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>
2020-09-22 17:45:12 -03:00
Florian Weimer
681900d296 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.
2020-09-22 19:07:49 +02:00