about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* nptl: Use <support/check.h> facilities in tst-setuid3Maciej W. Rozycki2024-08-301-21/+16
| | | | | | | | | | | | Remove local FAIL macro in favor to FAIL_EXIT1 from <support/check.h>, which provides equivalent reporting, with the name of the file and the line number within of the failure site additionally included. Remove FAIL_ERR altogether and include ": %m" explicitly with the format string supplied to FAIL_EXIT1 as there seems little value to have a separate macro just for this. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 8c98195af6e6f1ce21743fc26c723e0f7e45bcf2)
* posix: Use <support/check.h> facilities in tst-truncate and tst-truncate64Maciej W. Rozycki2024-08-301-13/+12
| | | | | | | | | | Remove local FAIL macro in favor to FAIL_RET from <support/check.h>, which provides equivalent reporting, with the name of the file of the failure site additionally included, for the tst-truncate-common core shared between the tst-truncate and tst-truncate64 tests. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit fe47595504a55e7bb992f8928533df154b510383)
* ungetc: Fix backup buffer leak on program exit [BZ #27821]Siddhesh Poyarekar2024-08-284-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> (cherry picked from commit 3e1d8d1d1dca24ae90df2ea826a8916896fc7e77)
* ungetc: Fix uninitialized read when putting into unused streams [BZ #27821]Siddhesh Poyarekar2024-08-283-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> (cherry picked from commit cdf0f88f97b0aaceb894cc02b21159d148d7065c)
* Make tst-ungetc use libsupportSiddhesh Poyarekar2024-08-281-55/+57
| | | | | | Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit 3f7df7e757f4efec38e45d4068e5492efcac4856)
* stdio-common: Add test for vfscanf with matches longer than INT_MAX [BZ #27650]Maciej W. Rozycki2024-08-282-0/+113
| | | | | | | | | | | | | | | | | | | | Complement commit b03e4d7bd25b ("stdio: fix vfscanf with matches longer than INT_MAX (bug 27650)") and add a test case for the issue, inspired by the reproducer provided with the bug report. This has been verified to succeed as from the commit referred and fail beforehand. As the test requires 2GiB of data to be passed around its performance has been evaluated using a choice of systems and the execution time determined to be respectively in the range of 9s for POWER9@2.166GHz, 24s for FU740@1.2GHz, and 40s for 74Kf@950MHz. As this is on the verge of and beyond the default timeout it has been increased by the factor of 8. Regardless, following recent practice the test has been added to the standard rather than extended set. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 89cddc8a7096f3d9225868304d2bc0a1aaf07d63)
* support: Add FAIL test failure helperMaciej W. Rozycki2024-08-284-48/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a FAIL test failure helper analogous to FAIL_RET, that does not cause the current function to return, providing a standardized way to report a test failure with a message supplied while permitting the caller to continue executing, for further reporting, cleaning up, etc. Update existing test cases that provide a conflicting definition of FAIL by removing the local FAIL definition and then as follows: - tst-fortify-syslog: provide a meaningful message in addition to the file name already added by <support/check.h>; 'support_record_failure' is already called by 'support_print_failure_impl' invoked by the new FAIL test failure helper. - tst-ctype: no update to FAIL calls required, with the name of the file and the line number within of the failure site additionally included by the new FAIL test failure helper, and error counting plus count reporting upon test program termination also already provided by 'support_record_failure' and 'support_report_failure' respectively, called by 'support_print_failure_impl' and 'adjust_exit_status' also respectively. However in a number of places 'printf' is called and the error count adjusted by hand, so update these places to make use of FAIL instead. And last but not least adjust the final summary just to report completion, with any error count following as reported by the test driver. - test-tgmath2: no update to FAIL calls required, with the name of the file of the failure site additionally included by the new FAIL test failure helper. Also there is no need to track the return status by hand as any call to FAIL will eventually cause the test case to return an unsuccesful exit status regardless of the return status from the test function, via a call to 'adjust_exit_status' made by the test driver. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 1b97a9f23bf605ca608162089c94187573fb2a9e)
* string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)Florian Weimer2024-08-193-25/+47
| | | | | | | | | | | | | | | | | | 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> (cherry picked from commit 25a5eb4010df94b412c67db9e346029de316d06b)
* Define __libc_initial for the static libcFlorian Weimer2024-08-191-0/+3
| | | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit eb0e50e9a1cf80a2ba6f33f990a08ef37a3267fb)
* 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> (cherry picked from commit 7da08862471dfec6fdae731c2a5f351ad485c71f)
* Adjust check-local-headers test for libaudit 4.0Florian Weimer2024-08-131-1/+1
| | | | | | | The new version introduces /usr/include/audit_logging.h and /usr/include/audit-records.h. (cherry picked from commit 91eb62d63887a959e43aafb6fc022a87614dc7c9)
* x32/cet: Support shadow stack during startup for Linux 6.10H.J. Lu2024-08-123-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | Use RXX_LP in RTLD_START_ENABLE_X86_FEATURES. Support shadow stack during startup for Linux 6.10: commit 2883f01ec37dd8668e7222dfdb5980c86fdfe277 Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Mar 15 07:04:33 2024 -0700 x86/shstk: Enable shadow stacks for x32 1. Add shadow stack support to x32 signal. 2. Use the 64-bit map_shadow_stack syscall for x32. 3. Set up shadow stack for x32. Add the map_shadow_stack system call to <fixup-asm-unistd.h> and regenerate arch-syscall.h. Tested on Intel Tiger Lake with CET enabled x32. There are no regressions with CET enabled x86-64. There are no changes in CET enabled x86-64 _dl_start_user. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 8344c1f5514b1b5b1c8c6e48f4b802653bd23b71)
* x86-64: Remove sysdeps/x86_64/x32/dl-machine.hH.J. Lu2024-08-122-87/+16
| | | | | | | | | | | | | | | | | | | | | Remove sysdeps/x86_64/x32/dl-machine.h by folding x32 ARCH_LA_PLTENTER, ARCH_LA_PLTEXIT and RTLD_START into sysdeps/x86_64/dl-machine.h. There are no regressions on x86-64 nor x32. There are no changes in x86-64 _dl_start_user. On x32, _dl_start_user changes are <_dl_start_user>: mov %eax,%r12d + mov %esp,%r13d mov (%rsp),%edx mov %edx,%esi - mov %esp,%r13d and $0xfffffff0,%esp mov 0x0(%rip),%edi # <_dl_start_user+0x14> lea 0x8(%r13,%rdx,4),%ecx Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 652c6cf26927352fc0e37e4e60c6fc98ddf6d3b4)
* 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> (cherry picked from commit c2a474f4617ede7a8bf56b7257acb37dc757b2d1)
* manual/stdio: Further clarify putc, putwc, getc, and getwcArjun Shankar2024-08-061-17/+10
| | | | | | | | | | | | | This is a follow-up to 10de4a47ef3f481592e3c62eb07bcda23e9fde4d that reworded the manual entries for putc and putwc and removed any performance claims. This commit further clarifies these entries and brings getc and getwc in line with the descriptions of putc and putwc, removing any performance claims from them as well. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 942670c81dc8071dd75d6213e771daa5d2084cb6)
* Fix name space violation in fortify wrappers (bug 32052)Andreas Schwab2024-08-065-63/+64
| | | | | | | | Rename the identifier sz to __sz everywhere. Fixes: a643f60c53 ("Make sure that the fortified function conditionals are constant") (cherry picked from commit 39ca997ab378990d5ac1aadbaa52aaf1db6d526f) (redone from scratch because of many conflicts)
* resolv: Fix tst-resolv-short-response for older GCC (bug 32042)Florian Weimer2024-08-011-2/+4
| | | | | | | | Previous GCC versions do not support the C23 change that allows labels on declarations. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit ec119972cb2598c04ec7d4219e20506006836f64)
* Add mremap testsH.J. Lu2024-08-017-0/+221
| | | | | | | | | Add tests for MREMAP_MAYMOVE and MREMAP_FIXED. On Linux, also test MREMAP_DONTUNMAP. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit ff0320bec2810192d453c579623482fab87bfa01)
* mremap: Update manual entryH.J. Lu2024-08-012-7/+36
| | | | | | | | | | | Update mremap manual entry: 1. Change mremap to variadic. 2. Document MREMAP_FIXED and MREMAP_DONTUNMAP. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit cb2dee4eccf46642eef588bee64f9c875c408f1c)
* linux: Update the mremap C implementation [BZ #31968]H.J. Lu2024-08-011-1/+13
| | | | | | | | | | | | | | Update the mremap C implementation to support the optional argument for MREMAP_DONTUNMAP added in Linux 5.7 since it may not always be correct to implement a variadic function as a non-variadic function on all Linux targets. Return MAP_FAILED and set errno to EINVAL for unknown flag bits. This fixes BZ #31968. Note: A test must be added when a new flag bit is introduced. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit 6c40cb0e9f893d49dc7caee580a055de53562206)
* Enhanced test coverage for strncmp, wcsncmpFlorian Weimer2024-08-015-1/+200
| | | | | | | | | | | | Add string/test-strncmp-nonarray and wcsmbs/test-wcsncmp-nonarray. This is the test that uncovered bug 31934. Test run time is more than one minute on a fairly current system, so turn these into xtests that do not run automatically. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 54252394c25ddf0062e288d4a6ab7a885f8ae009)
* Enhance test coverage for strnlen, wcsnlenFlorian Weimer2024-08-015-0/+144
| | | | | | | | This commit adds string/test-strnlen-nonarray and wcsmbs/test-wcsnlen-nonarray. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 783d4c0b81889c39a9ddf13b60d0fde4040fb1c0)
* manual: make setrlimit() description less ambiguousLukas Bulwahn2024-07-291-2/+2
| | | | | | | | | | | | The existing description for setrlimit() has some ambiguity. It could be understood to have the semantics of getrlimit(), i.e., the limits from the process are stored in the provided rlp pointer. Make the description more explicit that rlp are the input values, and that the limits of the process is changed with this function. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit aedbf08891069fc029ed021e4dba933eb877b394)
* manual/stdio: Clarify putc and putwcArjun Shankar2024-07-291-6/+6
| | | | | | | | | | | | | | | | The manual entry for `putc' described what "most systems" do instead of describing the glibc implementation and its guarantees. This commit fixes that by warning that putc may be implemented as a macro that double-evaluates `stream', and removing the performance claim. Even though the current `putc' implementation does not double-evaluate `stream', offering this obscure guarantee as an extension to what POSIX allows does not seem very useful. The entry for `putwc' is also edited to bring it in line with `putc'. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 10de4a47ef3f481592e3c62eb07bcda23e9fde4d)
* malloc: add multi-threaded tests for aligned_alloc/calloc/mallocMiguel Martín2024-07-293-0/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve aligned_alloc/calloc/malloc test coverage by adding multi-threaded tests with random memory allocations and with/without cross-thread memory deallocations. Perform a number of memory allocation calls with random sizes limited to 0xffff. Use the existing DSO ('malloc/tst-aligned_alloc-lib.c') to randomize allocator selection. The multi-threaded allocation/deallocation is staged as described below: - Stage 1: Half of the threads will be allocating memory and the other half will be waiting for them to finish the allocation. - Stage 2: Half of the threads will be allocating memory and the other half will be deallocating memory. - Stage 3: Half of the threads will be deallocating memory and the second half waiting on them to finish. Add 'malloc/tst-aligned-alloc-random-thread.c' where each thread will deallocate only the memory that was previously allocated by itself. Add 'malloc/tst-aligned-alloc-random-thread-cross.c' where each thread will deallocate memory that was previously allocated by another thread. The intention is to be able to utilize existing malloc testing to ensure that similar allocation APIs are also exposed to the same rigors. Reviewed-by: Arjun Shankar <arjun@redhat.com> (cherry picked from commit b0fbcb7d0051a68baf26b2aed51a8a31c34d68e5)
* malloc: avoid global locks in tst-aligned_alloc-lib.cMiguel Martín2024-07-291-19/+20
| | | | | | | | Make sure the DSO used by aligned_alloc/calloc/malloc tests does not get a global lock on multithreaded tests. Reviewed-by: Arjun Shankar <arjun@redhat.com> (cherry picked from commit 9a27b566b2048f599048f2f4afe1cce06c4ef43d)
* resolv: Track single-request fallback via _res._flags (bug 31476)Florian Weimer2024-07-243-5/+10
| | | | | | | | This avoids changing _res.options, which inteferes with change detection as part of automatic reloading of /etc/resolv.conf. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 868ab8923a2ec977faafec97ecafac0c3159c1b2)
* resolv: Do not wait for non-existing second DNS response after error (bug 30081)Florian Weimer2024-07-245-1/+150
| | | | | | | | | In single-request mode, there is no second response after an error because the second query has not been sent yet. Waiting for it introduces an unnecessary timeout. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit af625987d619388a100b153520d3ee308bda9889)
* resolv: Allow short error responses to match any query (bug 31890)Florian Weimer2024-07-244-10/+135
| | | | | Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 691a3b2e9bfaba842e46a5ccb7f5e6ea144c3ade)
* elf: Fix localplt.awk for DT_RELR-enabled builds (BZ 31978)Adhemerval Zanella2024-07-231-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each input readelf output, localplt.awk parses each 'Relocation section' entry, checks its offset against the dynamic section entry, and saves each DT_JMPREL, DT_RELA, and DT_REL offset value it finds. After all lines are read, the script checks if any segment offset differed from 0, meaning at least one 'Relocation section' was matched. However, if the shared object was built with RELR support and the static linker could place all the relocation on DT_RELR, there would be no DT_JMPREL, DT_RELA, and DT_REL entries; only a DT_RELR. For the current three ABIs that support (aarch64, x86, and powerpc64), the powerpc64 ld.so shows the behavior above. Both x86_64 and aarch64 show extra relocations on '.rela.dyn', which makes the script check to succeed. This patch fixes by handling DT_RELR, where the offset is checked against the dynamic section entries and if the shared object contains an entry it means that there are no extra PLT entries (since all relocations are relative). It fixes the elf/check-localplt failure on powerpc. Checked with a build/check for aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabihf, s390x-linux-gnu, powerpc-linux-gnu, powerpc64-linux-gnu, and powerpc64le-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit 4f047d9edecb1a9b796a9a904dcd42bd3cc3d3b6)
* Fix usage of _STACK_GROWS_DOWN and _STACK_GROWS_UP defines [BZ 31989]John David Anglin2024-07-193-4/+4
| | | | | | Signed-off-by: John David Anglin <dave.anglin@bell.net> Reviewed-By: Andreas K. Hüttel <dilfridge@gentoo.org> (cherry picked from commit 8cfa4ecff21adf226984f135aa576dd8063bbba3)
* Linux: Make __rseq_size useful for feature detection (bug 31965)Florian Weimer2024-07-165-12/+43
| | | | | | | | | | | | The __rseq_size value is now the active area of struct rseq (so 20 initially), not the full struct size including padding at the end (32 initially). Update misc/tst-rseq to print some additional diagnostics. Reviewed-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> (cherry picked from commit 2e456ccf0c34a056e3ccafac4a0c7effef14d918)
* elf: Make dl-rseq-symbols Linux onlyAdhemerval Zanella2024-07-163-1/+4
| | | | | | | | And avoid a Hurd build failures. Checked on x86_64-linux-gnu. (cherry picked from commit 9fc639f654dc004736836613be703e6bed0c36a8)
* nptl: fix potential merge of __rseq_* relro symbolsMichael Jeanson2024-07-163-8/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | While working on a patch to add support for the extensible rseq ABI, we came across an issue where a new 'const' variable would be merged with the existing '__rseq_size' variable. We tracked this to the use of '-fmerge-all-constants' which allows the compiler to merge identical constant variables. This means that all 'const' variables in a compile unit that are of the same size and are initialized to the same value can be merged. In this specific case, on 32 bit systems 'unsigned int' and 'ptrdiff_t' are both 4 bytes and initialized to 0 which should trigger the merge. However for reasons we haven't delved into when the attribute 'section (".data.rel.ro")' is added to the mix, only variables of the same exact types are merged. As far as we know this behavior is not specified anywhere and could change with a new compiler version, hence this patch. Move the definitions of these variables into an assembler file and add hidden writable aliases for internal use. This has the added bonus of removing the asm workaround to set the values on rseq registration. Tested on Debian 12 with GCC 12.2. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 2b92982e2369d292560793bee8e730f695f48ff3)
* s390x: Fix segfault in wcsncmp [BZ #31934]Stefan Liebler2024-07-161-9/+1
| | | | | | | | | | | | | | | | | | | | | The z13/vector-optimized wcsncmp implementation segfaults if n=1 and there is only one character (equal on both strings) before the page end. Then it loads and compares one character and misses to check n again. The following load fails. This patch removes the extra load and compare of the first character and just start with the loop which uses vector-load-to-block-boundary. This code-path also checks n. With this patch both tests are passing: - the simplified one mentioned in the bugzilla 31934 - the full one in Florian Weimer's patch: "manual: Document a GNU extension for strncmp/wcsncmp" (https://patchwork.sourceware.org/project/glibc/patch/874j9eml6y.fsf@oldenburg.str.redhat.com/): On s390x-linux-gnu (z16), the new wcsncmp test fails due to bug 31934. Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit 9b7651410375ec8848a1944992d663d514db4ba7)
* stdlib: fix arc4random fallback to /dev/urandom (BZ 31612)Adhemerval Zanella2024-07-082-1/+3
| | | | | | | | | | | | | | | The __getrandom_nocancel used by __arc4random_buf uses INLINE_SYSCALL_CALL (which returns -1/errno) and the loop checks for the return value instead of errno to fallback to /dev/urandom. The malloc code now uses __getrandom_nocancel_nostatus, which uses INTERNAL_SYSCALL_CALL, so there is no need to use the variant that does not set errno (BZ#29624). Checked on x86_64-linux-gnu. Reviewed-by: Xi Ruoyao <xry111@xry111.site> (cherry picked from commit 184b9e530e6326e668709826903b6d30dc6cac3f)
* math: Provide missing math symbols on libc.a (BZ 31781)Adhemerval Zanella2024-07-023-6/+6
| | | | | | | | | | | The libc.a for alpha, s390, and sparcv9 does not provide copysignf64x, copysignf128, frexpf64x, frexpf128, modff64x, and modff128. Checked with a static build for the affected ABIs. Reviewed-by: H.J. Lu <hjl.tools@gmail.com> (cherry picked from commit eaa8113bf0eb599025e3efdbe1bb214ee8dc645a)
* math: Fix isnanf128 static build (BZ 31774)Adhemerval Zanella2024-07-021-0/+4
| | | | | | | | | | Some static implementation of float128 routines might call __isnanf128, which is not provided by the static object. Checked on x86_64-linux-gnu. Reviewed-by: H.J. Lu <hjl.tools@gmail.com> (cherry picked from commit 5d4999e519ec77e75bef920e2540e8605015680a)
* math: Fix i386 and m68k exp10 on static build (BZ 31775)Adhemerval Zanella2024-07-022-4/+14
| | | | | | | | | | | | The commit 08ddd26814 removed the static exp10 on i386 and m68k with an empty w_exp10.c (required for the ABIs that uses the newly implementation). This patch fixes by adding the required symbols on the arch-specific w_exp{f}_compat.c implementation. Checked on i686-linux-gnu and with a build for m68k-linux-gnu. Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit 1f09aae36aa185b8b1100dfa6b776442279bf580)
* math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)Adhemerval Zanella2024-07-025-13/+17
| | | | | | | | | | | | | | | | The commit 16439f419b removed the static fmod/fmodf on i386 and m68k with and empty w_fmod.c (required for the ABIs that uses the newly implementation). This patch fixes by adding the required symbols on the arch-specific w_fmod{f}_compat.c implementation. To statically build fmod fails on some ABI (alpha, s390, sparc) because it does not export the ldexpf128, this is also fixed by this patch. Checked on i686-linux-gnu and with a build for m68k-linux-gnu. Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Tested-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit 0b716305dfb48c2d13ed4f7d06c082b90c1d226f)
* posix: Fix pidfd_spawn/pidfd_spawnp leak if execve fails (BZ 31695)Adhemerval Zanella2024-06-253-39/+65
| | | | | | | | | | | | | | | | | | | If the pidfd_spawn/pidfd_spawnp helper process succeeds, but evecve fails for some reason (either with an invalid/non-existent, memory allocation, etc.) the resulting pidfd is never closed, nor returned to caller (so it can call close). Since the process creation failed, it should be up to posix_spawn to also, close the file descriptor in this case (similar to what it does to reap the process). This patch also changes the waitpid with waitid (P_PIDFD) for pidfd case, to avoid a possible pid re-use. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit c90cfce849d010474e8cccf3e5bff49a2c8b141f)
* Linux: Include <dl-symbol-redir-ifunc.h> in dl-sysdep.cFlorian Weimer2024-06-211-0/+1
| | | | | | | | | | | | The _dl_sysdep_parse_arguments function contains initalization of a large on-stack variable: dl_parse_auxv_t auxv_values = { 0, }; This uses a non-inline version of memset on powerpc64le-linux-gnu, so it must use the baseline memset. (cherry picked from commit f6ea5d1291cf3f264514d03872ebae84e0293b69)
* NEWS: update list of fixed CVEs in 2.39Andreas K. Hüttel2024-06-151-0/+20
| | | | Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* NEWS: update list of fixed bugs in 2.39Andreas K. Hüttel2024-06-151-0/+50
| | | | Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86: Properly set x86 minimum ISA level [BZ #31883]H.J. Lu2024-06-153-3/+17
| | | | | | | | | | | | | | | | | | | | | | | Properly set libc_cv_have_x86_isa_level in shell for MINIMUM_X86_ISA_LEVEL defined as (__X86_ISA_V1 + __X86_ISA_V2 + __X86_ISA_V3 + __X86_ISA_V4) Also set __X86_ISA_V2 to 1 for i386 if __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 is defined. There are no changes in config.h nor in config.make on x86-64. On i386, -march=x86-64-v2 with GCC generates #define MINIMUM_X86_ISA_LEVEL 2 in config.h and have-x86-isa-level = 2 in config.make. This fixes BZ #31883. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 29807a271edca3e47195bda0c69ae45e245551a9)
* x86: Properly set MINIMUM_X86_ISA_LEVEL for i386 [BZ #31867]H.J. Lu2024-06-152-4/+12
| | | | | | | | | | | | On i386, set the default minimum ISA level to 0, not 1 (baseline which includes SSE2). There are no changes in config.h nor in config.make on x86-64. This fixes BZ #31867. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Tested-by: Ian Jordan <immoloism@gmail.com> Reviewed-by: Sam James <sam@gentoo.org> Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 09bc68b0ac26331a0109f0578c9368e09176da18)
* localedata: ssy_ER: Fix syntax errorMike FABIAN2024-06-141-1/+1
| | | | (cherry picked from commit 07fd072caff50bca2a7e9f5737a5b38280d2ffda)
* malloc: New test to check malloc alternate path using memory obstructionsayan paul2024-06-102-0/+73
| | | | | | | | | | | | | The test aims to ensure that malloc uses the alternate path to allocate memory when sbrk() or brk() fails.To achieve this, the test first creates an obstruction at current program break, tests that obstruction with a failing sbrk(), then checks if malloc is still returning a valid ptr thus inferring that malloc() used mmap() instead of brk() or sbrk() to allocate the memory. Reviewed-by: Arjun Shankar <arjun@redhat.com> Reviewed-by: Zack Weinberg <zack@owlfolio.org> (cherry picked from commit 127fc56152347d73cb7c1c283e60e1cb1f15e9f9)
* malloc: Improve aligned_alloc and calloc test coverage.Joe Simmons-Talbott2024-06-105-0/+151
| | | | | | | | | | | | | | | | Add a DSO (malloc/tst-aligned_alloc-lib.so) that can be used during testing to interpose malloc with a call that randomly uses either aligned_alloc, __libc_malloc, or __libc_calloc in the place of malloc. Use LD_PRELOAD with the DSO to mirror malloc/tst-malloc.c testing as an example in malloc/tst-malloc-random.c. Add malloc/tst-aligned-alloc-random.c as another example that does a number of malloc calls with randomly sized, but limited to 0xffff, requests. The intention is to be able to utilize existing malloc testing to ensure that similar allocation APIs are also exposed to the same rigors. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 3395157ff2b0657d70c36169156f67440205c8bf)
* malloc/Makefile: Split and sort testsH.J. Lu2024-06-101-64/+102
| | | | | | | | Put each test on a separate line and sort tests. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit d49cd6a1913da9744b9a0ffbefb3f7958322382e)