]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
22 hours agoposix: Do not recurse once per pattern component in glob [BZ #34453] master
Adhemerval Zanella [Fri, 31 Jul 2026 16:41:02 +0000 (16:41 +0000)] 
posix: Do not recurse once per pattern component in glob [BZ #34453]

glob splits the pattern at its rightmost slash and calls itself on
the part before it, so a pattern needs one stack frame per directory
component.  It also calls itself once per brace expression.  Either can
be made as deep as the pattern is long, so glob overflows the stack
before it can answer.  The descent is on the pattern alone, so the
leading component, which is what decides whether anything can match at
all, is only reached at the bottom of the recursion:

  glob ("__nonexistent__/*/*/.../*/x", 0, NULL, &g)

with a few thousand components crashes with an default stack (usually
8MB on Linux).

Expand the components in a loop instead.  glob_dir_pattern collects
what each component has to do into a heap-allocated array, then matches
them from left to right, and glob_brace walks the brace expansions with
an explicit stack.  Both arrays are sized from the pattern up front:
there is no more than one step per slash and no more than one brace
level per brace, since each consumes one.

Matching left to right also means a leading directory that does not
exist ends the expansion at the first component rather than after
descending through all of them.

Stack usage no longer depends on the pattern: a pattern with 100000
components now resolves on a 64 KiB thread stack, where before 4096
components overflowed 8 MiB.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, and i686-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
22 hours agoposix: Remove the alloca uses from glob_in_dir
Adhemerval Zanella [Fri, 31 Jul 2026 18:07:44 +0000 (18:07 +0000)] 
posix: Remove the alloca uses from glob_in_dir

What is left are the name used to stat a component without
metacharacters and the blocks holding the matched names.  With those on
the heap the alloca budget can go as well.

Also treat the size overflow as an error.  It used to fall through
to malloc with the wrapped size and then copy the full length
into it.

alloca is now used only by the MSDOS and Windows paths, which glibc
does not build, so move its header out of the way as well.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, and i686-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
22 hours agoposix: Use malloc instead of alloca for the glob brace expansion
Adhemerval Zanella [Fri, 31 Jul 2026 18:06:02 +0000 (18:06 +0000)] 
posix: Use malloc instead of alloca for the glob brace expansion

The last alloca in __glob is the buffer holding one expansion of a
brace expression.  As with the directory and user names, the stack it
takes is not bounded by the call itself.

Use malloc unconditionally.  __glob no longer uses alloca; glob_in_dir
still does, so the accounting stays for now.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, and i686-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
22 hours agoposix: Use malloc instead of alloca for the glob user name
Adhemerval Zanella [Fri, 31 Jul 2026 16:37:17 +0000 (16:37 +0000)] 
posix: Use malloc instead of alloca for the glob user name

Use malloc unconditionally.  The name is only needed for the passwd
lookup that follows, which is far more expensive than the allocation.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, and i686-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
22 hours agoposix: Move the glob home directory lookups out of __glob
Adhemerval Zanella [Fri, 31 Jul 2026 16:35:53 +0000 (16:35 +0000)] 
posix: Move the glob home directory lookups out of __glob

Expanding "~" or "~user" needs a struct scratch_buffer to call
getpwnam_r through, where the code might reserve extra stack in
every glob frame (around 1224 bytes on x86_64).  Even though the
lookups only run when the caller passed GLOB_TILDE or
GLOB_TILDE_CHECK.

Move the two lookups into glob_current_home_dir and glob_user_home_dir,
which return the directory as a malloc'ed string.  The frame of each
glob call drops to around 184 bytes.

This also fixes a small leak: the ~user path returned GLOB_NOSPACE
without freeing user_name when scratch_buffer_grow failed.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, and i686-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
22 hours agoposix: Use malloc instead of alloca for the glob directory name
Adhemerval Zanella [Fri, 31 Jul 2026 16:32:13 +0000 (16:32 +0000)] 
posix: Use malloc instead of alloca for the glob directory name

Use malloc unconditionally instead.  These are one-off allocations
whose cost is dwarfed by the readdir and fnmatch work that follows.

The amount of stack this can take is not bounded by these calls alone,
glob recursively calls itself per pattern component, and each call
starts a fresh alloca budget.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, and i686-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
31 hours agoLoongArch: Fix intermittent nptl/tst-cancel32 failure
mengqinggang [Wed, 5 Aug 2026 08:03:34 +0000 (16:03 +0800)] 
LoongArch: Fix intermittent nptl/tst-cancel32 failure

The nptl/tst-cancel32 test fails intermittently on LoongArch
with SIGSEGV at __longjmp:

0x7ffff7de7f6c <__longjmp+28>   rotri.d         $sp, $t0, 0x11
0x7ffff7de7f70 <__longjmp+32>   xor             $sp, $sp, $t1

rotri.d and xor are expanded from PTR_DEMANGLE2.
If the thread is cancelled between the rotri.d and xor,
an incomplete sp register causes the SIGSEGV.

Change the destination register of rotri.d to avoid an incomplete sp.

44 hours agoelf: Use the effective lazy mode for the deferred IRELATIVE pass
Adhemerval Zanella [Mon, 3 Aug 2026 14:02:54 +0000 (11:02 -0300)] 
elf: Use the effective lazy mode for the deferred IRELATIVE pass

The 63b31c05a8a split relocation processing must agree for the lazy
flag, a mismatch would change the .rel.plt handling.

This is not an issue for any port currently, but on hppa it may return
a different value: if hppa implements IFUNC support, the second pass would
route PLT entries to its empty lazy handler and leave the descriptors
unrelocated, silently.

Make ELF_DYNAMIC_RELOCATE_PASS take lazy as an int lvalue and store the
effective mode back into it, so the DL_RELOC_IRELATIVE call reuses the
same variable instead of a separately threaded copy.  The two passes can no
longer disagree about the partitioning.  elf_machine_runtime_setup has side
effects, so it must stay a single call.

Checked on x86_64-linux-gnu, and built for all supported architectures.

Reviewed-by: Sam James <sam@gentoo.org>
44 hours agoelf: Honour skip_ifunc for cross-object IFUNC relocations [BZ #34428]
Adhemerval Zanella [Mon, 3 Aug 2026 14:02:53 +0000 (11:02 -0300)] 
elf: Honour skip_ifunc for cross-object IFUNC relocations [BZ #34428]

Commit 63b31c05a8a ("elf: Defer all IRELATIVE relocations until after PLT
setup") dropped the skip_ifunc argument from elf_dynamic_do_Rel, assuming
the new deferred elf_dynamic_do_Rel_irelative pass handles every relocation
that may run an IFUNC resolver.  That only holds for IFUNC symbols defined
in the object being relocated: a reference to an IFUNC in another object is
an ordinary JMP_SLOT or GLOB_DAT against an undefined symbol, and its IFUNC
nature is only known after symbol resolution inside elf_machine_rel.  Those
relocations stay in the regular pass, which no longer propagated
skip_ifunc, so __RTLD_NOIFUNC was ignored for them.

ldd -u forces non-lazy binding (GLRO(dl_lazy) = 0 for DL_DEBUG_UNUSED), so
the resolver was called and the diagnostic emitted:

  $ ldd -u /bin/ls
  /bin/ls: Relink `' with `/usr/lib64/libc.so.6' for IFUNC symbol `__mempcpy_chk'

ldd -r with LD_BIND_NOW is affected in the same way.

Restore the skip_ifunc parameter and thread it through _ELF_DYNAMIC_DO_RELOC.

This new semantic shows that ELF_DYNAMIC_RELOCATE_NOIFUNC naming is misleading
(it reads as "do not process IFUNC", yet it takes a skip_ifunc
argument). Replace it to:

  DL_RELOC_BOTH     -> DL_RELOC_ALL
  DL_RELOC_NOIFUNC  -> DL_RELOC_NORMAL
  DL_RELOC_IFUNC    -> DL_RELOC_IRELATIVE

ELF_DYNAMIC_RELOCATE_NOIFUNC and ELF_DYNAMIC_RELOCATE_IFUNC become a single
ELF_DYNAMIC_RELOCATE_PASS taking the pass as its first argument, and
ELF_DYNAMIC_DO_REL/ELF_DYNAMIC_DO_RELA take the pass instead of having three
near-identical variants each.

Checked on x86_64-linux-gnu, and built for all supported architectures.

Reviewed-by: Sam James <sam@gentoo.org>
2 days agoelf: preserve exit code in tests
Sam James [Sat, 8 Aug 2026 00:03:18 +0000 (01:03 +0100)] 
elf: preserve exit code in tests

Use $fail when we set it rather than just '1' (we already checked
that it is non-zero) to make logs more meaningful.

(Also, use $rc when we already checked it svalue.)

2 days agonss: Use test resolver for tst-getaddrinfo4
Adhemerval Zanella [Thu, 9 Jul 2026 17:48:14 +0000 (14:48 -0300)] 
nss: Use test resolver for tst-getaddrinfo4

Rewrite the BZ#15339 test to use the resolv_test framework instead of
querying the network, so it can run as a regular test.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 days agosysdeps: Remove duplicated INTERNAL_SYSCALL_NCS macros
Ryota Saito [Sat, 1 Aug 2026 19:52:59 +0000 (04:52 +0900)] 
sysdeps: Remove duplicated INTERNAL_SYSCALL_NCS macros

Commit 89b53077d2a ("nptl: Fix Race conditions in pthread cancellation
[BZ#12683]") added a second copy of the __INTERNAL_SYSCALL_NCS{0-7}
and INTERNAL_SYSCALL_NCS_CALL macros, which had already been defined
earlier in the same file by commit 00baddbb93 ("linux: Add generic
syscall implementation").  Remove the second copy.

Signed-off-by: Ryota Saito <saito.ryota.23@shizuoka.ac.jp>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 days agonss: Use reallocarray to prevent integer overflow in getaddrinfo (bug 33977)
Marcus Poller [Mon, 6 Jul 2026 08:37:32 +0000 (10:37 +0200)] 
nss: Use reallocarray to prevent integer overflow in getaddrinfo (bug 33977)

replacing realloc by reallocarray introduces a basic overflow check.
(old + count) might still overflow, but since the NSS backend is trusted,
we do not consider this to be a valid case.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 days agostring: Speed up strcasecmp test data initialization
Magnus Lindholm [Wed, 5 Aug 2026 21:14:59 +0000 (23:14 +0200)] 
string: Speed up strcasecmp test data initialization

The strcasecmp and strncasecmp tests repeatedly initialize large
buffers for many combinations of lengths and alignments.  The existing
loops perform a remainder operation and call toupper and tolower for
every element.

Generate at most max_char elements using an additive recurrence and
apply the case conversions while creating this initial pattern.  The
recurrence produces the same sequence as the existing multiplication
and remainder expression.  Expand the completed pattern using bulk
copies.

This preserves the generated test data and locale-dependent case
conversion while substantially reducing the initialization cost on
slower systems.

Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 days agostring: Speed up strcmp test data initialization
Magnus Lindholm [Wed, 5 Aug 2026 21:14:58 +0000 (23:14 +0200)] 
string: Speed up strcmp test data initialization

The strcmp and strncmp tests repeatedly initialize large buffers for
many combinations of lengths and alignments.  The existing loops
perform a remainder operation and two individual stores for every
element.

Generate at most max_char elements using an additive recurrence.  The
recurrence produces the same sequence as the existing multiplication
and remainder expression.  Expand this initial pattern using bulk
copies, and then copy the completed first buffer to the second buffer.

This preserves the generated test data while substantially reducing
the initialization cost on slower systems.

The change also applies to the wcscmp and wcsncmp tests, which include
the same test sources.

Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 days agoarm: Order the rtld link after libgcc-stubs.a
Adhemerval Zanella [Thu, 6 Aug 2026 17:08:00 +0000 (14:08 -0300)] 
arm: Order the rtld link after libgcc-stubs.a

The librtld.map and librtld.os link recipes use $(gnulib), which on arm
contains libgcc-stubs.a through gnulib-arch.  But the archive is only a
prerequisite of lib-noranlib so the rtld link can run before the archive
exists:

  ld.bfd: cannot find .../elf/libgcc-stubs.a: No such file or directory

The race seems to predates the parallel subdirectory recursion, which
only made it observable.

Add the order-only dependency in sysdeps/arm/Makefile rather than in
elf/Makefile.  Theprerequisite lists expand when the rule is parsed,
and gnulib-arch is only defined once Makerules includes the sysdeps
makefiles.

Verified with a build for arm-linux-gnueabihf.
Reviewed-by: Sam James <sam@gentoo.org>
2 days agoMakefile: Order the top-level stamp files before the subdirectory fan-out
Adhemerval Zanella [Thu, 6 Aug 2026 17:07:59 +0000 (14:07 -0300)] 
Makefile: Order the top-level stamp files before the subdirectory fan-out

The archive rules in Makerules list every stamp file as a prerequisite,
including the top level's own, and the elf sub-make evaluates them to
build libc_pic.a for the librtld.map link.  A sub-make can only create
the stamp files of its own directory, so when the top-level ones do not
exist yet it fails with:

  make[2]: *** No rule to make target '.../stamp.os', needed by
  '.../libc_pic.a'.  Stop.

The serial recursion created them before the subdirectories through the
prerequisite order of subdir_lib; the parallel recursion (commit
7cac99621e96) does not.  Add them as prerequisites of the object-building
per-subdirectory targets.
Reviewed-by: Sam James <sam@gentoo.org>
2 days agoMakerules: Make the .dt to .d conversion safe against concurrent sub-makes
Adhemerval Zanella [Thu, 6 Aug 2026 17:07:58 +0000 (14:07 -0300)] 
Makerules: Make the .dt to .d conversion safe against concurrent sub-makes

The %.d: %.dt rule seds its input into a fixed temporary name, renames
it into place and removes the input.  Two makes converting the same
file trip over each other:

  mv: cannot stat '.../test-double-libmvec-sincos-avx512f.o.T': No such file or directory
  sed: can't read .../test-float-libmvec-acosf-avx512f.o.dt: No such file or directory

That happens because the elf rtld-Rules recursion runs a sub-make over
every $(rtld-subdirs) directory, which converts that directory's .dt
files, and the parallel subdirectory recursion (commit 7cac99621e96)
runs it concurrently with those subdirectories' own sub-makes.

Add the PID of the shell to the temporary name and claim the input with
a rename: only the run that wins converts and installs the target.
Reviewed-by: Sam James <sam@gentoo.org>
2 days agoMakefile: Only print the test summary in the second pass of 'make check'
Adhemerval Zanella [Thu, 6 Aug 2026 17:07:57 +0000 (14:07 -0300)] 
Makefile: Only print the test summary in the second pass of 'make check'

The build-only first pass of the two-pass 'make check' still runs the
static checks (abi, conformtest, installed headers, etc.), and the
top-level tests recipe merged and summarized their results.

An unexpected FAIL there (e.g. check-abi) aborted 'check' before the
second pass ran any built test, and even a clean run printed a misleading
partial summary.

Pass tests-summary=no in the first pass to skip the merge and summary;
the .test-result files persist, so the second pass folds those results
into the one complete summary at the end, restoring the single-pass
reporting behavior.
Reviewed-by: Sam James <sam@gentoo.org>
2 days agoMakerules: Only install the ABI lib-names header from the top level (BZ 34439)
Rudi Heitbaum [Thu, 6 Aug 2026 17:07:56 +0000 (14:07 -0300)] 
Makerules: Only install the ABI lib-names header from the top level (BZ 34439)

The $(inst_includedir)/%.h install rules exist only where $(headers) is
non-empty, so in a subdir without headers (e.g. csu) the prerequisite
added on install-others-nosubdir has no rule.

It only worked because .NOTPARALLEL made the top level install the header
first, which the parallel subdir recursion no longer guarantees.
Reviewed-by: Sam James <sam@gentoo.org>
2 days agoFix gen-as-const-headers races with the parallel subdir recursion (BZ 34438)
Adhemerval Zanella [Thu, 6 Aug 2026 17:07:55 +0000 (14:07 -0300)] 
Fix gen-as-const-headers races with the parallel subdir recursion (BZ 34438)

The parallel subdirectory recursion (commit 7cac99621e96) only orders
csu (and mach/hurd on Hurd) before the parallel fan-out plus the edges
the Depend files request.  A header generated from gen-as-const-headers
is only ordered before the compilations of the subdirectory that
adds the .sym (through before-compile), so a header consumed by a
different subdirectory may not exist yet when its consumer is
compiled.

That is the case for <sigaltstack-offsets.h>: it is generated when
building misc, while its only consumer, ____longjmp_chk.S (x86_64 and
sh), is built in debug.  The serial recursion always ran misc before
debug in the sorted order, hiding the missing dependency.

Move the generate the header to 'debug' instead.

The same class of problem exists on Hurd: jmp_buf-ssp.h that is used
by ____longjmp_chk.S in debug, and signal-defines.h that is sued
by debug and setjmp.

Deterministically reproduced with 'make debug/subdir_lib' from a clean
build tree (which orders only csu before debug), and verified with
builds for x86_64-linux-gnu, sh4-linux-gnu, i686-gnu, and x86_64-gnu.
Reviewed-by: Sam James <sam@gentoo.org>
2 days agoalpha: expect test-float32x-float64-div to fail
Matt Turner [Mon, 3 Aug 2026 23:55:09 +0000 (19:55 -0400)] 
alpha: expect test-float32x-float64-div to fail

_Float32x and _Float64 are both binary64 on Alpha, so this narrowing
divide is a plain divide and the hardware alone decides whether to signal
underflow.

IEEE 754 determines tininess after rounding from the result rounded as if
the exponent range were unbounded, while Alpha determines it from the
delivered result.  The two differ for a quotient that is tiny but rounds
up to the smallest normal, as in DBL_MIN / (1 + 2^-52) under a rounding
mode that rounds away from zero: the binade below DBL_MIN has a finer
spacing than the subnormals, so the unbounded rounding stays below
DBL_MIN and the result is tiny, but the delivered result is DBL_MIN and
looks normal.  Alpha signals no underflow for it.

Nothing in software can correct this.  The hardware detects no underflow,
so no software completion trap is taken and the kernel emulation never
runs, and as the operation is not really narrowing there is no wider
intermediate for libm to examine.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 days agoalpha: add the denormal trap enable bit to FE_NOMASK_ENV
Matt Turner [Mon, 3 Aug 2026 23:55:06 +0000 (19:55 -0400)] 
alpha: add the denormal trap enable bit to FE_NOMASK_ENV

FE_NOMASK_ENV is the floating-point environment in which no exception is
masked, so it must enable every exception that FE_ALL_EXCEPT covers.  On
Alpha that includes the GNU extension FE_DENORMAL, whose SWCR trap enable
bit is IEEE_TRAP_ENABLE_DNO (bit 6).

The constant only set bits 1 through 5 (INV, DZE, OVF, UNF and INE), so
after fesetenv (FE_NOMASK_ENV) a subsequent fegetexcept () returned
0x3e0000 rather than FE_ALL_EXCEPT (0x7e0000), and denormal exceptions
stayed masked.  Set bit 6 as well.

Fixes math/test-fenv-return on alpha.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 days agolinux: Inline syscall cancellation to keep wrapper frames observable (BZ 34338)
Adhemerval Zanella [Fri, 21 Mar 2025 14:03:00 +0000 (14:03 +0000)] 
linux: Inline syscall cancellation to keep wrapper frames observable (BZ 34338)

The cancellable syscall wrappers end with a tail call to __syscall_cancel,
the wrapper frame is then elided, so when the syscall executes the wrapper
is no longer present on the stack.  Tools that unwind from CFI alone, such
as valgrind, perf and sampling profilers, cannot observe it. On gdb, it
only recovers it from DWARF call site information, which reduced-debuginfo
libc builds usually omit.

The behaviour is target dependent: for a shared (PIC) the tail call is
emitted on aarch64, arc, loongarch and riscv.  It is not emitted on i386,
x86_64, arm, s390x, sparc and alpha, where the seventh argument is passed
on the stack or fewer argument registers are available, nor on powerpc
and mips, where the TOC/GOT pointer must be restored after the call.
This is why the problem was originally reported as aarch64 specific while
x86_64 was unaffected.

Rather than only inhibiting the tail call [1] (which keeps the wrapper frame
but still leaves the __syscall_cancel and __internal_syscall_cancel
frames), move the cancellation logic back into the wrappers.  In the
single-threaded case the syscall is now issued directly from the wrapper;
only the multi-threaded path still calls the out-of-line __syscall_cancel_arch.

This keeps the wrapper observable and removes the extra frames, mimicking
how cancellation was handled before 89b53077d2a58f00e7debdfe58afabe953dac60d.

The result is a small libc.so .text increase (size, first column):

  ABI            master      patched      diff    increase
  aarch64       1635880     1647424      11544      0.71%
  x86_64        1981081     1992257      11176      0.56%
  powerpc64le   2364336     2376964      12628      0.53%
  riscv64       1368386     1376704       8318      0.61%
  loongarch64   1741385     1755601      14216      0.82%

The tst-backtrace5 was suppose to track this issue, but due wrong
loop variable check it does not take this in account.  This patch also fixes
it.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabihf, and powerpc64le-linux-gnu.

[1] https://sourceware.org/pipermail/libc-alpha/2025-March/165395.html

3 days agostdio-common: avoid repeated regexp matches in tst-printf-format.awk
Matt Turner [Tue, 4 Aug 2026 01:59:44 +0000 (21:59 -0400)] 
stdio-common: avoid repeated regexp matches in tst-printf-format.awk

Whether the value is an infinity, a NaN or zero does not change between
the conversions applied to it, but was determined again for each one.
Determine it where the value is read.

Also look for the '#' flag with index() before matching the expressions
that need it, and test the value first where both have to hold.

For the %f conversion for double, in the C locale, as the median of five
runs:

  x86_64, gawk 5.4.1    1.248s -> 1.184s
  x86_64, gawk 5.3.2    0.703s -> 0.708s
  alpha,  gawk 5.4.60    26.6s ->  25.8s

So this only helps with the regular expression engine that gawk 5.4
brought in; under 5.3.2 it is lost in the noise.  Output and exit status
are unchanged for the e, f and g conversions for double under both
gawk versions and both locales.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 days agostdio-common: run AWK in the C locale in the printf format tests
Matt Turner [Tue, 4 Aug 2026 14:17:20 +0000 (10:17 -0400)] 
stdio-common: run AWK in the C locale in the printf format tests

The program under test runs in the C locale, through the test program
prefix, but AWK inherits whatever locale the build was started in.  They
agree today only because the locale in use shares its decimal point with
the C locale.

It is also faster.  gawk takes a single byte path in its regular
expression engine when MB_CUR_MAX is 1, and the script matches several
expressions against every line.  For the %f conversion for double, the
largest of these tests, as the median of five runs:

  x86_64, gawk 5.4.1    1.482s -> 1.248s
  x86_64, gawk 5.3.2    0.911s -> 0.703s
  alpha,  gawk 5.4.60    30.9s ->  26.6s

Worth noting that gawk 5.4 is a good deal slower here than 5.3 was, at
1.248s against 0.703s for the same input in the C locale, so these tests
have become more expensive than they used to be.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 days agopowerpc: Fix -mlong-double-128 IBM format configure test for Clang
Matt Turner [Sun, 26 Jul 2026 18:43:11 +0000 (14:43 -0400)] 
powerpc: Fix -mlong-double-128 IBM format configure test for Clang

The check for -mlong-double-128 IBM extended format support wrapped its
test code in AC_LANG_PROGRAM, which places the body inside main().  The
body defines a function, so it became a nested function definition -- a
GCC extension that Clang does not implement, making the test fail with
Clang.

Use AC_LANG_SOURCE so the function is defined at file scope, and
regenerate configure.

Reviewed-by: Sam James <sam@gentoo.org>
3 days agoldbl-opt: Fix -mlong-double-128 configure test for Clang
Matt Turner [Sun, 26 Jul 2026 04:27:37 +0000 (00:27 -0400)] 
ldbl-opt: Fix -mlong-double-128 configure test for Clang

The check for -mlong-double-128 support wrapped its test code in
AC_LANG_PROGRAM, which places the body inside main().  The body defines
a function, so it became a nested function definition -- a GCC extension
that Clang does not implement, making the test fail (and thus the whole
build error out) with Clang even though it supports -mlong-double-128.

Use AC_LANG_SOURCE so the function is defined at file scope, matching the
pattern already used by the powerpc64le compiler checks, and regenerate
configure.

Reviewed-by: Sam James <sam@gentoo.org>
3 days agoelf: Improve diagnostics for static TLS exhaustion
Frédéric Bérat [Thu, 28 May 2026 08:36:19 +0000 (10:36 +0200)] 
elf: Improve diagnostics for static TLS exhaustion

Improve the error diagnostics printed when static TLS allocation fails
during dlopen.

The CHECK_STATIC_TLS macro is updated to pass the fully resolved sym and
the referencing map over to _dl_allocate_static_tls, modifying its
signature.

When _dl_allocate_static_tls is called, it now attempts to reconstruct
what failed using _dl_exception_create_format. It displays:
* The name of the symbol that triggers this.
* Whether this is due to static TLS space being exhausted, or if the
  symbol has previously been used as global-dynamic and is now being
  tried to use as initial-exec.
* If the symbol-defining map is different from the referencing map, it
  includes its name as well.
* If static TLS is exhausted, includes requested size and available
  size.

The change cascades through all architecture variants modifying their
dl-machine calls to CHECK_STATIC_TLS to conform to the new prototype.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 days agohurd: Fix build after the ftw kernel_stat.h inclusion
Adhemerval Zanella [Tue, 4 Aug 2026 14:25:48 +0000 (14:25 +0000)] 
hurd: Fix build after the ftw kernel_stat.h inclusion

Commit 6758def7171 changed the generic ftw{64}.c to include
kernel_stat.h, which is Linux specific.

Add a Hurd version of kernel_stat.h defining XSTAT_IS_XSTAT64 to 0,
since struct stat and struct stat64 never share a layout on Hurd: on
32-bit ABIs st_ino, st_size, and st_blocks are narrower in struct stat,
and on 64-bit ABIs the two structures still differ in size because
_SPARE_SIZE in bits/stat.h reserves three more ints of spare space in
struct stat than in struct stat64.

This keeps the ftw/ftw64 symbols exactly as before the change, where
the aliasing check on __OFF_T_MATCHES_OFF64_T was always false because
the Hurd bits/typesizes.h does not define it.

Checked with a full build for i686-gnu and x86_64-gnu.

6 days agort: skip nanosleep interval and abs test for low precision clocks
Mark Wielaard [Tue, 14 Jan 2025 00:30:40 +0000 (01:30 +0100)] 
rt: skip nanosleep interval and abs test for low precision clocks

If a clock doesn't have enough precision to check the sleep resolution
(quantum.tv_nsec > TEST_NSEC / 10) then record the quantum.tv_nsec,
but skip the interval_test and abs_test for that clock.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Tested-by: Magnus Lindholm <linmag7@gmail.com>
6 days agoalpha: Fix stack alignment in makecontext
Magnus Lindholm [Mon, 3 Aug 2026 15:51:59 +0000 (17:51 +0200)] 
alpha: Fix stack alignment in makecontext

The Alpha ABI requires the stack pointer to be 16-byte aligned.
However, __makecontext did not realign it after reserving space for
arguments. Depending on uc_stack.ss_size, this could leave the stack
only 8-byte aligned.

Round the new stack pointer down to a 16-byte boundary after reserving
the argument area.

This fixes stdlib/tst-makecontext2.

Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 days agoio: fix ftw ABI on MIPS n64
Xi Ruoyao [Wed, 22 Jul 2026 11:26:10 +0000 (19:26 +0800)] 
io: fix ftw ABI on MIPS n64

On MIPS n64 off_t is same as off64_t, but struct stat is not same as
struct stat64 (very peculiar but see the "as tempting as it..." comment
in linux/mips/kernel_stat.h).  As the ftw/ftw64 callback accepts a
pointer to a function who accepts struct stat/stat64, for MIPS n64 we
must use different implementations for ftw and ftw64.

Thus for testing if ftw64 can be aliased to ftw, we should check
XSTAT_IS_XSTAT64 instead of __OFF_T_MATCHES_OFF64_T.

This resolves the io/tst-ftw-lnk failure observed on MIPS n64.

Link: https://sourceware.org/glibc/wiki/Testing/Tests/io/tst-ftw-lnk
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
8 days agosysdeps: Fix comment typos in sysdeps/unix/sysdep.h
Ryota Saito [Sat, 1 Aug 2026 17:23:38 +0000 (02:23 +0900)] 
sysdeps: Fix comment typos in sysdeps/unix/sysdep.h

Fix grammar in the comments describing __SYSCALL_CANCEL_CALL and
__INTERNAL_SYSCALL_CANCEL_CALL.

Signed-off-by: Ryota Saito <saito.ryota.23@shizuoka.ac.jp>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
10 days agomath: Fix x86_64 tanh _FloatN aliases binding to the FMA variant [BZ 34465]
Adhemerval Zanella [Thu, 30 Jul 2026 11:55:54 +0000 (08:55 -0300)] 
math: Fix x86_64 tanh _FloatN aliases binding to the FMA variant [BZ 34465]

The generic implementation emits libm_alias_double unconditionally, so
tanhf32x and tanhf64 bind directly to __tanh_fma.

Guard the alias with '#ifndef __tanh' and emit it from the dispatcher,
as sin.  Also remove the stale __expm1 defines, unused since tanh moved
to CORE-MATH.

Checked on x86_64-linux-gnu, and with 'qemu-x86_64 -cpu Nehalem'.

Reported-by: Michael Brunnbauer <brunni@netestate.de>
10 days agodlfcn: Deprecate dlinfo request type RTLD_DI_ORIGIN (bug #24298)
Arjun Shankar [Tue, 14 Jul 2026 12:40:59 +0000 (14:40 +0200)] 
dlfcn: Deprecate dlinfo request type RTLD_DI_ORIGIN (bug #24298)

Commit b52619f2e8bbae57d79c95538346198c4a9f24a6 added a new dlinfo
request type, RTLD_DI_ORIGIN_PATH, to be used instead of RTLD_DI_ORIGIN
which is prone to buffer overflows.  With a replacement available,
RTLD_DI_ORIGIN can now be deprecated.

This commit deprecates RTLD_DI_ORIGIN by adding a compile-time warning
upon its use, and documents the deprecation in the manual.

The warning depends on "Enumerator Attributes" supported by gcc
since 6.1 and by clang.  A new macro __attribute_deprecated_enum__,
analogous to __attribute_deprecated_msg__, is defined in cdefs.h.
Because gnulib can override system-installed cdefs.h, thus hiding our
definition, the deprecation is conditional on the macro being defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agobenchtests: Create objdir in the bench-%.c generation rule
Adhemerval Zanella [Tue, 28 Jul 2026 14:27:33 +0000 (11:27 -0300)] 
benchtests: Create objdir in the bench-%.c generation rule

The $(objpfx)bench-%.c rule writes its output into $(objpfx) without
ensuring that directory exists.  Serial builds happened to satisfy
that ordering, with parallel builds the generation recipe can
run before the directory is created, failing with:

  cannot create .../benchtests/bench-xxx.c-tmp: Directory nonexistent

Add the standard $(make-target-directory).

Reviewed-by: Florian Weimer <fweimer@redhat.com>
12 days agomisc: Makefile style fix
Yury Khrustalev [Mon, 20 Jul 2026 15:39:21 +0000 (16:39 +0100)] 
misc: Makefile style fix

13 days agoelf: test: handle different rootsbindir in tst-ldconfig-cache
Xi Ruoyao [Sat, 25 Jul 2026 16:11:44 +0000 (00:11 +0800)] 
elf: test: handle different rootsbindir in tst-ldconfig-cache

When compiling a glibc for a merged-/usr distro people may set
rootsbindir=/usr/sbin.  But tst-ldconfig-cache has hard-coded
/sbin/ldconfig path and so it fails with a different rootsbindir.

Fix it by using support_install_rootsbindir like run_ldconfig in
test-container.c.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
13 days agolocaledata: Add brh_PK locale for Brahui language [BZ #33952]
Hammad Mengal [Mon, 20 Jul 2026 07:09:58 +0000 (12:09 +0500)] 
localedata: Add brh_PK locale for Brahui language [BZ #33952]

Add locale data for Brahui (brh), a Dravidian language spoken by
approximately 2.8 million people (2023 Pakistan Census) primarily in
Balochistan, Pakistan.  Brahui is the only Dravidian language written
in the Perso-Arabic (Nastaliq) script.

The ISO 639-3 code brh is added to iso-639.def.  Brahui has no ISO
639-1 or ISO 639-2 code, so the three-letter code is used for both the
terminology and bibliographic fields, as is already done for other
639-3-only entries such as brx (Bodo).

Locale content follows CLDR locale brh, for which the submitter is the
contributing native speaker.

Changes since v3:
  - iso-639.def: place Brahui before Braj, restoring alphabetical
    order by English language name.
  - LC_TIME: add first_weekday 1 and first_workday 2.  The previous
    value of 7 selected Saturday, which does not match CLDR territory
    data for PK (firstDay = sun); ur_PK and sd_PK both use 1.
  - LC_TIME: reorder d_t_fmt and date_fmt so the date precedes the
    time, matching the CLDR brh date-time combination pattern and the
    shape used by sd_PK, and use U+060C ARABIC COMMA as the separator,
    which is the comma in the CLDR brh punctuation exemplar set.
  - LC_TIME: abday repeats the full day names, as Brahui has no
    distinct abbreviated forms; CLDR brh gives identical values at the
    abbreviated and wide widths, and ur_PK, pa_PK and fa_IR do the
    same.
  - LC_TIME: am_pm now matches the CLDR brh day-period values.
  - LC_MONETARY: n_sep_by_space 1, matching p_sep_by_space, so that
    positive and negative amounts are spaced alike.
  - LC_MESSAGES: yesexpr accepts U+062C and U+0647, and noexpr accepts
    U+0627, since these initials occur in attested spellings of the
    affirmative and negative words.
  - LC_CTYPE: add transliterations for U+06C1 and U+06B7.
  - LC_TELEPHONE: use the "+%c %a %l" form.
  - LC_IDENTIFICATION: record CLDR as the source; bump revision.

Signed-off-by: Hammad Mengal <hammadalo99@gmail.com>
Reviewed-by: Mike FABIAN <mfabian@redhat.com>
13 days agomath: Fix sinh worst-case results for |x| > 36.736801 [BZ 34441]
Adhemerval Zanella [Mon, 27 Jul 2026 16:37:19 +0000 (13:37 -0300)] 
math: Fix sinh worst-case results for |x| > 36.736801 [BZ 34441]

The CORE-MATH import mistranslated the accurate path result scaling
'th *= sp.f' as 'th *= asuint64 (sp)' (commit 106f8c2ed68), and two of
the 51 exceptional-case table entries were dropped when the table was
moved to e_sinh_data.c (commit f05c4907a27).

Checked on x86_64-linux-gnu and aarch64-linux-gnu.

13 days agoAArch64: Add ifunc masking tunable
Wilco Dijkstra [Mon, 6 Jul 2026 12:25:23 +0000 (12:25 +0000)] 
AArch64: Add ifunc masking tunable

Remove the glibc.cpu.name tunable since it's unused and out of date.
Add support for glibc.cpu.hwcaps to adjust ifunc selection for debugging
and benchmarking.  Only allow disabling of features that are (a) used by
ifuncs, (b) safe to disable to a more generic ifunc without any security
impact.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2 weeks agohurd: fix fork's longjmp demangling on i386
Samuel Thibault [Sun, 26 Jul 2026 22:59:36 +0000 (00:59 +0200)] 
hurd: fix fork's longjmp demangling on i386

i386's setjmp does not actually mangle ebp.

2 weeks agohurd: Make the readlink __fstatat64 references optional
Samuel Thibault [Fri, 24 Jul 2026 21:10:02 +0000 (23:10 +0200)] 
hurd: Make the readlink __fstatat64 references optional

They may show up or not depending on the toolchain in use.

2 weeks agoNEWS: add 2.45 section
Andreas K. Hüttel [Sat, 25 Jul 2026 00:12:28 +0000 (09:12 +0900)] 
NEWS: add 2.45 section

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agoversion.h: bump to 2.44.9000 / development glibc-2.44.9000
Andreas K. Hüttel [Sat, 25 Jul 2026 00:10:58 +0000 (09:10 +0900)] 
version.h: bump to 2.44.9000 / development

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agoChangeLog.old/ChangeLog.33: add glibc-2.44
Andreas K. Hüttel [Fri, 24 Jul 2026 13:16:45 +0000 (22:16 +0900)] 
ChangeLog.old/ChangeLog.33: add

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agoversion.h, include/features.h: Increase version number
Andreas K. Hüttel [Fri, 24 Jul 2026 13:10:57 +0000 (22:10 +0900)] 
version.h, include/features.h: Increase version number

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agoNEWS: drop empty section
Andreas K. Hüttel [Fri, 24 Jul 2026 12:53:17 +0000 (21:53 +0900)] 
NEWS: drop empty section

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agopo: update (only line number changes)
Andreas K. Hüttel [Fri, 24 Jul 2026 12:48:02 +0000 (21:48 +0900)] 
po: update (only line number changes)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agolibc.pot: regenerate
Andreas K. Hüttel [Fri, 24 Jul 2026 12:12:27 +0000 (21:12 +0900)] 
libc.pot: regenerate

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agohurd: Make setitimer clear interval on value being 0
Samuel Thibault [Wed, 22 Jul 2026 20:24:29 +0000 (22:24 +0200)] 
hurd: Make setitimer clear interval on value being 0

posix says value being 0 means disabling a timer, regardless of the
interval, so we should clear the interval in that case, so a further
setitimer call does not see a non-zero interval.

2 weeks agohurd: xfail more tests waiting for barrier setpshared support
Samuel Thibault [Wed, 22 Jul 2026 20:22:19 +0000 (22:22 +0200)] 
hurd: xfail more tests waiting for barrier setpshared support

2 weeks agomanual/install.texi, INSTALL: update version numbers
Andreas K. Hüttel [Tue, 21 Jul 2026 15:29:10 +0000 (00:29 +0900)] 
manual/install.texi, INSTALL: update version numbers

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agoresolv: Disable TCP servers in tst-resolv-res_init-failure
Florian Weimer [Tue, 21 Jul 2026 13:54:27 +0000 (15:54 +0200)] 
resolv: Disable TCP servers in tst-resolv-res_init-failure

This avoids spurious xaccept errors on slow systems.  With this
change, the test still reproduces the original bug.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 weeks agoNEWS: mention more recent developments
Andreas K. Hüttel [Mon, 20 Jul 2026 08:21:29 +0000 (17:21 +0900)] 
NEWS: mention more recent developments

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agomath: test: Fix unsupported check in test-narrowing-trap
Yury Khrustalev [Thu, 16 Jul 2026 13:09:33 +0000 (14:09 +0100)] 
math: test: Fix unsupported check in test-narrowing-trap

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 weeks agohurd: demangle pointers on fork's longjmp
Samuel Thibault [Mon, 20 Jul 2026 15:10:44 +0000 (17:10 +0200)] 
hurd: demangle pointers on fork's longjmp

The thread state structure requires plain pointers, while the jmpbuf has
mangled pointers.

Fixes 78f1f0e39cd41d28ae771eb3498bc33780c85cfd
("Consolidate the C pointer guard and align the assembly
implementations")

2 weeks agohurd: Add __readlink and readlink to dl-sysdep.c
Samuel Thibault [Mon, 20 Jul 2026 18:17:08 +0000 (20:17 +0200)] 
hurd: Add __readlink and readlink to dl-sysdep.c

Fixes fcea66cd4685f9f3719e09cac52c73b9ece4bade
("Add system-wide tunables: Filters")
which adds calling it from rtld.

2 weeks agohurd: Add __fstatat64 to dl-sysdep.c
Samuel Thibault [Mon, 20 Jul 2026 09:15:46 +0000 (11:15 +0200)] 
hurd: Add __fstatat64 to dl-sysdep.c

Fixes b9957a70b82203d91b0659b93cfe8632f954aba3
("Add system-wide tunables: cache ld.so.cache")
which adds calling it from rtld.

2 weeks agomanual: Add stability warning regarding system-wide tunables
Florian Weimer [Mon, 20 Jul 2026 13:53:56 +0000 (15:53 +0200)] 
manual: Add stability warning regarding system-wide tunables

And mention system-wide tunables in NEWS.
Reviewed-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2 weeks agocontrib.texi: update
Andreas K. Hüttel [Mon, 20 Jul 2026 14:12:23 +0000 (23:12 +0900)] 
contrib.texi: update

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoNEWS: insert list of fixed bugs
Andreas K. Hüttel [Mon, 20 Jul 2026 08:31:33 +0000 (17:31 +0900)] 
NEWS: insert list of fixed bugs

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoNEWS: editorial changes
Andreas K. Hüttel [Mon, 20 Jul 2026 05:24:35 +0000 (14:24 +0900)] 
NEWS: editorial changes

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agomath: Update tanh from CORE-MATH (revision cf237fa0)
Adhemerval Zanella [Fri, 17 Jul 2026 17:14:44 +0000 (17:14 +0000)] 
math: Update tanh from CORE-MATH (revision cf237fa0)

Sync the double-precision tanh implementation with CORE-MATH revision
cf237fa0.

Checked on aarch64-linux-gnu.

3 weeks agoRevert "malloc: Remove dynamic mmap/trim threshold [BZ #30769]"
Peter Bergner [Fri, 17 Jul 2026 17:24:38 +0000 (01:24 +0800)] 
Revert "malloc: Remove dynamic mmap/trim threshold [BZ #30769]"

This change causes large degradations on multiple SPEC benchmarks,
so we have to revert this commit.

GLIBC BZ: https://sourceware.org/PR34394

This reverts commit 17a79a51208c5648fe70983085833bf15d83d0f1

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoAdd RWF_NOSIGNAL from Linux 6.18 to bits/uio-ext.h
Adhemerval Zanella [Mon, 6 Jul 2026 14:18:36 +0000 (11:18 -0300)] 
Add RWF_NOSIGNAL from Linux 6.18 to bits/uio-ext.h

It was added by commit db2ab24a341ce89351a1bede37a96a3e3ce1726a.

Reviewed-by: Carlos O'Donell <carlos@redaht.com>
3 weeks agomath: Fix inaccurate sin/cos/tan for large arguments (BZ 34376)
Adhemerval Zanella [Thu, 16 Jul 2026 21:21:20 +0000 (18:21 -0300)] 
math: Fix inaccurate sin/cos/tan for large arguments (BZ 34376)

The Payne-Hanek range reducer __branred delivers the reduced argument
as a double-double with only about 93 significant bits.  For arguments
extremely close to a multiple of pi/2 the true reduced argument can be
as small as 2^-61, so most of those bits cancel and sin/cos/tan can be
wrong by up to ~143000 ulp.  This inaccuracy used to be handled by the
multiple-precision slow paths, which was removed by commit
649095838b8 ("sin/cos slow paths: remove slow paths from huge range
reduction") and commit 476d692e8a8 ("math: Remove slow paths in tan
[BZ #15267]").

Restore the e_rem_pio2.c (removed as unused by commit ca3aac57efa
"Remove unused math files") and use __ieee754_rem_pio2 for
the huge-argument reduction instead of __branred, which is removed.

It also does not depend on precise IEEE double rounding, so the nofma
and vector-width workarounds for branred.c are no longer needed.

The file is restored trimmed to its huge-argument path, the callers
reduce smaller arguments themselves and handle non-finite inputs, so
only 1e8 < |x| < 2^1024 reaches __ieee754_rem_pio2.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, armv7a-linux-gnueabihf,
and i686-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agobenchtests: Add path-oriented workloads to tan
Adhemerval Zanella [Thu, 16 Jul 2026 21:21:19 +0000 (18:21 -0300)] 
benchtests: Add path-oriented workloads to tan

The tan input list spans the full binary64 range, so a single number mixes
the kernel, and the i__branred reductions in one average.  Add two named
workloads that isolate the ends of that spread, so each can be measured
separately:

  - workload-fast.wrf: uniform random inputs in [-pi, pi].

  - workload-slow.wrf: |x| in [2^27, 2^1024), log-uniform over binades.

The existing full-range inputs are replaced as the default workload.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agobenchtests: Add path-oriented workloads to sin
Adhemerval Zanella [Thu, 16 Jul 2026 21:21:18 +0000 (18:21 -0300)] 
benchtests: Add path-oriented workloads to sin

The sin input list spans the full binary64 range, so a single number mixes
the kernel, the reduce_sincos reduction , and the __branred reduction in
one average.  Add three named workloads that isolate the paths __cos
actually dispatches to, so each can be measured separately:

  - workload-fast.wrf: uniform random inputs in [-pi, pi].

  - workload-moderate.wrf: |x| in [4, 6.7e7], log-uniform over binades.

  - workload-slow.wrf: |x| in [2^27, 2^1024), log-uniform over binades.

The existing full-range inputs are replaced as the default workload.

Reviewed-by: Carlos O'Donell <carlos@redaht.com>
3 weeks agobenchtests: Add path-oriented workloads to cos
Adhemerval Zanella [Thu, 16 Jul 2026 21:21:17 +0000 (18:21 -0300)] 
benchtests: Add path-oriented workloads to cos

The cos input list spans the full binary64 range, so a single number mixes
the kernel, the reduce_sincos reduction , and the __branred reduction in one
average.  Add three named workloads that isolate the paths __cos actually
dispatches to, so each can be measured separately:

  - workload-fast.wrf: uniform random inputs in [0, 2*pi].

  - workload-moderate.wrf: |x| in [4, 6.7e7], log-uniform over binades.

  - workload-slow.wrf: |x| in [2^27, 2^1024), log-uniform over binades.

The existing full-range inputs are replaced as the default workload.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agosparc: Align THP tests to the 8MB huge-page size
Adhemerval Zanella [Wed, 15 Jul 2026 13:09:10 +0000 (10:09 -0300)] 
sparc: Align THP tests to the 8MB huge-page size

The sparc64 uses an 8KB base page and 8MB PMD transparent huge page.
It fixes the following regression on sparc:

FAIL: elf/tst-thp-1
FAIL: elf/tst-thp-1-no-s-code
FAIL: elf/tst-thp-1-no-s-code-pde
FAIL: elf/tst-thp-1-no-s-code-static
FAIL: elf/tst-thp-1-pde
FAIL: elf/tst-thp-1-static
FAIL: elf/tst-thp-align

Checked with the elf tests on qemu sparc64.

Tested-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoelf: Defer arch PLT IFUNC relocations in the two-phase relocation split
Adhemerval Zanella [Tue, 14 Jul 2026 13:39:57 +0000 (10:39 -0300)] 
elf: Defer arch PLT IFUNC relocations in the two-phase relocation split

The split introduced by commit 63b31c05a8a does not handle sparc
and (R_SPARC_JMP_IREL) powerpc64 (ELFv1, R_PPC64_JMP_IREL), which
are emited in some constructions.  Handle such cases on
elf_dynamic_is_Rel_irelative.

It fixes elf/tst-ifunc-fault-bindnow and elf/tst-ifunc-fault-lazy on
sparc64 (powerpc64 emits R_PPC64_IRELATIVE in both cases,
R_PPC64_JMP_IREL is emitted only when the ifunc is called, not just
referenced).

Checked with the elf tests on qemu sparc64 and powerpc64.

Tested-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agosparc: Fix static IFUNC startup crash by redirecting __mempcpy (BZ #34396)
Adhemerval Zanella [Tue, 14 Jul 2026 12:07:27 +0000 (09:07 -0300)] 
sparc: Fix static IFUNC startup crash by redirecting __mempcpy (BZ #34396)

After commit b75ad99d45b, __libc_setup_tls -> _dl_allocate_tls_init copies
the TLS init image with the IFUNC __mempcpy before ARCH_SETUP_IREL resolves
it, so on a multi-arch sparcv9/sparc64 static build the call jumps through an
unrelocated PLT slot and the process dies with SIGILL.

The sparc dl-symbol-redir-ifunc.h only redirected memset.  Redirect
memcpy, memmove, mempcpy and __mempcpy to the ultra1 routines as well,
and merge the identical sparc64 and sparc32/sparcv9 copies into a single
sysdeps/sparc file.  The redirection is guarded by __sparc_v9__ &&
USE_MULTIARCH so that sparcv8 (leon) and --disable-multi-arch builds,
which have no __*_ultra1 routines, are left untouched.

Checked with elf tests for sparc32 and sparc64 on qemu system.

Tested-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoRevert "strace-tst-thp.sh: Allow unsupported THP tests"
H.J. Lu [Wed, 15 Jul 2026 22:15:44 +0000 (06:15 +0800)] 
Revert "strace-tst-thp.sh: Allow unsupported THP tests"

This reverts commit ea50bcc538f3e161dd589b4a855d80ef8a35fce8.

3 weeks agostrace-tst-thp.sh: Allow unsupported THP tests
H.J. Lu [Fri, 3 Jul 2026 02:17:20 +0000 (10:17 +0800)] 
strace-tst-thp.sh: Allow unsupported THP tests

Change strace-tst-thp.sh to

output=${test_prog}.$$
...
/bin/sh -c \
  "timeout -k 4 $((3*$TIMEOUTFACTOR)) ${cmd} --direct 2>&1" > "${output}"
if grep -E "madvise\(0x[0-9a-f]+, [0-9]+, 0xe)" "${output}"; then
...

so that unsupported THP tests exit with status 77.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agothp: Disable THP if THP isn't supported by kernel
H.J. Lu [Sat, 4 Jul 2026 00:17:05 +0000 (08:17 +0800)] 
thp: Disable THP if THP isn't supported by kernel

Since DL_MAP_DEFAULT_THP_PAGESIZE is defined for x86-64, THP control
is to set to madvise by default.  If THP is disabled in x86-64 kernel,
madvise (..., MADV_HUGEPAGE) returns -EINVAL to indicate that THP isn't
supported.  Add _dl_thp_madvise to disable THP in this case.  This
fixes BZ #34348.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agothp: Link THP PDE tests with $(LOAD-THP-ADDRESS-LDFLAGS)
H.J. Lu [Sat, 4 Jul 2026 05:32:10 +0000 (13:32 +0800)] 
thp: Link THP PDE tests with $(LOAD-THP-ADDRESS-LDFLAGS)

LOAD-THP-ADDRESS-LDFLAGS was added to work around:

https://sourceware.org/bugzilla/show_bug.cgi?id=34184

which is needed for THP PDE tests.  Add $(LOAD-THP-ADDRESS-LDFLAGS) to
LDFLAGS-tst-thp-1 and LDFLAGS-tst-thp-1-no-s-code if PIE isn't built
by default so that they are linked with $(LOAD-THP-ADDRESS-LDFLAGS).
This fixes BZ #34314.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoAdd advisory text for CVE-2026-6368
Adhemerval Zanella [Wed, 1 Jul 2026 18:24:34 +0000 (15:24 -0300)] 
Add advisory text for CVE-2026-6368

3 weeks agoposix: Fix wordexp WRDE_APPEND to preserve state on non-NOSPACE errors (BZ 34090...
Adhemerval Zanella [Mon, 13 Apr 2026 19:33:30 +0000 (16:33 -0300)] 
posix: Fix wordexp WRDE_APPEND to preserve state on non-NOSPACE errors (BZ 34090, CVE-2026-6368)

The previous implementation saved a copy of the wordexp_t struct at
entry and blindly restored it on error via (*pwordexp = old_word).
This is incorrect when WRDE_APPEND is set because w_addword may have
called realloc on we_wordv during partial processing before the error
was detected.  If realloc relocated the buffer, the saved we_wordv
pointer is dangling; restoring it causes a use-after-free in the
caller (e.g. via wordfree), and the relocated buffer is leaked.

Fix this by duplicating the we_wordv pointer array at entry when
WRDE_APPEND is set, so that all subsequent realloc calls inside
w_addword operate on the copy.

This change also fixes a POSIX conformance issue: if the WRDE_APPEND
flag is specified, pwordexp->we_wordc and pwordexp->we_wordv shall
not be modified.

Also fix two pre-existing error return paths in the '"' and '\'' cases
that returned directly from w_addword failures instead of going through
do_error, which would leak the saved array (and previously would also
skip the word cleanup).

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agoldconfig: add --install option
DJ Delorie [Tue, 30 Jun 2026 21:26:34 +0000 (17:26 -0400)] 
ldconfig: add --install option

Add --install option, which copies a pre-built ld.so.cache into place,
honoring the cache and root options and defaults.  This gives the user
a canonical "correct" way to install a pre-built cache without risk
of a program trying to load a partially-written file.

Co-authored-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agopo: Integrate translations
Andreas K. Hüttel [Tue, 14 Jul 2026 13:04:19 +0000 (22:04 +0900)] 
po: Integrate translations

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agos390: Use 64bit branch relative on count instruction in strncpy-z900.S [BZ #34398]
Stefan Liebler [Tue, 14 Jul 2026 08:56:49 +0000 (10:56 +0200)] 
s390: Use 64bit branch relative on count instruction in strncpy-z900.S [BZ #34398]

At the time the s390-32 strncpy implementation was adjusted for the
s390-64 port, the brct (branch relative on count) instruction was
not adjusted from 32bit to 64bit instruction.

If n contains a value >32bit, the number of 8 byte chunks is computed
with srlg (64bit shift right). The processing of 8 byte chunks is then
processed by looping with brct (32bit branch relative on count) instruction.

This patch just uses the brctg (64bit branch relative on count) instruciton.

Note 1: There is a second loop copying the remaining seven bytes.  The usage
of 32bit brct for looping is fine here.

Note 2: If glibc is build with architecture level set >=z13, the z900 variant
of strncpy is not build at all.

Note 3: If glibc is build for <z13, the z900 ifunc variant is only chosen if
not run on >=z13 or if called via __GI_strncpy.

3 weeks agoUse correct type for glibc.malloc.perturb in tst-tunconf1.c
Stefan Liebler [Mon, 13 Jul 2026 08:31:53 +0000 (10:31 +0200)] 
Use correct type for glibc.malloc.perturb in tst-tunconf1.c

On s390x the test elf/tunconf1 fails with:
tst-tunconf1.c:41: numeric comparison failure (widths 64 and 32)
   left: 180388626436 (0x2a00000004); from: (long)perturb
  right: 42 (0x2a); from: 42

According to elf/dl-tunables.list, glibc.malloc.perturb is of type int32_t (4byte)
and not size_t (8byte) which was used for TUNABLE_GET_FULL inside the testcase.
Therefore the correct 32bit value 0x2a=42 is written to the to the wrong place
and leads to the comparison failure.

The printf format specifiers for size_t were also adjusted.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agobenchtests: Build benchmarks in parallel
Adhemerval Zanella [Tue, 7 Jul 2026 18:30:12 +0000 (15:30 -0300)] 
benchtests: Build benchmarks in parallel

The unconditional '.NOTPARALLEL' in benchtests/Makefile forced the whole
subdirectory to build serially, even though its only purpose is to keep
the benchmark *runs* from perturbing each other's timing.

Replace it with ordering that serializes only the benchmark runs, and
only when more than one benchmark group will actually run.  The combined
'bench' goal builds every benchmark program in parallel (through
bench-build) and then runs the bench-set, bench-func and bench-malloc
groups strictly one after another.

Reviewed-by: Sam James <sam@gentoo.org>
3 weeks agosparc: Fix static (non-PIE) executables when PIE is enabled by default
Adhemerval Zanella [Sat, 11 Jul 2026 16:33:12 +0000 (13:33 -0300)] 
sparc: Fix static (non-PIE) executables when PIE is enabled by default

For the default --enable-default-pie, $(pic-default) adds -DPIC to
CPPFLAGS-.o so.  However, -fPIE ($(pie-default)) is only added to
CFLAGS-.o, which does not affect assembler (.S) sources

On SPARC the GOT register setup in SETUP_PIC_REG references
_GLOBAL_OFFSET_TABLE_ through %hi/%lo, and the assembler only rewrite
those into the required PC-relative relocations (R_SPARC_PC22 and
R_SPARC_PC10) when it is in *PIC* mode; otherwise it emits absolute
R_SPARC_HI22/R_SPARC_LO10.  With the absolute relocations the
__sparc_get_pc_thunk sequence adds the run-time PC to an already-absolute
GOT address, so the computed GOT register is wrong.  In _start this makes
the address of main come out bogus, and __libc_start_main jumps to an
unmapped address.

This removes the requirement of the --disable-default-pie for sparc
to build static binaries correctly.

Checked some tests (mainly the elf/ one) on a sparc64-linux-gnu
qemu system.

Reviewed-by: Sam James <sam@gentoo.org>
3 weeks agoelf: Remove unused tunable_seclevel_t
Adhemerval Zanella [Mon, 6 Jul 2026 19:56:35 +0000 (16:56 -0300)] 
elf: Remove unused tunable_seclevel_t

The per-tunable security level is no longer part of struct _tunable and
no tunable in dl-tunables.list declares one.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agoelf: Remove _dl_unload_cache
Adhemerval Zanella [Mon, 6 Jul 2026 19:36:49 +0000 (16:36 -0300)] 
elf: Remove _dl_unload_cache

It is a no-op since b9957a70b82.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomanual: Document default AT_SECURE handling for system-wide tunables
Adhemerval Zanella [Mon, 6 Jul 2026 14:48:23 +0000 (11:48 -0300)] 
manual: Document default AT_SECURE handling for system-wide tunables

A system-wide tunable without an onlysecure/nonsecure/anysecure prefix
defaults to "nonsecure", i.e. it is not applied to AT_SECURE processes.
This is a deliberate, conservative default but was not documented.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agoelf: Let environment aliases override overridable system-wide tunables
Adhemerval Zanella [Mon, 6 Jul 2026 16:35:15 +0000 (13:35 -0300)] 
elf: Let environment aliases override overridable system-wide tunables

The environment-variable alias loop in __tunables_init skipped every tunable
whose "initialized" flag was set, which was originally meant only to give
the canonical GLIBC_TUNABLES form precedence over the legacy MALLOC_*
aliases.

Now that the cache also sets "initialized", a legacy alias could no longer
override an *overridable* cache default, even though the canonical
GLIBC_TUNABLES form still could.

Track separately the tunables that were set from GLIBC_TUNABLES during this
call and skip only those in the alias loop

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agoelf: Avoid redundant ld.so.cache reload after first load
Adhemerval Zanella [Mon, 6 Jul 2026 14:48:23 +0000 (11:48 -0300)] 
elf: Avoid redundant ld.so.cache reload after first load

_dl_check_ldsocache_needs_loading only stored the stat fields it
compares (mtime, ino, size, dev) on the path where a cache was already
loaded.  On the very first call CACHE is NULL and the function returned
"needs loading" without recording those fields, leaving
new_cache_file_time zero.  The next call then copied that zero value
into cache_file_time and compared it against the freshly stat'd values,
which always differed, forcing a second, unnecessary load (munmap +
mmap + re-parse) of an unchanged cache at every startup.

It can be shown with repro:

  $ cat << EOF > repro.c
  #include <dlfcn.h>
  int main (void) { dlopen ("does-not-exist-xyz.so.99", RTLD_NOW); return 0; }
  EOF
  $ gcc repro.c -o repro
  $ strace -f -e trace=openat elf/ld.so --library-path . ./repro 2>&1 | grep -c "/etc/ld.so.cache"

The result should be 1, instead of 2.

Record the stat fields as soon as the stat succeeds, before the
CACHE == NULL early return, so the following call has an accurate
baseline and does not spuriously reload.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agoelf: Verify the tunable cache header signature and version
Adhemerval Zanella [Mon, 6 Jul 2026 19:56:27 +0000 (16:56 -0300)] 
elf: Verify the tunable cache header signature and version

The tunable header signature and version are written by ldconfig but
never checked them on read, so the version field was inert.  Reject
the section unless both match.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agoelf: Bound the tunable cache string table against the mapping size
Adhemerval Zanella [Mon, 6 Jul 2026 19:56:12 +0000 (16:56 -0300)] 
elf: Bound the tunable cache string table against the mapping size

_dl_load_cache_tunables bounds each entry's string offsets against
[s_start, start + cache_new->len_strings], but len_strings is an
unvalidated 32-bit field from ld.so.cache and s_start/s_end were int.  A
corrupt cache with an oversized len_strings could make s_end exceed the
mapping (or overflow), letting an offset point outside the mmap; the
following strcmp/__strdup would then read unmapped memory.

Compute the offsets as size_t and clamp s_end to cachesize, matching how
the regular library lookup bounds string offsets against the mapping size.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 weeks agolocaledata: Use libc-alpha ML as the canonical contact
Siddhesh Poyarekar [Thu, 9 Jul 2026 13:52:39 +0000 (09:52 -0400)] 
localedata: Use libc-alpha ML as the canonical contact

Replace instances of "bug-glibc@gnu.org", "libc-locales@sourceware.org"
and "bug-glibc-locales@gnu.org" with libc-alpha@sourceware.org as the
single touchpoint for the community.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 weeks agoposix: Use unique PID file in tst-spawn3 and tst-spawn3-pidfd
Florian Weimer [Thu, 9 Jul 2026 15:09:32 +0000 (17:09 +0200)] 
posix: Use unique PID file in tst-spawn3 and tst-spawn3-pidfd

The test sources are built twice and the two tests may run in parallel.
They cannot use the same PID file.

Reviewed-by: Sam James <sam@gentoo.org>
4 weeks agolocaledata: Avoid concurrently written locales in gen-locale.sh
Florian Weimer [Wed, 8 Jul 2026 15:38:42 +0000 (17:38 +0200)] 
localedata: Avoid concurrently written locales in gen-locale.sh

There is no cross-directory exclusion of concurrent $(gen-locales)
usage.  Parallel localedef calls can clobber locale data as it is
being loaded by tests.

With the separate staging areas, there are no peer directories,
so hard-linking no longer happens.  The touch command is therefore
unnecessary.

Reviewed-by: Sam James <sam@gentoo.org>
4 weeks agoAdd system-wide tunables: implement overridability
DJ Delorie [Tue, 7 Jul 2026 03:27:44 +0000 (23:27 -0400)] 
Add system-wide tunables: implement overridability

Implement the overridability/nonoverridability flags
for tunables.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agolibc.pot: regenerate
Andreas K. Hüttel [Tue, 7 Jul 2026 01:39:18 +0000 (10:39 +0900)] 
libc.pot: regenerate

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 weeks agoRevert "malloc: aarch64: Add ifuncs for malloc functions"
Yury Khrustalev [Wed, 1 Jul 2026 12:45:40 +0000 (13:45 +0100)] 
Revert "malloc: aarch64: Add ifuncs for malloc functions"

Due to issue in GDB and Valgrind that incorrectly call malloc
ifunc resolver as the malloc function, we have to revert this
change.

GDB BZ: https://sourceware.org/bugzilla/show_bug.cgi?id=34330
Valgrind bug: https://bugs.kde.org/show_bug.cgi?id=522497

This reverts commit 9ed3576e61f7a87eb83d512531566f5e5d6bb032.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agonetinet/tcp.h: Sync with Linux 6.15 and fix struct tcp_info tail (BZ 34347)
Adhemerval Zanella [Fri, 3 Jul 2026 13:33:48 +0000 (10:33 -0300)] 
netinet/tcp.h: Sync with Linux 6.15 and fix struct tcp_info tail (BZ 34347)

Add the TCP_RTO_MAX_MS and TCP_RTO_MIN_US socket options (commit
54a378f43425085d0684679d99735696b69165bc, Linux 6.15) and TCP_DELACK_MAX_US
(commit 9552f90835ef3552d0af327e48dc360717777d62, Linux 6.15).

Commit 7e46c2aae47d3284d4eb0845ddcc3951e987d681 synced the accurate ECN
additions but encoded the trailing bitfield word of struct tcp_info
incorrectly as two uint16_t fields (tcpi_accecn_fail_mode and
tcpi_accecn_opt_seen), omitting tcpi_ecn_mode and tcpi_options2.  Restore
the kernel layout:

  uint32_t tcpi_ecn_mode:2,
   tcpi_accecn_opt_seen:2,
   tcpi_accecn_fail_mode:4,
   tcpi_options2:24;

The overall structure size is unchanged.  Also add the TCPI_ECN_MODE_*
and TCP_ACCECN_* value constants for these fields, introduced together
with them by Linux commit 4fa4ac5e5848 (Linux 7.0).

Reviewed-by: Florian Weimer <fweimer@redhat.com>