Commit graph

38613 commits

Author SHA1 Message Date
Carlos O'Donell 1c7a34567d localedata: Do not generate output if warnings were present.
With LC_MONETARY parsing fixed we can now generate locales
without forcing output with '-c'.

Removing '-c' from localedef invocation is the equivalent of
using -Werror for localedef.  The glibc locale sources should
always be clean and free from warnings.

We remove '-c' from both test locale generation and the targets
used for installing locales e.g. install-locale-archive, and
install-locale-files.

Tested on x86_64 and i686 without regressions.
Tested with install-locale-archive target.
Tested with install-locale-files target.

Reviewed-by: DJ Delorie <dj@redhat.com>
2022-02-25 07:31:27 -05:00
Carlos O'Donell 2ab8b74567 localedef: Update LC_MONETARY handling (Bug 28845)
ISO C17, POSIX Issue 7, and ISO 30112 all allow the char*
types to be empty strings i.e. "", integer or char values to
be -1 or CHAR_MAX respectively, with the exception of
decimal_point which must be non-empty in ISO C. Note that
the defaults for mon_grouping vary, but are functionaly
equivalent e.g. "\177" (no further grouping reuqired) vs.
"" (no grouping defined for all groups).

We include a broad comment talking about harmonizing ISO C,
POSIX, ISO 30112, and the default C/POSIX locale for glibc.

We reorder all setting based on locale/categories.def order.

We soften all missing definitions from errors to warnings when
defaults exist.

Given that ISO C, POSIX and ISO 30112 allow the empty string
we change LC_MONETARY handling of mon_decimal_point to allow
the empty string.  If mon_decimal_point is not defined at all
then we pick the existing legacy glibc default value of
<U002E> i.e. ".".

We also set the default for mon_thousands_sep_wc at the
same time as mon_thousands_sep, but this is not a change in
behaviour, it is always either a matching value or L'\0',
but if in the future we change the default to a non-empty
string we would need to update both at the same time.

Tested on x86_64 and i686 without regressions.
Tested with install-locale-archive target.
Tested with install-locale-files target.

Reviewed-by: DJ Delorie <dj@redhat.com>
2022-02-25 07:31:27 -05:00
Arjun Shankar ea89d5bbd9 localedef: Handle symbolic links when generating locale-archive
Whenever locale data for any locale included symbolic links, localedef
would throw the error "incomplete set of locale files" and exclude it
from the generated locale archive.  This commit fixes that.

Co-authored-by: Florian Weimer <fweimer@redhat.com>

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-02-24 22:45:05 +01:00
H.J. Lu 89377d41d7 benchtests: Add small sizes (<= 64) to bench-bzero-walk.c
Small sizes (<= 64) represent large portion of memset usages with zero
value.  Add sizes (<= 64) to bench-bzero-walk.c to cover small sizes.
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2022-02-24 12:28:34 -08:00
Sunil K Pandey db34e88b86 math: Add more input to atanh accuracy tests
This patch adds following input to atanh accuracy test.

    0x1.f80094p-8

Tested on x86-64 and i686 platforms.
Other platforms may have to regenerate ulps file.

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2022-02-24 09:20:43 -08:00
Stafford Horne ee5d27bea5 resolv: Fix tst-resolv tests for 2.35 ABIs and later
The commit 737e873b30 ("resolv: Do not build libanl.so for ABIs starting
at 2.35") disabled building libanl for ports supporting only 2.35 and
later like OpenRISC.

However, the if statement was not updated quite correctly and the change
ends up disabling many tst-resolv* tests.  This was not supposed to be
done and it causes test dependency errors like:

     make: Entering directory 'gnu-home/glibc/resolv'
     make: *** No rule to make target 'gnu-home/build-glibc/resolv/tst-resolv-res_ninit.out', needed by 'gnu-home/build-glibc/resolv/mtrace-tst-resolv-res_ninit.out'. Stop.
     make: Leaving directory 'gnu-home/glibc/resolv'

This patch move the extra-libs += libanl definition and condition down
to be closer to other libanl definitions.  The $(have-GLIBC_2.34)
condition now includes libanl-routines and libanl-shared-only-routines as
well.

Also, I have added a comment to endif of $(have-thread-library) to help
show the bondary of the have-thread-library definitions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-02-24 16:25:26 +09:00
Sunil K Pandey 1153f71586 x86_64: Disable libmvec tests if multiarch not enabled [BZ# 28869]
This patch disable libmvec math tests if multiarch not enabled.

This fixes [BZ# 28869]

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-02-23 14:59:49 -08:00
H.J. Lu cf97591313 benchtests: Add benches for memset with 0 value
memset with zero as the value to set is by far the majority value (99%+
for Python3 and GCC).  Add bench-memset-zero-large.c,
bench-memset-zero-walk.c and bench-memset-zero.c to measure memset
implementations for zeroing.

Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2022-02-23 12:07:06 -08:00
Adhemerval Zanella 0f88a5c66e i686: Remove bzero optimizations
The symbol is not present in current POSIX specification and compiler
already generates memset call.
2022-02-23 14:18:18 -03:00
Adhemerval Zanella dbf37d6d0e s390: Remove bzero optimizations
The symbol is not present in current POSIX specification and compiler
already generates memset call.
2022-02-23 14:18:18 -03:00
Adhemerval Zanella 4e81019f30 powerpc: Remove powerpc64 bzero optimizations
The symbol is not present in current POSIX specification and compiler
already generates memset call.
2022-02-23 14:18:18 -03:00
Adhemerval Zanella 68122d8a04 powerpc: Remove powerpc32 bzero optimizations
The symbol is not present in current POSIX specification and compiler
already generates memset call.
2022-02-23 14:18:18 -03:00
Adhemerval Zanella a61933fe27 sparc: Remove bzero optimization
The symbol is not present in current POSIX specification and compiler
already generates memset call.
2022-02-23 14:18:18 -03:00
Adhemerval Zanella c0d215f162 ia64: Remove bzero optimization
The symbol is not present current POSIX specification and compiler
already generates memset call.  The arch specific implementation
is just to avoid the __bzero symbol creation (which ia64 abi does
not export).
2022-02-23 14:18:17 -03:00
Adhemerval Zanella f883dbaf1f alpha: Remove bzero optimization
The symbols is not present in current POSIX specification and compiler
already generates memmove call.
2022-02-23 14:06:49 -03:00
Adhemerval Zanella bf92893a14 x86_64: Remove bcopy optimizations
The symbols is not present in current POSIX specification and compiler
already generates memmove call.
2022-02-23 14:06:49 -03:00
Adhemerval Zanella 8bad328203 i386: Remove bcopy optimizations
The symbols is not present in current POSIX specification and compiler
already generates memmove call.
2022-02-23 14:06:49 -03:00
Adhemerval Zanella 86a82cd57c powerpc: Remove bcopy optimizations
The symbols is not present in current POSIX specification and compiler
already generates memmove call.
2022-02-23 14:06:49 -03:00
Adhemerval Zanella 80b85f92f4 ia64: Remove bcopy
It just call memmove as the generic implementation.
2022-02-23 14:06:45 -03:00
John David Anglin d2224ffbdd hppa: Fix warnings from _dl_lookup_address
This change fixes two warnings from _dl_lookup_address.

The first warning comes from dropping the volatile keyword from
desc in the call to _dl_read_access_allowed.  We now have a full
atomic barrier between loading desc[0] and the access check, so
desc no longer needs to be declared as volatile.

The second warning comes from the implicit declaration of
_dl_fix_reloc_arg.  This is fixed by including dl-runtime.h and
declaring _dl_fix_reloc_arg in dl-runtime.h.
2022-02-22 18:51:35 +00:00
John David Anglin 9e7e5fda38 hppa: Revise gettext trampoline design
The current getcontext return trampoline is overly complex and it
unnecessarily clobbers several registers.  By saving the context
pointer (r26) in the context, __getcontext_ret can restore any
registers not restored by setcontext.  This allows getcontext to
save and restore the entire register context present when getcontext
is entered.  We use the unused oR0 context slot for the return
from __getcontext_ret.

While this is not directly useful in C, it can be exploited in
assembly code.  Registers r20, r23, r24 and r25 are not clobbered
in the call path to getcontext.  This allows a small simplification
of swapcontext.

It also allows saving and restoring the 6-bit SAR register in the
LSB of the oSAR context slot.  The getcontext flag value can be
stored in the MSB of the oSAR slot.
2022-02-22 17:28:46 +00:00
Joseph Myers fdc1ae67fe Add SOL_MPTCP, SOL_MCTP from Linux 5.16 to bits/socket.h
Linux 5.16 adds constants SOL_MPTCP and SOL_MCTP to the getsockopt /
setsockopt levels; add these constants to bits/socket.h.

Tested for x86_64.
2022-02-21 22:49:36 +00:00
H.J. Lu 2c0915cbf5 elf: Check invalid hole in PT_LOAD segments [BZ #28838]
Changes in v2:

1. Update commit log.

commit 163f625cf9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Dec 21 12:35:47 2021 -0800

    elf: Remove excessive p_align check on PT_LOAD segments [BZ #28688]

removed the p_align check against the page size.  It caused the loader
error or crash on elf/tst-p_align3 when loading elf/tst-p_alignmod3.so,
which has the invalid p_align in PT_LOAD segments, added by

commit d8d94863ef
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Dec 21 13:42:28 2021 -0800

The loader failure caused by a negative length passed to __mprotect is
random, depending on architecture and toolchain.  Update _dl_map_segments
to detect invalid holes.  This fixes BZ #28838.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-02-21 07:57:18 -08:00
Siddhesh Poyarekar 949ad78a18 realpath: Do not copy result on failure (BZ #28815)
On failure, the contents of the resolved buffer passed in by the caller
to realpath are undefined.  Do not copy any partial resolution to the
buffer and also do not test resolved contents in test-canon.c.

Resolves: BZ #28815

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-02-21 08:26:33 +05:30
Noah Goldstein b98d0bbf74 x86: Fix TEST_NAME to make it a string in tst-strncmp-rtm.c
Previously TEST_NAME was passing a function pointer. This didn't fail
because of the -Wno-error flag (to allow for overflow sizes passed
to strncmp/wcsncmp)

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-02-18 15:24:50 -08:00
Noah Goldstein 7835d611af x86: Test wcscmp RTM in the wcsncmp overflow case [BZ #28896]
In the overflow fallback strncmp-avx2-rtm and wcsncmp-avx2-rtm would
call strcmp-avx2 and wcscmp-avx2 respectively. This would have
not checks around vzeroupper and would trigger spurious
aborts. This commit fixes that.

test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass on
AVX2 machines with and without RTM.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-02-18 16:35:18 -06:00
John David Anglin 71b108d7eb hppa: Fix swapcontext
This change fixes the failure of stdlib/tst-setcontext2 and
stdlib/tst-setcontext7 on hppa.  The implementation of swapcontext
in C is broken.  C saves the return pointer (rp) and any non
call-clobbered registers (in this case r3, r4 and r5) on the
stack.  However, the setcontext call in swapcontext pops the
stack and subsequent calls clobber the saved registers.  When
the context in oucp is restored, both tests fault.

Here we rewrite swapcontext in assembly code to avoid using
the stack for register values that need to be used after
restoration.  The getcontext and setcontext routines are
revised to save and restore register ret1 for normal returns.
We copy the oucp pointer to ret1.  This allows access to
the old context after calling getcontext and setcontext.
2022-02-18 20:38:25 +00:00
Noah Goldstein c627209832 x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ #28896]
In the overflow fallback strncmp-avx2-rtm and wcsncmp-avx2-rtm would
call strcmp-avx2 and wcscmp-avx2 respectively. This would have
not checks around vzeroupper and would trigger spurious
aborts. This commit fixes that.

test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass on
AVX2 machines with and without RTM.

Co-authored-by: H.J. Lu <hjl.tools@gmail.com>
2022-02-17 15:43:05 -06:00
H.J. Lu aa5a720056 string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
fails without

commit ddf0992cf5
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Sun Jan 9 16:02:21 2022 -0600

    x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]

and

commit 7e08db3359
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Sun Jan 9 16:02:28 2022 -0600

    x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]

This is for BZ #28755.

Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2022-02-17 11:04:12 -08:00
Adhemerval Zanella bbe199b27a microblaze: Use the correct select syscall (BZ #28883)
On Microblaze only __NR_newselect is implemented, even though kernel
advertise __NR_select on asm/unistd.h.  Since microblaze is the
only architecture that undef __ASSUME_PSELECT, the generic code
change is simpler than chaging the architecture syscall number.

Acked-by: Mark Hatle <mark.hatle@xilinx.com>
2022-02-16 16:26:44 -03:00
Joseph Myers 790a607e23 Update kernel version to 5.16 in tst-mman-consts.py
This patch updates the kernel version in the test tst-mman-consts.py
to 5.16.  (There are no new MAP_* constants covered by this test in
5.16 that need any other header changes.)

Tested with build-many-glibcs.py.
2022-02-16 14:19:24 +00:00
Adhemerval Zanella 894755e16e pthread: Use 64 bit time_t stat internally for sem_open (BZ #28880)
The __sem_check_add_mapping internal stat calls fails with
EOVERFLOW if system time is larger than 32 bit.

It is a missing spot from 52a5fe70a2 fix to use 64 bit stat
internally.

Checked on x86_64-linux-gnu and i686-linux-gnu.
2022-02-16 10:20:56 -03:00
Noah Goldstein e108c02a5e x86: Fix bug in strncmp-evex and strncmp-avx2 [BZ #28895]
Logic can read before the start of `s1` / `s2` if both `s1` and `s2`
are near the start of a page. To avoid having the result contimated by
these comparisons the `strcmp` variants would mask off these
comparisons. This was missing in the `strncmp` variants causing
the bug. This commit adds the masking to `strncmp` so that out of
range comparisons don't affect the result.

test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass as
well a full xcheck on x86_64 linux.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-02-16 02:11:16 -06:00
Noah Goldstein 0281c7a7ec String: Strength memset tests in test-memset.c
The prior sentinel logic was broken and was checking the SIMPLE_MEMSET
as opposed to the tested implementation. As well `s` (the test buffer)
was not reset between implementation tests so it was possible for a
buggy implementation to be hidden by a previously executed correct
one.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-02-15 11:25:04 -06:00
H.J. Lu a5659cf27d x86-64: Define __memcmpeq in ld.so
Define __memcmpeq in ld.so so that compiler can generate __memcmpeq call
when compiling for ld.so.
2022-02-14 17:57:07 -08:00
Samuel Thibault 7a06be051c htl: Destroy thread-specific data before releasing joins
Applications may want to assume that after pthread_join() returns, all
thread-specific data has been released.
2022-02-14 19:29:02 +01:00
Samuel Thibault 06dbfcced3 htl: Fix initializing the key lock
The static pthread_once_t in the pt-key.h header was creating one
pthread_once_t per includer.  We have to use a shared common
pthread_once_t instead.
2022-02-14 19:29:02 +01:00
Samuel Thibault 33038a7d91 mach: Fix LLL_SHARED value
Mach defines GSYNC_SHARED, not SYNC_SHARED.
2022-02-14 19:29:02 +01:00
Samuel Thibault 315c9e794a htl: Make pthread_[gs]etspecific not check for key validity
Since __pthread_key_create might be concurrently reallocating the
__pthread_key_destructors array, it's not safe to access it without the
mutex held. Posix explicitly says we are allowed to prefer performance
over error detection.
2022-02-14 19:29:02 +01:00
H.J. Lu 0fb8800029 x86-64: Remove bzero weak alias in SS2 memset
commit 3d9f171bfb
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Feb 7 05:55:15 2022 -0800

    x86-64: Optimize bzero

added the optimized bzero.  Remove bzero weak alias in SS2 memset to
avoid undefined __bzero in memset-sse2-unaligned-erms.
2022-02-14 10:16:02 -08:00
John David Anglin 17c57d70bd hppa: Fix typo 2022-02-14 17:41:59 +00:00
Adhemerval Zanella fee62d6c62 linux: Use socket-constants-time64.h on tst-socket-timestamp-compat
The kernel header might not define the SO_TIMESTAMP{NS}_OLD or
SO_TIMESTAMP{NS}_NEW if it older than v5.1.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2022-02-14 14:05:57 -03:00
H.J. Lu f9db5433f3 x86/configure.ac: Define PI_STATIC_AND_HIDDEN/SUPPORT_STATIC_PIE
Move PI_STATIC_AND_HIDDEN and SUPPORT_STATIC_PIE to
sysdeps/x86/configure.ac.
2022-02-14 07:34:54 -08:00
John David Anglin 2e20cd63c9 Fix elf/tst-audit2 on hppa
The test elf/tst-audit2 fails on hppa with a segmentation fault in the
long branch stub used to call malloc from calloc.  This occurs because
the test is not a PIC executable and calloc is called from the dynamic
linker before the dp register is initialized in _dl_start_user.

The fix is to move the dp register initialization into
elf_machine_runtime_setup.  Since the address of $global$ can't be
loaded directly, we continue to use the DT_PLTGOT value from the
the main_map to initialize dp.
2022-02-14 15:14:49 +00:00
H.J. Lu 6229aa74fb x86: Use CHECK_FEATURE_PRESENT on PCONFIG
PCONFIG is a privileged instruction.  Use CHECK_FEATURE_PRESENT, instead
of CHECK_FEATURE_ACTIVE, on PCONFIG in tst-cpu-features-supports.c.
2022-02-14 05:53:03 -08:00
H.J. Lu 61a4425dd4 x86: Don't check PTWRITE in tst-cpu-features-cpuinfo.c
Don't check PTWRITE against /proc/cpuinfo since kernel doesn't report
PTWRITE in /proc/cpuinfo.
2022-02-14 05:53:03 -08:00
Noah Goldstein 7912236f4a x86: Set .text section in memset-vec-unaligned-erms
commit 3d9f171bfb
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Feb 7 05:55:15 2022 -0800

    x86-64: Optimize bzero

Remove setting the .text section for the code. This commit
adds that back.
2022-02-12 04:25:19 -06:00
Florian Weimer 098c795e85 Linux: Include <dl-auxv.h> in dl-sysdep.c only for SHARED
Otherwise, <dl-auxv.h> on POWER ends up being included twice,
once in dl-sysdep.c, once in dl-support.c.  That leads to a linker
failure due to multiple definitions of _dl_cache_line_size.

Fixes commit d96d2995c1
("Revert "Linux: Consolidate auxiliary vector parsing").
2022-02-11 19:50:58 +01:00
Florian Weimer d96d2995c1 Revert "Linux: Consolidate auxiliary vector parsing"
This reverts commit 8c8510ab27.  The
revert is not perfect because the commit included a bug fix for
_dl_sysdep_start with an empty argv, introduced in commit
2d47fa6862 ("Linux: Remove
DL_FIND_ARG_COMPONENTS"), and this bug fix is kept.

The revert is necessary because the reverted commit introduced an
early memset call on aarch64, which leads to crash due to lack of TCB
initialization.
2022-02-11 17:10:59 +01:00
Noah Goldstein 02561bb48a String: Ensure 'MIN_PAGE_SIZE' is multiple of 'getpagesize'
When 'TEST_LEN' was defined as (4096 * 3) the allocation size Would
not be a multiple of system page size if system page size > 4096.
2022-02-11 04:06:27 -06:00