aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-04-25benchtest: Correct shell script related to bench-malloc-threadHEADmasterCupertino Miranda1-1/+1
This patch changes the shell script that selects which arguments are used for the execution of bench-malloc-thread. The problem seems to have been introduced in commit: commit 2d6427a63cad8056ba6bcaaaa8df21977c8dde3d Author: Wangyang Guo <wangyang.guo@intel.com> Date: Fri Nov 29 16:05:35 2024 +0800 benchtests: Add calloc test With current condition, the following error "/bin/sh: 3: [[: not found" occurs when executing `make bench BENCHSET="malloc-thread"` and the else path is taken, using incorrect arguments for bench test execution. Error is reproducible in Debian based distros. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-04-25linux/termio: remove <termio.h> and struct termioH. Peter Anvin6-46/+5
The <termio.h> interface is absolutely ancient: it was obsoleted by <termios.h> already in the first version of POSIX (1988) and thus predates the very first version of Linux. Unfortunately, some constant macros are used both by <termio.h> and <termios.h>; particularly problematic is the baud rate constants since the termio interface *requires* that the baud rate is set via an enumeration as part of c_cflag. In preparation of revamping the termios interface to support the arbitrary baud rate capability that the Linux kernel has supported since 2008, remove <termio.h> in the hope that no one still uses this archaic interface. Note that there is no actual code in glibc to support termio: it is purely an unabstracted ioctl() interface. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-04-22elf: tst-audit10: split AVX512F code into dedicated functions [BZ #32882]Aurelien Jarno2-55/+55
"Recent" GCC versions (since commit fc62716fe8d1, backported to stable branches) emit a vzeroupper instruction at the end of functions containing AVX instructions. This causes the tst-audit10 test to fail on CPUs lacking AVX instructions, despite the AVX512F check. The crash occurs in the pltenter function of tst-auditmod10b.c. Fix that by moving the code guarded by the check_avx512 function into specific functions using the target ("avx512f") attribute. Note that since commit 5359c3bc91cc ("x86-64: Remove compiler -mavx512f check") it is safe to assume that the compiler has AVX512F support, thus the __AVX512F__ checks can be dropped. Tested on non-AVX, AVX2 and AVX512F machines. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-04-22Add NT_ARM_GCS and NT_RISCV_TAGGED_ADDR_CTRL from Linux 6.13 to elf.hJoseph Myers1-0/+3
Linux 6.13 adds new ELF note types NT_ARM_GCS and NT_RISCV_TAGGED_ADDR_CTRL. Add these to glibc's elf.h. Tested for x86_64.
2025-04-22Add AT_* constants from Linux 6.12Joseph Myers2-0/+5
Linux 6.12 adds AT_RENAME_* aliases for RENAME_* flags for renameat2, and also AT_HANDLE_MNT_ID_UNIQUE. Add the first set of aliases to stdio.h alongside the RENAME_* names, and AT_HANDLE_MNT_ID_UNIQUE to bits/fcntl-linux.h. Tested for x86_64.
2025-04-21hurd: Make symlink return EEXIST on existing target directorySamuel Thibault1-1/+1
8ef17919509e ("hurd: Fix EINVAL error on linking to a slash-trailing path [BZ #32569]) made symlink return ENOTDIR, but the gnulib testsuite does not recognize it for such a situation, and EEXIST is indeed more comprehensible to users.
2025-04-21hurd: Clear FP exceptions before calling signal handlerSamuel Thibault1-4/+10
This avoids SIGFPE handlers (or code longjmp-ed to) getting disturbed by the exception that generated it. Note: gcc's unwinding depends on the rpc_wait_trampoline/trampoline exact code, so we here avoid breaking it.
2025-04-21hurd: Do not check for xstate level if it was not initializedSamuel Thibault1-1/+1
If __thread_get_state failed, there is no xstate level to check. ok is 0 already and the memory exists, but better not read uninitialized memory.
2025-04-21hurd: Do not restore xstate when it is not initializedSamuel Thibault2-34/+40
If the process has never used fp before getting a signal, xstate is set (and thus the x87 state is not initialized) but xstate->initialized is still 0, and we should not restore anything.
2025-04-20hurd: Make *utime*s catch invalid times [BZ #32802, BZ #32803]Samuel Thibault3-12/+66
2025-04-18hurd: save xstate during signal handlingLuca Dariz9-25/+458
* hurd/Makefile: add new tests * hurd/test-sig-rpc-interrupted.c: check xstate save and restore in the case where a signal is delivered to a thread which is waiting for an rpc. This test implements the rpc interruption protocol used by the hurd servers. It was so far passing on Debian thanks to the local-intr-msg-clobber.diff patch, which is now obsolete. * hurd/test-sig-xstate.c: check xstate save and restore in the case where a signal is delivered to a running thread, making sure that the xstate is modified in the signal handler. * hurd/test-xstate.h: add helpers to test xstate * sysdeps/mach/hurd/i386/bits/sigcontext.h: add xstate to the sigcontext structure. + sysdeps/mach/hurd/i386/sigreturn.c: restore xstate from the saved context * sysdeps/mach/hurd/x86/trampoline.c: save xstate if supported. Otherwise we fall back to the previous behaviour of ignoring xstate. * sysdeps/mach/hurd/x86_64/bits/sigcontext.h: add xstate to the sigcontext structure. * sysdeps/mach/hurd/x86_64/sigreturn.c: restore xstate from the saved context Signed-off-by: Luca Dariz <luca@orpolo.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-ID: <20250319171118.142163-1-luca@orpolo.org>
2025-04-18hurd: Check return value of mach_port_mod_refs() in the dup routine of fcntl()Zhaoming Luo2-28/+87
Message-ID: <20250310084409.24177-1-zhmingluo@163.com>
2025-04-16malloc: move tcache_init out of hot tcache pathsCupertino Miranda1-12/+6
This patch moves any calls of tcache_init away after tcache hot paths. Since there is no reason to initialize tcaches in the hot path and since we need to be able to check tcache != NULL in any case, because of tcache_thread_shutdown function, moving tcache_init away from hot path can only be beneficial. The patch also removes the initialization of tcaches within the __libc_free call. It only makes sense to initialize tcaches for the thread after it calls one of the allocation functions. Also the patch removes the save/restore of errno from tcache_init code, as it is no longer needed.
2025-04-15aarch64: Add back non-temporal load/stores from oryon-1's memsetAndrew Pinski1-0/+26
I misunderstood the recommendation from the hardware team about non-temporal load/stores. It is still recommended to use them in memset for large sizes. It was not recommended for their use with device memory and memset is already not valid to be used with device memory. This reverts commit e6590f0c86632c36c9a784cf96075f4be2e920d2. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-04-15aarch64: Add back non-temporal load/stores from oryon-1's memcpyAndrew Pinski1-0/+40
I misunderstood the recommendation from the hardware team about non-temporal load/stores. It is still recommended to use them in memcpy for large sizes. It was not recommended for their use with device memory and memcpy is already not valid to be use with device memory. This reverts commit eb5eeb47403e0a91de834868e501b4d62b8d2cb9. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-04-15malloc: Use tailcalls in __libc_freeWilco Dijkstra1-7/+24
Use tailcalls to avoid the overhead of a frame on the free fastpath. Move tcache initialization to _int_free_chunk(). Add malloc_printerr_tail() which can be tailcalled without forcing a frame like no-return functions. Change tcache_double_free_verify() to retry via __libc_free() after clearing the key. Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-04-15malloc: Inline tcache_freeWilco Dijkstra1-30/+14
Inline tcache_free since it's only used by __libc_free. Add __glibc_likely for the tcache checks. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-04-15malloc: Improve free checksWilco Dijkstra1-9/+6
The checks on size can be merged and use __builtin_add_overflow. Since tcache only handles small sizes (and rejects sizes < MINSIZE), delay this check until after tcache. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-04-15malloc: Inline _int_free_checkWilco Dijkstra1-19/+12
Inline _int_free_check since it is only used by __libc_free. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-04-14malloc: Inline _int_freeWilco Dijkstra2-28/+12
Inline _int_free since it is a small function and only really used by __libc_free. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-04-14malloc: Move mmap code out of __libc_free hotpathWilco Dijkstra1-30/+40
Currently __libc_free checks for a freed mmap chunk in the fast path. Also errno is always saved and restored to preserve it. Since mmap chunks are larger than the largest tcache chunk, it is safe to delay this and handle tcache, smallbin and medium bin blocks first. Move saving of errno to cases that actually need it. Remove a safety check that fails on mmap chunks and a check that mmap chunks cannot be added to tcache. Performance of bench-malloc-thread improves by 9.2% for 1 thread and 6.9% for 32 threads on Neoverse V2. Reviewed-by: DJ Delorie <dj@redhat.com> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-04-14manual/tunables: fix a trivial typoAurelien Jarno1-1/+1
Fixes: 12a497c716f0 ("elf: Extend glibc.rtld.execstack tunable to force executable stack (BZ 32653)" Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-04-14Fix spelling mistake "trucate" -> "truncate"Colin Ian King1-1/+1
There is a spelling mistake in a test filename. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-04-14Fix spelling mistake "suports" -> "supports"Colin Ian King2-2/+2
There are spelling mistakes in assert messages. Fix them. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-04-14Fix spelling mistake "succsefully" -> "successfully"Colin Ian King1-1/+1
There is a spelling mistake in a puts statement. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-04-14manual: Mention POSIX-1.2024 requires time_t to be 64 bit or wider.Collin Funk1-1/+2
* manual/time.texi (Time Types): Mention POSIX-1.2024 requires 64 bit time_t. Signed-off-by: Collin Funk <collin.funk1@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-04-14manual: Update standardization of getline and getdelim [BZ #32830]Collin Funk1-11/+15
* manual/stdio.texi (Line Input): Document that getline and getdelim where GNU extensions until standardized in POSIX.1-2008. Add restrict to function prototypes. Signed-off-by: Collin Funk <collin.funk1@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-04-14libio: Add test case for fflushFrédéric Bérat4-0/+208
Since one path uses _IO_SYNC and the other _IO_OVERFLOW, the newly added test cases verifies that `fflush (FILE)` and `fflush (NULL)` are semantically equivalent from the FILE perspective. Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-04-14libio: Synthesize ESPIPE error if lseek returns 0 after reading bytesFlorian Weimer3-0/+61
This is required so that fclose, when trying to seek to the right position after filling the input buffer, does not fail with EINVAL. This fclose code path only ignores ESPIPE errors. Reported by Petr Pisar on <https://bugzilla.redhat.com/show_bug.cgi?id=2358265>. Fixes commit be6818be31e756398e45f70e2819d78be0961223 ("Make fclose seek input file to right offset (bug 12724)"). Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2025-04-12x86: Detect Intel Diamond RapidsH.J. Lu1-0/+12
Detect Intel Diamond Rapids and tune it similar to Intel Granite Rapids. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2025-04-11x86: Handle unknown Intel processor with default tuningSunil K Pandey1-144/+143
Enable default tuning for unknown Intel processor. Tested on x86, no regression. Co-Authored-By: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-10conform: Add initial support for C23.Collin Funk82-151/+151
Hi Joseph, As we discussed, this patch just makes C23 include every check that is performed by C11. I tested the commit by adding the ISO23 Make and Python variables to be the same as ISO11. So the only difference was compiling with -DISO23 instead of -DISO11. And changed the temporary directories to instead use the format f'/tmp/glibc-{self.standard}-{self.header}'. Then I used a shell script to run 'cmp' on each file in the ISO11 and ISO23 directories for each header to make sure they were the same. -- 8< -- Make C23 checks include every test that is performed by C11. Done by running the following command: find conform -name '*.h-data' | xargs sed -i \ -e 's| !defined ISO11| !defined ISO11 \&\& !defined ISO23|g' \ -e 's| defined ISO11| defined ISO11 \|\| defined ISO23|g' \ -e 's|ifdef ISO11|if defined ISO11 \|\| defined ISO23|g' \ -e 's|ifndef ISO11|if !defined ISO11 \&\& !defined ISO23|g' Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2025-04-10x86: Add ARL/PTL/CWF model detection supportSunil K Pandey1-0/+10
- Add ARROWLAKE model detection. - Add PANTHERLAKE model detection. - Add CLEARWATERFOREST model detection. Intel® Architecture Instruction Set Extensions Programming Reference https://cdrdv2.intel.com/v1/dl/getContent/671368 Section 1.2. No regression, validated model detection on SDE. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-10timezone: Enhance tst-bz28707 diagnosticsFlorian Weimer1-14/+20
This hopefully provides additional information about why the test failed, in case the fix in commit 62db87ab24f9ca483f97f ("timezone: Fix tst-bz28707 Makefile rule") turns out to be insufficient. Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2025-04-10powerpc: Remove relocation cache flush code for power64Florian Weimer1-15/+0
This is only needed for -mno-secure-plt, and this linkage mode is not supported with powerpc64 and powerp64le. Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
2025-04-09math: Fix up THREEp96 constant in expf128 [BZ #32411]Jakub Jelinek1-1/+1
As mentioned by the reporter in a pull request against gcc-mirror, the THREEp96 constant in e_expl.c is incorrect, it is actually 0x3.p+94f128 rather than 0x3.p+96f128. The algorithm uses that to compute the t2 integer (tval2), by whose delta it adjusts the x+xl pair and then in the result uses the precomputed exp value for that entry. Using 0x3.p+94f128 rather than 0x3.p+96f128 results in tval2 sometimes being one smaller, sometimes one larger than the desired value, thus can mean the x+xl pair after adjustment will be larger in absolute value than it should be. DesWursters created a test program for this https://github.com/DesWurstes/comparefloats and his results were total: 1135000000 not_equal: 4322 earlier_score: 674 later_score: 3648 I've modified this so with https://sourceware.org/bugzilla/show_bug.cgi?id=32411#c3 so that it actually tests pseudo-random _Float128 values with range (-16384.,16384) with strong bias on values larger than 0.0002 in absolute value (so that tval1/tval2 aren't zero most of the time) and that gave total: 10000000000 not_equal: 29861 earlier_score: 4606 later_score: 25255 So, in both cases, in most cases the change doesn't result in any differences, and in those rare cases where does, about 85% have smaller ulp than without the patch. Additionally I've tried https://sourceware.org/bugzilla/show_bug.cgi?id=32411#c4 and in 2 billion iterations it didn't find any case where x+xl after the adjustments without this change would be smaller in absolute value compared to x+xl after the adjustments with this change. Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-04-08elf: Extend glibc.rtld.execstack tunable to force executable stack (BZ 32653)Adhemerval Zanella11-13/+82
From the bug report [1], multiple programs still require to dlopen shared libraries with either missing PT_GNU_STACK or with the executable bit set. Although, in some cases, it seems to be a hard-craft assembly source without the required .note.GNU-stack marking (so the static linker is forced to set the stack executable if the ABI requires it), other cases seem that the library uses trampolines [2]. Unfortunately, READ_IMPLIES_EXEC is not an option since on some ABIs (x86_64), the kernel clears the bit, making it unsupported. To avoid reinstating the broken code that changes stack permission on dlopen (0ca8785a28), this patch extends the glibc.rtld.execstack tunable to allow an option to force an executable stack at the program startup. The tunable is a security issue because it defeats the PT_GNU_STACK hardening. It has the slight advantage of making it explicit by the caller, and, as for other tunables, this is disabled for setuid binaries. A tunable also allows us to eventually remove it, but from previous experiences, it would require some time. Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=32653 [2] https://github.com/conda-forge/ctng-compiler-activation-feedstock/issues/143 Reviewed-by: Sam James <sam@gentoo.org>
2025-04-08stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabsLenard Mollenkopf47-2/+475
C2Y adds unsigned versions of the abs functions (see C2Y draft N3467 and proposal N3349). Tested for x86_64. Signed-off-by: Lenard Mollenkopf <glibc@lenardmollenkopf.de>
2025-04-08stdio-common: In tst-setvbuf2, close helper thread descriptor only if openedFlorian Weimer1-18/+21
The helper thread may get canceled before the open system call succeds. Then ThreadData.fd remains zero, and eventually the xclose call in end_reader_thread fails because descriptor 0 is not open. Instead, initialize the fd member to -1 (not a valid descriptor) and close the descriptor only if valid. Do this in a new end_thread helper routine. Also add more error checking to close operations. Fixes commit 95b780c1d0549678c0a244c6e2112ec97edf0839 ("stdio: Add more setvbuf tests").
2025-04-07Remove duplicates from binaries-shared-tests when creating make rulesAndreas Schwab1-1/+1
This avoids a warning from make because binaries-shared-tests contains both $(tests-container) and $(tests-internal).
2025-04-05x86: Optimize xstate size calculationSunil K Pandey2-56/+24
Scan xstate IDs up to the maximum supported xstate ID. Remove the separate AMX xstate calculation. Instead, exclude the AMX space from the start of TILECFG to the end of TILEDATA in xsave_state_size. Completed validation on SKL/SKX/SPR/SDE and compared xsave state size with "ld.so --list-diagnostics" option, no regression. Co-Authored-By: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2025-04-05NEWS: update for GCC 12.1 requirement [BZ #32539]Sam James1-1/+1
Since 27b96e069aad17cefea9437542180bff448ac3a0, the minimum GCC required to build glibc is GCC 12.1. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-02stdio: fix hurd link for tst-setvbuf2DJ Delorie1-1/+2
2025-04-02stdlib: Fix qsort memory leak if callback throws (BZ 32058)Adhemerval Zanella8-36/+188
If the input buffer exceeds the stack auxiliary buffer, qsort will malloc a temporary one to call mergesort. Since C++ standard does allow the callback comparison function to throw [1], the glibc implementation can potentially leak memory. The fixes uses a pthread_cleanup_combined_push and pthread_cleanup_combined_pop, so it can work with and without exception enables. The qsort code path that calls malloc now requires some extra setup and a call to __pthread_cleanup_push anmd __pthread_cleanup_pop (which should be ok since they just setup some buffer state). Checked on x86_64-linux-gnu. [1] https://timsong-cpp.github.io/cppwp/n4950/alg.c.library#4 Reviewed-by: DJ Delorie <dj@redhat.com>
2025-04-02sysdeps: powerpc: restore -mlong-double-128 checkSam James2-0/+117
We mistakenly dropped the check in 27b96e069aad17cefea9437542180bff448ac3a0; there's some other checks which we *can* drop, but let's worry about that later. Fixes the build on ppc64le where GCC is configured with --with-long-double-format=ieee. Reviewed-by: Andreas Schwab <schwab@suse.de>
2025-04-01stdio: Add more setvbuf testsDJ Delorie3-1/+1041
2025-04-01add ptmx support to test-containerDJ Delorie4-0/+67
2025-04-01Update syscall lists for Linux 6.14Joseph Myers1-2/+2
Linux 6.14 has no new syscalls. Update the version number in syscall-names.list to reflect that it is still current for 6.14. Tested with build-many-glibcs.py.
2025-03-31x86: Link tst-gnu2-tls2-x86-noxsave{,c,xsavec} with libpthreadFlorian Weimer1-0/+3
This fixes a test build failure on Hurd. Fixes commit 145097dff170507fe73190e8e41194f5b5f7e6bf ("x86: Use separate variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)"). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-31elf: Fix tst-origin build when toolchain defaults to --as-needed (BZ 32823)John David Anglin1-1/+2
Checked on aarch64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>