]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
27 hours agohurd: calling alarm() whilst handling SIGALRM can deadlock. master
Mike Kelly [Sat, 14 Feb 2026 09:17:11 +0000 (09:17 +0000)] 
hurd: calling alarm() whilst handling SIGALRM can deadlock.

alarm() and restart_itimer() can attempt to acquire _hurd_siglock and
_hurd_itimer_lock in opposite sequence resulting in occasional
deadlock. Rearranged to always acquire the locks in the same sequence
with a new pre-condition that setitimer_locked() must be called with
both locks already acquired.
Message-ID: <20260214091715.157471-2-mike@weatherwax.co.uk>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 days agonss: Missing checks in __nss_configure_lookup, __nss_database_get (bug 28940)
Florian Weimer [Fri, 13 Feb 2026 08:02:07 +0000 (09:02 +0100)] 
nss: Missing checks in __nss_configure_lookup, __nss_database_get (bug 28940)

This avoids a null pointer dereference in the
nss_database_check_reload_and_get function, and assertion failures.

Reviewed-by: Sam James <sam@gentoo.org>
2 days agoLinux: In getlogin_r, use utmp fallback only for specific errors
Florian Weimer [Fri, 13 Feb 2026 08:02:07 +0000 (09:02 +0100)] 
Linux: In getlogin_r, use utmp fallback only for specific errors

Most importantly, if getwpuid_r fails, it does not make sense to retry
via utmp because the user ID obtained from there is less reliable than
the one from /proc/self/loginuid.

Reviewed-by: Sam James <sam@gentoo.org>
2 days agonss: Introduce dedicated struct nss_database_for_fork type
Florian Weimer [Fri, 13 Feb 2026 08:02:07 +0000 (09:02 +0100)] 
nss: Introduce dedicated struct nss_database_for_fork type

The initialized field in struct nss_database_data is rather confusing
because it is not used by the regular NSS code, only by the fork
state synchronization code.  Introduce a separate type and place
the initialized field there.

Reviewed-by: Sam James <sam@gentoo.org>
3 days agonscd: Add basic test
Florian Weimer [Thu, 12 Feb 2026 11:18:54 +0000 (12:18 +0100)] 
nscd: Add basic test

The innetgr tests are similar to a downstream test for rhbz#1054846.
This seems to be the first tests of this function.  The getnetgrent
tests are new, too.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 days agosupport: Add support for starting and stopping nscd
Florian Weimer [Thu, 12 Feb 2026 11:18:54 +0000 (12:18 +0100)] 
support: Add support for starting and stopping nscd

Reviewed-by: DJ Delorie <dj@redhat.com>
3 days agonscd: Pass TRY_AGAIN errors in the hosts cache to clients
Florian Weimer [Thu, 12 Feb 2026 11:18:54 +0000 (12:18 +0100)] 
nscd: Pass TRY_AGAIN errors in the hosts cache to clients

This is the minimal set of changes to get the upcoming test to pass.
The TTL extension logic is somewhat iffy.  There is a trade-off here:
correct operation under the DNS specification (no TTL extensions), or
reducing loading the infrastructure if TRY_AGAIN is the result of
overload from this client.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 days agosupport: Add missing NSS formatting and checking functions
Florian Weimer [Thu, 12 Feb 2026 11:18:54 +0000 (12:18 +0100)] 
support: Add missing NSS formatting and checking functions

This change is largely auto-generated.  The function implementations
are mechanical and use the glibc-specific support framework, so this
should be low-risk and therefore acceptable.

The struct etherent type is currently internal-only (although it
can be used by NSS modules), which is why it is not included here.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 days agosupport: Clean up NSS formatting and checking functions
Florian Weimer [Thu, 12 Feb 2026 11:18:54 +0000 (12:18 +0100)] 
support: Clean up NSS formatting and checking functions

Move <netdb.h> includes into the implementation files.  Use const
where appropriate.  Introduce support_check_nss and use it to
implement the check_* functions.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 days agoinclude: isolate __O_CLOEXEC flag for sys/mount.h and fcntl.h
DJ Delorie [Tue, 27 Jan 2026 03:24:42 +0000 (22:24 -0500)] 
include: isolate __O_CLOEXEC flag for sys/mount.h and fcntl.h

Including sys/mount.h should not implicitly include fcntl.h
as that causes namespace pollution and conflicts with kernel
headers.  It only needs O_CLOEXEC for OPEN_TREE_CLOEXEC
(although it shouldn't need that, but it's defined that way)
so we provide that define (via a private version) separately.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Tested-by: Florian Weimer <fweimer@redhat.com>
4 days agox86: Build tst-gnu2-tls2-x86* iff compiler supports TLS descriptor
Adhemerval Zanella [Thu, 5 Feb 2026 17:49:59 +0000 (14:49 -0300)] 
x86: Build tst-gnu2-tls2-x86* iff compiler supports TLS descriptor

The test modules are built with
-mtls-dialect=$(have-test-mtls-descriptor), similar to tst-gnu2-tls2.

Checked on x86_64-linux-gnu.

4 days agohurd: _hurd_intr_rpc_mach_msg() might not preserve the correct reply port
Mike Kelly [Mon, 9 Feb 2026 20:42:00 +0000 (20:42 +0000)] 
hurd: _hurd_intr_rpc_mach_msg() might not preserve the correct reply port

Calls to mach_msg_trap() that return MACH_SEND_INTERRUPTED modify the message header. A subsequent attempt at sending the message can return EINTR for handling by the caller. Mig generated code (expecting the message header to be unaltered) now fails assertion in __mig_dealloc_reply_port(). Fixed by restoring the altered message header content before reattempting RPC message delivery.
Message-ID: <20260209204213.91782-2-mike@weatherwax.co.uk>

5 days agohppa: Fix type punning in sysdeps/hppa/dl-fptr.c [BZ 33888]
John David Anglin [Tue, 10 Feb 2026 14:41:43 +0000 (09:41 -0500)] 
hppa: Fix type punning in sysdeps/hppa/dl-fptr.c [BZ 33888]

Compiling gcc with -Werror=strict-aliasing exposed a type punning
issue in dl-fptr.c.  It does a number of compare and swap operations
to atomically exchange function pointers, etc.  The PTR argument
is dereferenced to determine the type of the objects to exchange.
Casting the type of the PTR argument to a different type will
result in in an error with -Werror=strict-aliasing.  For example,
a `(ElfW(Addr) *' pointer is not strictly equivalent to a
`struct fdesc *' pointer.

Fix this by removing the casts from the COMPARE_AND_SWAP PTR
arguments and adjusting the type of the OLD and NEW arguments
to match the dereferenced PTR type.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
5 days agoUse Linux 6.19 in build-many-glibcs.py
Joseph Myers [Tue, 10 Feb 2026 13:53:46 +0000 (13:53 +0000)] 
Use Linux 6.19 in build-many-glibcs.py

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

5 days agox86-64: Use 32-bit zero idiom for shorter encoding
George Hu [Mon, 9 Feb 2026 19:22:18 +0000 (20:22 +0100)] 
x86-64: Use 32-bit zero idiom for shorter encoding

Replace the 64-bit zero idiom with the 32-bit form. In 64-bit mode,
zeroing the lower 32 bits of a GPR implicitly clears the entire
register. The 32-bit encoding is one byte shorter while preserving
identical semantics.

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 days agoSHARED-FILES: Update Unicode version to 17.0.0.
Carlos O'Donell [Fri, 6 Feb 2026 22:05:31 +0000 (17:05 -0500)] 
SHARED-FILES: Update Unicode version to 17.0.0.

In commit 88dc93cb400b832d2478c6c70bc4cf8c5b37432d we updated to
Unicode 17.0.0.

8 days agomalloc: Remove unused tcache code from unsorted bin scan
Wilco Dijkstra [Wed, 17 Dec 2025 16:16:23 +0000 (16:16 +0000)] 
malloc: Remove unused tcache code from unsorted bin scan

Now that fastbins have been removed, there is no need to add chunks
to tcache during an unsorted scan.  Small blocks can only be added
to unsorted as a result of a remainder chunk split off a larger block,
so there is no point in checking for additional chunks to place in
tcache.  The last remainder is checked first, and will be used if it
is large enough or an exact fit.  The unsorted bin scan becomes simpler
as a result.  Remove the tcache_unsorted_limit tunable and manual entries.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
9 days agotests: aarch64: clean up BTI and GCS tests
Yury Khrustalev [Thu, 5 Feb 2026 15:16:42 +0000 (15:16 +0000)] 
tests: aarch64: clean up BTI and GCS tests

No functional change, just cleaning up code, fixing style
and correcting typos.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
9 days agotests: aarch64: move BTI tests to linux/aarch64 folder
Yury Khrustalev [Thu, 5 Feb 2026 14:29:13 +0000 (14:29 +0000)] 
tests: aarch64: move BTI tests to linux/aarch64 folder

No functional change. BTI tests check Linux-related functionality
and belong in the linux/aarch64 directory.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
9 days agotst-{pthread|sched}-affinity-inheritance: Only use in-mask CPUs in affinity mask.
Stefan Liebler [Thu, 5 Feb 2026 12:03:08 +0000 (13:03 +0100)] 
tst-{pthread|sched}-affinity-inheritance: Only use in-mask CPUs in affinity mask.

On s390x, the two tests are failing on a lpar with linux 6.18 booted with nosmt:
FAIL:  misc/tst-sched-affinity-inheritance
FAIL:  nptl/tst-pthread-affinity-inheritance

Both tests were failing because they are claiming that the CPU affinity mask was
not correctly inherited in the forked process/thread.
The error already happened before forking, as the mask was set up to use
CPUs 0-14 in set_cpu_mask().  But according to e.g. lscpu or the line
"Cpus_allowed_list" in /proc/self/status, only the following CPUs were in mask at startup:
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
while 1, 3, 5, ... were configured, but not online.

Now the test first gets the current CPU mask at startup in do_test() and
set_cpu_mask() only selects those available CPUs.  The test is now just
counting the available CPUs instead of relying on get_nprocs().  This allows
to run the test even if it was already limited via taskset.

Therefore both concrete tests now have the get_my_affinity() function.  This
also allows to implement verify_my_affinity() in the common skeleton.

In order to ensure that the affinity mask is really set as expected,
verify_my_affinity() is now also called before forking a new process or
creating a new thread.

For also printing the list of mismatched CPU IDs in xor_set in
verify_my_affinity(), the argument order of CPU_ISSET_S is now fixed.
Furthermore we now keep iterating over all configured CPUs to print
the list of cpucount IDs instead of iterating over the first nproc CPUs.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
10 days agohurd: Take cancel_lock in critical section
Samuel Thibault [Tue, 3 Feb 2026 23:04:58 +0000 (23:04 +0000)] 
hurd: Take cancel_lock in critical section

read/write etc. shall be signal-safe, and take cancel_lock, so we have to
defer signal delivery while holding cancel_lock.

Reported-by: Michael Banck <mbanck@gmx.net>
10 days agomalloc: Extend malloc function hiding to tst-memalign-{2,3} (BZ #32366)
Adhemerval Zanella [Wed, 31 Dec 2025 15:38:25 +0000 (12:38 -0300)] 
malloc: Extend malloc function hiding to tst-memalign-{2,3} (BZ #32366)

clang 21 optimize out memalign.

Checked on x86_64-linux-gnu with gcc-15 and clang-21.

10 days agoelf: Build tst-gnu2-tls2 iff compiler supports TLS descriptor
Adhemerval Zanella [Wed, 4 Feb 2026 14:03:20 +0000 (11:03 -0300)] 
elf: Build tst-gnu2-tls2 iff compiler supports TLS descriptor

The test modules are built with
-mtls-dialect=$(have-test-mtls-descriptor), similar to tst-gnu2-tls1.

Checked on x86_64-linux-gnu.

11 days agox86: Fix for cache computation on Hygon under hypervisors
Jiamei Xie [Wed, 4 Feb 2026 08:46:07 +0000 (09:46 +0100)] 
x86: Fix for cache computation on Hygon under hypervisors

On Hygon CPUs, glibc currently relies on CPUID leaf 0x8000001D to
compute cache parameters. This works correctly on bare-metal
systems. However, under some hypervisors (e.g. QEMU with -cpu
qemu64), the maximum supported extended CPUID leaf is only
0x8000000A, and CPUID 0x8000001D is not exposed. In this case,
cache information computed via 0x8000001D is zeroed out.

This patch introduces legacy fallback of cache computation based on
CPUID 0x80000005 and 0x80000006, consistent with the AMD
implementation, to restore correct cache information under such
environments.

Signed-off-by: Jiamei Xie <xiejiamei@hygon.cn>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
11 days agosupport: Also put libaudit, libcap into the testroot if present
Florian Weimer [Wed, 4 Feb 2026 08:46:07 +0000 (09:46 +0100)] 
support: Also put libaudit, libcap into the testroot if present

Some configurations of nscd are linked against those libraries.

11 days agoRules: Set up test infrastructure if tests-container is set
Florian Weimer [Wed, 4 Feb 2026 08:46:07 +0000 (09:46 +0100)] 
Rules: Set up test infrastructure if tests-container is set

Previously, if a subdirectory had only container-based tests (via
tests-container), the Makefile rules for the test infrastructure
were excluded.

11 days agohurd: Test FPU preservation on double-signal delivery
Samuel Thibault [Tue, 3 Feb 2026 21:54:35 +0000 (21:54 +0000)] 
hurd: Test FPU preservation on double-signal delivery

This test was fixed by 826484111a ("hurd: handling pending signals could
result in corruption of FPU state.")

11 days agohurd: handling pending signals could result in corruption of FPU state
Mike Kelly [Mon, 2 Feb 2026 07:25:02 +0000 (07:25 +0000)] 
hurd: handling pending signals could result in corruption of FPU state

Handling a pending signal calls _hurd_setup_sighandler() once again
after the initial signal handling. In this case a pointer to the
previous sigcontext is available to supply the interrupted thread's
original basic state, fpu state and fpu XSTATE. The original XSTATE
was not being preserved by the pending signal but instead overwritten
with the active XSTATE. XSTATE register values modified by the
signal handling code could therefore be wrongly propogated back to
the interrupted user code.

11 days agognulib: sync comment from upstream
Paul Eggert [Tue, 3 Feb 2026 17:28:23 +0000 (09:28 -0800)] 
gnulib: sync comment from upstream

11 days agoAArch64: Add if('fastmath') to math-vector-fortran.h [BZ #33226]
Wilco Dijkstra [Tue, 27 Jan 2026 14:28:35 +0000 (14:28 +0000)] 
AArch64: Add if('fastmath') to math-vector-fortran.h [BZ #33226]

Only enable vector math functions with -ffast-math by adding if('fastmath').
This uses a new annotation supported by GCC 16 (PR 118955).  If an older
compiler is used, it will disable the math function without an error.
This fixes BZ #33226.

11 days agoAArch64: Optimize memcpy for Kunpeng 950 processor
Weihong Ye [Tue, 3 Feb 2026 17:09:03 +0000 (17:09 +0000)] 
AArch64: Optimize memcpy for Kunpeng 950 processor

For copies ≤64 bytes, the implementation remains consistent with memcpy_sve.
For 65–128 bytes, it removes the 96-byte branch and reorders instructions,
improving performance by 18–32%.  For >128 bytes, it aligns the destination
to a 32-byte boundary and uses Pre-indexed load/store instructions to reduce
address-update overhead.

All benchmarks report execution time (lower is better). Geomean results
    (__memcpy_generic → this patch):
    - bench-memcpy:         16.74 → 12.11  (28% faster)
    - bench-memcpy-large:   24287 → 23302  (4% faster)
    - bench-memcpy-random: 107693 → 72153  (33% faster)

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agoDon't include <bits/openat2.h> directly (bug 33848)
Andreas Schwab [Tue, 3 Feb 2026 11:41:23 +0000 (12:41 +0100)] 
Don't include <bits/openat2.h> directly (bug 33848)

Headers from bits directories should never be included directly, only via
the official headers.

12 days agoposix: avoid a cast in regex syntax bit definitions
Collin Funk [Mon, 26 Jan 2026 02:52:34 +0000 (18:52 -0800)] 
posix: avoid a cast in regex syntax bit definitions

The cast doesn't have any benefit over using a UL suffix and prevents
the macro from being used in preprocessor directives.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
12 days agoelf: Add test case for LD_PROFILE/LD_PROFILE_OUTPUT interaction
Florian Weimer [Mon, 2 Feb 2026 20:15:48 +0000 (21:15 +0100)] 
elf: Add test case for LD_PROFILE/LD_PROFILE_OUTPUT interaction

This verifies that LD_PROFILE is correctly ignored if LD_PROFILE_OUTPUT
is not set.

The test was initially auto-generated, then heavily edited and re-edited
for brevity and clarity.  The test uses glibc-specific interfaces
(including one that did not exist at all a couple of hours ago), so
this should be unproblematic.

12 days agosupport: Add support_spawn_wrap and related functionality
Florian Weimer [Mon, 2 Feb 2026 20:15:48 +0000 (21:15 +0100)] 
support: Add support_spawn_wrap and related functionality

It allows us to write test cases in C that run tests with
dynamic linker wrapping.

The iconv test case was auto-generated.  The posix_spawn usage
is mechanical, and the interface it tests is newly added in this
commit, so this should be acceptable.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agoarm: Fix tst-gnu2-tls2
Adhemerval Zanella [Tue, 20 Jan 2026 13:11:10 +0000 (10:11 -0300)] 
arm: Fix tst-gnu2-tls2

On armv7a vfpv4 tst-gnu2-tls2 fails with:

  open tst-gnu2-tls2mod0.so
  open tst-gnu2-tls2mod1.so
  open tst-gnu2-tls2mod2.so
  close tst-gnu2-tls2mod0.so
  close tst-gnu2-tls2mod1.so
  open tst-gnu2-tls2mod0.so
  open tst-gnu2-tls2mod1.so
  Didn't expect signal from child: got `Aborted'

Because AFTER_TLSDESC_CALL might clobber caller-saved registers and
the zero array might call the memset function resolution, which itself
might clobber some vector registers.

The AFTER_TLSDESC_CALL calls memset and memcmp, and both the
lazy resolution and the routines themselves can clobber the
caller-saved registes used in the tests.

Checked on arm-linux-gnueabihf (armv7-a vpfv4 / QEMU).

Reviewed-by: Florian Weimer <fweimer@redhat.com>
12 days agolinux: use PIDFD_GET_INFO ioctl for pidfd_getpid() if available
Luca Boccassi [Wed, 28 Jan 2026 15:37:56 +0000 (15:37 +0000)] 
linux: use PIDFD_GET_INFO ioctl for pidfd_getpid() if available

Linux v6.13 introduced a new ioctl to query info from a pidfd.
The advantage of this vs. parsing /proc/ is that it works even
when procfs is not mounted. It's also a single syscall, and doesn't
need manual string parsing. Use it when available.

Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agoelf: Fix ambiguous error message for --f in sotruss [BZ #25257]
Avinal Kumar [Mon, 5 Jan 2026 13:29:27 +0000 (18:59 +0530)] 
elf: Fix ambiguous error message for --f in sotruss [BZ #25257]

The sotruss utility printed an incomplete error message when the
ambiguous option --f was used.  The message did not list the possible
matching options, making it unclear how to resolve the ambiguity.

This commit corrects the error message to report all valid alternatives.

Example after this change:

$ sotruss --f /bin/true
sotruss: option '--f' is ambiguous; possibilities: '--from' '--follow'
Try `sotruss --help' or `sotruss --usage' for more information.

This fixes BZ #25257.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Suggested-by: Carlos Santos <casantos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agopowerpc: Add math-use-builtins-f{max,min}.h
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:26 +0000 (10:02 -0300)] 
powerpc: Add math-use-builtins-f{max,min}.h

ISA 2.06 (POWER7) added xsmindp/xsmaxdp, but we can only
use the builtin for GCC 14+ [1]

Checked on powerpc64le-linux-gnu.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103605

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Optimize f{max,min}imum_mag_num{f,l,f128}
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:25 +0000 (10:02 -0300)] 
math: Optimize f{max,min}imum_mag_num{f,l,f128}

Simplify order signal comparison and reorganize check to reduce
branches and allow targets to use conditional select/move.

With gcc-15 on aarch64 for fmaximum_mag_num:

* master:

0000000000000000 <__fmaximum_mag_num>:
   0:   d503245f        bti     c
   4:   1e60c004        fabs    d4, d0
   8:   1e60c023        fabs    d3, d1
   c:   1e632080        fcmp    d4, d3
  10:   5400008d        b.le    20 <__fmaximum_mag_num+0x20>
  14:   1e60401f        fmov    d31, d0
  18:   1e6043e0        fmov    d0, d31
  1c:   d65f03c0        ret
  20:   54000085        b.pl    30 <__fmaximum_mag_num+0x30>  // b.nfrst
  24:   1e60403f        fmov    d31, d1
  28:   1e6043e0        fmov    d0, d31
  2c:   d65f03c0        ret
  30:   54000161        b.ne    5c <__fmaximum_mag_num+0x5c>  // b.any
  34:   4f000402        movi    v2.4s, #0x0
  38:   1e6e101d        fmov    d29, #1.000000000000000000e+00
  3c:   6ee0f842        fneg    v2.2d, v2.2d
  40:   4ea21c5e        mov     v30.16b, v2.16b
  44:   2e7d1c22        bsl     v2.8b, v1.8b, v29.8b
  48:   2e7d1c1e        bsl     v30.8b, v0.8b, v29.8b
  4c:   1e6223d0        fcmpe   d30, d2
  50:   1e61ac1f        fcsel   d31, d0, d1, ge // ge = tcont
  54:   1e6043e0        fmov    d0, d31
  58:   d65f03c0        ret
  5c:   1e612020        fcmp    d1, d1
  60:   1e60403f        fmov    d31, d1
  64:   54ffff87        b.vc    54 <__fmaximum_mag_num+0x54>
  68:   1e602000        fcmp    d0, d0
  6c:   1e60401f        fmov    d31, d0
  70:   54ffff27        b.vc    54 <__fmaximum_mag_num+0x54>
  74:   1e61281f        fadd    d31, d0, d1
  78:   17fffff7        b       54 <__fmaximum_mag_num+0x54>

* patch:

0000000000000000 <__fminimum_mag_num>:
   0:   d503245f        bti     c
   4:   1e612000        fcmp    d0, d1
   8:   1e60401f        fmov    d31, d0
   c:   540000e6        b.vs    28 <__fminimum_mag_num+0x28>
  10:   1e60c01e        fabs    d30, d0
  14:   1e60c03d        fabs    d29, d1
  18:   1e7d23c0        fcmp    d30, d29
  1c:   54000160        b.eq    48 <__fminimum_mag_num+0x48>  // b.none
  20:   1e605c20        fcsel   d0, d1, d0, pl  // pl = nfrst
  24:   d65f03c0        ret
  28:   1e612020        fcmp    d1, d1
  2c:   1e604020        fmov    d0, d1
  30:   54ffffa7        b.vc    24 <__fminimum_mag_num+0x24>
  34:   1e7f23e0        fcmp    d31, d31
  38:   1e6043e0        fmov    d0, d31
  3c:   54ffff47        b.vc    24 <__fminimum_mag_num+0x24>
  40:   1e612be0        fadd    d0, d31, d1
  44:   d65f03c0        ret
  48:   9e660000        fmov    x0, d0
  4c:   f100001f        cmp     x0, #0x0
  50:   1e61bc00        fcsel   d0, d0, d1, lt  // lt = tstop
  54:   d65f03c0        ret

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu,
riscv64-linux-gnu-rv64imafdc-lp64d, and loongarch64-linux-gnuf64.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Optimize f{max,min}imum_mag{f,l,f128}
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:24 +0000 (10:02 -0300)] 
math: Optimize f{max,min}imum_mag{f,l,f128}

Simplify order signal comparison and reorganize check to reduce
branches and allow targets to use conditional select/move.

With gcc-15 on aarch64 for fmaximum_mag:

* master:

0000000000000000 <__fmaximum_mag>:
   0:   d503245f        bti     c
   4:   1e60c004        fabs    d4, d0
   8:   1e60c023        fabs    d3, d1
   c:   1e632080        fcmp    d4, d3
  10:   5400008d        b.le    20 <__fmaximum_mag+0x20>
  14:   1e60401f        fmov    d31, d0
  18:   1e6043e0        fmov    d0, d31
  1c:   d65f03c0        ret
  20:   54000085        b.pl    30 <__fmaximum_mag+0x30>  // b.nfrst
  24:   1e60403f        fmov    d31, d1
  28:   1e6043e0        fmov    d0, d31
  2c:   d65f03c0        ret
  30:   54000161        b.ne    5c <__fmaximum_mag+0x5c>  // b.any
  34:   4f000402        movi    v2.4s, #0x0
  38:   1e6e101d        fmov    d29, #1.000000000000000000e+00
  3c:   6ee0f842        fneg    v2.2d, v2.2d
  40:   4ea21c5e        mov     v30.16b, v2.16b
  44:   2e7d1c22        bsl     v2.8b, v1.8b, v29.8b
  48:   2e7d1c1e        bsl     v30.8b, v0.8b, v29.8b
  4c:   1e6223d0        fcmpe   d30, d2
  50:   1e61ac1f        fcsel   d31, d0, d1, ge // ge = tcont
  54:   1e6043e0        fmov    d0, d31
  58:   d65f03c0        ret
  5c:   1e61281f        fadd    d31, d0, d1
  60:   1e6043e0        fmov    d0, d31
  64:   d65f03c0        ret

* patch:

0000000000000000 <__fmaximum_mag>:
   0:   d503245f        bti     c
   4:   1e612000        fcmp    d0, d1
   8:   540000e6        b.vs    24 <__fmaximum_mag+0x24>
   c:   1e60c01f        fabs    d31, d0
  10:   1e60c03e        fabs    d30, d1
  14:   1e7e23e0        fcmp    d31, d30
  18:   540000a0        b.eq    2c <__fmaximum_mag+0x2c>  // b.none
  1c:   1e60dc20        fcsel   d0, d1, d0, le
  20:   d65f03c0        ret
  24:   1e612800        fadd    d0, d0, d1
  28:   d65f03c0        ret
  2c:   9e660000        fmov    x0, d0
  30:   f100001f        cmp     x0, #0x0
  34:   1e60bc20        fcsel   d0, d1, d0, lt  // lt = tstop
  38:   d65f03c0        ret

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu,
riscv64-linux-gnu-rv64imafdc-lp64d, and loongarch64-linux-gnuf64.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Optimize f{max,min}imum_num{f,l,f,f128}
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:23 +0000 (10:02 -0300)] 
math: Optimize f{max,min}imum_num{f,l,f,f128}

Add an isunordered check for fast-path and simplified sign check
and use the fmax/fmin when possible.

With gcc-15 on aarch64 for fmaximum_num:

* master

0000000000000000 <__fmaximum_num>:
   0:   d503245f        bti     c
   4:   1e612000        fcmp    d0, d1
   8:   5400008d        b.le    18 <__fmaximum_num+0x18>
   c:   1e60401f        fmov    d31, d0
  10:   1e6043e0        fmov    d0, d31
  14:   d65f03c0        ret
  18:   54000085        b.pl    28 <__fmaximum_num+0x28>  // b.nfrst
  1c:   1e60403f        fmov    d31, d1
  20:   1e6043e0        fmov    d0, d31
  24:   d65f03c0        ret
  28:   54000161        b.ne    54 <__fmaximum_num+0x54>  // b.any
  2c:   4f000402        movi    v2.4s, #0x0
  30:   1e6e101e        fmov    d30, #1.000000000000000000e+00
  34:   6ee0f842        fneg    v2.2d, v2.2d
  38:   4ea21c5d        mov     v29.16b, v2.16b
  3c:   2e7e1c22        bsl     v2.8b, v1.8b, v30.8b
  40:   2e7e1c1d        bsl     v29.8b, v0.8b, v30.8b
  44:   1e6223b0        fcmpe   d29, d2
  48:   1e61ac1f        fcsel   d31, d0, d1, ge // ge = tcont
  4c:   1e6043e0        fmov    d0, d31
  50:   d65f03c0        ret
  54:   1e612020        fcmp    d1, d1
  58:   1e60403f        fmov    d31, d1
  5c:   54ffff87        b.vc    4c <__fmaximum_num+0x4c>
  60:   1e602000        fcmp    d0, d0
  64:   1e60401f        fmov    d31, d0
  68:   54ffff27        b.vc    4c <__fmaximum_num+0x4c>
  6c:   1e61281f        fadd    d31, d0, d1
  70:   17fffff7        b       4c <__fmaximum_num+0x4c>

* patch:

0000000000000000 <__fmaximum_num>:
   0:   d503245f        bti     c
   4:   1e612000        fcmp    d0, d1
   8:   54000086        b.vs    18 <__fmaximum_num+0x18>
   c:   1e61681f        fmaxnm  d31, d0, d1
  10:   1e6043e0        fmov    d0, d31
  14:   d65f03c0        ret
  18:   1e612020        fcmp    d1, d1
  1c:   1e60403f        fmov    d31, d1
  20:   54ffff87        b.vc    10 <__fmaximum_num+0x10>
  24:   1e602000        fcmp    d0, d0
  28:   1e60401f        fmov    d31, d0
  2c:   54ffff27        b.vc    10 <__fmaximum_num+0x10>
  30:   1e61281f        fadd    d31, d0, d1
  34:   17fffff7        b       10 <__fmaximum_num+0x10>

And with gcc-15 on x86_64:

* master:

0000000000000000 <__fmaximum_num>:
   0:   66 0f 2e c1             ucomisd %xmm1,%xmm0
   4:   66 0f 28 d8             movapd %xmm0,%xmm3
   8:   77 5e                   ja     68 <__fmaximum_num+0x68>
   a:   66 0f 2e c8             ucomisd %xmm0,%xmm1
   e:   77 50                   ja     60 <__fmaximum_num+0x60>
  10:   66 0f 2e c1             ucomisd %xmm1,%xmm0
  14:   7a 5a                   jp     70 <__fmaximum_num+0x70>
  16:   75 58                   jne    70 <__fmaximum_num+0x70>
  18:   f3 0f 7e 05 00 00 00    movq   0x0(%rip),%xmm0        # 20 <__fmaximum_num+0x20>
  1f:   00
  20:   f2 0f 10 15 00 00 00    movsd  0x0(%rip),%xmm2        # 28 <__fmaximum_num+0x28>
  27:   00
  28:   66 0f 28 e0             movapd %xmm0,%xmm4
  2c:   66 0f 54 15 00 00 00    andpd  0x0(%rip),%xmm2        # 34 <__fmaximum_num+0x34>
  33:   00
  34:   66 0f 54 c1             andpd  %xmm1,%xmm0
  38:   66 0f 54 e3             andpd  %xmm3,%xmm4
  3c:   66 0f 56 e2             orpd   %xmm2,%xmm4
  40:   66 0f 56 d0             orpd   %xmm0,%xmm2
  44:   f2 0f c2 d4 02          cmplesd %xmm4,%xmm2
  49:   66 0f 54 da             andpd  %xmm2,%xmm3
  4d:   66 0f 55 d1             andnpd %xmm1,%xmm2
  51:   66 0f 56 d3             orpd   %xmm3,%xmm2
  55:   66 0f 28 c2             movapd %xmm2,%xmm0
  59:   c3                      ret
  5a:   66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
  60:   66 0f 28 c1             movapd %xmm1,%xmm0
  64:   c3                      ret
  65:   0f 1f 00                nopl   (%rax)
  68:   c3                      ret
  69:   0f 1f 80 00 00 00 00    nopl   0x0(%rax)
  70:   66 0f 2e c9             ucomisd %xmm1,%xmm1
  74:   66 0f 28 c1             movapd %xmm1,%xmm0
  78:   7b ea                   jnp    64 <__fmaximum_num+0x64>
  7a:   66 0f 2e db             ucomisd %xmm3,%xmm3
  7e:   66 0f 28 c3             movapd %xmm3,%xmm0
  82:   7b e0                   jnp    64 <__fmaximum_num+0x64>
  84:   f2 0f 58 c1             addsd  %xmm1,%xmm0
  88:   c3                      ret

* patch:

0000000000000000 <__fmaximum_num>:
   0:   66 0f 2e c1             ucomisd %xmm1,%xmm0
   4:   7a 2a                   jp     30 <__fmaximum_num+0x30>
   6:   77 18                   ja     20 <__fmaximum_num+0x20>
   8:   66 0f 2e c8             ucomisd %xmm0,%xmm1
   c:   77 08                   ja     16 <__fmaximum_num+0x16>
   e:   66 0f 50 c0             movmskpd %xmm0,%eax
  12:   a8 01                   test   $0x1,%al
  14:   74 0a                   je     20 <__fmaximum_num+0x20>
  16:   66 0f 28 c1             movapd %xmm1,%xmm0
  1a:   c3                      ret
  1b:   0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
  20:   66 0f 28 c8             movapd %xmm0,%xmm1
  24:   66 0f 28 c1             movapd %xmm1,%xmm0
  28:   c3                      ret
  29:   0f 1f 80 00 00 00 00    nopl   0x0(%rax)
  30:   66 0f 2e c9             ucomisd %xmm1,%xmm1
  34:   7b e0                   jnp    16 <__fmaximum_num+0x16>
  36:   66 0f 2e c0             ucomisd %xmm0,%xmm0
  3a:   7b e4                   jnp    20 <__fmaximum_num+0x20>
  3c:   f2 0f 58 c8             addsd  %xmm0,%xmm1
  40:   eb d4                   jmp    16 <__fmaximum_num+0x16>

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu,
riscv64-linux-gnu-rv64imafdc-lp64d, and loongarch64-linux-gnuf64.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Optimize f{max,min}imum{f,l,f128}
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:22 +0000 (10:02 -0300)] 
math: Optimize f{max,min}imum{f,l,f128}

Add an isunordered check for fast-path and simplified sign check
and use the fmax/fmin when possible.

With gcc-15 on aarch64:

* master:

0000000000000000 <__fmaximum>:
   0:   d503245f        bti     c
   4:   1e612000        fcmp    d0, d1
   8:   5400008d        b.le    18 <__fmaximum+0x18>
   c:   1e60401f        fmov    d31, d0
  10:   1e6043e0        fmov    d0, d31
  14:   d65f03c0        ret
  18:   54000085        b.pl    28 <__fmaximum+0x28>  // b.nfrst
  1c:   1e60403f        fmov    d31, d1
  20:   1e6043e0        fmov    d0, d31
  24:   d65f03c0        ret
  28:   54000161        b.ne    54 <__fmaximum+0x54>  // b.any
  2c:   4f000402        movi    v2.4s, #0x0
  30:   1e6e101e        fmov    d30, #1.000000000000000000e+00
  34:   6ee0f842        fneg    v2.2d, v2.2d
  38:   4ea21c5d        mov     v29.16b, v2.16b
  3c:   2e7e1c22        bsl     v2.8b, v1.8b, v30.8b
  40:   2e7e1c1d        bsl     v29.8b, v0.8b, v30.8b
  44:   1e6223b0        fcmpe   d29, d2
  48:   1e61ac1f        fcsel   d31, d0, d1, ge // ge = tcont
  4c:   1e6043e0        fmov    d0, d31
  50:   d65f03c0        ret
  54:   1e61281f        fadd    d31, d0, d1
  58:   1e6043e0        fmov    d0, d31
  5c:   d65f03c0        ret

* patch:

0000000000000000 <__fmaximum>:
   0:   d503245f        bti     c
   4:   1e612000        fcmp    d0, d1
   8:   54000086        b.vs    18 <__fmaximum+0x18>
   c:   1e61681f        fmaxnm  d31, d0, d1
  10:   1e6043e0        fmov    d0, d31
  14:   d65f03c0        ret
  18:   1e61281f        fadd    d31, d0, d1
  1c:   1e6043e0        fmov    d0, d31
  20:   d65f03c0        ret

And with gcc-15 on x86_64:

* master:

0000000000000000 <__fmaximum>:
   0:   66 0f 2e c1             ucomisd %xmm1,%xmm0
   4:   77 56                   ja     5c <__fmaximum+0x5c>
   6:   66 0f 2e c8             ucomisd %xmm0,%xmm1
   a:   77 4c                   ja     58 <__fmaximum+0x58>
   c:   66 0f 2e c1             ucomisd %xmm1,%xmm0
  10:   7a 4e                   jp     60 <__fmaximum+0x60>
  12:   75 4c                   jne    60 <__fmaximum+0x60>
  14:   f3 0f 7e 1d 00 00 00    movq   0x0(%rip),%xmm3        # 1c <__fmaximum+0x1c>
  1b:   00
  1c:   f2 0f 10 15 00 00 00    movsd  0x0(%rip),%xmm2        # 24 <__fmaximum+0x24>
  23:   00
  24:   66 0f 28 e3             movapd %xmm3,%xmm4
  28:   66 0f 54 15 00 00 00    andpd  0x0(%rip),%xmm2        # 30 <__fmaximum+0x30>
  2f:   00
  30:   66 0f 54 e0             andpd  %xmm0,%xmm4
  34:   66 0f 54 d9             andpd  %xmm1,%xmm3
  38:   66 0f 56 e2             orpd   %xmm2,%xmm4
  3c:   66 0f 56 d3             orpd   %xmm3,%xmm2
  40:   f2 0f c2 d4 02          cmplesd %xmm4,%xmm2
  45:   66 0f 54 c2             andpd  %xmm2,%xmm0
  49:   66 0f 55 d1             andnpd %xmm1,%xmm2
  4d:   66 0f 56 c2             orpd   %xmm2,%xmm0
  51:   c3                      ret
  52:   66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
  58:   66 0f 28 c1             movapd %xmm1,%xmm0
  5c:   c3                      ret
  5d:   0f 1f 00                nopl   (%rax)
  60:   f2 0f 58 c1             addsd  %xmm1,%xmm0
  64:   c3                      ret

* patched:

0000000000000000 <__fmaximum>:
   0:   66 0f 2e c1             ucomisd %xmm1,%xmm0
   4:   7a 2a                   jp     30 <__fmaximum+0x30>
   6:   77 18                   ja     20 <__fmaximum+0x20>
   8:   66 0f 2e c8             ucomisd %xmm0,%xmm1
   c:   77 08                   ja     16 <__fmaximum+0x16>
   e:   66 0f 50 c0             movmskpd %xmm0,%eax
  12:   a8 01                   test   $0x1,%al
  14:   74 0a                   je     20 <__fmaximum+0x20>
  16:   66 0f 28 c1             movapd %xmm1,%xmm0
  1a:   c3                      ret
  1b:   0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
  20:   66 0f 28 c8             movapd %xmm0,%xmm1
  24:   66 0f 28 c1             movapd %xmm1,%xmm0
  28:   c3                      ret
  29:   0f 1f 80 00 00 00 00    nopl   0x0(%rax)
  30:   f2 0f 58 c8             addsd  %xmm0,%xmm1
  34:   66 0f 28 c1             movapd %xmm1,%xmm0
  38:   c3                      ret

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu,
riscv64-linux-gnu-rv64imafdc-lp64d, and loongarch64-linux-gnuf64.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Order signed zeros in f{max,min}mag{f,l,f128}
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:21 +0000 (10:02 -0300)] 
math: Order signed zeros in f{max,min}mag{f,l,f128}

The functions are documented to behave like fmax/fmin when the
arguments have the same absolute value.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu,
riscv64-linux-gnu-rv64imafdc-lp64d, and loongarch64-linux-gnuf64.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Order signed zeros in f{max,min}{f,l,f128}
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:20 +0000 (10:02 -0300)] 
math: Order signed zeros in f{max,min}{f,l,f128}

The C standard (at least from C99 until C23) does not require
fmin/fmax to order zeros by their sign, so glibc's previous behavior
was entirely standards-conforming.  However, the standard does
recommend that zeros be ordered in a footnote, saying:

"If possible, fmax is sensitive to the sign of zero, for example
fmax(−0.0, +0.0) ideally returns +0."

As this is indeed possible (and not too complicated), implement it as
a quality-of-implementation improvement.  It also remove possible
deviations between architectures, where for some architectures that
has direct mapping instruction (USE_FMA*_BUILTIN) they already do
the ordering.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu,
riscv64-linux-gnu-rv64imafdc-lp64d, and loongarch64-linux-gnuf64.

Co-authored-by: James Y Knight <jyknight@google.com>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agoi386: Remove f{max,min} assembly implementations
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:19 +0000 (10:02 -0300)] 
i386: Remove f{max,min} assembly implementations

The sNaN handling on i386 was not properly implemented or tested due to
ABI and compiler constraints [1] [2], and although GCC has an open bug
to try to fix at least the sNaN in the function call arguments [3], it
will most likely never be fixed.

To simplify the fix or the order signed zeros and make f{fmin,fmax} behave
semantically equal to the rest of the f{min,max}* function, this patch
removes all i386 assembly optimizations.  The f{min,max} functions should
not be hotspots in any meaningful code people are running on i386 nowadays.

Checked on i686-linux-gnu.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57484#c11
[2] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5aa4a1a1fd742479818a668d42d91ca9ec4a6318
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56831

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agox86_64: Remove f{max,min} assembly implementations
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:18 +0000 (10:02 -0300)] 
x86_64: Remove f{max,min} assembly implementations

Using recent gcc, the generic implementation generates the same code
for normal and subnormal numbers for float/double.

For long double, the generic implementations generates slight worse
code for the fast-path.  With gcc-15:

* sysdeps/x86_64/fpu/s_fmaxl.S

  fldt    8(%rsp)
  fldt    24(%rsp)
  fucomi  %st(1), %st
  jp      2f
  fcmovb  %st(1), %st
  fstp    %st(1)
  ret

* generic

  fldt     0x8(%rsp)
  fldt     0x18(%rsp)
  fucomi   %st(1),%st
  jp       18 <__fmaxl+0x18>
  fxch     %st(1)
  fcomi    %st(1),%st
  fcmovbe  %st(1),%st
  fstp     %st(1)
  ret

It could be optimized by using isgreater instead of a direct comparison
for the non unordered, but this prevents x86 to issue maxsd.

Checked on x86_64-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Simplify f{max,min}mag template
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:17 +0000 (10:02 -0300)] 
math: Simplify f{max,min}mag template

On aarch64 with gcc-15 it optimizes the fast-path slightly, for fmaxmag:

* master

0000000000000000 <__fmaxmag>:
   0:   d503245f        bti     c
   4:   1e60c01e        fabs    d30, d0
   8:   1e60c03f        fabs    d31, d1
   c:   1e7f23c0        fcmp    d30, d31
  10:   5400004d        b.le    18 <__fmaxmag+0x18>
  14:   d65f03c0        ret
  18:   54000065        b.pl    24 <__fmaxmag+0x24>  // b.nfrst
  1c:   1e604020        fmov    d0, d1
  20:   d65f03c0        ret
  24:   540001e0        b.eq    60 <__fmaxmag+0x60>  // b.none
  [...]
  60:   1e612010        fcmpe   d0, d1
  64:   1e61cc00        fcsel   d0, d0, d1, gt
  68:   d65f03c0        ret

* patch:

0000000000000000 <__fmaxmag>:
   0:   d503245f        bti     c
   4:   1e612000        fcmp    d0, d1
   8:   540000e6        b.vs    24 <__fmaxmag+0x24>
   c:   1e60c01f        fabs    d31, d0
  10:   1e60c03e        fabs    d30, d1
  14:   1e7e23e0        fcmp    d31, d30
  18:   540001c0        b.eq    50 <__fmaxmag+0x50>  // b.none
  1c:   1e60dc20        fcsel   d0, d1, d0, le
  20:   d65f03c0        ret
  [...]
  50:   1e612010        fcmpe   d0, d1
  54:   1e61cc00        fcsel   d0, d0, d1, gt
  58:   d65f03c0        ret
  [...]

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu,
riscv64-linux-gnu-rv64imafdc-lp64d, and loongarch64-linux-gnuf64.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Simplify f{max,min} template
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:16 +0000 (10:02 -0300)] 
math: Simplify f{max,min} template

On x86_64, it allows the fast path (normal/subnormal inputs) to use maxsd.
With gcc-15 targetting x86_64 for fmax:

* master:

        ucomisd xmm0, xmm1
        jnb     .L1
        ucomisd xmm1, xmm0
        ja      .L13
        [...]
.L13:
        movapd  xmm0, xmm1
.L1:
        ret

* patch;

        ucomisd xmm0, xmm1
        jp      .L2
        maxsd   xmm0, xmm1
        ret

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agox86: Add __issignalingl inline
Adhemerval Zanella [Fri, 23 Jan 2026 13:02:15 +0000 (10:02 -0300)] 
x86: Add __issignalingl inline

Checked on x86_64-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
12 days agomath: Add __issignaling inline
Wilco Dijkstra [Fri, 23 Jan 2026 13:02:14 +0000 (10:02 -0300)] 
math: Add __issignaling inline

Add __issignaling inline based on the issignaling_inline implementation.
Improve the __issignalingf inline.  Remove issignaling(f)_inline and its uses.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
13 days agomanual: Document //TRANSLIT and //IGNORE support in iconv_open [BZ #3794]
Avinal Kumar [Mon, 2 Feb 2026 15:26:13 +0000 (16:26 +0100)] 
manual: Document //TRANSLIT and //IGNORE support in iconv_open [BZ #3794]

The //TRANSLIT and //IGNORE suffix supported by iconv_open
was not documented in the glibc manual.  This commit adds the
documentation for the suffixes.

This fixes BZ #3794.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
13 days agomanual: Document that iconv buffers may not overlap
Florian Weimer [Mon, 2 Feb 2026 14:20:57 +0000 (15:20 +0100)] 
manual: Document that iconv buffers may not overlap

As discussed here:

  Re: [bug-gnu-libiconv] iconv and overlapping input/output buffers
  <https://lists.gnu.org/archive/html/bug-gnu-libiconv/2026-01/msg00002.html>

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agostdio-common: Assume support for 'long long'
Alejandro Colomar [Tue, 11 Nov 2025 13:29:28 +0000 (14:29 +0100)] 
stdio-common: Assume support for 'long long'

GCC supports 'long long' since essentially forever.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agohurd: copy over start/end and entry too on fork
Samuel Thibault [Sat, 31 Jan 2026 16:04:53 +0000 (17:04 +0100)] 
hurd: copy over start/end and entry too on fork

gdb needs them to properly find libraries etc.

2 weeks agomanual: Fix some typos in the Threads chapter.
Collin Funk [Wed, 28 Jan 2026 07:44:51 +0000 (23:44 -0800)] 
manual: Fix some typos in the Threads chapter.

2 weeks agomanual: Fix some typos in the Low-Level Terminal Interface chapter.
Collin Funk [Wed, 28 Jan 2026 07:40:22 +0000 (23:40 -0800)] 
manual: Fix some typos in the Low-Level Terminal Interface chapter.

2 weeks agoriscv: Disable multiarch memset variants when !IS_IN(libc)
Yao Zihong [Mon, 26 Jan 2026 21:28:00 +0000 (15:28 -0600)] 
riscv: Disable multiarch memset variants when !IS_IN(libc)

This patch disables multiarch memset variants when !IS_IN(libc),
because rtld can only use a single fixed implementation.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoriscv: Disable multiarch memcpy variants when !IS_IN(libc)
Yao Zihong [Mon, 26 Jan 2026 21:24:40 +0000 (15:24 -0600)] 
riscv: Disable multiarch memcpy variants when !IS_IN(libc)

This patch disables multiarch memcpy variants when !IS_IN(libc),
because rtld can only use a single fixed implementation.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoposix: Run tst-wordexp-reuse-mem test
Florian Weimer [Mon, 26 Jan 2026 16:12:37 +0000 (17:12 +0100)] 
posix: Run tst-wordexp-reuse-mem test

The test was not properly scheduled for execution with a Makefile
dependency.

Fixes commit 80cc58ea2de214f85b0a1d902a3b668ad2ecb302 ("posix: Reset
wordexp_t fields with WRDE_REUSE (CVE-2025-15281 / BZ 33814").

2 weeks agomanual: Updates for the dynamic linker hardening recommendations
Florian Weimer [Mon, 26 Jan 2026 15:56:45 +0000 (16:56 +0100)] 
manual: Updates for the dynamic linker hardening recommendations

This update addresses text relocations, and clarifies
constructor/destructor priorities by mentioning the relevant
GCC attributes.

2 weeks agodlfcn: Add dlinfo request type RTLD_DI_ORIGIN_PATH (bug #24298)
Arjun Shankar [Mon, 26 Jan 2026 12:49:37 +0000 (13:49 +0100)] 
dlfcn: Add dlinfo request type RTLD_DI_ORIGIN_PATH (bug #24298)

The existing dlinfo request type RTLD_DI_ORIGIN used for querying the
value of the '$ORIGIN' dynamic string token is prone to buffer
overflows.

This commit adds a new request type named RTLD_DI_ORIGIN_PATH that
returns a pointer to the dynamic string token (i.e. the 'l_origin' field
in the link map) instead.  The dlinfo manual is updated with the new
request type, and the description of RTLD_DI_ORIGIN is updated to
recommend RTLD_DI_ORIGIN_PATH instead.

A test for the new request type is also added to tst-dlinfo.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 weeks agopo: Incorporate translatins (nl updated, ar new)
Andreas K. Hüttel [Mon, 26 Jan 2026 00:29:30 +0000 (01:29 +0100)] 
po: Incorporate translatins (nl updated, ar new)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoFix ldbl-128ibm ceill, floorl, roundl and truncl zero-sign handling
Aurelien Jarno [Tue, 20 Jan 2026 17:25:08 +0000 (18:25 +0100)] 
Fix ldbl-128ibm ceill, floorl, roundl and truncl zero-sign handling

When the result of ceill, floorl, roundl and truncl is zero, the sign of
the result must match the sign of the input. For the IBM 128-bit long
double format, the sign is determined by the high part.

Ensure the correct sign when the high part is the result of
computations, by copying the sign from the input high part to the output
high part. On POWER, this conveniently maps to the fcpsgn instruction.

In addition add test for the values provided in BZ #33623, and for the
opposite value when the result is 0.

Fixes: BZ #33623
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agomalloc: Correct Makefile sorting glitches
Florian Weimer [Sat, 24 Jan 2026 09:29:39 +0000 (10:29 +0100)] 
malloc: Correct Makefile sorting glitches

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agosupport: Reinitialize containers if /etc is present
Florian Weimer [Sat, 24 Jan 2026 09:29:39 +0000 (10:29 +0100)] 
support: Reinitialize containers if /etc is present

This prevents test failures because configuration file leftovers
unexpectedly change glibc for future tests.  Whether this
triggers depends on test execution order.

Adding postclean.req files manually (before this change) appears
too error-prone.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agosupport: Add support_hardcoded_paths_in_test
Florian Weimer [Sat, 24 Jan 2026 09:29:22 +0000 (10:29 +0100)] 
support: Add support_hardcoded_paths_in_test

It indicates whether glibc was configured with
--enable-hardcoded-path-in-tests.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agosupport: Fix memory leaks in support_subprogram, support_subprogram_wait
Florian Weimer [Sat, 24 Jan 2026 09:29:22 +0000 (10:29 +0100)] 
support: Fix memory leaks in support_subprogram, support_subprogram_wait

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agostdlib: Do not run tst-system subtest with RLIMIT_NPROC as root
Florian Weimer [Sat, 24 Jan 2026 09:29:22 +0000 (10:29 +0100)] 
stdlib: Do not run tst-system subtest with RLIMIT_NPROC as root

RLIMIT_NPROC is typically ignored by root users with capabilities.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
3 weeks agoversion.h: Increase version number glibc-2.43.9000
Andreas K. Hüttel [Fri, 23 Jan 2026 22:51:31 +0000 (23:51 +0100)] 
version.h: Increase version number

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoNEWS: add 2.44 section
Andreas K. Hüttel [Fri, 23 Jan 2026 22:50:10 +0000 (23:50 +0100)] 
NEWS: add 2.44 section

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoCreate ChangeLog.old/ChangeLog.32 glibc-2.43
Andreas K. Hüttel [Fri, 23 Jan 2026 20:54:00 +0000 (21:54 +0100)] 
Create ChangeLog.old/ChangeLog.32

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoversion.h, include/features.h: Increase version number
Andreas K. Hüttel [Fri, 23 Jan 2026 20:49:16 +0000 (21:49 +0100)] 
version.h, include/features.h: Increase version number

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agocontrib.texi: Add missing accent
Andreas K. Hüttel [Fri, 23 Jan 2026 11:22:19 +0000 (12:22 +0100)] 
contrib.texi: Add missing accent

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agotst-cond23: add <support/test-driver.h> include
Aurelien Jarno [Sun, 18 Jan 2026 17:47:00 +0000 (18:47 +0100)] 
tst-cond23: add <support/test-driver.h> include

This is needed for the recently added EXIT_UNSUPPORTED return value.
Message-ID: <20260118174700.495539-1-aurelien@aurel32.net>

3 weeks agoinstall.texi, INSTALL: update versions
Andreas K. Hüttel [Thu, 22 Jan 2026 22:18:14 +0000 (23:18 +0100)] 
install.texi, INSTALL: update versions

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agocontrib.texi: Updates
Andreas K. Hüttel [Thu, 22 Jan 2026 22:11:05 +0000 (23:11 +0100)] 
contrib.texi: Updates

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoNEWS: Insert list of fixed security advisories
Andreas K. Hüttel [Thu, 22 Jan 2026 21:00:10 +0000 (22:00 +0100)] 
NEWS: Insert list of fixed security advisories

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoNEWS: Mention build issues due to const-preserving macros
Andreas K. Hüttel [Thu, 22 Jan 2026 16:20:55 +0000 (17:20 +0100)] 
NEWS: Mention build issues due to const-preserving macros

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoNEWS: Insert list of fixed bugs
Andreas K. Hüttel [Thu, 22 Jan 2026 16:33:34 +0000 (17:33 +0100)] 
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 [Thu, 22 Jan 2026 16:12:18 +0000 (17:12 +0100)] 
NEWS: Editorial changes

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoNEWS: Additional items and minor consolidation
Andreas K. Hüttel [Thu, 22 Jan 2026 16:04:32 +0000 (17:04 +0100)] 
NEWS: Additional items and minor consolidation

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoNEWS: Group ISO C23 related changes
Andreas K. Hüttel [Thu, 22 Jan 2026 11:56:58 +0000 (12:56 +0100)] 
NEWS: Group ISO C23 related changes

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agopo: Incorporate translations
Andreas K. Hüttel [Thu, 22 Jan 2026 11:44:43 +0000 (12:44 +0100)] 
po: Incorporate translations

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoUpdate advisory text for GLIBC-SA-2026-0003
Adhemerval Zanella [Wed, 21 Jan 2026 16:38:46 +0000 (13:38 -0300)] 
Update advisory text for GLIBC-SA-2026-0003

Add all of the Fix-Commit lines for fixed branches.

Fixes were tested and committed up to glibc-2.31.

3 weeks agoAdd advisory text for CVE-2025-15281
Carlos O'Donell [Fri, 16 Jan 2026 23:46:43 +0000 (18:46 -0500)] 
Add advisory text for CVE-2025-15281

Explain the security issue and set context for the vulnerability to help
downstreams get a better understanding of the issue.

Reviewed-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
3 weeks agoposix: Reset wordexp_t fields with WRDE_REUSE (CVE-2025-15281 / BZ 33814)
Adhemerval Zanella [Thu, 15 Jan 2026 13:32:19 +0000 (10:32 -0300)] 
posix: Reset wordexp_t fields with WRDE_REUSE (CVE-2025-15281 / BZ 33814)

The wordexp fails to properly initialize the input wordexp_t when
WRDE_REUSE is used. The wordexp_t struct is properly freed, but
reuses the old wc_wordc value and updates the we_wordv in the
wrong position.  A later wordfree will then call free with an
invalid pointer.

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

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agolibc.pot: regenerate
Andreas K. Hüttel [Mon, 19 Jan 2026 15:24:36 +0000 (16:24 +0100)] 
libc.pot: regenerate

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoLinux: fix tst-copy_file_range-large failure in 32-bit glibc build on 64-bit kernel...
Xi Ruoyao [Thu, 15 Jan 2026 08:24:57 +0000 (16:24 +0800)] 
Linux: fix tst-copy_file_range-large failure in 32-bit glibc build on 64-bit kernel [BZ 33790]

Reported-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Tested-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoelf: Ignore LD_PROFILE if LD_PROFILE_OUTPUT is not set (bug 33797)
Florian Weimer [Thu, 15 Jan 2026 21:29:46 +0000 (22:29 +0100)] 
elf: Ignore LD_PROFILE if LD_PROFILE_OUTPUT is not set (bug 33797)

The previous default for LD_PROFILE_OUTPUT, /var/tmp, is insecure
because it's typically a 1777 directory, and other systems could
place malicious files there which interfere with execution.

Requiring the user to specify a profiling directory mitigates
the impact of bug 33797.  Clear LD_PROFILE_OUTPUT alongside
with LD_PROFILE.

Rework the test not to use predictable file names.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 weeks agohurd: make __thread_set_pcsptp align stack
Samuel Thibault [Sat, 17 Jan 2026 14:15:33 +0000 (15:15 +0100)] 
hurd: make __thread_set_pcsptp align stack

When cancelling a thread, __pthread_do_cancel forces calling call_exit,
but we need to align down the stack, so any further SSE use can work.

4 weeks agoUpdate advisory text for CVE-2026-0951
Carlos O'Donell [Fri, 16 Jan 2026 22:12:24 +0000 (17:12 -0500)] 
Update advisory text for CVE-2026-0951

Add all of the Fix-Commit lines for fixed branches.

Fixes were tested and committed up to glibc-2.32 (last actively
maintained branch).

4 weeks agoAdd advisory text for CVE-2026-0951
Carlos O'Donell [Fri, 16 Jan 2026 13:14:49 +0000 (08:14 -0500)] 
Add advisory text for CVE-2026-0951

Explain the security issue and set context for the vulnerability to help
downstreams get a better understanding of the issue.

Reviewed-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
4 weeks agoAdd advisory text for CVE-2026-0861
Siddhesh Poyarekar [Thu, 15 Jan 2026 22:03:38 +0000 (17:03 -0500)] 
Add advisory text for CVE-2026-0861

Explain the security issue and set context for the vulnerability to help
downstreams get a better understanding of the issue.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 weeks agoresolv: Fix NSS DNS backend for getnetbyaddr (CVE-2026-0915)
Carlos O'Donell [Thu, 15 Jan 2026 20:09:38 +0000 (15:09 -0500)] 
resolv: Fix NSS DNS backend for getnetbyaddr (CVE-2026-0915)

The default network value of zero for net was never tested for and
results in a DNS query constructed from uninitialized stack bytes.
The solution is to provide a default query for the case where net
is zero.

Adding a test case for this was straight forward given the existence of
tst-resolv-network and if the test is added without the fix you observe
this failure:

FAIL: resolv/tst-resolv-network
original exit status 1
error: tst-resolv-network.c:174: invalid QNAME: \146\218\129\128
error: 1 test failures

With a random QNAME resulting from the use of uninitialized stack bytes.

After the fix the test passes.

Additionally verified using wireshark before and after to ensure
on-the-wire bytes for the DNS query were as expected.

No regressions on x86_64.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomemalign: reinstate alignment overflow check (CVE-2026-0861)
Siddhesh Poyarekar [Thu, 15 Jan 2026 11:06:40 +0000 (06:06 -0500)] 
memalign: reinstate alignment overflow check (CVE-2026-0861)

The change to cap valid sizes to PTRDIFF_MAX inadvertently dropped the
overflow check for alignment in memalign functions, _mid_memalign and
_int_memalign.  Reinstate the overflow check in _int_memalign, aligned
with the PTRDIFF_MAX change since that is directly responsible for the
CVE.  The missing _mid_memalign check is not relevant (and does not have
a security impact) and may need a different approach to fully resolve,
so it has been omitted.

CVE-Id: CVE-2026-0861
Vulnerable-Commit: 9bf8e29ca136094f73f69f725f15c51facc97206
Reported-by: Igor Morgenstern, Aisle Research
Fixes: BZ #33796
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
4 weeks agomalloc: Add tst-mallocfork to tests-exclude-threaded exception list
Arjun Shankar [Tue, 13 Jan 2026 16:59:26 +0000 (17:59 +0100)] 
malloc: Add tst-mallocfork to tests-exclude-threaded exception list

Commit 244c404ae85003f45aa491a50b6902655ee2df15 added -threaded-main and
-threaded-worker variants of several malloc tests with some exceptions.

tst-mallocfork calls fork from a signal handler, leading to sporadic
deadlocks when multi-threaded since fork is not AS-safe when
multi-threading.  This commit therefore adds tst-mallocfork to the
appropriate exception list.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoaarch64: Fix LD_AUDIT with GCS in permissive mode
Adhemerval Zanella [Wed, 7 Jan 2026 16:52:39 +0000 (13:52 -0300)] 
aarch64: Fix LD_AUDIT with GCS in permissive mode

In permissive mode, during audit module handling, check_gcs is unaware
that it is handling audit modules rather than the binary itself.  It
causes the loader to fail to load the audit module, rather than
loading it and disabling GCS.

Also extends GCS tests with 4 LD_AUDIT tests:

1. tst-gcs-audit-disabled: checks if the audit module without GCS
   marking is loaded with default gcs support.

2. tst-gcs-audit-enforced: checks if the audit module without GCS
   marking is not loaded when GCS is enforced.

3. tst-gcs-audit-optional: checks if the audit module without GCS
   marking is loaded when GCS is optional.

4. tst-gcs-audit-override: check if the audit modules without GCS
   marking is loaded when GCS is overrided.

Checked on aarch64-linux-gnu with Linux 6.18 on Apple M4 emulated (for
BTI support) and on qemu 10.1.50 simulated (for GCS).

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
Tested-by: Yury Khrustalev <yury.khrustalev@arm.com>
4 weeks agoaarch64: Add LD_PRELOAD tests for GCS handling
Adhemerval Zanella [Wed, 7 Jan 2026 16:52:38 +0000 (13:52 -0300)] 
aarch64: Add LD_PRELOAD tests for GCS handling

There are modeled after the 'shared' tests subset and it adds 4 new
tests:

1. tst-gcs-preload-disabled: checks if GCS is disabled when a LD_PRELOAD
   module is used without GCS marking with default GCS support.

2. tst-gcs-preload-enforced-abort: chekcs if loader aborts startup when
   a LD_PRELOAD is used without GCS marking and GCS is enforced.

3. tst-gcs-preload-optional: checks if GCS is disabled when a LD_PRELOAD
   is used without GCS marking and GCS is optional.

4. tst-gcs-preload-override: checks if GCS is enabled when a LD_PRELOAD
   is used without GCS marking and GCS is overrided.

Checked on aarch64-linux-gnu with Linux 6.18 on Apple M4 emulated (for
BTI support) and on qemu 10.1.50 simulated (for GCS).

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
Tested-by: Yury Khrustalev <yury.khrustalev@arm.com>
4 weeks agoaarch64: Add LD_AUDIT tests for BTI handling
Adhemerval Zanella [Wed, 7 Jan 2026 16:52:37 +0000 (13:52 -0300)] 
aarch64: Add LD_AUDIT tests for BTI handling

This patch adds 3 new tests:

1. tst-bti-permissive-audit: checks that process runs when an LD_AUDIT module
   not marked with BTI but BTI is not enforced.

2. tst-bti-prot-audit: checks if the process correctly handles audit module with
   BTI marking when BTI is enforced.

3. tst-bti-unprot-audit: check if the process ignores an audit module without
   BTI marking when BTI is enforced.

Checked on aarch64-linux-gnu with Linux 6.18 on Apple M4 emulated (for
BTI support) and on qemu 10.1.50 simulated (for GCS).

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
Tested-by: Yury Khrustalev <yury.khrustalev@arm.com>