about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* Revert "inet: Avoid label at end of compound statement in tst-if_nameindex"Florian Weimer2024-08-211-1/+3
| | | | | | This reverts commit 26aca73db5e5ea299b554ceae418b13102b24948. Reason for revert: Unintended semantic change.
* inet: Avoid label at end of compound statement in tst-if_nameindexFlorian Weimer2024-08-211-3/+1
| | | | This fails to compile with GCC 8.
* Rules: Also build memcheck tests even when not running themSamuel Thibault2024-08-201-1/+5
| | | | | | | This will avoid in the future cases like a57cbbd85379 ("malloc: Link threading tests with $(shared-thread-library") missing the memcheck cases added in 251843e16fce ("malloc: Link threading tests with $(shared-thread-library)")
* malloc: Link threading tests with $(shared-thread-library)Samuel Thibault2024-08-201-0/+6
| | | | Fixes build failures on Hurd.
* inet: test if_nametoindex and if_indextonameDJ Delorie2024-08-192-0/+117
| | | | | | | | | | Tests for if_nameindex, if_name2index, and if_index2name Tests that valid results are consistent. Tests that invalid parameters fail correctly. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* elf: Make dl-fptr and dl-symaddr hppa specificAdhemerval Zanella2024-08-194-401/+22
| | | | | | | | With ia64 removal, the function descriptor supports is only used by HPPA and new architectures do not seem leaning towards this design. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* x86: Unifies 'strnlen-evex' and 'strnlen-evex512' implementations.Matthew Sterrett2024-08-193-680/+469
| | | | | | | | | | | | | | | | | | | | This commit uses a common implementation 'strnlen-evex-base.S' for both 'strnlen-evex' and 'strnlen-evex512' This patch serves both to reduce the number of implementations, and it also does some small optimizations that benefit strnlen-evex and strnlen-evex512. All tests pass on x86. Benchmarks were taken on SKX. https://www.intel.com/content/www/us/en/products/sku/123613/intel-core-i97900x-xseries-processor-13-75m-cache-up-to-4-30-ghz/specifications.html Geometric mean for strnlen-evex over all benchmarks (N=10) was (new/old) 0.881 Geometric mean for strnlen-evex512 over all benchmarks (N=10) was (new/old) 0.953 Code Size Changes: strnlen-evex : +31 bytes strnlen-evex512 : +156 bytes Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
* string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)Florian Weimer2024-08-192-25/+46
| | | | | | | | | | | | | | | | | Secondary namespaces have a different malloc. Allocating the buffer in one namespace and freeing it another results in heap corruption. Fix this by using a static string (potentially translated) in secondary namespaces. It would also be possible to use the malloc from the initial namespace to manage the buffer, but these functions would still not be safe to use in auditors etc. because a call to strerror could still free a buffer while it is used by the application. Another approach could use proper initial-exec TLS, duplicated in secondary namespaces, but that would need a callback interface for freeing libc resources in namespaces on thread exit, which does not exist today. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Use macros for *stat wrappersFlorian Weimer2024-08-1616-168/+34
| | | | | | | | | | | | Macros will automatically use the correct types, without having to fiddle with internal glibc macros. It's also impossible to get the types wrong due to aliasing because support_check_stat_fd and support_check_stat_path do not depend on the struct stat* types. The changes reveal some inconsistencies in tests. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* io: Use struct statx and xstatx in testsFlorian Weimer2024-08-1614-95/+57
| | | | | | | | This avoids the need to define struct_statx to an appropriate struct stat type variant because struct statx does not change based on time/file offset flags. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Add the xstatx functionFlorian Weimer2024-08-163-0/+35
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Include <string.h> for strcmp in support_format_addrinfo.cFlorian Weimer2024-08-161-0/+1
| | | | | | | This is currently implied by the internal headers, but it makes sense not to rely on this. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Remove #include <config.h>Florian Weimer2024-08-162-2/+0
| | | | | | | This is not needed: include/intprops.h has its own detection logic. It makes building these files outside of glibc easer. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Fix extraneous testing run by tst-rseq-nptl in the test driverMaciej W. Rozycki2024-08-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix an issue with commit 8f4632deb354 ("Linux: rseq registration tests") and prevent testing from being run in the process of the test driver itself rather than just the test child where one has been forked. The problem here is the unguarded use of a destructor to call a part of the testing. The destructor function, 'do_rseq_destructor_test' is called implicitly at program completion, however because it is associated with the executable itself rather than an individual process, it is called both in the test child *and* in the test driver itself. Prevent this from happening by providing a guard variable that only enables test invocation from 'do_rseq_destructor_test' in the process that has first run 'do_test'. Consequently extra testing is invoked from 'do_rseq_destructor_test' only once and in the correct process, regardless of the use or the lack of of the '--direct' option. Where called in the controlling test driver process that has neved called 'do_test' the destructor function silently returns right away without taking any further actions, letting the test driver fail gracefully where applicable. This arrangement prevents 'tst-rseq-nptl' from ever causing testing to hang forever and never complete, such as currently happening with the 'mips-linux-gnu' (o32 ABI) target. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Report error if setaffinity wrapper fails (Bug 32040)Carlos O'Donell2024-08-151-1/+1
| | | | | | | | | | | | Previously if the setaffinity wrapper failed the rest of the subtest would not execute and the current subtest would be reported as passing. Now if the setaffinity wrapper fails the subtest is correctly reported as faling. Tested manually by changing the conditions of the affinity call including setting size to zero, or checking the wrong condition. No regressions on x86_64. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* ungetc: Fix backup buffer leak on program exit [BZ #27821]Siddhesh Poyarekar2024-08-154-2/+47
| | | | | | | | | | | | | | | | | | | | | If a file descriptor is left unclosed and is cleaned up by _IO_cleanup on exit, its backup buffer remains unfreed, registering as a leak in valgrind. This is not strictly an issue since (1) the program should ideally be closing the stream once it's not in use and (2) the program is about to exit anyway, so keeping the backup buffer around a wee bit longer isn't a real problem. Free it anyway to keep valgrind happy when the streams in question are the standard ones, i.e. stdout, stdin or stderr. Also, the _IO_have_backup macro checks for _IO_save_base, which is a roundabout way to check for a backup buffer instead of directly looking for _IO_backup_base. The roundabout check breaks when the main get area has not been used and user pushes a char into the backup buffer with ungetc. Fix this to use the _IO_backup_base directly. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* ungetc: Fix uninitialized read when putting into unused streams [BZ #27821]Siddhesh Poyarekar2024-08-153-6/+6
| | | | | | | | | | | | | | | | | | | | When ungetc is called on an unused stream, the backup buffer is allocated without the main get area being present. This results in every subsequent ungetc (as the stream remains in the backup area) checking uninitialized memory in the backup buffer when trying to put a character back into the stream. Avoid comparing the input character with buffer contents when in backup to avoid this uninitialized read. The uninitialized read is harmless in this context since the location is promptly overwritten with the input character, thus fulfilling ungetc functionality. Also adjust wording in the manual to drop the paragraph that says glibc cannot do multiple ungetc back to back since with this change, ungetc can actually do this. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Make tst-ungetc use libsupportSiddhesh Poyarekar2024-08-151-55/+57
| | | | | Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* x86: Add `Avoid_STOSB` tunable to allow NT memset without ERMSNoah Goldstein2024-08-156-12/+53
| | | | | | | | | | | | | | | | | | | The goal of this flag is to allow targets which don't prefer/have ERMS to still access the non-temporal memset implementation. There are 4 cases for tuning memset: 1) `Avoid_STOSB && Avoid_Non_Temporal_Memset` - Memset with temporal stores 2) `Avoid_STOSB && !Avoid_Non_Temporal_Memset` - Memset with temporal/non-temporal stores. Non-temporal path goes through `rep stosb` path. We accomplish this by setting `x86_rep_stosb_threshold` to `x86_memset_non_temporal_threshold`. 3) `!Avoid_STOSB && Avoid_Non_Temporal_Memset` - Memset with temporal stores/`rep stosb` 3) `!Avoid_STOSB && !Avoid_Non_Temporal_Memset` - Memset with temporal stores/`rep stosb`/non-temporal stores. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86: Use `Avoid_Non_Temporal_Memset` to control non-temporal pathNoah Goldstein2024-08-152-8/+23
| | | | | | | | | | This is just a refactor and there should be no behavioral change from this commit. The goal is to make `Avoid_Non_Temporal_Memset` a more universal knob for controlling whether we use non-temporal memset rather than having extra logic based on vendor. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86: Fix bug in strchrnul-evex512 [BZ #32078]Noah Goldstein2024-08-152-5/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue was we were expecting not matches with CHAR before the start of the string in the page cross case. The check code in the page cross case: ``` and $0xffffffffffffffc0,%rax vmovdqa64 (%rax),%zmm17 vpcmpneqb %zmm17,%zmm16,%k1 vptestmb %zmm17,%zmm17,%k0{%k1} kmovq %k0,%rax inc %rax shr %cl,%rax je L(continue) ``` expects that all characters that neither match null nor CHAR will be 1s in `rax` prior to the `inc`. Then the `inc` will overflow all of the 1s where no relevant match was found. This is incorrect in the page-cross case, as the `vmovdqa64 (%rax),%zmm17` loads from before the start of the input string. If there are matches with CHAR before the start of the string, `rax` won't properly overflow. The fix is quite simple. Just replace: ``` inc %rax shr %cl,%rax ``` With: ``` sar %cl,%rax inc %rax ``` The arithmetic shift will clear any matches prior to the start of the string while maintaining the signbit so the 1s can properly overflow to zero in the case of no matches. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* Test errno setting on strtod overflow in tst-strtod-roundJoseph Myers2024-08-141-0/+11
| | | | | | | | We have no tests that errno is set to ERANGE on overflow of strtod-family functions (we do have some tests for underflow, in tst-strtod-underflow). Add such tests to tst-strtod-round. Tested for x86_64.
* libio/tst-getdelim: Add new test covering NUL as a delimiterFrédéric Bérat2024-08-141-1/+21
| | | | | | | Add a new test to getdelim to verify that '\0' can be set as a delimiter. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* manual: Document dprintf and vdprintfFlorian Weimer2024-08-131-0/+27
| | | | Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* manual: Document generic printf error codesFlorian Weimer2024-08-131-0/+23
| | | | | | Describe EOVERFLOW, ENOMEN, EILSEQ. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* ARC: Regenerate ULPsPavel Kozlov2024-08-112-0/+81
| | | | | | Regenerate fpu and soft-fp ULPs. Based on results from HSDK-4xD board with GCC 14 build. Including new tests added by 07972839108495245d8b93ca546462b3f4dad47f.
* support: Add options list terminator to the test driverFlorian Weimer2024-08-091-0/+1
| | | | | | This avoids crashes if a test is passed unknown options. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Define __libc_initial for the static libcFlorian Weimer2024-08-091-0/+3
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Turn on -Wimplicit-fallthrough by default if availableFlorian Weimer2024-08-093-1/+36
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* LoongArch: Add cfi instructions for _dl_tlsdesc_dynamicmengqinggang2024-08-095-373/+258
| | | | | | | | | | | | | | In _dl_tlsdesc_dynamic, there are three 'addi.d sp, sp, -size' instructions to allocate stack size for Float/LSX/LASX registers. Every 'addi.d sp, sp, -size' needs a cfi_adjust_cfa_offset because of sp is used to compute CFA. But only one 'addi.d sp, sp, -size' will be run according to HWCAP value. And all cfi_adjust_cfa_offset will be executed in stack unwinding, it result in incorrect CFA. Change _dl_tlsdesc_dynamic to _dl_tlsdesc_dynamic, _dl_tlsdesc_dynamic_lsx and _dl_tlsdesc_dynamic_lasx. Conflicting cfi instructions can be distributed to the three functions. And cfi instructions can correspond to stack down instructions.
* LoongArch: Regenerate ULPscaiyinyu2024-08-091-32/+32
| | | | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f. Signed-off-by: caiyinyu <caiyinyu@loongson.cn>
* RISC-V: Regenerate ULPsJulian Zhu2024-08-081-32/+32
| | | | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* MIPS: Regenerate ULPsJulian Zhu2024-08-082-51/+51
| | | | | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f. Signed-off-by: Julian Zhu <jz531210@gmail.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
* powerpc64le: Update ulpsFlorian Weimer2024-08-081-12/+12
| | | | Based on results from a POWER8 system with a GCC 8 build.
* elf: Remove struct dl_init_args from elf/dl-open.cFlorian Weimer2024-08-081-23/+3
| | | | It is completely redundant with struct dl_open_args.
* s390x: Update ulpsFlorian Weimer2024-08-081-32/+32
| | | | Based on results from a z16 system with a GCC 8 build.
* nptl: Fix stray process left by tst-cancel7 blocking testingMaciej W. Rozycki2024-08-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix an issue with commit b74121ae4bc5 ("Update.") and prevent a stray process from being left behind by tst-cancel7 (and also tst-cancelx7, which is the same test built with '-fexceptions' additionally supplied to the compiler), which then blocks remote testing until the process has been killed by hand. This test case creates a thread that runs an extra copy of the test via system(3) and using the '--direct' option so that the test wrapper does not interfere with this instance. This extra copy executes its business and calls sigsuspend(2) and then never terminates by itself. Instead it relies on being killed by the main test process directly via a thread cancellation request or, should that fail, by issuing SIGKILL either at the conclusion of 'do_test' or by the test driver via 'do_cleanup' where the test timeout has been hit or the test driver interrupted. However if the main test process has been instead killed by a signal, such as due to incorrect execution, before it had a chance to kill the extra copy of the test case, then the test wrapper will terminate without running 'do_cleanup' and consequently the extra copy of the test case will remain forever in its suspended state, and in the remote case in particular it means that the remote test wrapper will wait forever for the SSH command to complete. This has been observed with the 'alpha-linux-gnu' target, where the main test process triggers SIGSEGV and the test wrapper correctly records: Didn't expect signal from child: got `Segmentation fault' in nptl/tst-cancel7.out and terminates, but then the calling SSH command continues waiting for the remaining process started in the same session on the remote target to complete. Address this problem by also registering 'do_cleanup' via atexit(3), observing that 'support_delete_temp_files' is registered by the test wrapper before the test initializing function 'do_prepare' is called and that we call all the functions registered in the reverse of the order in which they were registered, so it is safe to refer to 'pidfilename' in 'do_cleanup' invoked by exit(3) because by that time temporary files have not yet been deleted. A minor inconvenience is that if 'signal_handler' is invoked in the test wrapper as a result of SIGALRM rather than SIGINT, then 'do_cleanup' will be called twice, once as a cleanup handler and again by exit(3). In reality it is harmless though, because issuing SIGKILL is guarded by a record lock, so if the first call has succeeded in killing the extra copy of the test case, then the subsequent call will do nothing. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Reorder semaphore release in tst-cancel7Maciej W. Rozycki2024-08-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Move the release of the semaphore used to synchronize between an extra copy of the test run as a separate process and the main test process until after the PID file has been locked. It is so that if the cleanup function gets called by the test driver due to premature termination of the main test process, then the function does not get at the PID file before it has been locked and conclude that the extra copy of the test has already terminated. This won't usually happen due to a relatively high amount of time required to elapse before timeout triggers in the test driver, but it will change with the next change. There is still a small time window remaining with this change in place where the main test process gets killed for some reason between the extra copy of the test has been already started by pthread_create(3) and a successful return from the call to sem_wait(3), in which case the cleanup function can be reached before PID has been written to the PID file and the file locked. It seems that with the test case structured as it is now and PID-based process management we have no means to avoid it. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc: Regenerate ULPs for soft-fpAdhemerval Zanella2024-08-071-27/+27
| | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f.
* powerpc: Update soft-fp ulpsAdhemerval Zanella2024-08-071-30/+30
| | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f.
* sparc: Regenerate ULPsAdhemerval Zanella2024-08-071-31/+31
| | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f.
* i386: Regenerate ULPsAdhemerval Zanella2024-08-072-73/+73
| | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f.
* arm: Regenerate ULPsAdhemerval Zanella2024-08-071-20/+20
| | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f.
* aarch64: Regenerate ULPsAdhemerval Zanella2024-08-071-32/+32
| | | | From new tests added by 07972839108495245d8b93ca546462b3f4dad47f.
* sysdeps: Re-flow and sort multiline gnu/Makefile definitionsAdhemerval Zanella2024-08-071-12/+42
|
* login: Re-flow and sort multiline Makefile definitionsAdhemerval Zanella2024-08-071-11/+53
|
* benchtests: Add random memset benchmarkWilco Dijkstra2024-08-072-0/+186
| | | | | | | | | Add a new randomized memset test similar to bench-random-memcpy. Instead of repeating the same call to memset over and over again, it times a large number of different inputs. The distribution of memset length and alignment is based on SPEC2017 (length up to 4096 and alignment up to 64). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* AArch64: Improve generic strlenWilco Dijkstra2024-08-071-12/+27
| | | | | | | | | Improve performance by handling another 16 bytes before entering the loop. Use ADDHN in the loop to avoid SHRN+FMOV when it terminates. Change final size computation to avoid increasing latency. On Neoverse V1 performance of the random strlen benchmark improves by 4.6%. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nss: Fix incorrect switch fall-through in tst-nss-gai-actionsFlorian Weimer2024-08-071-0/+1
| | | | | | This only happened on test failure. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* added inputs giving large errors on x86_64 for new C23 functionsPaul Zimmermann2024-08-075-44/+5475
| | | | | | | | | | | These functions are exp10m1, exp2m1, log10p1, log2p1. Also regenerated ulps on x86_64. For each format, there are 4 values, one for each rounding mode. (For the intel96 format, there are 8 values, 4 for Intel hardware, and 4 for AMD hardware. However, regen-ulps was only run on Intel. It should be run in a separate patch on a AMD x86_64.) Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>