Commit Graph

43308 Commits

Author SHA1 Message Date
Samuel Thibault 0bbeb1fd13 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.
2026-01-17 15:15:33 +01:00
Carlos O'Donell 872cc459a9 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).
2026-01-16 17:12:24 -05:00
Carlos O'Donell ffe48207fd 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>
2026-01-16 10:20:56 -05:00
Siddhesh Poyarekar 75d8c149f8 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>
2026-01-16 09:32:51 -05:00
Carlos O'Donell e56ff82d50 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>
2026-01-16 08:20:10 -05:00
Siddhesh Poyarekar c9188d3337 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: 9bf8e29ca1
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>
2026-01-15 16:19:50 -05:00
Arjun Shankar 289d3283b6 malloc: Add tst-mallocfork to tests-exclude-threaded exception list
Commit 244c404ae8 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>
2026-01-15 17:00:08 +01:00
Adhemerval Zanella 088a2055da 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>
2026-01-14 15:00:24 -03:00
Adhemerval Zanella e304c9cbf7 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>
2026-01-14 14:33:27 -03:00
Adhemerval Zanella cc098e61b0 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>
2026-01-14 14:33:25 -03:00
Adhemerval Zanella 99207945fb aarch64: Add LD_PRELOAD tests for BTI handling
Add 3 new tests to check if LD_PRELOAD is correctly handled:

1. tst-bti-abort-unprot-preload: checks if the process is aborted if
   a LD_PRELOAD module without BTI marking is used and BTI is enforced.

2. tst-bti-dep-prot-preload: checks if the process works correctly if
   a LD_PRELOAD module with BTI marking is used and BTI is enforced.

3. tst-bti-permissive-preload: checks if the process works correctly
   if a LD_PRELOAD module with BTI marking is used and BTI is not
   enforced.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
Tested-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-01-14 14:33:22 -03:00
Adhemerval Zanella ae62786747 Revert "x86: Do not use __builtin_fpclassify for _Float64x/long double"
This reverts commit 5011210399. It
breaks libstdc++ and other languages bootstrap.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-01-14 14:33:20 -03:00
Adhemerval Zanella 9e822788e5 Revert "x86: Do not use __builtin_isinf_sign for _Float64x/long double"
This reverts commit 999cd617cb.  It
breaks libstdc++ and other languages bootstrap.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-01-14 14:33:16 -03:00
Yury Khrustalev 5d1cb431aa aarch64: update NEWS for 2.43 release
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2026-01-13 13:26:27 +00:00
Yury Khrustalev 99b8ec8fd4 aarch64: Add LD_DEBUG=security to log BTI and GCS warnings
Introduce DL_DEBUG_SECURITY mask to enable messages related to
loading modules that lack certain target-dependent hardening
or security features.

Use this mask for warnings related to AArch64 BTI and GCS.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-01-13 09:33:04 +00:00
Samuel Thibault 274441f62a tst-if_nameindex.c: Fix minimum buffer size
The standard says that the buffer given to if_indextoname shall have at
least IF_NAMESIZE bytes.
2026-01-12 21:24:40 +01:00
Sachin Monga f05ab7c4a9 ldbl-128ibm-compat: Add local aliases for printf family symbols
When the compiler selects IEEE-128 long double ABI(-mabi=ieeelongdouble),
calls to printf, fprintf, sprintf and snprintf are redirected to the
__printfieee128, __fprintfieee128, __sprintfieee128 and __snprintfieee128
symbols respectively.  This causes "break printf" (and others) in
GDB to fail because the original symbol names do not exist as global
symbols in libc.so.6.

Fix this by adding local symbol aliases in the ieee128 compatibility
files so that the original symbol names are present in the symbol table
again.  This restores the expected GDB behavior ("break printf" works)
without requiring dynamic symbols or versioned compatibility symbols.

Suggested-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-01-12 12:40:29 -05:00
Adhemerval Zanella e56b3faf8d math: Fix powerpc64le -Os build after 6b7067460f
The __USE_EXTERN_INLINES is gated __OPTIMIZE_SIZE__, so also gated
the alias required using the same logic.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-01-12 10:34:42 -03:00
Adhemerval Zanella 422c3a5baf x86: Fix x86_64 build failure with -Os (BZ 33367)
The 13cfd77bf5 change broke the b5d88fa6c3 fix by removing the symbol
to __symbol redirections.  Although it works for -O2 with both gcc
and clang, with -Os without the redirection, the libcall might still
be issued.

This patch reinstates the b5d88fa6c3 fix, with a modification that
allows each ifunc variant to control which trunc to issue.  This is
required for clang, which defines HAVE_X86_INLINE_TRUNC to 1 (meaning
that trunc will always be lowered to the instruction on -Os).

Checked on x86_64-linux-gnu with -O2 and -Os with gcc-15 and clang-18.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-01-12 10:34:40 -03:00
Adhemerval Zanella 8efe2b03db math: Sync acosh from CORE-MATH
The CORE-MATH c423b9a3 commit made atanh to use a slight different
muldd_acc and polydd (which uses muldd_acc internally) compared
to previous version.

The new tests were suggested by Paul Zimmermann (although I did
not see any regression).

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

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-01-12 10:34:38 -03:00
Adhemerval Zanella 05b46df987 math: Sync atanh from CORE-MATH
The CORE-MATH c423b9a3 commit made atanh to use a slight different
muldd_acc, mulddd, and polydd (which uses muldd_acc internally)
compare to asinh and acosh.

The new tests were suggested by Paul Zimmermann (although I did
not see any regression).

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

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-01-12 10:34:35 -03:00
Adhemerval Zanella eafea63c11 math: Sync asinh from CORE-MATH
The CORE-MATH commit cd653cf7 fixes some issues for RNDZ (below).

testing double (without inline functions)
Failure: Test: asinh_towardzero (0x1.07888cc76eb3cp-4)
Result:
 is:          6.4294901954893124e-02   0x1.075a175321f74p-4
 should be:   6.4294901954893110e-02   0x1.075a175321f73p-4
 difference:  1.3877787807814456e-17   0x1.0000000000000p-56
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: asinh_towardzero (0x1.07888e17d0fep-4)
Result:
 is:          6.4294906839823556e-02   0x1.075a18a2d2922p-4
 should be:   6.4294906839823542e-02   0x1.075a18a2d2921p-4
 difference:  1.3877787807814456e-17   0x1.0000000000000p-56
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: asinh_towardzero (0x1.07888e344d64ep-4)
Result:
 is:          6.4294907253493294e-02   0x1.075a18bf3fed0p-4
 should be:   6.4294907253493280e-02   0x1.075a18bf3fecfp-4
 difference:  1.3877787807814456e-17   0x1.0000000000000p-56
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: asinh_towardzero (0x1.07888e45219adp-4)
Result:
 is:          6.4294907497881415e-02   0x1.075a18d00b3f4p-4
 should be:   6.4294907497881401e-02   0x1.075a18d00b3f3p-4
 difference:  1.3877787807814456e-17   0x1.0000000000000p-56
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: asinh_towardzero (0x1.0788946685afp-4)
Result:
 is:          6.4294930288402857e-02   0x1.075a1eee32572p-4
 should be:   6.4294930288402843e-02   0x1.075a1eee32571p-4
 difference:  1.3877787807814456e-17   0x1.0000000000000p-56
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: asinh_towardzero (0x1.07889a0cffe1fp-4)
Result:
 is:          6.4294951293986671e-02   0x1.075a2491b07a9p-4
 should be:   6.4294951293986657e-02   0x1.075a2491b07a8p-4
 difference:  1.3877787807814456e-17   0x1.0000000000000p-56
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: asinh_towardzero (0x1.07889cddeccf9p-4)
Result:
 is:          6.4294961763186983e-02   0x1.075a276120993p-4
 should be:   6.4294961763186969e-02   0x1.075a276120992p-4
 difference:  1.3877787807814456e-17   0x1.0000000000000p-56
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: asinh_towardzero (0x1.07889efd3a82bp-4)
Result:
 is:          6.4294969652980468e-02   0x1.075a297f4f503p-4
 should be:   6.4294969652980454e-02   0x1.075a297f4f502p-4
 difference:  1.3877787807814456e-17   0x1.0000000000000p-56
 ulp       :  1.0000
 max.ulp   :  0.0000
Maximal error of `asinh_towardzero'
 is      : 1 ulp
 accepted: 0 ulp

The muldd was renamed to muldd_acc to avoid deviate from CORE-MATH
(the symbol and logic in replicated on multiple implementation,
different than glibc we consolidate it on ddcoremath.h).

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

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-01-12 10:34:32 -03:00
Yury Khrustalev 0ca2eb1194 aarch64: Fix error messages for GCS and BTI incompatible modules
When either program path of module name is empty, don't print an
empty string followed by a colon.

Also fix-up test for a static BTI binary to check error message
for this case.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-01-12 09:32:16 +00:00
Samuel Thibault e539a26999 hurd: Fix sigreturn clobbering some xmm registers
__sigreturn2 uses _hurd_sigstate_unlock after restoring the interrupted
xmm values, we thus need it not to touch xmm. It makes sense to inline
sigstate_is_global_rcv _hurd_sigstate_lock/unlock anyway. unlock calls
gsync_wake, so we need to avoid xmm there as well.
2026-01-11 02:03:31 +01:00
Xi Ruoyao bcf231ec71
Linux: test sizes larger than UINT_MAX for copy_file_range
If the kernel supports the COPY_FILE_RANGE_64 FUSE interface, we can
safely tests the large size values.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Tested-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-01-09 12:19:52 +01:00
Xi Ruoyao ee77bb99b7
Update the bundled <linux/fuse.h> userspace header from Linux 6.18
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-01-09 12:19:49 +01:00
Xi Ruoyao dc700cc2c6
Linux: fix copy_file_range test on Linux >= 6.18
On Linux >= 6.18, the kernel submits the new COPY_FILE_RANGE_64
operation to the fuse implementation for large files.  There is a
fall-back routine to COPY_FILE_RANGE but it's only used if
COPY_FILE_RANGE_64 returns ENOSYS.

So, return ENOSYS instead of EIO for "unsupported" operations in order
to make the kernel do the correct thing for this case and maybe in case
that a new operation is added into the kernel fuse interface in the
future.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-01-09 12:19:46 +01:00
Florian Weimer 78fdb2d6b1 Switch currency symbol for the bg_BG locale to euro
Bulgaria joined the eurozone on 2026-01-01.

Suggested-by: Йордан Гигов <jgigov@abv.bg>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2026-01-09 10:39:34 +01:00
Yury Khrustalev 755798985d aarch64: Fix PT_GNU_PROPERTY checks for static exe (BZ 33713)
All checks related to the PT_GNU_PROPERTY bits would be skipped
if the binary had no PT_GNU_PROPERTY note at all. This meant that
enforcing an abort when some bits are not present was not possible.

Fixes BZ 33713

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-01-05 10:51:05 +00:00
Samuel Thibault 063d6815f3 tst-sig-redzone: Decorate assembly function
To make sure to put it into .text, and let debugging tools know about it.
2026-01-04 21:55:04 +01:00
Samuel Thibault d942f309e3 hurd: check that signal processing does not hurt the x86_64 redzone 2026-01-04 21:42:08 +01:00
Samuel Thibault b61699f95b hurd: also test mmx state restoration
mmx registers are not the same as mmx, so better test them too
2026-01-04 20:27:09 +01:00
Joan Lledó 9307ff1073 mach/hurd: add `bits/in.h`
This defines `IP_PKTINFO` and `struct in_pktinfo`
Message-ID: <20260104102835.9373-2-jlledom@mailfence.com>
2026-01-04 11:31:59 +01:00
Paul Eggert a4669376d0 Better terminology for ‘long double’ in manual
* manual/math.texi (Mathematical Constants):
Don’t say that long double is “the same as” double, as the
types remain distinct (problem reported by Keith Thompson).
Also, don’t imply that float is the “narrowest”, as floating
point types don’t have widths in Standard C.  Instead, talk
about precision and exponent range.
2026-01-03 10:27:52 -08:00
Paul Eggert 2e9ed6f045 Update copyright dates not handled by scripts/update-copyrights
I've updated copyright dates in glibc for 2026.  This is the patch for
the changes not generated by scripts/update-copyrights.
2026-01-01 13:42:29 -08:00
Paul Eggert 66f3e9219d Update copyright dates with scripts/update-copyrights 2026-01-01 13:42:29 -08:00
Paul Eggert a9bf6a2a90 Pass glibc pre-commit checks
This is needed for the next patch which updates copyright dates.
* elf/sprof.c:
* sysdeps/unix/sysv/linux/tst-pidfd_getinfo.c:
Remove trailing white space.
* misc/tst-atomic.c: Remove trailing empty line.
2026-01-01 13:42:03 -08:00
Siddhesh Poyarekar 6c8af6a43c malloc_info: fix closing </sizes> tag typo
Fix regression in commit 7447efa962
("malloc: remove fastbin code from malloc_info") where the closing
`sizes` tag had a typo, missing the '/'.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2025-12-29 07:09:30 -05:00
caiyinyu b71d59074b LoongArch: Use generic __builtin_trap in abort.
Reviewed-by: Xi Ruoyao <xry111@xry111.site>
2025-12-25 09:38:13 +08:00
Adhemerval Zanella bd56942533 malloc: Fix clang build after 1c588a2187
clang issues:

malloc.c:1909:8: error: converting the result of '<<' to a boolean always evaluates to true [-Werror,-Wtautological-constant-compare]
 1909 |   if (!DEFAULT_THP_PAGESIZE || mp_.thp_mode != malloc_thp_mode_not_supported)
      |        ^
../sysdeps/unix/sysv/linux/aarch64/malloc-hugepages.h:19:35: note: expanded from macro 'DEFAULT_THP_PAGESIZE'
   19 | #define DEFAULT_THP_PAGESIZE    (1UL << 21)

Checked on aarch64-linux-gnu.
2025-12-22 15:55:34 -03:00
Adhemerval Zanella d8561d1552 elf: Fix elf/tst-decorate-maps on aarch64 after 321e1fc73f
The intention of the call "xmalloc(256 * 1024)" in tst-decorate-maps is
to force malloc() to fall back to using mmap() since such an amount
won't be available from the main heap.

Post 321e1fc73f, on aarch64, the heap gets extended by default by at
least 2MB, thus the aforementioned call may get satisfied on the main
heap itself. Thus, increase the amount of memory requested to force the
mmap() path again.

Checked on aarch64-linux-gnu.
2025-12-22 15:55:32 -03:00
Adhemerval Zanella 2b00b3a890 misc: Enable tst-atomic for clang
The atomic.h macros now uses compiler builtins.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-22 15:55:30 -03:00
Adhemerval Zanella 7be72e37e6 math: Use math_opt_barrier on ldbl-128 powl underflow/overflow handling
This avoids compiler to move the operation before the 'iy' compare.

It fixes math/test-float128-pow regreesions when building with clang [1]:

Failure: pow (-0x1.000002p+0, 0xf.ffffffffffff8p+1020): Exception "Underflow" set
Failure: pow (-0x1.000002p+0, 0xf.ffffffffffffbffffffffffffcp+1020): Exception "Underflow" set
Failure: pow (-0x1.000002p+0, 0xf.fffffffffffffffffffffffffff8p+16380): Exception "Underflow" set
Failure: pow (-0x1.000002p+0, 0xf.fffffffffffffffp+16380): Exception "Underflow" set
Failure: pow (-0x1.000002p+0, 0xf.fffffp+124): Exception "Underflow" set
Failure: pow (-0x1.00000ep+0, 0xf.ffffffffffff8p+1020): Exception "Underflow" set
Failure: pow (-0x1.00000ep+0, 0xf.ffffffffffffbffffffffffffcp+1020): Exception "Underflow" set
Failure: pow (-0x1.00000ep+0, 0xf.fffffffffffffffffffffffffff8p+16380): Exception "Underflow" set
Failure: pow (-0x1.00000ep+0, 0xf.fffffffffffffffp+16380): Exception "Underflow" set
Failure: pow (-0x2p+0, -0xf.ffffffffffff8p+1020): Exception "Overflow" set
Failure: pow (-0x2p+0, -0xf.ffffffffffffbffffffffffffcp+1020): Exception "Overflow" set
Failure: pow (-0x2p+0, -0xf.fffffffffffffffffffffffffff8p+16380): Exception "Overflow" set
Failure: pow (-0x2p+0, -0xf.fffffffffffffffp+16380): Exception "Overflow" set
Failure: pow (-0x2p+0, -0xf.fffffp+124): Exception "Overflow" set
Failure: pow (-0x2p+0, 0xf.ffffffffffff8p+1020): Exception "Underflow" set
Failure: pow (-0x2p+0, 0xf.ffffffffffffbffffffffffffcp+1020): Exception "Underflow" set
Failure: pow (-0x2p+0, 0xf.fffffffffffffffffffffffffff8p+16380): Exception "Underflow" set
Failure: pow (-0x2p+0, 0xf.fffffffffffffffp+16380): Exception "Underflow" set
Failure: pow (-0x2p+0, 0xf.fffffp+124): Exception "Underflow" set
[...]

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

[1] https://github.com/llvm/llvm-project/issues/173080

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-22 15:55:26 -03:00
Adhemerval Zanella bc78f67ca1 stdio: Fix tst-vfprintf-user-type on clang
The pointer alias comparison will be optimized away by the compiler,
so use an indirection point to prevent it (similar to
malloc/tst-malloc-aux.h).

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-22 15:55:23 -03:00
Adhemerval Zanella 999cd617cb x86: Do not use __builtin_isinf_sign for _Float64x/long double
Neither gcc [1] nor clang [2] handles pseudo-normal numbers correctly
with the __builtin_isinf_sign, so disable its usage for _Float64x and
long double types.

This only affects x86, so add a new define __FP_BUILTIN_ISINF_SIGN_DENORMAL
to gate long double and related types to the libc function instead.

It fixes the regression on test-ldouble-isinf when built with clang:

Failure: isinf (pseudo_zero): Exception "Invalid operation" set
Failure: isinf (pseudo_inf): Exception "Invalid operation" set
Failure: isinf (pseudo_qnan): Exception "Invalid operation" set
Failure: isinf (pseudo_snan): Exception "Invalid operation" set
Failure: isinf (pseudo_unnormal): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_zero): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_inf): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_qnan): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_snan): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_unnormal): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_zero): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_inf): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_qnan): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_snan): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_unnormal): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_zero): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_inf): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_qnan): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_snan): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_unnormal): Exception "Invalid operation" set

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

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123173
[2] https://github.com/llvm/llvm-project/issues/172651

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-22 15:55:20 -03:00
Adhemerval Zanella 5011210399 x86: Do not use __builtin_fpclassify for _Float64x/long double
Neither gcc [1] nor clang [2] handles pseudo-normal numbers correctly
with the __builtin_fpclassify, so disable its usage for _Float64x and
long double types.

This only affects x86, so add a new header, fp-builtin-denormal.h, that
defines whether the architecture requires disabling the optimization
through a new glibc define (__FP_BUILTIN_FPCLASSIFY_DENORMAL).

It fixes the regression on test-ldouble-fpclassify and
test-float64x-fpclassify when built with clang:

Failure: fpclassify (pseudo_zero): Exception "Invalid operation" set
Failure: fpclassify (pseudo_inf): Exception "Invalid operation" set
Failure: fpclassify (pseudo_qnan): Exception "Invalid operation" set
Failure: fpclassify (pseudo_snan): Exception "Invalid operation" set
Failure: fpclassify (pseudo_unnormal): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_zero): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_inf): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_qnan): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_snan): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_unnormal): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_zero): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_inf): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_qnan): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_snan): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_unnormal): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_zero): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_inf): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_qnan): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_snan): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_unnormal): Exception "Invalid operation" set

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

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123161
[2] https://github.com/llvm/llvm-project/issues/172533

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-22 15:55:16 -03:00
Sergey Kolosov 81763a4f7e resolv: Add test for NOERROR/NODATA handling [BZ #14308]
Add a test which verifies that getaddrinfo does not fail if one of A/AAAA
responses is NOERROR/NODATA reply with recursion unavailable and the other
response provides an address.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-22 14:07:16 +01:00
Yao Zihong 0b8a996f44 riscv: Add RVV memset for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of memset for RISC-V and
enables it for both multiarch (IFUNC) and non-multiarch builds.

The implementation integrates Hau Hsu's 2023 RVV work under a unified
ifunc-based framework. A vectorized version (__memset_vector) is added
alongside the generic fallback (__memset_generic). The runtime resolver
selects the RVV variant when RISCV_HWPROBE_KEY_IMA_EXT_0 reports vector
support (RVV).

Currently, the resolver still selects the RVV variant even when the RVV
extension is disabled via prctl(). As a consequence, any process that
has RVV disabled via prctl() will receive SIGILL when calling memset().

Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Co-authored-by: Jeff Law <jeffreyalaw@gmail.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2025-12-19 17:51:50 -06:00
Adhemerval Zanella 65f55bb7e5 stdlib: Avoid strlen plt with clang
The clang-21 LoopIdiomRecognizePass replaces some loops in
__xpg_basename with a strlen call.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-19 13:23:06 -03:00
Adhemerval Zanella 42b4589f28 math: Do not use __builtin_isgreater* and __builtin_isless* on clang
clang does not check for unordered numbers with builtins for 128-bit
float types (both _Float128 on x86_64 or long double on aarch64) [1].

For instance, the code:

  #ifdef __x86_64__
  typedef __float128 FLOAT128_TYPE;
  #elif defined (__aarch64__)
  typedef long double FLOAT128_TYPE;
  #endif

  int foo (FLOAT128_TYPE x, FLOAT128_TYPE y)
  {
    return __builtin_isgreater (x, y);
  }

Will issue a __gttf2 call instead of a __unordtf2 followed by the
comparison.

Using the generic implementation fixes multiple issues with math tests,
such as:

Failure: fmax (0, qNaN): Exception "Invalid operation" set
Failure: fmax (0, -qNaN): Exception "Invalid operation" set
Failure: fmax (-0, qNaN): Exception "Invalid operation" set
Failure: fmax (-0, -qNaN): Exception "Invalid operation" set
Failure: fmax (9, qNaN): Exception "Invalid operation" set
Failure: fmax (9, -qNaN): Exception "Invalid operation" set
Failure: fmax (-9, qNaN): Exception "Invalid operation" set
Failure: fmax (-9, -qNaN): Exception "Invalid operation" set

It has a small performance overhead due to the extra isunordered (which
could be omitted for float and double types). Using _Generic (similar to
how __MATH_TG) on a bivariadic function requires a lot of boilerplate
macros.

[1] https://github.com/llvm/llvm-project/issues/172499
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-19 13:23:06 -03:00