aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
23 hoursmalloc: move tcache_init out of hot tcache pathsHEADmasterCupertino 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.
41 hoursaarch64: 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>
41 hoursaarch64: 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>
2 daysmalloc: 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>
2 daysmalloc: 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>
2 daysmalloc: 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>
2 daysmalloc: 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>
3 daysmalloc: 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>
3 daysmalloc: 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>
3 daysmanual/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>
3 daysFix 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>
3 daysFix 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>
3 daysFix 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>
3 daysmanual: 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>
3 daysmanual: 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>
3 dayslibio: 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>
3 dayslibio: 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>
5 daysx86: 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>
6 daysx86: 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>
7 daysconform: 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>
7 daysx86: 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>
7 daystimezone: 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>
7 dayspowerpc: 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>
8 daysmath: 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>
9 dayself: 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>
9 daysstdlib: 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>
9 daysstdio-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").
10 daysRemove 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).
12 daysx86: 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>
12 daysNEWS: 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>
2025-03-31Raise the minimum GCC version to 12.1 [BZ #32539]H.J. Lu8-217/+9
For all Linux distros with glibc 2.40 which I can find, GCC 14.2 is used to compile glibc 2.40: OS GCC URL AOSC 14.2.0 https://aosc.io/ Arch Linux 14.2.0 https://archlinux.org/ ArchPOWER 14.2.0 https://archlinuxpower.org/ Artix 14.2.0 https://artixlinux.org/ Debian 14.2.0 https://www.debian.org/ Devuan 14.2.0 https://www.devuan.org/ Exherbo 14.2.0 https://www.exherbolinux.org/ Fedora 14.2.1 https://fedoraproject.org/ Gentoo 14.2.1 https://gentoo.org/ Kali Linux 14.2.0 https://www.kali.org/ KaOS 14.2.0 https://kaosx.us/ LiGurOS 14.2.0 https://liguros.gitlab.io/ Mageia 14.2.0 https://www.mageia.org/en/ Manjaro 14.2.0 https://manjaro.org/ NixOS 14.2.0 https://nixos.org/ openmamba 14.2.0 https://openmamba.org/ OpenMandriva 14.2.0 https://openmandriva.org/ openSUSE 14.2.0 https://www.opensuse.org/ Parabola 14.2.0 https://www.parabola.nu/ PLD Linux 14.2.0 https://pld-linux.org/ PureOS 14.2.0 https://pureos.net/ Raspbian 14.2.0 http://raspbian.org/ Slackware 14.2.0 http://www.slackware.com/ Solus 14.2.0 https://getsol.us/ T2 SDE 14.2.0 http://t2sde.org/ Ubuntu 14.2.0 https://www.ubuntu.com/ Wikidata 14.2.0 https://wikidata.org/ Support older versions of GCC to build glibc 2.42: 1. Need to work around bugs in older versions of GCC. 2. Can't use the new features in newer versions of GCC, which may be required for new features, like _Float16 which requires GCC 12.1 or above, in glibc, The main benefit of supporting older versions of GCC is easier backport of bug fixes to the older releases of glibc, which can be mitigated by avoiding incompatible features in newer versions of GCC for critical bug fixes. Require GCC 12.1 or newer to build. Remove GCC version check for PowerPC and s390x. TEST_CC and TEST_CXX can be used to test the glibc build with the older versions of GCC. For glibc developers who are using Linux OSes which don't come with GCC 12.1 or newer, they should build and install GCC 12.1 or newer to work on glibc. This fixes BZ #32539. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-03-31Fix typo in commentYLK2-2/+2
2025-03-31manual: tidy the longopt.c exampleSamuel Zeter1-5/+5
- Change longopt.c's backticks to single quotes - puts() does not use format specifiers Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-31manual: Document functions adopted by POSIX.1-2024.Collin Funk10-85/+116
Here is a patch updating the documentation to mention GNU and BSD extensions that were adopted by POSIX.1-2024. * manual/llio.texi (Memory-mapped I/O): Add that MAP_ANON and MAP_ANONYMOUS were added by POSIX.1-2024. * manual/memory.texi (Changing Block Size): Mention that reallocarray was added by POSIX.1-2024. * manual/message.texi (Message Translation): Adjust wording to match standardization. (Translation with gettext): Mention the gettext family of functions were added by POSIX.1-2024. * manual/pattern.texi (Wildcard Matching): Mention that FNM_CASEFOLD was added by POSIX.1-2024. * manual/process.texi (Creating a Process): Mention that _Fork and WCOREDUMP were added by POSIX.1-2024. * manual/signal.texi (Miscellaneous Signals): Mention that SIGWINCH was added by POSIX-1.2024. * manual/startup.texi (Environment Access): Mention that secure_getenv was added by POSIX.1-2024. * manual/string.texi (Truncating Strings): Mention that strlcpy, strlcat, wcslcpy, and wslcat were added by POSIX-1.2024. (Search Functions): Document that memmem was added by POSIX-1.2024. * manual/terminal.texi (Allocation): Mention that ptsname_r was added by POSIX-1.2024. * manual/threads.texi (Waiting with Explicit Clocks): Move node under POSIX Threads. Mention pthread_cond_clockwait, pthread_rwlock_clockrdlock, and pthread_rwlock_clockwrlock were added by POSIX-1.2024. (Joining Threads): New node under Non-POSIX Extensions. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2025-03-31aarch64: Fix _dl_tlsdesc_dynamic unwind for pac-ret (BZ 32612)Adhemerval Zanella4-12/+100
When libgcc is built with pac-ret, it requires to autenticate the unwinding frame based on CFI information. The _dl_tlsdesc_dynamic uses a custom calling convention, where it is responsible to save and restore all registers it might use (even volatile). The pac-ret support added by 1be3d6eb823d8b952fa54b7bbc90cbecb8981380 was added only on the slow-path, but the fast path also adds DWARF Register Rule Instruction (cfi_adjust_cfa_offset) since it requires to save/restore some auxiliary register. It seems that this is not fully supported neither by libgcc nor AArch64 ABI [1]. Instead, move paciasp/autiasp to function prologue/epilogue to be used on both fast and slow paths. I also corrected the _dl_tlsdesc_dynamic comment description, it was copied from i386 implementation without any adjustment. Checked on aarch64-linux-gnu with a toolchain built with --enable-standard-branch-protection on a system with pac-ret support. [1] https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#id1 Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2025-03-29x86: Use separate variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)Florian Weimer9-8/+40
Previously, the initialization code reused the xsave_state_full_size member of struct cpu_features for the TLSDESC state size. However, the tunable processing code assumes that this member has the original XSAVE (non-compact) state size, so that it can use its value if XSAVEC is disabled via tunable. This change uses a separate variable and not a struct member because the value is only needed in ld.so and the static libc, but not in libc.so. As a result, struct cpu_features layout does not change, helping a future backport of this change. Fixes commit 9b7091415af47082664717210ac49d51551456ab ("x86-64: Update _dl_tlsdesc_dynamic to preserve AMX registers"). Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-29x86: Skip XSAVE state size reset if ISA level requires XSAVEFlorian Weimer1-0/+5
If we have to use XSAVE or XSAVEC trampolines, do not adjust the size information they need. Technically, it is an operator error to try to run with -XSAVE,-XSAVEC on such builds, but this change here disables some unnecessary code with higher ISA levels and simplifies testing. Related to commit befe2d3c4dec8be2cdd01a47132e47bdb7020922 ("x86-64: Don't use SSE resolvers for ISA level 3 or above"). Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-28malloc: Improve performance of __libc_mallocWilco Dijkstra1-13/+20
Improve performance of __libc_malloc by splitting it into 2 parts: first handle the tcache fastpath, then do the rest in a separate tailcalled function. This results in significant performance gains since __libc_malloc doesn't need to setup a frame and we delay tcache initialization and setting of errno until later. On Neoverse V2, bench-malloc-simple improves by 6.7% overall (up to 8.5% for ST case) and bench-malloc-thread improves by 20.3% for 1 thread and 14.4% for 32 threads. Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-28stdio-common: Reject real data w/o exponent digits in scanf [BZ #12701]Maciej W. Rozycki38-2335/+2338
Reject invalid formatted scanf real input data the exponent part of which is comprised of an exponent introducing character, optionally followed by a sign, and with no actual digits following. Such data is a prefix of, but not a matching input sequence and it is required by ISO C to cause a matching failure. Currently a matching success is instead incorrectly produced along with the conversion result according to the input significand read and the exponent of zero, with the significand and the exponent part wholly consumed from input. Correct an invalid `tstscanf.c' test accordingly that expects a matching success for input data provided in the ISO C standard as an example for a matching failure. Enable input data that causes test failures without this fix in place. Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28stdio-common: Reject significand prefixes in scanf [BZ #12701]Maciej W. Rozycki13-505/+510
Reject invalid formatted scanf real input data that is comprised of a hexadecimal prefix, optionally preceded by a sign, and with no actual digits following owing to the field width restriction in effect. Such data is a prefix of, but not a matching input sequence and it is required by ISO C to cause a matching failure. Currently a matching success is instead incorrectly produced along with the conversion result of zero, with the prefix wholly consumed from input. Where the end of input is marked by the end-of-file condition rather than the field width restriction in effect a matching failure is already correctly produced. Enable input data that causes test failures without this fix in place. Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28stdio-common: Reject integer prefixes in scanf [BZ #12701]Maciej W. Rozycki29-1897/+1907
Reject invalid formatted scanf integer input data that is comprised of a binary or hexadecimal prefix, optionally preceded by a sign, and with no actual digits following. Such data is a prefix of, but not a matching input sequence and it is required by ISO C to cause a matching failure. Currently a matching success is instead incorrectly produced along with the conversion result of zero, with the prefix wholly consumed from input. Enable input data that causes test failures without this fix in place. Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-28stdio-common: Also reject exp char w/o significand in i18n scanf [BZ #13988]Maciej W. Rozycki3-3/+63
Fix the handling of real 'scanf' input such as "+.e" as per BZ #13988 for the i18n case as well, complementing commit 6ecec3b616ae ("Don't accept exp char without preceding digits in scanf float parsing"), where the 'e' character is incorrectly consumed from input. Add a test case matching stdio-common/bug26.c, with bits from localedata/tst-sscanf.c. Reviewed-by: Joseph Myers <josmyers@redhat.com>