aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
9 daysx86: Include <bits/stdlib-bsearch.h> in dl-cacheinfo.hH.J. Lu1-2/+13
On x86-64, when glibc is configured with --enable-stack-protector=all and compiled with -Os, ld.so crashes very early: (gdb) r --direct Starting program: /export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/string/test-memswap --direct Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7f41b0a in bsearch (__key=__key@entry=0x7fffffffda28, __base=__base@entry=0x7ffff7fca140 <intel_02_known>, __nmemb=__nmemb@entry=68, __size=__size@entry=8, __compar=__compar@entry=0x7ffff7f3b691 <intel_02_known_compare>) at ../bits/stdlib-bsearch.h:22 22 { (gdb) disass Dump of assembler code for function bsearch: 0x00007ffff7f41af0 <+0>: push %r15 0x00007ffff7f41af2 <+2>: mov %rcx,%r15 0x00007ffff7f41af5 <+5>: push %r14 0x00007ffff7f41af7 <+7>: push %r13 0x00007ffff7f41af9 <+9>: mov %rsi,%r13 0x00007ffff7f41afc <+12>: push %r12 0x00007ffff7f41afe <+14>: mov %rdi,%r12 0x00007ffff7f41b01 <+17>: push %rbp 0x00007ffff7f41b02 <+18>: mov %rdx,%rbp 0x00007ffff7f41b05 <+21>: push %rbx 0x00007ffff7f41b06 <+22>: sub $0x18,%rsp => 0x00007ffff7f41b0a <+26>: mov %fs:0x28,%r14 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We can't use stack protector at this point. 0x00007ffff7f41b13 <+35>: mov %r14,0x8(%rsp) 0x00007ffff7f41b18 <+40>: mov %r8,%r14 0x00007ffff7f41b1b <+43>: test %rbp,%rbp 0x00007ffff7f41b1e <+46>: je 0x7ffff7f41b48 <bsearch+88> 0x00007ffff7f41b20 <+48>: mov %rbp,%rbx 0x00007ffff7f41b23 <+51>: mov %r12,%rdi 0x00007ffff7f41b26 <+54>: shr $1,%rbx 0x00007ffff7f41b29 <+57>: imul %r15,%rbx 0x00007ffff7f41b2d <+61>: add %r13,%rbx 0x00007ffff7f41b30 <+64>: mov %rbx,%rsi (gdb) bt #0 0x00007ffff7f41b0a in bsearch (__key=__key@entry=0x7fffffffda28, __base=__base@entry=0x7ffff7fca140 <intel_02_known>, __nmemb=__nmemb@entry=68, __size=__size@entry=8, __compar=__compar@entry=0x7ffff7f3b691 <intel_02_known_compare>) at ../bits/stdlib-bsearch.h:22 #1 0x00007ffff7f3c1be in intel_check_word (name=188, value=1979933440, has_level_2=has_level_2@entry=0x7fffffffda7f, no_level_2_or_3=no_level_2_or_3@entry=0x7fffffffda7e, cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:217 #2 0x00007ffff7f3c29f in handle_intel (name=name@entry=188, cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:279 #3 0x00007ffff7f3ccf9 in dl_init_cacheinfo (cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:852 #4 init_cpu_features (cpu_features=<optimized out>) at ../sysdeps/x86/cpu-features.c:1153 #5 0x00007ffff7f3d6f9 in __libc_start_main_impl (main=0x7ffff7f396dc <main>, argc=2, argv=0x7fffffffdbe8, init=<optimized out>, fini=<optimized out>, rtld_fini=0x0, stack_end=0x7fffffffdbd8) at ../csu/libc-start.c:269 #6 0x00007ffff7f39901 in _start () at ../sysdeps/x86_64/start.S:115 (gdb) The problem is that since __USE_EXTERN_INLINES isn't defined with -Os, the inline bsearch in <bits/stdlib-bsearch.h> isn't available and the external bsearch is compiled with stack protector. Include <bits/stdlib-bsearch.h> in dl-cacheinfo.h fixed BZ #33374. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
10 daysLinux: Add missing si_code constants from Linux kernelThiago Jung Bauermann1-1/+15
This brings the si_codes listed in siginfo-consts.h up-to-date with Linux v6.16's include/uapi/asm-generic/siginfo.h. Tested on aarch64-linux-gnu and x86_64-linux-gnu. Suggested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
10 daysRemove futex_supports_psharedAndreas Schwab8-69/+9
Both NPTL and HTL support PTHREAD_PROCESS_SHARED, and since the removal of the NaCL port there are no other pthread implementations.
10 daysmisc: Add support for Linux uio.h RWF_DONTCACHE flagXi Ruoyao3-1/+10
Linux 6.14 adds the new flag for uncached buffered IO on a filesystem supporting it. This caused two test failures as these tests expected the flag 0x00000080 is unused. Add the flag definition to fix these tests on Linux >= 6.14: FAIL: misc/tst-preadvwritev2 FAIL: misc/tst-preadvwritev64v2 The test failures were not detected in routine test suite runs because normally we create the test file in /tmp, where a tmpfs is usually mounted, and tmpfs does not support this flag. But it can be reproduced with TMPDIR set to some directory in an ext4 file system. Link: https://git.kernel.org/torvalds/c/af6505e5745b Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
10 daysalpha: Align stack for alphaAdhemerval Zanella1-0/+2
As done already for x86_64 [1] and aarch64 [2]. It fixes misc/tst-misalign-clone on alpha. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=27902 [2] https://sourceware.org/bugzilla/show_bug.cgi?id=27939 Reviewed-by: Collin Funk <collin.funk1@gmail.com>
10 daysmalloc: Fix Os build on some ABIsAdhemerval Zanella1-0/+6
I have not checked with all versions for all ABIs, but I saw failures with gcc-14 on arm, alpha, hppa, i686, sparc, sh4, and microblaze. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
13 dayslibio: Define AT_RENAME_* with the same tokens as LinuxFlorian Weimer2-3/+9
Linux uses different expressions for the RENAME_* and AT_RENAME_* constants. Mirror that in <stdio.h>, so that the macro redefinitions do not result in preprocessor warnings. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
13 daystestsuite: Update tests for 'xfclose' useMaciej W. Rozycki9-4/+12
Convert (some) tests to use 'xfclose' rather than using plain 'fclose' call with no error checking or plain missing such a call. Reviewed-by: Florian Weimer <fweimer@redhat.com>
13 daystestsuite: Update tests for 'xfmemopen' useMaciej W. Rozycki16-53/+31
Convert tests to use 'xfmemopen' rather than open-coding error checks with 'fmemopen' or plain missing them, where 'fmemopen' itself is not the scope of testing. Leave 'fmemopen' tests alone. Reviewed-by: Florian Weimer <fweimer@redhat.com>
13 dayssupport: Implement 'xfmemopen' for seamless 'fmemopen' useMaciej W. Rozycki3-0/+33
Add 'xfmemopen' wrapper for seamless 'fmemopen' use in tests, following 'xfopen', 'xfclose', etc., and providing a standardized error reporting facility. Reviewed-by: Florian Weimer <fweimer@redhat.com>
13 daysx86_64: Unconditionally run test elf/check-dt-x86-64-pltArjun Shankar1-1/+1
The intention of GLIBC_ABI_DT_X86_64_PLT is simply to mark the existence of the fix in f8587a61892cbafd98ce599131bf4f103466f084 ("x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT"). Testing for GLIBC_ABI_DT_X86_64_PLT does not depend on the linker supporting -z mark-plt. Therefore remove this dependency on linker support and test unconditionally. Fixes commit 399384e0c8193e31aea014220ccfa24300ae5938 ("x86-64: Add GLIBC_ABI_DT_X86_64_PLT [BZ #33212]") Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-03Fix sysdeps/mips/dl-machine-reject-phdr.h build with GCC 16Joseph Myers1-1/+1
Building for MIPS has been broken with GCC mainline since mid-July, probably GCC commit 0eac9cfee8cb0b21de866a04d5d59685ab35208f "c, c++: Extend -Wunused-but-set-* warnings [PR44677]", because the variable perfect_match in elf_machine_reject_phdr_p is set unconditionally, but only used if _MIPS_SIM == _ABIO32. Mark it with __attribute__ ((unused)), which seems cleaner in such a conditionally-used case than making all other logic relating to this variable conditional. Tested with build-many-glibcs.py (compilers build, which previously failed) for mips64-linux-gnu.
2025-09-02AArch64: Implement exp2m1 and exp10m1 routinesHasaan Khan23-2/+17707
Vector variants of the new C23 exp2m1 & exp10m1 routines. Note: Benchmark inputs for exp2m1 & exp10m1 are identical to exp2 & exp10 respectively, this also includes the floating point variations. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-09-01Tests: Create files with mode 0666, not 0777 (bug 33171)Florian Weimer6-13/+12
Mode 0777 should be used for directories only because it results in executable entries (after typical umasks are applied). Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-09-01nptl: Fix "Arch-sepecific" typo in commentJonathan Wakely1-1/+1
2025-09-01nptl: Provide __pthread_rwlock_unlock compat symbol for versions before 2.43Xi Ruoyao2-1/+7
The symbol was unintentionally leaked on ports introduced after GLIBC_2.34, provide the compat symbol to avoid breaking ABI on them. Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-01nptl: Drop IS_IN (libpthread) around hidden_proto (__pthread_rwlock_unlock)Xi Ruoyao1-5/+1
Now libpthread is a dummy library and it no longer contains __pthread_rwlock_unlock at all, thus IS_IN (libpthread) does not make sense here. It seems an left over from commit eb29dcde31e7 ("nptl: Move rwlock functions with forwarders into libc") and it caused libc.so to export an unversioned __pthread_rwlock_unlock on Linux ports introduced after the 2.34 release (loongarch and or1k) but the symbol is not ever supposed to be exported on those new ports. Only since the commit 3b2b88cceeb7 ("elf: early conversion of elf p_flags to mprotect flags") the header dependency change happened to pull in libc-lockP.h which sets hidden_proto (__pthread_rwlock_unlock) correctly, the symbol is no longer exported, breaking the ABI on those ports. Remove this #if as a clean up and to prevent such a mess from happening again. Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-08-29login: fix ut_line comparison logicDJ Delorie1-4/+5
ut_line[] is not a string, it's a fixed-width character field, and may not be NUL terminated. Thus, the use of strcmp is incorrect. strncmp is more appropriate as it stops at the field size. Note that differences beyond the field size do not count here, as (1) this test doesn't do that, and (2) such differences are traditionally ignored (i.e. logins that are silently truncated to 8 characters, etc) While this is "only a test", we should still demonstrate the correct way of doing things. Also, using strncmp avoids a "not a string" warning from gcc if you use -O1 or lower, where it can't deduce that overflow won't happen. Reviewed-by: Sam James <sam@gentoo.org> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-29malloc: add tst-mxfast to hugetlb exclusion listDJ Delorie1-0/+1
tst-mxfast needs GLIBC_TUNABLES to be set to its own value. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-08-29x86: Use flag output operands for inline asm in atomic-machine.hUros Bizjak1-48/+48
Use the flag output constraints feature available in gcc 6+ ("=@cc<cond>") instead of explicitly setting a boolean variable with SETcc instruction. This approach decouples the instruction that sets the flags from the code that consumes them, allowing the compiler to create better code when working with flags users. Instead of e.g.: lock add %esi,(%rdi) sets %sil test %sil,%sil jne <...> the compiler now generates: lock add %esi,(%rdi) js <...> No functional changes intended. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: H.J.Lu <hjl.tools@gmail.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-08-28x32: Fix, optimize and cleanup RSEQ_* accessorsUros Bizjak1-31/+39
Add missing "memory" clobber to accessors. The "memory" clobber tells the compiler that the assembly code performs memory reads or writes to items other than those listed in the input and output operands (for example, accessing the memory pointed to by one of the input parameters). Use MOVZBL instead of MOVB when reading 1-byte memory location into a register. MOVB to a register actually inserts into the LSB of the word-sized register, making the result dependent on the previous register value. MOVZBL avoids this issue. Change %P asm operand modifiers to %c. The ‘c’ modifier is a generic asm operand modifier that requires a constant operand and prints the constant expression without punctuation. Replace %b asm operand modifiers with explicit casts. Explicit casts inform the compiler which part of the register value is used, allowing it to perform additional optimizations (e.g. narrowing the preceding operation). Remove %q asm operand modifiers. Since the value is already cast to 'long long int', the compiler will emit a 64-bit register name in the assembly without needing %q. No functional changes intended. Tested-by: H.J. Lu <hjl.tools@gmail.com> Co-Authored-By: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-27x86/configure: Improve portability of isa level checkHenrik Lindström2-2/+2
wc -l pads the output with leading spaces on some systems, e.g. FreeBSD. This results in the check `test "$count" = 1` failing. Use -eq for integer comparison instead. Signed-off-by: Henrik Lindström <henrik@lxm.se> Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-08-27elf: early conversion of elf p_flags to mprotect flagsCupertino Miranda30-102/+104
This patch replaces _dl_stack_flags global variable by _dl_stack_prot_flags. The advantage is that any convertion from p_flags to final used mprotect flags occurs at loading of p_flags. It avoids repeated spurious convertions of _dl_stack_flags, for example in allocate_thread_stack. This modification was suggested in: https://sourceware.org/pipermail/libc-alpha/2025-March/165537.html Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-27malloc: Support hugepages in mremap_chunkWilco Dijkstra2-5/+35
Add mremap_chunk support for mmap()ed chunks using hugepages by accounting for their alignment, to prevent the mremap call failing in most cases where the size passed is not a hugepage size multiple. It also improves robustness for reallocating hugepages since mremap is much less likely to fail, so running out of memory when reallocating a larger size and having to copy the old contents after mremap fails is also less likely. To track whether an mmap()ed chunk uses hugepages, have a flag in the lowest bit of the mchunk_prev_size field which is set after a call to sysmalloc_mmap, and accessed later in mremap_chunk. Create macros for getting and setting this bit, and for mapping the bit off when accessing the field for mmap()ed chunks. Since the alignment cannot be lower than 8 bytes, this flag cannot affect the alignment data. Add malloc/tst-tcfree4-malloc-check to the tests-exclude-malloc-check list as malloc-check prevents the tcache from being used to store chunks. This test caused failures due to a bug in mem2chunk_check to be fixed in a later patch. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-27malloc: Change mmap chunk layoutWilco Dijkstra2-28/+34
Change the mmap chunk layout to be identical to a normal chunk. This makes it safe for tcache to hold mmap chunks and simplifies size calculations in memsize and musable. Add mmap_base() and mmap_size() macros to simplify code. Reviewed-by: Cupertino Miranda <cupertino.miranda@oracle.com>
2025-08-27added benchmark inputs for rsqrtf and rsqrtPaul Zimmermann3-0/+2010
Changes with respect to v1: - added missing rsqrt and rsqrtf in bench-math
2025-08-26add missing benchmark files for several C23 binary64 functionsPaul Zimmermann12-0/+11066
These files were prepared together with Saban Houssein.
2025-08-25manual: Refer to libc-alpha instead of a dead mailing list.Collin Funk2-2/+2
* manual/message.texi (Advanced gettext functions): Refer to libc-alpha@sourceware.org instead of bug-glibc-manual@gnu.org which no longer exists. * NEWS: Likewise. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-08-23Don't pass -c to LIBC_TRY_TEST_CC_OPTIONH.J. Lu4-12/+12
LIBC_TRY_TEST_CC_OPTION is defined with LIBC_TRY_CC_OPTION: dnl Test a compiler option or options with an empty input file. dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false]) AC_DEFUN([LIBC_TRY_CC_OPTION], [AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])], [$2], [$3])]) which passes -S to compiler. Unlike gcc, when -c is also passed to clang 20, we get configure:7838: clang -c -Werror -fsemantic-interposition -xc /dev/null -S -o /dev/null clang: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument] Don't pass -c to LIBC_TRY_TEST_CC_OPTION since -c isn't needed. This fixes BZ #33318. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-08-23Remove test-have-mamx-tile from Makefile.inH.J. Lu3-5/+0
Since have-mamx-tile is for TEST_CC only as shown in sysdeps/x86_64/configure.ac: LIBC_CONFIG_VAR([have-mamx-tile], [$libc_cv_test_x86_have_amx_tile]) remove test-have-mamx-tile from Makefile.in. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-08-22Don't use -Wfree-labels/-Wmissing-parameter-name if unsupportedH.J. Lu1-0/+4
Don't use -Wfree-labels/-Wmissing-parameter-name for "make check" if they are unsupported by TEST_CC. This fixes BZ #33310. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-08-22Undef __INT64_C/__UINT64_C for glibc build and testH.J. Lu1-0/+5
Since clang 20 defines __INT64_C and __UINT64_C as built-in macros, undef them for glibc build and test. This fixes BZ #33311. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-22Revert "Don't use -Wfree-labels/-Wmissing-parameter-name if unsupported"H.J. Lu3-9/+6
This reverts commit ee06d98c5b9161fcaa03c562860d6ec4a8700cd2.
2025-08-22Don't use -Wfree-labels/-Wmissing-parameter-name if unsupportedH.J. Lu3-6/+9
Don't use -Wfree-labels/-Wmissing-parameter-name for "make check" if they are unsupported by TEST_CC. This fixes BZ #33310. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-22x86: Set have-protected-data to no if unsupportedH.J. Lu4-0/+224
If the building compiler enables no direct external data access by default, access to protected data in shared libraries from executables must be compiled with no direct external data access. If the testing compiler doesn't support it, set have-protected-data to no to disable the tests which requires no direct external data access. Add LIBC_TRY_CC_COMMAND to test a building compiler option or options with an input file. This fixes BZ #33286. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-08-23stdio-common: Convert macros across scanf input specifier testsMaciej W. Rozycki5-400/+412
Convert 'compare_real', 'read_real', and 'verify_input' macros to functions so as to improve readability and avoid pitfalls. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23stdio-common: Adjust header inclusion in scanf input specifier testsMaciej W. Rozycki99-86/+18
Move the inclusion of the data class header from the individual tests to the data-type-specific skeleton, providing for the use of the data type under test in the data class header and reducing duplication. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23stdio-common: Include correct skeleton in scanf input specifier testsMaciej W. Rozycki70-70/+70
Follow 'scanf' itself and use the system header inclusion variant for the data-type-specific skeleton consistently across the remaining scanf family functions so that any sysdeps/ variant takes precedence even in the presence of a corresponding skeleton in stdio-common/ (though we have no such arrangement at the moment). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23stdio-common: Fix NaN input data for scanf input specifier tests [BZ #32857]Maciej W. Rozycki48-1264/+1264
Update NaN input data with 'n-char-sequence' in reference data matching data under test, removing test failures with the M68K host. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23stdio-common: Fix bad NaN crash in scanf input specifier tests [BZ #32857]Maciej W. Rozycki1-31/+33
Fix a null pointer dereference causing a crash in 'read_real' when the terminating null character is written for use with the subsequent call to 'nan' for invalid NaN reference input, such as: %a:nan:1:3:nanny: by moving all the 'n-char-sequence' handling under the check for the opening parenthesis. No test case added as it's a test case issue in the first place. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23stdio-common: Fix a crash in scanf input specifier tests [BZ #32857]Maciej W. Rozycki1-5/+5
Fix a null pointer dereference causing a crash in 'read_real' when the terminating null character is written for use with the subsequent call to 'nan' for NaN reference input using null 'n-char-sequence', such as: %a:nan():1:5:nan(): by moving the memory allocation call ahead of the check for the closing parenthesis. No test case added as it's a test case issue in the first place. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23stdio-common: Fix error reporting in scanf input specifier testsMaciej W. Rozycki1-3/+4
Remove buffer contents reporting from the real variant of 'verify_input' where there has been an input data format error making the contents of data buffers irrelevant. For example given invalid float input data: %a:nan:1:3:nan(: these messages are produced: error: ./tst-scanf-format-skeleton.c:240: input buffer: `0000c07f' error: ./tst-scanf-format-skeleton.c:240: value buffer: `0000c07f' error: ./tst-scanf-format-skeleton.c:242: input line 1: input data format error with the two former lines irrelevant. Remove them from output then, only leaving: error: ./tst-scanf-format-skeleton.c:242: input line 1: input data format error No test case added as it's a test case issue in the first place. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23stdio-common: Reject insufficient character data in scanf [BZ #12701]Maciej W. Rozycki6-22/+405
Reject invalid formatted scanf character data with the 'c' conversion where there is not enough input available to satisfy the field width requested. It is required by ISO C that this conversion matches a sequence of characters of exactly the number specified by the field width and it is also already documented as such in our own manual: "It reads precisely the next N characters, and fails if it cannot get that many." Currently a matching success is instead incorrectly produced where the EOF condition is encountered before the required number of characters has been retrieved, and the characters actually obtained are stored in the buffer provided. Add test cases accordingly and remove placeholders from 'c' conversion input data for the existing scanf tests. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-22Disable -Wimplicit-fallthrough when clang is in useH.J. Lu2-0/+11
Clang's -Wimplicit-fallthrough warning, which flags unannotated fall-through in switch statements, does not recognize specific comments like /* FALLTHROUGH */ for suppressing the warning, unlike GCC. Since fall through comments are used extensively in glibc, disable -Wimplicit-fallthrough when clang is in use. This fixes BZ #33312. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-22libio: Properly link in libio functions in static binariesH.J. Lu3-1/+39
commit 3020f72618e4f1d7338cd42b8bc7b2813e961b5a Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Date: Tue Dec 27 18:11:43 2022 -0300 libio: Remove the usage of __libc_IO_vtables added #define libio_static_fn_required(name) __asm (".globl " #name); to link in libio functions in static binaries. But there is no relocation in .globl _IO_file_open and "strip --strip-unneeded" will remove such unreferenced symbols which breaks static binaries. Redefine libio_static_fn_required to create a reference to the required function with static __typeof (name) *const name##_p __attribute__((used)) = name; This fixes BZ #33300. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Tested-by: Xi Ruoyao <xry111@xry111.site>
2025-08-22x86_64: Use __seg_fs qualifiers in NPTL accessorsUros Bizjak4-96/+105
Use __seg_fs named address space qualifiers to cast NPTL accessors to %fs: prefixed addresses. Use volatile access only where strictly necessary. Use existing assembly RSEQ_* accessors for x32 to work around the GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121613 because negative value in __rseq_offset is used as an offset from %fs. Co-Authored-By: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com>
2025-08-21x86: Remove an extra space before THREAD_SELFH.J. Lu2-2/+2
After f6dd43d5f7 i386: Remove stalled __GNUC_PREREQ (6, 0) test in THREAD_SELF() b0f0c41a5f x86_64: Remove stalled __GNUC_PREREQ (6, 0) test in THREAD_SELF() removed the unnecessary __GNUC_PREREQ (6, 0) test, remove the extra space before THREAD_SELF macro name. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-20x86_64: Remove stalled __GNUC_PREREQ (6, 0) test in THREAD_SELF()Uros Bizjak1-14/+1
Currenty GCC-12 is required as the minimum supported compiler version. Remove stalled __GNUC_PREREQ (6, 0) test for GCC compiler version in THREAD_SELF() macro definition. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: H.J.Lu <hjl.tools@gmail.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-20i386: Use __seg_gs qualifiers in NPTL accessorsUros Bizjak2-130/+41
Use __seg_gs named address space qualifiers to cast NPTL accessors to %gs: prefixed addresses. Use volatile access only where strictly necessary. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: H.J.Lu <hjl.tools@gmail.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-20i386: Remove stalled __GNUC_PREREQ (6, 0) test in THREAD_SELF()Uros Bizjak1-14/+1
Currenty GCC-12 is required as the minimum supported compiler version. Remove stalled __GNUC_PREREQ (6, 0) test for GCC compiler version in THREAD_SELF() macro definition. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: H.J.Lu <hjl.tools@gmail.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>