aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-03-24Update kernel version to 6.13 in header constant testsJoseph Myers3-4/+4
There are no new constants covered by tst-mman-consts.py, tst-mount-consts.py or tst-sched-consts.py in Linux 6.13 that need any header changes, so update the kernel version in those tests. (tst-pidfd-consts.py will need updating separately along with adding new constants to glibc.) Tested with build-many-glibcs.py.
2025-03-21support: Link links-dso-program-c with libgcc_s only if availableFlorian Weimer3-1/+56
Add a configure check to detect bootstrapping builds that do not have libgcc_s. Fixes commit 3e2be87832781a29ed67f38f87c1ce3dd4c1b866 ("support: Link links-dso-program-c against libgcc_s"). Reviewed-by: Sam James <sam@gentoo.org>
2025-03-21elf: Use +nolink-deps to add make-only dependency for tst-originFlorian Weimer1-1/+4
The tst-origin test must link against liborigin-mod.so. Correct build order depends on a makefile rule dependency on $(objpfx)liborigin-mod.so. Use +nolink-deps to remvoe this dependency from the linker command line. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-21Makeconfig: Support $(+nolink-deps) in link flagsFlorian Weimer2-5/+9
This allows adding dependencies to rules, but not linking against them. This is more or less a reimplementation of .EXTRA_PREREQS feature from GNU make 4.3. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-21debug: Improve '%n' fortify detection (BZ 30932)Adhemerval Zanella15-65/+373
The 7bb8045ec0 path made the '%n' fortify check ignore EMFILE errors while trying to open /proc/self/maps, and this added a security issue where EMFILE can be attacker-controlled thus making it ineffective for some cases. The EMFILE failure is reinstated but with a different error message. Also, to improve the false positive of the hardening for the cases where no new files can be opened, the _dl_readonly_area now uses _dl_find_object to check if the memory area is within a writable ELF segment. The procfs method is still used as fallback. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-03-21Remove eloop-threshold.hAdhemerval Zanella8-93/+60
On both Linux and Hurd the __eloop_threshold() is always a constant (40 and 32 respectively), so there is no need to always call __sysconf (_SC_SYMLOOP_MAX) for Linux case (!SYMLOOP_MAX). To avoid a name clash with gnulib, rename the new file min-eloop-threshold.h. Checked on x86_64-linux-gnu and with a build for x86_64-gnu. Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-21malloc: missing initialization of tcache in _mid_memalignCupertino Miranda1-0/+2
_mid_memalign includes tcache code but does not attempt to initialize tcaches. Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-21support: Link links-dso-program-c against libgcc_sFlorian Weimer2-0/+22
If C++ support is not available, links-dso-program-c is used instead of the C++ version. The C version was not linked against libgcc_s, which meant that thread cancellation and the backtrace function did not work in containers tests in that situation. Reviewed-by: Sam James <sam@gentoo.org>
2025-03-21Add _FORTIFY_SOURCE support for inet_ntopFrédéric Bérat46-0/+182
- Create the __inet_ntop_chk routine that verifies that the builtin size of the destination buffer is at least as big as the size given by the user. - Redirect calls from inet_ntop to __inet_ntop_chk or __inet_ntop_warn - Update the abilist for this new routine - Update the manual to mention the new fortification Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-21Add missing guards in include/arpa/inet.hFrédéric Bérat1-0/+3
Add the missing guards in the header, similarly to other headers at the same level Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-21Prepare inet_ntop to be fortifiedFrédéric Bérat3-6/+9
Rename inet_ntop to __inet_ntop and create the inet_ntop weak alias based on it in order to prepare for disabling fortification when available. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-19add inputs giving large errors for rsqrtPaul Zimmermann2-0/+656
2025-03-18malloc: Improve csize2tidxWilco Dijkstra1-1/+1
Remove the alignment rounding up from csize2tidx - this makes no sense since the input should be a chunk size. Removing it enables further optimizations, for example chunksize_nomask can be safely used and invalid sizes < MINSIZE are not mapped to a valid tidx. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-18elf: Fix tst-origin make rulesAdhemerval Zanella1-10/+3
The tst-origin build can fail with: /usr/bin/ld: [...]libc.so: undefined reference to `__tunable_is_initialized@GLIBC_PRIVATE' Since the custom link invocation links against system glibc instead of the built one. The only requirement is to avoid liborigin.so linked with a full path, which is the default for --enable-hardcoded-path-in-tests. There is no need to use a custom rule. Checked on x86_64-linux-gnu.
2025-03-18AArch64: Optimize algorithm in users of SVE expf helperPierre Blanchard3-26/+16
Polynomial order was unnecessarily high, unlocking multiple optimizations. Max error for new SVE expf is 0.88 +0.5ULP. Max error for new SVE coshf is 2.56 +0.5ULP. Performance improvement on Neoverse V1: expf (30%), coshf (26%). Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-03-18malloc: Improve arena_for_chunk()Wilco Dijkstra1-6/+7
Change heap_max_size() to improve performance of arena_for_chunk(). Instead of a complex calculation, using a simple mask operation to get the arena base pointer. HEAP_MAX_SIZE should be larger than the huge page size, otherwise heaps will use not huge pages. On AArch64 this removes 6 instructions from arena_for_chunk(), and bench-malloc-thread improves by 1.1% - 1.8%. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-18benchtests: Increase iterations of bench-malloc-simpleWilco Dijkstra1-1/+1
Increase iterations so it runs for ~1 second on modern CPUs. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-17elf: Fix tst-origin make rulesAdhemerval Zanella1-3/+7
Add tests-special before include Rules and compile liborigin.os with MODULE_NAME set to testsuite instead of libc.
2025-03-15htl: Make pthread_setcanceltype / state a cancellation pointSamuel Thibault3-0/+21
as expected by tst-cancel32.
2025-03-14tst-fopen-threaded: Only check EOF for failing readSiddhesh Poyarekar1-10/+18
The fread race checker looks for EOF in every thread, which is incorrect since threads calling fread successfully could lag behind and read the EOF condition, resulting in multiple threads thinking that they encountered an EOF. Only look for EOF condition if fread fails to read a char. Also drop the clearerr() since it could mask the failure of another reader, thus hiding a test failure. Finally, also check for error in the stream for completeness. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-14Implement C23 powrJoseph Myers48-2/+18866
C23 adds various <math.h> function families originally defined in TS 18661-4. Add the powr functions, which are like pow, but with simpler handling of special cases (based on exp(y*log(x)), so negative x and 0^0 are domain errors, powers of -0 are always +0 or +Inf never -0 or -Inf, and 1^+-Inf and Inf^0 are also domain errors, while NaN^0 and 1^NaN are NaN). The test inputs are taken from those for pow, with appropriate adjustments (including removing all tests that would be domain errors from those in auto-libm-test-in and adding some more such tests in libm-test-powr.inc). The underlying implementation uses __ieee754_pow functions after dealing with all special cases that need to be handled differently. It might be a little faster (avoiding a wrapper and redundant checks for special cases) to have an underlying implementation built separately for both pow and powr with compile-time conditionals for special-case handling, but I expect the benefit of that would be limited given that both functions will end up needing to use the same logic for computing pow outside of special cases. My understanding is that powr(negative, qNaN) should raise "invalid": that the rule on "invalid" for an argument outside the domain of the function takes precedence over a quiet NaN argument producing a quiet NaN result with no exceptions raised (for rootn it's explicit that the 0th root of qNaN raises "invalid"). I've raised this on the WG14 reflector to confirm the intent. Tested for x86_64 and x86, and with build-many-glibcs.py.
2025-03-13x86_64: Add atanh with FMASunil K Pandey5-0/+51
On SPR, it improves atanh bench performance by: Before After Improvement reciprocal-throughput 15.1715 14.8628 2% latency 57.1941 56.1883 2% Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-13elf: Canonicalize $ORIGIN in an explicit ld.so invocation [BZ 25263]Adhemerval Zanella13-74/+214
When an executable is invoked directly, we calculate $ORIGIN by calling readlink on /proc/self/exe, which the Linux kernel resolves to the target of any symlinks. However, if an executable is run through ld.so, we cannot use /proc/self/exe and instead use the path given as an argument. This leads to a different calculation of $ORIGIN, which is most notable in that it causes ldd to behave differently (e.g., by not finding a library) from directly running the program. To make the behavior consistent, take advantage of the fact that the kernel also resolves /proc/self/fd/ symlinks to the target of any symlinks in the same manner, so once we have opened the main executable in order to load it, replace the user-provided path with the result of calling readlink("/proc/self/fd/N"). (On non-Linux platforms this resolution does not happen and so no behavior change is needed.) The __fd_to_filename requires _fitoa_word and _itoa_word, which for 32-bits pulls a lot of definitions from _itoa.c (due _ITOA_NEEDED being defined). To simplify the build move the required function to a new file, _fitoa_word.c. Checked on x86_64-linux-gnu and i686-linux-gnu. Co-authored-by: Geoffrey Thomas <geofft@ldpreload.com> Reviewed-by: Geoffrey Thomas <geofft@ldpreload.com> Tested-by: Geoffrey Thomas <geofft@ldpreload.com>
2025-03-13x86_64: Add sinh with FMASunil K Pandey5-0/+58
On SPR, it improves sinh bench performance by: Before After Improvement reciprocal-throughput 14.2017 11.815 17% latency 36.4917 35.2114 4% Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-13benchtests: Remove wrong snippet from 360cce0b06Adhemerval Zanella1-1/+0
2025-03-13x86_64: Add tanh with FMASunil K Pandey4-0/+49
On Skylake, it improves tanh bench performance by: Before After Improvement max 110.89 95.826 14% min 20.966 20.157 4% mean 30.9601 29.8431 4% Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-13nptl: Check if thread is already terminated in sigcancel_handler (BZ 32782)Adhemerval Zanella4-6/+83
The SIGCANCEL signal handler should not issue __syscall_do_cancel, which calls __do_cancel and __pthread_unwind, if the cancellation is already in proces (and libgcc unwind is not reentrant). Any cancellation signal received after is ignored. Checked on x86_64-linux-gnu and aarch64-linux-gnu. Tested-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-03-13nptl: PTHREAD_COND_INITIALIZER compatibility with pre-2.41 versions (bug 32786)Florian Weimer2-1/+3
The new initializer and struct layout does not initialize the __g_signals field in the old struct layout before the change in commit c36fc50781995e6758cae2b6927839d0157f213c ("nptl: Remove g_refs from condition variables"). Bring back fields at the end of struct __pthread_cond_s, so that they are again zero-initialized. Reviewed-by: Sam James <sam@gentoo.org>
2025-03-12getaddrinfo.c: support MPTCP (BZ #29609)zhenwei pi2-0/+29
There is a lack of MPTCP support from gaih_inet_typeproto array, add MPTCP entry. Signed-off-by: zhenwei pi <zhenwei.pi@linux.dev> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-12math: Refactor how to use libm-test-ulpsAdhemerval Zanella62-33869/+417
The current approach tracks math maximum supported errors by explicitly setting them per function and architecture. On newer implementations or new compiler versions, the file is updated with newer values if it shows higher results. The idea is to track the maximum known error, to update the manual with the obtained values. The constant libm-test-ulps shows little value, where it is usually a mechanical change done by the maintainer, for past releases it is usually ignored whether the ulp change resulted from a compiler regression, and the math tests already have a maximum ulp error that triggers a regression. It was shown by a recent update after the new acosf [1] implementation that is correctly rounded, where the libm-test-ulps was indeed from a compiler issue. This patch removes all arch-specific libm-test-ulps, adds system generic libm-test-ulps where applicable, and changes its semantics. The generic files now track specific implementation constraints, like if it is expected to be correctly rounded, or if the system-specific has different error expectations. Now multiple libm-test-ulps can be defined, and system-specific overrides generic implementation. This is for the case where arch-specific implementation might show worse precision than generic implementation, for instance, the cbrtf on i686. Regressions are only reported if the implementation shows larger errors than 9 ulps (13 for IBM long double) unless it is overridden by libm-test-ulps and the maximum error is not printed at the end of tests. The regen-ulps rule is also removed since it does not make sense to update the libm-test-ulps automatically. The manual error table is also removed, Paul Zimmermann and others have been tracking libm precision with a more comprehensive analysis for some releases; so link to his work instead. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=9cc9f8e11e8fb8f54f1e84d9f024917634a78201
2025-03-12Update syscall lists for Linux 6.13Joseph Myers26-2/+106
Linux 6.13 adds four new syscalls. Update syscall-names.list and regenerate the arch-syscall.h headers with build-many-glibcs.py update-syscalls. Tested with build-many-glibcs.py.
2025-03-12Makefile: Clean up pthread_atfork integrationFlorian Weimer2-3/+1
Do not add the pthread_atfork routine again in nptl/Makefile, instead rely on sysdeps/pthread/Makefile for the integration (as this is the directory that contains the source file). In sysdeps/pthread/Makefile, add to static-only-routines. Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-12nptl: Include <stdbool.h> in tst-pthread_gettid_np.cFlorian Weimer1-0/+1
The test uses the while (true) construct.
2025-03-12Linux: Add new test misc/tst-sched_setattr-threadFlorian Weimer2-0/+117
The straightforward sched_getattr call serves as a test for bug 32781, too. Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-12Linux: Remove attribute access from sched_getattr (bug 32781)Florian Weimer1-1/+1
The GCC attribute expects an element count, not bytes.
2025-03-12Linux: Add the pthread_gettid_np function (bug 27880)Florian Weimer39-0/+171
Current Bionic has this function, with enhanced error checking (the undefined case terminates the process). Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-11elf: Test dlopen (NULL, RTLD_LAZY) from an ELF constructorFlorian Weimer5-0/+149
This call must not complete initialization of all shared objects in the global scope because the ELF constructor which makes the call likely has not finished initialization. Calling more constructors at this point would expose those to a partially constructed dependency. This completes the revert of commit 9897ced8e78db5d813166a7ccccfd5a ("elf: Run constructors on cyclic recursive dlopen (bug 31986)").
2025-03-11s390x: Regenerate ULPs.Stefan Liebler1-0/+20
Needed due to: "Implement C23 rsqrt" commit ID 77261698b4e938020a1b2032709a54d942ba330f Same max ulps as used for x86_64 in the mentioned commit.
2025-03-08math: Remove an extra semicolon in math function declarationsAurelien Jarno1-1/+1
Commit 6bc301672bfbd ("math: Remove __XXX math functions from installed math.h [BZ #32418]") left an extra semicolon after macro expansion. For instance the ceil declaration after expansion is: extern double ceil (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));; This chokes very naive parsers like gauche c-wrapper. Fix that by removing that extra semicolon in the macro. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-07nptl: extend test coverage for sched_yieldSergey Kolosov2-3/+38
We add sched_yield() API testing to the existing thread affinity test case because it allows us to test sched_yield() operation in the following scenarios: * On a main thread. * On multiple threads simultaneously. * On every CPU the system reports simultaneously. The ensures we exercise sched_yield() in as many scenarios as we would exercise calls to the affinity functions. Additionally, the test is improved by adding a semaphore to coordinate all the threads running, so that an early starter thread won't consume cpu resources that could be used to start the other threads. Co-authored-by: DJ Delorie <dj@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-03-07posix: Move environ helper variables next to environ definition (bug 32541)Florian Weimer4-3/+44
This helps with statically interposing getenv. Updates commit 7a61e7f557a97ab597d6fca5e2d1f13f65685c61 ("stdlib: Make getenv thread-safe in more cases"). Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-07Implement C23 rsqrtJoseph Myers50-2/+3865
C23 adds various <math.h> function families originally defined in TS 18661-4. Add the rsqrt functions (1/sqrt(x)). The test inputs are taken from those for sqrt. Tested for x86_64 and x86, and with build-many-glibcs.py.
2025-03-07Use binutils 2.44 branch and Linux 6.13 in build-many-glibcs.pyJoseph Myers1-2/+2
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs builds).
2025-03-07elf: Fix handling of symbol versions which hash to zero (bug 29190)Florian Weimer9-6/+185
This was found through code inspection. No application impact is known. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-07configure: Fix spelling of -Wl,--no-error-execstack optionFlorian Weimer2-3/+3
BFD ld recognizes all -no-* options (with a single leading dash) unconditionally. Fixes commit a2bd5008a99032830add3e4005c25b61e3207112 ("Pass -Wl,--no-error-execstack for tests where -Wl,-z,execstack is used [PR32717]").
2025-03-06manual: Mark perror as MT-unsafe and update check-safety.shCarlos O'Donell2-25/+61
The manual marked perror as MT-safe, but then listed a remark indicating that it was unsafe because of a race between the function and access to stderr. The function is indeed MT-unsafe because of the unlocked access to stderr internals and bug 32730 has been filed to address this issue. The script manual/check-safety.sh should have caught this issue, but a missed escaping of "?" along with searching of all inputs again via "$@" resulted in a non-functional regexp. In order to avoid regressions we also update check-safety.sh. The script manual/check-safety.sh is updated in the following ways: * The MT-unsafe remarks in MT-safe context check is fixed. - It now detects the perror safety note mistake. * Comments updated indicating that we allow MT context marks to count for other contexts if they are related. - This is why commit ad9c4c536115ba38be3e63592a632709ec8209b4 failed and the failure is now understood as expected. * All checks now have verbose output. * Back reference based duplicate checks are removed. - They are too complex and don't cover all cases. No regressions on x86_64.
2025-03-07elf: Check if __attribute__ ((aligned (65536))) is supportedH.J. Lu3-5/+48
The BZ #32763 tests fail to build for MicroBlaze (which defines MAX_OFILE_ALIGNMENT to (32768*8) in GCC, so __attribute__ ((aligned (65536))) is unsupported). Add a configure-time check to enable BZ #32763 tests only if __attribute__ ((aligned (65536))) is supported. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-03-06htl: Make __pthread_create_internal directly call __pthread_sigmaskSamuel Thibault1-4/+1
__pthread_sigmask will already know to pass our current ss to __sigthreadmask.
2025-03-06htl: Make __pthread_sigmask directly call __sigthreadmaskSamuel Thibault2-3/+4
If no thread was created yet, __pthread_sigstate will not find our ss because self->kernel_thread is still nul, and then change the global sigstate instead of our sigstate! We can directly call __sigthreadmask and skip the (bogus) lookup step.
2025-03-06hurd: Consolidate signal mask changeSamuel Thibault5-103/+92
__pthread_sigstate and __sigprocmask were already the same, except for clear_pending.