aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-06-23powerpc: use .machine power10 in POWER10 assembler sourcesAndreas Schwab5-5/+5
They were misattributed as POWER9 sources.
2025-06-21hurd: Remove a duplicate entry from 'tests-unsupported'.Collin Funk1-3/+0
When building on GNU/Hurd the following warnings repeat themselves: ../Rules:400: target '/home/collin/obj/glibc/io/test-lfs.out' given more than once in the same rule ../Rules:400: target '/home/collin/obj/glibc/io/test-lfs.out' given more than once in the same rule This is because commit 73b854e955 (hurd: Mark more memory-hungry tests as unsupported, 2025-01-12) added it to 'tests-unsupported' even though it was already added by decf02d382 (hurd: Mark two tests as unsupported, 2023-04-13). Message-ID: <54dc6bf7e0dbedb1b19356f41fec843c1c523b11.1750130025.git.collin.funk1@gmail.com>
2025-06-21hurd: Fix redefinition of 'P2ALIGN'.Collin Funk1-0/+5
When building on GNU/Hurd warnings like the following occur: ../sysdeps/x86_64/multiarch/strnlen-evex-base.S:53:10: warning: "P2ALIGN" redefined 53 | # define P2ALIGN(...) .p2align 4,, 6 | ^~~~~~~ In file included from /usr/include/x86_64-gnu/mach/x86_64/syscall_sw.h:30, from ../sysdeps/mach/sysdep.h:21, from ../sysdeps/mach/x86/sysdep.h:31, from ../sysdeps/x86_64/multiarch/strnlen-evex-base.S:24: /usr/include/x86_64-gnu/mach/x86_64/asm.h:78:9: note: this is the location of the previous definition 78 | #define P2ALIGN(p2) .p2align p2 /* gas-specific */ | ^~~~~~~ The fix is to undefine the macro from system headers in sysdep.h so that it can be properly defined in assembly files where its definition depends on whether string functions are being compiled for wide-characters or not. Message-ID: <721cd3a1bae1a553857db1dd69761a175f611364.1750131904.git.collin.funk1@gmail.com>
2025-06-19resource/Makefile: Split and sort testsMartin Coufal1-1/+5
Split and sort tests in resource/Makefile. Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-06-19malloc: Link large tcache tests with $(shared-thread-library)Florian Weimer1-52/+58
Introduce tests-link-with-libpthread to list tests that require linking with libpthread, and use that to generate dependencies on $(shared-thread-library) for all multi-threaded tests. Fixes build failures of commit cde5caa4bb21d5c474b9e4762cc847bcbc70e481 ("malloc: add testing for large tcache support") on Hurd. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-06-19x86: Update tst-gnu2-tls2 testsH.J. Lu8-28/+79
Update tst-gnu2-tls2 tests to set XMM0...XMM7 to all 1s in malloc to verify that XMM registers are preserved when _dl_tlsdesc_dynamic is called by clearing vectors with zeroed XMM registers before _dl_tlsdesc_dynamic and using these XMM registers to clear vectors after _dl_tlsdesc_dynamic. This improves the BZ #31372 test. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-06-19i386: Update ___tls_get_addr to preserve vector registersH.J. Lu25-169/+623
Compiler generates the following instruction sequence for dynamic TLS access: leal tls_var@tlsgd(,%ebx,1), %eax call ___tls_get_addr@PLT CALL instruction is transparent to compiler which assumes all registers, except for EFLAGS, AX, CX, and DX, are unchanged after CALL. But ___tls_get_addr is a normal function which doesn't preserve any vector registers. 1. Rename the generic __tls_get_addr function to ___tls_get_addr_internal. 2. Change ___tls_get_addr to a wrapper function with implementations for FNSAVE, FXSAVE, XSAVE and XSAVEC to save and restore all vector registers. 3. dl-tlsdesc-dynamic.h has: _dl_tlsdesc_dynamic: /* Like all TLS resolvers, preserve call-clobbered registers. We need two scratch regs anyway. */ subl $32, %esp cfi_adjust_cfa_offset (32) It is wrong to use movl %ebx, -28(%esp) movl %esp, %ebx cfi_def_cfa_register(%ebx) ... mov %ebx, %esp cfi_def_cfa_register(%esp) movl -28(%esp), %ebx to preserve EBX on stack. Fix it with: movl %ebx, 28(%esp) movl %esp, %ebx cfi_def_cfa_register(%ebx) ... mov %ebx, %esp cfi_def_cfa_register(%esp) movl 28(%esp), %ebx 4. Update _dl_tlsdesc_dynamic to call ___tls_get_addr_internal directly. 5. Add have-test-mtls-traditional to compile tst-tls23-mod.c with traditional TLS variant to verify the fix. 6. Define DL_RUNTIME_RESOLVE_REALIGN_STACK in sysdeps/x86/sysdep.h. This fixes BZ #32996. Co-Authored-By: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-18manual: Clarify renameat documentationJitka Obselkova1-1/+3
Clarify the meaning of renameat arguments. Signed-off-by: Jitka Obselkova <jobselko@redhat.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-06-18posix: Add nonnull attribute to glob_pattern_p.Collin Funk1-1/+2
* posix/glob.h (glob_pattern_p): Add __nonnull ((1)) since this function expects a string and does not check for NULL. Signed-off-by: Collin Funk <collin.funk1@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-18math: Simplify and optimize modf implementationAdhemerval Zanella2-52/+70
Refactor the generic implementation to use math_config.h definitions, and add an alternative one if the ABI supports truncf instructions (gated through math-use-builtins-trunc.h). The generic implementation generates similar code on x86_64, while the optimization one for aarch64 (where truncf is supported as a builtin by through frintz), the improvements are: reciprocal-throughput master patch difference workload-0_1 3.0595 3.0698 -0.34% workload-1_maxint 5.1747 3.0542 40.98% workload-maxint_maxfloat 3.4391 3.0349 11.75% workload-integral 3.2732 3.0293 7.45% latency master patch difference workload-0_1 3.5267 4.7107 -33.57% workload-1_maxint 6.9074 4.7282 31.55% workload-maxint_maxfloat 3.7210 4.7506 -27.67% workload-integral 3.8634 4.8137 -24.60% Checked on aarch64-linux-gnu and x86_64-linux-gnu. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-06-18math: Simplify and optimize modff implementationAdhemerval Zanella2-45/+71
Refactor the generic implementation to use math_config.h definitions, and add an alternative one if the ABI supports truncf instructions (gated through math-use-builtins-trunc.h). The generic implementation generates similar code for x86_64, while the optimization path aarch64 (where truncf is supported as a builtin) through frintz), the improvements are: reciprocal-throughput master patch difference workload-0_1 3.0740 3.0326 1.35% workload-1_maxint 5.2231 3.0436 41.73% workload-maxint_maxfloat 4.0962 3.0551 25.42% workload-integral 3.7093 3.0612 17.47% latency master patch difference workload-0_1 3.5521 4.7313 -33.20% workload-1_maxint 6.7148 4.7314 29.54% workload-maxint_maxfloat 4.0458 4.7518 -17.45% workload-integral 3.9719 4.7427 -19.40% Checked on aarch64-linux-gnu and x86_64-linux-gnu. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-06-18AArch64: Improve codegen SVE log1p helperLuna Lamb3-24/+71
Improve codegen by packing coefficients. 4% and 2% improvement in throughput microbenchmark on Neoverse V1, for acosh and atanh respectively. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-06-18AArch64: Optimise SVE FP64 HyperbolicsDylan Fleming3-165/+289
Reworke SVE FP64 hyperbolics to use the SVE FEXPA instruction. Also update the special case handelling for large inputs to be entirely vectorised. Performance improvements on Neoverse V1: cosh_sve: 19% for |x| < 709, 5x otherwise sinh_sve: 24% for |x| < 709, 5.9x otherwise tanh_sve: 12% for |x| < 19, 9x otherwise Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-06-18AArch64: Optimize SVE exp functionsDylan Fleming4-155/+211
Improve performance of SVE exps by making better use of the SVE FEXPA instruction. Performance improvement on Neoverse V1: exp2_sve: 21% exp2f_sve: 24% exp10f_sve: 23% expm1_sve: 25% Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-06-18sparc: Fix sparc32 Fix argument passing to __libc_start_main (BZ 32981)Adhemerval Zanella1-3/+4
Commit 404526ee2e58f3c075253943ddc9988f4bd6b80c changed _start to write the last argument to __libc_start_main without taking into consideration that the function did not create a full stack frame, which leads to overwriting the argv[0].
2025-06-18Fix termios related targetsAndreas Schwab1-9/+18
Move Linux-specific termios headers and tests from misc to termios subdir and install newly added bits/termios-cbaud.h.
2025-06-18malloc: Cleanup _mid_memalignWilco Dijkstra1-14/+7
Remove unused 'address' parameter from _mid_memalign and callers. Fix off-by-one alignment calculation in __libc_pvalloc. Reviewed-by: DJ Delorie <dj@redhat.com>
2025-06-18aarch64: simplify calls to __libc_arm_za_disable in assemblyYury Khrustalev3-42/+27
There is no functional change in this patch. We remove stores and loads to stack, return address signing, and redundant CFI directives before and after call to __libc_arm_za_disable(). The __libc_arm_za_disable implementation follows special calling convention that allows to avoid most of the operations that would be necessary for a call to a normal function (see [1] for details). First, we rely on __libc_arm_za_disable() not clobbering certain registers, and we put return address into one of these registers. Now we don't need to store it on stack, so we don't need to sign return address using PAC. Second, as a result of the above, we don't need to update the CFI offset. This patch provides small optimisation avoiding unnecessary store and load on stack also simplifies assembly code and CFI directives. [1]: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-18aarch64: GCS: use internal struct in __alloc_gcsYury Khrustalev3-8/+28
No functional change here, just a small refactoring to simplify using __alloc_gcs() for allocating shadow stacks. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-18powerpc: Remove assembler workaroundsAndreas Schwab4-101/+34
Now that we require at least binutils 2.39 the support for POWER9 and POWER10 instructions can be assumed.
2025-06-17malloc: Fix tests-malloc-largetcache testsAdhemerval Zanella1-1/+1
The commit cde5caa4bb21d5c474b9e4762cc847bcbc70e481 added the tests-malloc-largetcache without adjusting the previous entry. The make check fails with: make[1]: Entering directory '/path/to/glibc' make subdir=csu -C csu ..=../ tests make[2]: Entering directory '/path/to/glibc/csu' make[2]: *** No rule to make target ')', needed by 'tests'. Stop. make[2]: Leaving directory '/path/to/csu' make[1]: *** [Makefile:484: csu/tests] Error 2
2025-06-17Add TCPI_OPT_USEC_TS from Linux 6.14 and TCPI_OPT_TFO_CHILD from 6.15 to ↵Jeremy Harris1-0/+3
netinet/tcp.h. This patch adds the TCPI_OPT_USEC_TS constant from Linux 6.14 to sysdeps/gnu/netinet/tcp.h This patch adds the TCPI_OPT_TFO_CHILD constant from Linux 6.15 to sysdeps/gnu/netinet/tcp.h Signed-off-by: Jeremy Harris <jgh@exim.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17linux/termios: regression test for termios speed functionsH. Peter Anvin (Intel)2-0/+593
Test that runs through a fairly large combination of the various termios speed functions, for the new speed_t interface, for the old speed_t interface (if enabled), and for the new baud_t interface. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-06-17include/array_length.h: add array_foreach[_const] macrosH. Peter Anvin1-0/+14
Add simple-to-use iterator macros for arrays. They are used instead of explicit for statements, like: /* Test all common speeds */ array_foreach_const (ts, test_speeds) test (fd, *ts); In this case, ts will be a const pointer to each of the elements of test_speeds in turn. Named array_foreach*() to allow for other kinds of equivalent iterator macros in the future. Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17termios: unify the naming of the termios speed fieldsH. Peter Anvin (Intel)3-5/+28
The generic code has __ispeed and __ospeed; Linux has c_ispeed and c_ospeed. Use an anonymous union member to allow both set of names on all platforms. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-06-17termios: add new baud_t interface, defined to be explicitly numericH. Peter Anvin (Intel)45-27/+400
Add an explicitly numeric interface for baudrate setting. For glibc, this only announces what is a fair accompli, but this is a plausible way forward for standardization, and may be possible to infill on non-compliant systems. The POSIX committee has stated: [https://www.austingroupbugs.net/view.php?id=1916#c7135] A future version of this standard is expected to add at least the following symbolic constants for use as values of objects of type speed_t: B57600, B115200, B230400, B460800, and B921600. Implementations are encouraged to propose additional interfaces which will make it possible to set and query a wider range of speeds than just those enumerated by the constants beginning with B. If a set of common interfaces emerges between several implementations, a future version of this standard will likely add those interfaces. This is exactly that interface. The use of the term "baud" is due to the need to have a term contrasting "speed", and it is already well established as a legacy term -- including in the names of the legacy Bxxx constants. Futhermore, it *is* valid from the point of view that the termios interface fundamentally emulates an RS-232 serial port as far as the application software is concerned. The documentation states that for the current version of glibc, speed_t == baud_t, but explicitly declares that this may not be the case in the future. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17manual: document all the termios Bxxx constants in the manualH. Peter Anvin (Intel)1-4/+70
Add all the Bxxx constants defined in the now-generic <bits/termios-baud.h> in the manual. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-06-17termios: merge the termios baud definitionsH. Peter Anvin (Intel)5-77/+48
Now all platforms unconditionally use the "sane" definitions of the termios baud constants. Unify them into a common file. Note: I have made them explicitly unsigned to avoid problems with compiler warnings for comparisons of unequal signedness or similar. These constants were historically octal on most platforms, and so unsigned by default. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17hurd+generic/termios: make speed_t an unsigned intH. Peter Anvin (Intel)1-1/+1
POSIX requires that speed_t is an unsigned integer type, so change the generic speed_t definition to be an unsigned int instead of a plain int. Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-06-17termios: change the generic cfsetspeed() to support arbitrary speedsH. Peter Anvin (Intel)1-133/+5
The generic implementaion of cfsetspeed() had an internal table of permitted baud rates, which was enforced even on an implementation supporting arbitrary baud rates. This was to be able to *also* accept numeric constants as well as Bxxx values. This fundamentally makes no sense; not only does it go against the documented behavior of cfsetspeed() which is to take the same input as cfset[io]speed(), but it means cfsetspeed() is broken with regard to a platform supporting arbitrary speeds. With Linux converted to arbitrary baud rates, the only remaining case of non-arbitrary baud rates appears to be Hurd with USE_OLD_TTY, which one can presume being a legacy case that few if any people care about, and so simply strip out this code and make cfsetspeed() rely on cfsetospeed() to validate acceptable speed constants. If a new platform is introduced which does not have arbitrary baud rate support, using non-baud rate Bxxx constants (highly not recommended; should be abstracted at the glibc level) but such aliasing is desired, it should be supported by cfset[io]speed() as well, and belongs in the platform-specific code. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17hurd/termios: remove USE_OLD_TTYH. Peter Anvin (Intel)2-33/+2
Hurd with USE_OLD_TTY was the only remaining platform with speed_t not containing a proper baud rate. From the looks of it, that code has long since bitrotted. Remove the vestiges of USE_OLD_TTY. Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-06-17linux: implement arbitrary and split speeds in termiosH. Peter Anvin (Intel)62-456/+1133
Linux has supported arbitrary speeds and split speeds in the kernel since 2008 on all platforms except Alpha (fixed in 2020), but glibc was never updated to match. This is further complicated by POSIX uses of macros for the cf[gs]et[io]speed interfaces, rather than plain numbers, as it really ought to have. On most platforms, the glibc ABI includes the c_[io]speed fields in struct termios, but they are incorrectly used. On MIPS and SPARC, they are entirely missing. For backwards compatibility, the kernel will still use the legacy speed fields unless they are set to BOTHER, and will use the legacy output speed as the input speed if the latter is 0 (== B0). However, the specific encoding used is visible to user space applications, including ones other than the one running. - SPARC and MIPS get a new struct termios, and tc[gs]etattr() is versioned accordingly. However, the new struct termios is set to be a strict extension of the old one, which means that cf* interfaces other than the speed-related ones do not need versioning. - The Bxxx constants are redefined as equivalent to their integer values and the legacy Bxxx constants are renamed __Bxxx. - cf[gs]et[io]speed() and cfsetspeed() are versioned accordingly. - tcgetattr() and cfset[io]speed() are adjusted to always keep the c_[io]speed fields correct (unlike earlier versions), but to canonicalize the representation to ALSO configure the legacy fields if a valid legacy representation exists. - tcsetattr(), too, canonicalizes the representation in this way before passing it to the kernel, to maximize compatibility with older applications/tools. - The old IBAUD0 hack is removed; it is no longer necessary since even the legacy c_cflag baud rate fields have had separate input values for a long time. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17linux/termios/powerpc: deal with powerpc-unique ioctl emulationH. Peter Anvin (Intel)1-0/+36
The powerpc architecture, only, emulates the termios ioctls using the glibc termios structure. Export the real kernel ones as the termios2 interface; although the kernel doesn't call it termios2, it is exactly the termios2 interface, and it avoids the namespace clash between the emulated ioctls and the real kernel ioctls. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17linux/ioctls: use <linux/sockios.h> for sockios ioctlsH. Peter Anvin (Intel)1-84/+1
In the kernel, these are <linux/sockios.h>. The differences between <linux/sockios.h> and the copied data in <bits/ioctls.h> are minor; mainly some #ifdefs, so try to use <linux/sockios.h> directly; it is hopefully clean enough these days to use directly. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17io: replace local_isatty() with a proper function __isatty_nostatus()H. Peter Anvin (Intel)5-11/+61
Replace local_isatty() inlined in libio with a proper function __isatty_nostatus(). This allows simpler system-specific implementations that don't need to touch errno at all. Note: I left the prototype in include/unistd.h (the internal header file.) It didn't much make sense to me to put it in a different header (not-cancel.h), but perhaps someone can elucidate the need. Add such an implementation for Linux, with a generic fallback. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17termios: make __tcsetattr() the internal interfaceH. Peter Anvin (Intel)6-9/+12
There is a prototype for an internal __tcsetattr() function in include/termios.h, but tcsetattr without __ were still declared as the actual functions. Make this match the comment and make __tcsetattr() an internal interface. This will be required to version struct termios for Linux on MIPS and SPARC. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-06-17Update advisory GLIBC-SA-2025-0003 and GLIBC-SA-2025-0004Carlos O'Donell2-0/+7
Add Fix-Commit information for backported fixes.
2025-06-17malloc: Sort tests-exclude-largetcache in MakefileH.J. Lu1-2/+2
This fixes: FAIL: lint-makefiles Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-06-16ppc64le: Revert "powerpc: Optimized strcmp for power10" (CVE-2025-5702)Carlos O'Donell5-239/+1
This reverts commit 3367d8e180848030d1646f088759f02b8dfe0d6f Reason for revert: Power10 strcmp clobbers non-volatile vector registers (Bug 33056) Tested on ppc64le without regression.
2025-06-16ppc64le: Revert "powerpc : Add optimized memchr for POWER10" (Bug 33059)Carlos O'Donell5-369/+11
This reverts commit b9182c793caa05df5d697427c0538936e6396d4b Reason for revert: Power10 memchr clobbers v20 vector register (Bug 33059) This is not a security issue, unlike CVE-2025-5745 and CVE-2025-5702. Tested on ppc64le without regression.
2025-06-16ppc64le: Revert "powerpc: Fix performance issues of strcmp power10" ↵Carlos O'Donell1-95/+66
(CVE-2025-5702) This reverts commit 90bcc8721ef82b7378d2b080141228660e862d56 This change is in the chain of the final revert that fixes the CVE i.e. 3367d8e180848030d1646f088759f02b8dfe0d6f Reason for revert: Power10 strcmp clobbers non-volatile vector registers (Bug 33056) Tested on ppc64le with no regressions.
2025-06-16ppc64le: Revert "powerpc: Optimized strncmp for power10" (CVE-2025-5745)Carlos O'Donell5-304/+1
This reverts commit 23f0d81608d0ca6379894ef81670cf30af7fd081 Reason for revert: Power10 strncmp clobbers non-volatile vector registers (Bug 33060) Tested on ppc64le with no regressions.
2025-06-16malloc: add testing for large tcache supportCupertino Miranda2-0/+35
This patch adds large tcache support tests by re-executing malloc tests using the tunable: glibc.malloc.tcache_max=1048576 Test names are postfixed with "largetcache". Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-06-16malloc: add tcache support for large chunk cachingCupertino Miranda1-82/+227
Existing tcache implementation in glibc seems to focus in caching smaller data size allocations, limiting the size of the allocation to 1KB. This patch changes tcache implementation to allow to cache any chunk size allocations. The implementation adds extra bins (linked-lists) which store chunks with different ranges of allocation sizes. Bin selection is done in multiples in powers of 2 and chunks are inserted in growing size ordering within the bin. The last bin contains all other sizes of allocations. This patch although by default preserves the same implementation, limitting caches to 1KB chunks, it now allows to increase the max size for the cached chunks with the tunable glibc.malloc.tcache_max. It also now verifies if chunk was mmapped, in which case __libc_free will not add it to tcache. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-06-16Always check lockf64 return valueH.J. Lu1-6/+12
On x86-64, when GCC 14.2.1 is used to build: commit f3c82fc1b41261f582f5f9fa12f74af9bcbc88f9 Author: Radko Krkos <krkos@mail.muni.cz> Date: Sat Jun 14 11:07:40 2025 +0200 io: Mark lockf() __wur [BZ #32800] In commit 0476597b28 flock() was marked __wur in posix/unistd.h, but not in io/fcntl.h, the declarations must match. Reviewed-by: Florian Weimer <fweimer@redhat.com> I got programs/locarchive.c: In function ‘open_archive’: programs/locarchive.c:641:18: error: ignoring return value of ‘lockf64’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] 641 | (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ programs/locarchive.c:653:14: error: ignoring return value of ‘lockf64’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] 653 | (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ programs/locarchive.c:660:14: error: ignoring return value of ‘lockf64’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] 660 | (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ programs/locarchive.c:679:14: error: ignoring return value of ‘lockf64’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] 679 | (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Update locarchive.c to always check lockf64 return value. This fixes BZ #33089. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-16elf: Add optimization barrier for __ehdr_start and _endH.J. Lu2-0/+21
rtld.c has extern const ElfW(Ehdr) __ehdr_start attribute_hidden; ... _dl_rtld_map.l_map_start = (ElfW(Addr)) &__ehdr_start; _dl_rtld_map.l_map_end = (ElfW(Addr)) _end; As https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120653 shows, compiler may generate run-time relocation on __ehdr_start with movq .LC0(%rip), %xmm0 ... .section .data.rel.ro.local,"aw" .align 8 .LC0: .quad __ehdr_start This won't work before run-time relocation is finished in rtld.c. Add optimization barrier to prevent run-time relocations against __ehdr_start and _end. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-06-15htl: move pthread_key_*, pthread_get/setspecificgfleury16-47/+76
Signed-off-by: gfleury <gfleury@disroot.org> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-ID: <20250613184440.1660335-1-gfleury@disroot.org>
2025-06-15elf: Remove the unused _etext declarationH.J. Lu1-1/+0
Since commit 53df2ce6885da3d0e89e87dca7b095622296014f Author: Florian Weimer <fweimer@redhat.com> Date: Fri Sep 8 13:02:06 2023 +0200 elf: Remove unused l_text_end field from struct link_map removed the only reference to _etext, also remove the unused _etext declaration. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-06-14io: Mark lockf() __wur [BZ #32800]Radko Krkos1-3/+4
In commit 0476597b28 flock() was marked __wur in posix/unistd.h, but not in io/fcntl.h, the declarations must match. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-13benchtests: Improve modf benchtestAdhemerval Zanella1-3/+4010
It adds four ranges, which is how the generic implementation handles normal numbers: 1. Random inputs in the range [0.0, 1.0]; 2. Random inputs in the range [1.0, (double)(UINT64_C(1) << 52))]; 3. Random inputs in the range [(double)(UINT64_C(1) << 52), DBL_MAX]; 4. Random integral inputs in the range [0.0, (double)(UINT64_C(1) << 52)]. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>