aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
6 dayself: Change ldconfig auxcache magic number (bug 32231)release/2.40/masterFlorian Weimer2-1/+2
In commit c628c2296392ed3bf2cb8d8470668e64fe53389f (elf: Remove ldconfig kernel version check), the layout of auxcache entries changed because the osversion field was removed from struct aux_cache_file_entry. However, AUX_CACHEMAGIC was not changed, so existing files are still used, potentially leading to unintended ldconfig behavior. This commit changes AUX_CACHEMAGIC, so that the file is regenerated. Reported-by: DJ Delorie <dj@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit 0a536f6e2f76e3ef581b3fd9af1e5cf4ddc7a5a2)
2024-10-18Make tst-strtod-underflow type-genericJoseph Myers1-60/+297
The test tst-strtod-underflow covers various edge cases close to the underflow threshold for strtod (especially cases where underflow on architectures with after-rounding tininess detection depends on the rounding mode). Make it use the type-generic machinery, with corresponding test inputs for each supported floating-point format, so that other functions in the strtod family are tested for underflow edge cases as well. Tested for x86_64. (cherry picked from commit 94ca2c0894f0e1b62625c369cc598a2b9236622c)
2024-10-01libio: Set _vtable_offset before calling _IO_link_in [BZ #32148]H.J. Lu3-1/+95
Since _IO_vtable_offset is used to detect the old binaries, set it in _IO_old_file_init_internal before calling _IO_link_in which checks _IO_vtable_offset. Add a glibc 2.0 test with copy relocation on _IO_stderr_@GLIBC_2.0 to verify that fopen won't cause memory corruption. This fixes BZ #32148. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 9dfea3de7f690bff70e3c6eb346b9ad082bb2e35)
2024-09-27Add tests of more strtod special casesJoseph Myers1-0/+14
There is very little test coverage of inputs to strtod-family functions that don't contain anything that can be parsed as a number (one test of ".y" in tst-strtod2), and none that I can see of skipping initial whitespace. Add some tests of these things to tst-strtod2. Tested for x86_64. (cherry picked from commit 378039ca578c2ea93095a1e710d96f58c68a3997)
2024-09-27Add more tests of strtod end pointerJoseph Myers1-2/+39
Although there are some tests in tst-strtod2 and tst-strtod3 for the end pointer provided by strtod when it doesn't parse the whole string, they aren't very thorough. Add tests of more such cases to tst-strtod2. Tested for x86_64. (cherry picked from commit b5d3737b305525315e0c7c93ca49eadc868eabd5)
2024-09-27Make tst-strtod2 and tst-strtod5 type-genericJoseph Myers2-82/+118
Some of the strtod tests use type-generic machinery in tst-strtod.h to test the strto* functions for all floating types, while others only test double even when the tests are in fact meaningful for all floating types. Convert tst-strtod2 and tst-strtod5 to use the type-generic machinery so they test all floating types. I haven't tried to convert them to use newer test interfaces in other ways, just made the changes necessary to use the type-generic machinery. Tested for x86_64. (cherry picked from commit 8de031bcb9adfa736c0caed2c79d10947b8d8f48)
2024-09-27powerpc64le: Build new strtod tests with long double ABI flags (bug 32145)Florian Weimer1-0/+4
This fixes several test failures: =====FAIL: stdlib/tst-strtod1i.out===== Locale tests all OK Locale tests all OK Locale tests strtold("1,5") returns -6,38643e+367 and not 1,5 strtold("1.5") returns 1,5 and not 1 strtold("1.500") returns 1 and not 1500 strtold("36.893.488.147.419.103.232") returns 1500 and not 3,68935e+19 Locale tests all OK =====FAIL: stdlib/tst-strtod3.out===== 0: got wrong results -2.5937e+4826, expected 0 =====FAIL: stdlib/tst-strtod4.out===== 0: got wrong results -6,38643e+367, expected 0 1: got wrong results 0, expected 1e+06 2: got wrong results 1e+06, expected 10 =====FAIL: stdlib/tst-strtod5i.out===== 0: got wrong results -6,38643e+367, expected 0 2: got wrong results 0, expected -0 4: got wrong results -0, expected 0 5: got wrong results 0, expected -0 6: got wrong results -0, expected 0 7: got wrong results 0, expected -0 8: got wrong results -0, expected 0 9: got wrong results 0, expected -0 10: got wrong results -0, expected 0 11: got wrong results 0, expected -0 12: got wrong results -0, expected 0 13: got wrong results 0, expected -0 14: got wrong results -0, expected 0 15: got wrong results 0, expected -0 16: got wrong results -0, expected 0 17: got wrong results 0, expected -0 18: got wrong results -0, expected 0 20: got wrong results 0, expected -0 22: got wrong results -0, expected 0 23: got wrong results 0, expected -0 24: got wrong results -0, expected 0 25: got wrong results 0, expected -0 26: got wrong results -0, expected 0 27: got wrong results 0, expected -0 Fixes commit 3fc063dee01da4f80920a14b7db637c8501d6fd4 ("Make __strtod_internal tests type-generic"). Suggested-by: Joseph Myers <josmyers@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit cc3e743fc09ee6fca45767629df9cbcbe1feba82)
2024-09-27Do not set errno for overflowing NaN payload in strtod/nan (bug 32045)Joseph Myers3-0/+57
As reported in bug 32045, it's incorrect for strtod/nan functions to set errno based on overflowing payload (strtod should only set errno for overflow / underflow of its actual result, and potentially if nothing in the string can be parsed as a number at all; nan should be a pure function that never sets it). Save and restore errno around the internal strtoull call and add associated test coverage. Tested for x86_64. (cherry picked from commit 64f62c47e9c350f353336f2df6714e1d48ec50d8)
2024-09-27Improve NaN payload testingJoseph Myers1-5/+54
There are two separate sets of tests of NaN payloads in glibc: * libm-test-{get,set}payload* verify that getpayload, setpayload, setpayloadsig and __builtin_nan functions are consistent in their payload handling. * test-nan-payload verifies that strtod-family functions and the not-built-in nan functions are consistent in their payload handling. Nothing, however, connects the two sets of functions (i.e., verifies that strtod / nan are consistent with getpayload / setpayload / __builtin_nan). Improve test-nan-payload to check actual payload value with getpayload rather than just verifying that the strtod and nan functions produce the same NaN. Also check that the NaNs produced aren't signaling and extend the tests to cover _FloatN / _FloatNx. Tested for x86_64. (cherry picked from commit be77d5ae417236883c02d3d67c0716e3f669fa41)
2024-09-27Make __strtod_internal tests type-genericJoseph Myers4-180/+313
Some of the strtod tests use type-generic machinery in tst-strtod.h to test the strto* functions for all floating types, while others only test double even when the tests are in fact meaningful for all floating types. Convert the tests of the internal __strtod_internal interface to cover all floating types. I haven't tried to convert them to use newer test interfaces in other ways, just made the changes necessary to use the type-generic machinery. As an internal interface, there are no aliases for different types with the same ABI (however, __strtold_internal is defined even if long double has the same ABI as double), so macros used by the type-generic testing code are redefined as needed to avoid expecting such aliases to be present. Tested for x86_64. (cherry picked from commit 3fc063dee01da4f80920a14b7db637c8501d6fd4)
2024-09-27Fix strtod subnormal rounding (bug 30220)Joseph Myers3-0/+386
As reported in bug 30220, the implementation of strtod-family functions has a bug in the following case: the input string would, with infinite exponent range, take one more bit to represent than is available in the normal precision of the return type; the value represented is in the subnormal range; and there are no nonzero bits in the value, below those that can be represented in subnormal precision, other than the least significant bit and possibly the 0.5ulp bit. In this case, round_and_return ends up discarding the least significant bit. Fix by saving that bit to merge into more_bits (it can't be merged in at the time it's computed, because more_bits mustn't include this bit in the case of after-rounding tininess detection checking if the result is still subnormal when rounded to normal precision, so merging this bit into more_bits needs to take place after that check). Tested for x86_64. (cherry picked from commit 457622c2fa8f9f7435822d5287a437bc8be8090d)
2024-09-27More thoroughly test underflow / errno in tst-strtod-roundJoseph Myers3-7761/+7857
Add tests of underflow in tst-strtod-round, and thus also test for errno being unchanged when there is neither overflow nor underflow. The errno setting before the function call to test for being unchanged is adjusted to set errno to 12345 instead of 0, so that any bugs where strtod sets errno to 0 would be detected. This doesn't add any new test inputs for tst-strtod-round, and in particular doesn't cover the edge cases of underflow the way tst-strtod-underflow does (none of the existing test inputs for tst-strtod-round actually exercise cases that have underflow with before-rounding tininess detection but not with after-rounding tininess detection), but at least it provides some coverage (as per the recent discussions) that ordinary non-overflowing non-underflowing inputs to these functions do not set errno. Tested for x86_64. (cherry picked from commit d73ed2601b7c3c93c3529149a3d7f7b6177900a8)
2024-09-27Test errno setting on strtod overflow in tst-strtod-roundJoseph Myers1-0/+11
We have no tests that errno is set to ERANGE on overflow of strtod-family functions (we do have some tests for underflow, in tst-strtod-underflow). Add such tests to tst-strtod-round. Tested for x86_64. (cherry picked from commit 207d64feb26279e152c50744e3c37e68491aca99)
2024-09-26Add tests of freadJoseph Myers2-0/+135
There seem to be no glibc tests specifically for the fread function. Add basic tests of that function. Tested for x86_64. (cherry picked from commit d14c977c65aac7db35bb59380ef99d6582c4f930)
2024-09-26stdio-common: Add new test for fdopenSergey Kolosov2-0/+247
This commit adds fdopen test with all modes. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 1d72fa3cfa046f7293421a7e58f2a272474ea901)
2024-09-11libio: Attempt wide backup free only for non-legacy codeSiddhesh Poyarekar2-1/+3
_wide_data and _mode are not available in legacy code, so do not attempt to free the wide backup buffer in legacy code. Resolves: BZ #32137 and BZ #27821 Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit ae4d44b1d501421ad9a3af95279b8f4d1546f1ce)
2024-09-10debug: Fix read error handling in pcprofiledumpFlorian Weimer1-36/+47
The reading loops did not check for read failures. Addresses a static analysis report. Manually tested by compiling a program with the GCC's -finstrument-functions option, running it with “LD_PRELOAD=debug/libpcprofile.so PCPROFILE_OUTPUT=output-file”, and reviewing the output of “debug/pcprofiledump output-file”. (cherry picked from commit 89b088bf70c651c231bf27e644270d093b8f144a)
2024-09-09elf: Fix tst-dlopen-tlsreinit1.out test dependencyFlorian Weimer1-1/+1
Fixes commit 5097cd344fd243fb8deb6dec96e8073753f962f9 ("elf: Avoid re-initializing already allocated TLS in dlopen (bug 31717)"). Reported-by: Patsy Griffin <patsy@redhat.com> Reviewed-by: Patsy Griffin <patsy@redhat.com> (cherry picked from commit e82a7cb1622bff08d8e3a144d7c5516a088f1cbc)
2024-09-09elf: Avoid re-initializing already allocated TLS in dlopen (bug 31717)Florian Weimer13-45/+310
The old code used l_init_called as an indicator for whether TLS initialization was complete. However, it is possible that TLS for an object is initialized, written to, and then dlopen for this object is called again, and l_init_called is not true at this point. Previously, this resulted in TLS being initialized twice, discarding any interim writes (technically introducing a use-after-free bug even). This commit introduces an explicit per-object flag, l_tls_in_slotinfo. It indicates whether _dl_add_to_slotinfo has been called for this object. This flag is used to avoid double-initialization of TLS. In update_tls_slotinfo, the first_static_tls micro-optimization is removed because preserving the initalization flag for subsequent use by the second loop for static TLS is a bit complicated, and another per-object flag does not seem to be worth it. Furthermore, the l_init_called flag is dropped from the second loop (for static TLS initialization) because l_need_tls_init on its own prevents double-initialization. The remaining l_init_called usage in resize_scopes and update_scopes is just an optimization due to the use of scope_has_map, so it is not changed in this commit. The isupper check ensures that libc.so.6 is TLS is not reverted. Such a revert happens if l_need_tls_init is not cleared in _dl_allocate_tls_init for the main_thread case, now that l_init_called is not checked anymore in update_tls_slotinfo in elf/dl-open.c. Reported-by: Jonathon Anderson <janderson@rice.edu> Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit 5097cd344fd243fb8deb6dec96e8073753f962f9)
2024-09-09elf: Clarify and invert second argument of _dl_allocate_tls_initFlorian Weimer4-9/+12
Also remove an outdated comment: _dl_allocate_tls_init is called as part of pthread_create. Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit fe06fb313bddf7e4530056897d4a706606e49377)
2024-08-30nptl: Use <support/check.h> facilities in tst-setuid3Maciej W. Rozycki1-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)
2024-08-30posix: Use <support/check.h> facilities in tst-truncate and tst-truncate64Maciej W. Rozycki1-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)
2024-08-28ungetc: Fix backup buffer leak on program exit [BZ #27821]Siddhesh Poyarekar4-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)
2024-08-28ungetc: Fix uninitialized read when putting into unused streams [BZ #27821]Siddhesh Poyarekar3-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)
2024-08-28Make tst-ungetc use libsupportSiddhesh Poyarekar1-55/+57
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit 3f7df7e757f4efec38e45d4068e5492efcac4856)
2024-08-28stdio-common: Add test for vfscanf with matches longer than INT_MAX [BZ #27650]Maciej W. Rozycki2-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)
2024-08-28support: Add FAIL test failure helperMaciej W. Rozycki4-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)
2024-08-19string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)Florian Weimer3-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)
2024-08-19Define __libc_initial for the static libcFlorian Weimer1-0/+3
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit eb0e50e9a1cf80a2ba6f33f990a08ef37a3267fb)
2024-08-15x86: Fix bug in strchrnul-evex512 [BZ #32078]Noah Goldstein2-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)
2024-08-12x32/cet: Support shadow stack during startup for Linux 6.10H.J. Lu3-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)
2024-08-12x86-64: Remove sysdeps/x86_64/x32/dl-machine.hH.J. Lu2-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)
2024-08-09support: Add options list terminator to the test driverFlorian Weimer1-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)
2024-08-06manual/stdio: Further clarify putc, putwc, getc, and getwcArjun Shankar1-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)
2024-08-06Fix name space violation in fortify wrappers (bug 32052)Andreas Schwab5-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)
2024-08-02x86: Tunables may incorrectly set Prefer_PMINUB_for_stringop (bug 32047)Florian Weimer1-0/+1
Fixes commit 5bcf6265f215326d14dfacdce8532792c2c7f8f8 ("x86: Disable non-temporal memset on Skylake Server"). Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 7a630f7d3392ca391a399486ce2846f9e4b4ee63)
2024-08-01resolv: Fix tst-resolv-short-response for older GCC (bug 32042)Florian Weimer1-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)
2024-08-01Add mremap testsH.J. Lu7-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)
2024-08-01mremap: Update manual entryH.J. Lu2-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)
2024-08-01linux: Update the mremap C implementation [BZ #31968]H.J. Lu2-1/+14
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)
2024-08-01Enhanced test coverage for strncmp, wcsncmpFlorian Weimer5-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)
2024-08-01Enhance test coverage for strnlen, wcsnlenFlorian Weimer5-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)
2024-07-29manual: make setrlimit() description less ambiguousLukas Bulwahn1-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)
2024-07-29manual/stdio: Clarify putc and putwcArjun Shankar1-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)
2024-07-29malloc: add multi-threaded tests for aligned_alloc/calloc/mallocMiguel Martín3-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)
2024-07-29malloc: avoid global locks in tst-aligned_alloc-lib.cMiguel Martín1-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)
2024-07-24Fix version number in NEWS fileFlorian Weimer1-1/+1
2024-07-24manual: Do not mention STATIC_TLS in dynamic linker hardening recommendationsFlorian Weimer1-12/+12
The current toolchain does not consistently generate it, and glibc does not use it. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com> (cherry picked from commit 90842d3980064ef410b998b22170ad409b76b9fd)
2024-07-24resolv: Do not wait for non-existing second DNS response after error (bug 30081)Florian Weimer5-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)
2024-07-24resolv: Allow short error responses to match any query (bug 31890)Florian Weimer4-10/+140
Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 691a3b2e9bfaba842e46a5ccb7f5e6ea144c3ade)