Compare commits

...
Author SHA1 Message Date
Florian Weimer e51a6bf18e malloc: Increase tcache fill count from 16 to 32
This avoids a regression in the omnetpp and xalancbmk benchmarks
of SPEC.  Apparently, these benchmarks are very sensitive to the
fill rate in malloc.

Suggested-by: Wilco Dijkstra <wilco.dijkstra@arm.com>
Tested-by: Wilco Dijkstra <wilco.dijkstra@arm.com>
2026-06-30 09:07:19 +02:00
Florian Weimer b50e24aea3 malloc: Only fill half of the tcache during batch allocation
This leaves room for subsequent frees.
2026-06-30 09:07:19 +02:00
Florian Weimer c0a1c6e06d malloc: Perform batched frees if tcache is full
Batched frees amortize the locking overhead once the tcache is full.
Previously, once the tcache slot was full, each free acquired the
arena lock.  With this change, neighboring tcache allocations in the
same arena re-use an arena lock that already exists.

Pass the tcache pointer to __libc_free_batch so that it is not
necessary to reload the tcache pointer after the _int_free_chunk
calls.
2026-06-30 09:07:19 +02:00
H.J. Lu ccd4cd5324 malloc: Don't call __get_thp_mode/__get_thp_size twice
Both ld.so and malloc track kernel THP mode and THP page size when THP
in ld.so is enabled by

GLIBC_TUNABLES=glibc.elf.thp=1

and THP in malloc is enabled by

GLIBC_TUNABLES=glibc.malloc.hugetlb=1

But DL_MAP_DEFAULT_THP_PAGESIZE and MALLOC_DEFAULT_THP_PAGESIZE may be
different when they are defined in <hugepages.h>.

If THP in ld.so is enabled, change malloc to use kernel THP mode from
ld.so, instead of calling __get_thp_mode, and use THP page size from
ld.so if it came from __get_thp_size.  This avoids calling __get_thp_mode
and __get_thp_size again, which are quite expensive:

1. Initialize mp_.thp_mode and GL(dl_thp_mode) to thp_mode_unknown.
2. Set mp_.thp_mode to GL(dl_thp_mode) if GL(dl_thp_mode) isn't
thp_mode_unknown.  Otherwise call __get_thp_mode to set mp_.thp_mode.
3. GL(dl_elf_thp_pagesize) is set to DL_MAP_DEFAULT_THP_PAGESIZE without
calling __get_thp_size and THP page size for malloc may be different from
THP page size for ld.so.  Set mp_.thp_pagesize to GL(dl_elf_thp_pagesize)
if DL_MAP_DEFAULT_THP_PAGESIZE is defined.  Otherwise call __get_thp_size
to set mp_.thp_pagesize.
4. THP page size in malloc is capped to MAX_THP_PAGESIZE.  If THP page
size is above MAX_THP_PAGESIZE, THP in malloc is disabled.

These result in when glibc.elf.thp is set to 1, malloc uses the actual
kernel THP mode instead of defaulting to madvise mode and madvise_thp
will stop issuing MADV_HUGEPAGE if kernel THP mode is always.

This fixes BZ #34083.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-06-26 10:18:36 +08:00
Jiri Stransky 96773cc77b nis: Fix a memory leak in nis_creategroup when malloc fails
The zo_domain field was missing from the list of fields to be freed.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-25 11:21:14 -03:00
Xiang Gao 21103aef12 stdio-common: Fix scanf nan/inf pushback [BZ #34208]
When scanf parses special floating-point inputs like "nan", "inf", it
may read one extra character to check whether the input still matches
the expected word.

If that extra character does not match, the conversion should fail, but
the character has already been read from the stream.  Some error paths
did not push it back before reporting the conversion error, so later input
started at the wrong position.

Fix this by keeping EOF and width errors separate from character mismatch
errors.  Push the character back before calling conv_error for mismatch
errors.

Add narrow and wide scanf tests using the same test body.  The test cases
focus on the paths changed by this patch: mismatches while matching "nan",
"nan(...)", "inf", and "infinity".

Tested on x86_64 Fedora 42.

The following tests passed without regressions:
  make test t=stdio-common/tst-scanf-bz34208
  make test t=stdio-common/tst-wscanf-bz34208
  make subdirs="stdio-common libio" check

Signed-off-by: Xiang Gao <gaoxiang@kylinos.cn>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-25 10:20:24 -03:00
Michael Ford ead80441e6 nss: Remove --enable-static-nss configure option
Since the NSS reorganization in glibc 2.33 the --enable-static-nss
option no longer changes the build: the files and dns services are built
into libc unconditionally, and there is no longer any mechanism to bake
the remaining services into libc.a.  After removing the dead
-DSTATIC_NSS define and the <gnu/lib-names.h> include (commits
82b710c190 and
2169401438), the option's only remaining
effect was to define DO_STATIC_NSS, which suppresses the static link
warnings on the NSS interface functions in libc.a.

With DO_STATIC_NSS gone, nss_interface_function emits the static link
warning unconditionally; static_nss and build-static-nss are removed
along with the configure option.

tst-nss-static, previously built only when build-static-nss was set, is
now added to tests-static unconditionally so the static NSS path retains
test coverage.

Signed-off-by: Michael Ford <fanquake@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-25 10:20:24 -03:00
Adhemerval Zanella 657fe73fb1 manual: Document indirect functions (IFUNC)
Add a new section to the Dynamic Linker chapter describing the
STT_GNU_IFUNC mechanism: the resolver calling convention for each
supported architecture, when resolvers run, and the functionality
supported in resolvers (TLS access, stack protector, cross-object
references) along with the remaining restrictions, reflecting the
recent ordering fixes (BZ 20680, BZ 23240, BZ 28817, BZ 34164,
BZ 34170).  Also cross-reference it from the hardening section.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-06-25 09:50:38 -03:00
Sachin Monga c9b5a4a593 ppc64le: Restore optimized memchr for power10 [BZ #34300]
Restore the POWER10 memchr implementation reverted in commit
a7877bb668 [BZ #33059], addressing the
actual cause:
The non-volatile vector register v20 used as the
zero vector (M_VREG_ZERO) is replaced with the volatile register v17.

Additionally, the assembler workaround used earlier for the
instructions lxvp and vextractbm is replaced with actual
instructions.
2026-06-25 00:21:08 -05:00
Shengwen Cheng a014af39fd riscv: Fix RV32 libthread_db THREAD_SELF register layout
The RISC-V libthread_db THREAD_SELF descriptor currently assumes 64-bit
general-register slots:

  REGISTER (64, 64, 4 * 8, ...)

That is correct for RV64, where tp/x4 is at byte offset 4 * 8 in the
general register set.  On RV32, general-register slots are 32-bit wide,
so tp/x4 is at byte offset 4 * 4.

Using the RV64 layout on RV32 makes libthread_db read the wrong thread
pointer value and prevents GDB from enabling pthread-aware thread
debugging.

Use a helper macro to pass the RISC-V register size into the
DB_THREAD_SELF definition.

Signed-off-by: Shengwen Cheng <shengwen1997.tw@gmail.com>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-06-24 17:54:00 +00:00
Adhemerval Zanella 16c74b94b9 elf: Fix clang-18 build of ifunc resolver tests
clang-18 errors on the static ifunc resolvers seen as unused.
2026-06-24 13:41:26 -03:00
H.J. Lu 8e5c299980 arm: Xfail 2 static THP tests
Since 2 static THP tests fail on arm:

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

due to limitations of arm32 kABI:

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

xfail them.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-24 06:18:21 +08:00
H.J. Lu d00085d6d0 thp: Limit THP code padding to 2 * THP page size
Since R_ARC_S25W_PCREL range is limited, 32MB THP code padding leads to
relocation overflow:

.../support/libsupport_nonshared.a(support_test_main.oS):
in function `support_test_main':
.../support/support_test_main.c:396:(.text+0x650): relocation truncated to fit: R_ARC_S25W_PCREL_PLT against symbol `atexit' defined in .text section in
../glibc/libc_nonshared.a(atexit.oS)
.../install/compilers/arc-linux-gnu/arc-glibc-linux-gnu/bin/ld: final link failed
collect2: error: ld returned 1 exit status

Limit THP code padding to 2 * THP page size to avoid R_ARC_S25W_PCREL
relocation overflow.

Tested natively for Linux/x86-64 and Linux/i686 as well as with
build-many-glibcs.py for arc-linux-gnu.

This fixes BZ #34311

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-24 06:17:20 +08:00
Mike FABIAN 98e1e467a8 Update documentation of iconv [BZ #30136]
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-06-23 14:50:30 -03:00
Pierre Blanchard 2cce7ec3c8 AArch64: additional mathvec build system cleanups.
Rely on a single list of ISAs and precisions for
source, tests and benchmarks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-23 14:50:30 -03:00
Pierre Blanchard c5a4d7ccb2 AArch64: Update SHARED-FILES with files from Arm Optimized-Routines
Adds lists for math.h and string.h and track file revisions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-23 14:50:30 -03:00
Pierre Blanchard 5a60281b88 AArch64: Update mathvec directory structure.
The new structure matches that of Arm Optimized-routines,
to facilitate files traceability.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-23 14:50:30 -03:00
John David Anglin f9deb2f50b hppa: Fix missing call to __feraiseexcept (BZ 34306)
The feupdateenv function is supposed to raise exceptions after
installing the environment represented by its envp argument.
This was accidentally missed on hppa.

The failure to raise exceptions was noticed by the failure of
the math/test-narrowing-trap test.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
2026-06-23 13:41:10 -04:00
Sergey Kolosov b61b98e3d0 resolv: Add test for gethostbyname_r unaligned buffer [BZ #18287]
Add a test for the buffer overflow in gethostbyname_r (Bug 18287), which
occurs when alignment padding is not subtracted from the remaining buffer
length.

The test uses binary search to find the exact required buffer size
for a mocked DNS response. It then tests all pointer misalignments
(1-7 bytes) using a custom 0xAA guard region. This guarantees
deterministic detection of out-of-bounds writes, avoiding false
negatives caused by malloc chunk rounding.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-06-23 08:40:41 +02:00
Justus Winter 91eb5057b9 Define _PATH_MOUNTED as "/etc/mtab"
Change the definition of _PATH_MOUNTED to "/etc/mtab". This is the
value used on Linux, and BSD also uses /etc/mtab.

The change is motivated by the fact that on Debian /etc/mtab is a
symbolic link to /proc/mounts. This patch adjusts the macro for
non-linux systems such as Hurd. Changing this using
sysdeps/mach/hurd/paths.h causes build problems because
/usr/include/hurd/paths.h is shadowed by this file. This change is
proposed in the hope that aligning the non-linux targets with the
glibc for Linux is perceived as a good thing while fixing this problem
on Debian/Hurd along the way.
2026-06-22 22:25:38 +02:00
Adhemerval Zanella bc76aa1658 Add advisory text for CVE-2026-6791
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2026-06-22 14:16:35 -03:00
Adhemerval Zanella 07c24f3539 posix: Fix stack overflow in wordexp tilde expansion (BZ 34091, CVE-2026-6791)
The parse_tilde function previously used strndupa to allocate memory
for the parsed username on the stack, and since the input is
user-defined, this can lead to a stack overflow.

This patch fixes the issue by replacing strndupa with scratch_buffer,
by reusing the buffer used in the __getpwnam_r call.

The new “tst-wordexp-tilde.c” test is a test-container to avoid using
system-defined NSS modules.

Checked on x86_64-linux-gnu and i686-linux-gnu.
2026-06-22 11:11:24 -03:00
60f7247847 riscv: Add RVV memmove for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of memmove 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 (__memmove_vector) is added
alongside the generic fallback (__memmove_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 memmove().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-06-20 22:56:09 -05:00
H.J. Lu 53d909a283 elf: Support THP segment load with madvise enabled THP
The current THP segment load approach works only when THP is enabled
with always in the kernel.  If THP is enabled with madvise in the
kernel, to enable THP segment load in an application, madvise should
be called with MADV_HUGEPAGE on all THP eligible PT_LOAD segments:

1. Define DL_MAP_DEFAULT_THP_PAGESIZE in hugepages.h and default it to 0.
If DL_MAP_DEFAULT_THP_PAGESIZE is defined, assume kernel THP madvise mode.
If kernel THP mode is always or never, there is an extra madvise call
which has no impact.  DL_MAP_DEFAULT_THP_PAGESIZE is defined for x86-64
and 64-bit loongarch.
2. Update _dl_map_segment_align to support madvise THP mode.  This fixes
BZ #34079.
3. Call _dl_executable_postprocess in rtld_setup_main_map for dynamic
executables and in LIBC_START_MAIN for static executables, which calls
madvise with MADV_HUGEPAGE on all THP eligible PT_LOAD segments in
executable.  This fixes BZ #34080 for both dynamic and static executables.
4. Call _dl_postprocess_loadcmd_extra in _dl_postprocess_loadcmd, which
calls madvise with MADV_HUGEPAGE on all THP eligible PT_LOAD segments
when loading an object after they have been mapped in.  This fixes
BZ #34080 for shared objects.
5. Set the maximum page alignment on THP tests to THP page size as the
default maximum page alignment may be smaller than THP page size.
6. Add tests to verify that large executable PT_LOAD segments in
executables are mapped at addresses aligned to THP page size when the
kernel is configured to use THP in "always" mode or "madvise" mode by
inspecting /proc/self/maps to check that the mapping address is aligned
to THP page size reported by the kernel.  Also verify that madvise is
called with MADV_HUGEPAGE when the glibc tunable glibc.elf.thp=1 is used
and madvise isn't called with MADV_HUGEPAGE when the glibc tunable
glibc.elf.thp=0 is used.

Skip these tests if THP page size cannot be determined or if THP is not
enabled in "always" mode nor "madvise" mode.

Quote WANG Rui <wangrui@loongson.cn>:

From benchmarking a clang build of the Linux kernel on x86_64 with
your patch in THP madvise mode, I observed that iTLB misses were
reduced, similar to what we see in THP always mode.

NB: Some THP tests fail on arm due to limitations of arm32 kABI:

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

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-20 05:35:24 +08:00
Carlos O'Donell 9310db5a08 advisories: Update GLIBC-SA-2026-0012 metadata
Update vulnerable versions in descriptive text.
2026-06-19 16:30:41 -04:00
Adhemerval Zanella da11a7d92c Remove unused THREAD_SET_POINTER_GUARD and THREAD_COPY_POINTER_GUARD
Commit a5ec880f80 ("Consolidate pointer
guard to use a relro variable instead of the TCB") moved the pointer
guard to the module-local relro variable __pointer_chk_guard_local and
dropped the THREAD_{SET,COPY}_POINTER_GUARD macros, which are no longer
defined by any target.

Checked on a build for all afftected targets.
2026-06-19 14:23:05 -03:00
Florian Weimer 4ba0b79b95 resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069)
This test case covers both input buffer overreads and output buffer
overflows.  It should systematically cover these issues.

I used code auto-generation for updating the test expectations for
truncated RDATA in TXT, ISDN records, after writing the rest
of the test by hand.

Assisted-by: LLM
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-06-19 18:22:20 +02:00
Florian Weimer a7b60d23bb resolv: Fix buffer overreads in ns_sprintrrf (CVE-2026-6238)
Check that the RDATA payload does not require more than RDATALEN
bytes while processing it.  The fixes cover A6, LOC records.
(CERT, TKEY, TSIG were fixed before, by switching to the generic
formatter.)

The vulnerable LOC record handling was first introduced before
glibc 2.0, in commit ee188d555b.

CERT, TSIG, TKEY handling came with commit
b43b13ac25, released with glibc 2.2.

A6 record handling was introduced in commit
9163381643 ("* resolv/ns_print.c
(ns_sprintrrf): Handle ns_t_a6 and ns_t_opt."), which went into glibc
2.7.

This fixes bug 34069.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-06-19 18:22:20 +02:00
Florian Weimer ca44a6609c resolv: More types as unknown in ns_sprintrrf (CVE-2026-5435)
Specifically, CERT, TKEY, TSIG, OPT.  This removes the buggy
implementations of TSIG, fixing bug 34033, and partially
fixing bug 34069.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-06-19 18:22:20 +02:00
Florian Weimer cd0db208d5 resolv: Check for inet_ntop failure in ns_sprintrrf
This makes the output more consistent (either failure or complete
output) and helps with systematic testing with varying buffer
sizes.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-06-19 18:22:20 +02:00
Florian Weimer d58415eb17 resolv: Improve formatting of unknown records in ns_sprintrrf
Do not add the "unknown RR type" comment.  After adding the TYPE
prefix, the number is largely redundant.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-06-19 18:22:20 +02:00
Florian Weimer f69b7f95e3 resolv: Fix ns_sprintrrf formatting of class, type values (bug 34289)
The p_class and p_type results could overwrite each other if both
were unknown.  Format unknown values with CLASS and TYPE prefixes,
as in RFC 3597.  Handle A6 separately because it cannot be added
to __p_type_syms for ABI reasons.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-06-19 18:22:20 +02:00
Florian Weimer 360f352c9a resolv: Declare __p_class_syms, __p_type_syms for internal use
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-06-19 18:22:20 +02:00
Florian Weimer 1607beb5f4 Update GLIBC-SA-2026-0012 to mention A6 records
It turns out there is a missing inner length check in it, too.

Also fix the vulnerable commit.  It predates the glibc 2.0 release
because the old stream-based formatting code in resolv/res_debug.c had
the same bug in its LOC handling.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-06-19 18:22:20 +02:00
Wilco Dijkstra cdbefe2f94 string: Improve memchr random test
Add matches before the start to ensure the memchr test checks they do not
result in false matches or missed matches.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-18 19:44:31 +00:00
Dylan Fleming 4e105d9855 AArch64: Vectorise SVE fp64 sin/cos special case
Implemented double precision vector fallback for SVE sin/cos.

Includes rewrite of sin to use trig instructions.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-06-18 14:56:22 +00:00
Dylan Fleming 708185c829 AArch64: Vectorise AdvSIMD fp64 sin/cos special case
Implemented double precision vector fallback for AdvSIMD sin/cos.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-06-18 14:56:22 +00:00
Dylan Fleming e585d88982 AArch64: Vectorise SVE fp32 sin/cos special case
Implemented single precision vector fallback for SVE sinf/cosf.

Includes a rewrite of SVE sinf to use the trig instructions.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-06-18 14:56:22 +00:00
Dylan Fleming faa9ea921a AArch64: Vectorise AdvSIMD fp32 sin/cos special case
Implemented single precision vector fallback for AdvSIMD sinf/cosf.

Includes cleanup of the fast pass to remove old styling and conventions.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-06-18 14:56:22 +00:00
Yury Khrustalev a3b1faddaf news: Describe AArch64-specific changes for 2.44
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2026-06-18 14:46:42 +01:00
Adhemerval Zanella 242a1f4b0f elf: Do not scrub AT_RANDOM to a constant when reseeding fails (BZ 34197)
_dl_reseed_random zeroed the AT_RANDOM bytes before refilling them with
getrandom (GRND_NONBLOCK).  That call is best-effort and can write nothing
(e.g. before the kernel entropy pool is initialized early at boot), leaving
the 16 bytes as a constant zero.

Since the value is exposed through getauxval (AT_RANDOM), this traded a
potential guard leak for a guaranteed predictable value.

Drop the memset and overwrite the bytes in place instead.  The generic
version now just drops the pointer (it is not used anywhere).

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

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-06-17 09:52:32 -03:00
Wilco Dijkstra 368438d8b6 manual: Update memchr description [BZ #19406]
Update memchr description to indicate it cannot overread and the size
may be larger than the object passed.  This is required since C11.

Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2026-06-17 11:48:50 +00:00
Samuel Thibault 89b4605be8 hurd: Add ETH_TLEN and ETH_FCS_LEN 2026-06-17 01:26:54 +02:00
Samuel Thibault 145b53b22a hurd: Fix ETH_P_PUP
According to IANA, PUP is 0200
2026-06-17 01:26:45 +02:00
Samuel Thibault 8d184c42cc Factorize if_arp.h
They were essentially identical between linux and hurd, and are
OS-independent.
2026-06-17 01:17:21 +02:00
Adhemerval Zanella 337e18d661 elf: Scrub and reseed the AT_RANDOM bytes after deriving the guards (BZ 34197)
Once the pointer and stack guards have been derived from AT_RANDOM, scrub
the bytes and refill them with new random data unrelated to the guards.
On Linux, it uses getrandom syscall (as for tcache_key_initialize), and
fallback to zero the memory if the syscall is not avaiable.

This keeps AT_RANDOM useful to applications while ensuring those bytes no
longer reveal the guards.

The work is done by _dl_reseed_random, called once the guards are in place
and before any ELF constructor can observe AT_RANDOM: in security_init for
the dynamic loader and in __libc_start_main for statically linked programs.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-16 14:53:48 -03:00
Adhemerval Zanella 604fe0b87b Consolidate dl-osinfo.h into the generic implementation
The generic and the Linux _dl_setup_stack_chk_guard and
_dl_setup_pointer_guard are identical when the kernel provides the
AT_RANDOM auxiliary vector, which is always the case on the supported
Linux kernels; the generic version only adds a fallback for a missing
AT_RANDOM.  Remove the Linux-specific dl-osinfo.h and use the generic
one for all targets.

The removed header pulled in <dl-sysdep.h>, which is what transitively
declared __libc_enable_secure for dl-parse_auxv.h; include <unistd.h>
there directly so it no longer relies on that.  Include <string.h> in
the generic header so it is self-contained.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-16 14:53:48 -03:00
Adhemerval Zanella 78f1f0e39c Consolidate the C pointer guard and align the assembly implementations
The per-architecture pointer_guard.h files all implemented some variant
of C PTR_MANGLE/PTR_DEMANGLE: the i386 and x86_64 versions did an
exclusive-or by the guard followed by a rotate left by
2 * sizeof (uintptr_t) + 1 bits (9 on 32-bit, 17 on 64-bit), while the
other targets did the exclusive-or only.  The assembly macros likewise
rotated on i386 and x86_64 but not on the other targets.

Consolidate everything to use XOR + rotate uniformly: collapse the
per-architecture C headers into a single generic implementation, and
add the matching rotate to the assembly implementations that lacked it.

Targets with an assembly rotate instruction (aarch64, arm, loongarch,
powerpc, s390, csky) just add it.  Those without one (alpha, sparc, sh)
synthesize the rotation: alpha and sparc with a shift/shift/or sequence,
which needs an extra scratch register added to the PTR_MANGLE/PTR_DEMANGLE
macros, sh with single-bit rotates, which needs no scratch.  The s390
__longjmp and ____longjmp_chk demangle the return address and stack
pointer in C, so update those too.

Checked with setjmp, ptrguard and longjmp_chk tests for all supported
ABIs that can run under qemu (all but csky), and with builds for all
supported ABIs.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-16 14:53:47 -03:00
Adhemerval Zanella c626d764d7 Remove the jmp_buf stack pointer demangle on ABIs that do not mangle it
arc, m68k, microblaze, mips, and riscv store the raw stack pointer in
setjmp, while their jmpbuf-unwind.h applies PTR_DEMANGLE to it in
_jmpbuf_sp.  This is currently harmless because these ABIs use the
generic pointer_guard.h, where the C PTR_DEMANGLE is a no-op.

No functional change.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-16 14:53:29 -03:00
Adhemerval Zanella afc90416e9 Split pointer_guard.h into C and assembly headers
Move the assembly PTR_MANGLE/PTR_DEMANGLE definitions out of each
pointer_guard.h into a new sibling pointer_guard-asm.h, guarded by
__ASSEMBLER__.  pointer_guard.h now includes pointer_guard-asm.h and
keeps only the C definitions.

No functional change: the .S and .c files still include pointer_guard.h
and get the same macros, and <pointer_guard-asm.h> resolves per-arch
through the usual sysdeps include path.

Checked with a build for all affected ABIs.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-16 14:53:29 -03:00
Adhemerval Zanella d50ae543a4 Enable the pointer guard in the dynamic loader
i386, powerpc, s390, sh and sparc fell back to the generic no-op
pointer_guard.h in ld.so, so the loader's own setjmp/longjmp and mangled
function pointers were left unprotected (the other targets already
mangle in rtld).  ld.so is position-independent and sets up
__pointer_chk_guard_local early in dl_main, so the loader can reach it
the same way a statically linked program does:

  - powerpc, s390, sh, sparc: select __pointer_chk_guard_local for
    IS_IN (rtld) and reuse the existing PIC guard load.
  - i386: load it via @GOTOFF off a GOT pointer set up with LOAD_PIC_REG
    in the caller-provided scratch register
    (ld.so does not keep the GOT in %ebx at the setjmp/longjmp entry).
  - s390: drop the IS_IN (rtld) "#undef PTR_DEMANGLE" in __longjmp.c so
    the loader's longjmp demangles to match its setjmp.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu, and
armv7a-linux-gnueabihf.  I also run elf and setjmp checks on qemu
loongarch64, powerpc64, powerpc64le, and s390x systems.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-16 14:53:28 -03:00
Adhemerval Zanella a5ec880f80 Consolidate pointer guard to use a relro variable instead of the TCB
For the targets that still read the pointer guard from the thread
descriptor (i386, x86_64, powerpc, s390, sparc, and sh), mangle and
demangle pointers using the module-local __pointer_chk_guard_local (in
ld.so and static binaries) or the global __pointer_chk_guard provided by
the dynamic loader (in shared objects), matching the scheme already used
by aarch64, alpha, arm, csky and loongarch.

On i386 the guard is no longer reachable as a single %gs-relative memory
operand, so the assembly PTR_MANGLE/PTR_DEMANGLE PIC variants need a
register to hold the GOT pointer and the guard address.

This removes the dependency on the TCB pointer_guard slot: drop
THREAD_{GET,SET,COPY}_POINTER_GUARD and the POINTER_GUARD tcb-offset,
and point the POINTER_CHK_GUARD test macro at the relro variable.  The
tcbhead_t slot is kept (renamed to an unused reserved field, except on
s390 which reused the stack guard) to preserve the ABI.  s390 gains a
distinct pointer guard rather than aliasing the stack guard.

Checked on x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu, and
armv7a-linux-gnueabihf.  I also run elf and setjmp checks on qemu
loongarch64, powerpc64, powerpc64le, and s390x systems.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-16 11:35:06 -03:00
Adhemerval Zanella 3785d4c0d0 elf: Propagate the pointer guard to ld.so loaded via static dlopen (BZ 34196)
The static-dlopen does not initialize the pointer guard for ABIs that
define THREAD_SET_POINTER_GUARD.  Besides not properly guard the
pointer if a libc.so symbol is called, this can lead to setjmp
failures (a jmp_buf set up by the loaded libc.so.6 cannot be restored
by the static program's __longjmp, and vice versa).

Seed the just-mapped loader's __pointer_chk_guard from the program's
__pointer_chk_guard_local in __rtld_static_init, next to the other
runtime values copied there.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-06-16 08:29:57 -03:00
Adhemerval Zanella a767fbcff0 math: Sync acosh with CORE-MATH 887cab6f
It syncs with CORE-MATH commit 887cab6f.  The new tests are from
the CORE-MATH acosh worst-cases inputs that trigger the FE_TOWARDZERO
issue with the previous implementation, along with the hard-to-round
cases from CORE-MATH commits 72febed6 and ce9e99f6.

Checked on x86_64-linux-gnu, x86_64-linux-gnu with --disable-multi-arch
(so soft FMA implementation is used), i686-linux-gnu (which uses its
own acosh implementation), aarch64-linux-gnu, and
armv7a-linux-gnueabihf.

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-06-15 17:41:15 +00:00
Michael Ford 82b710c190 inet: Remove unused STATIC_NSS define
The --enable-static-nss configuration adds -DSTATIC_NSS to CFLAGS for
the inet subdirectory, but no source file has referenced the STATIC_NSS
macro for quite some time. So remove the dead define.

Signed-off-by: Michael Ford <fanquake@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-15 15:00:03 +00:00
Michael Ford 2169401438 nss: Remove <gnu/lib-names.h> include from nsswitch.c
nsswitch.c no longer references any of the *_SO macros provided by
<gnu/lib-names.h>. The only consumer, __nss_shlib_revision, moved to
nss_module.c as part of the NSS reorganization in glibc 2.33 (and
nss_module.c includes the header unconditionally), but the guarded
include was left behind.

Signed-off-by: Michael Ford <fanquake@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-15 14:59:41 +00:00
Adhemerval Zanella 1111fbdd3e arm: Save/restore VFP registers in PLT trampolines (BZ 34144, BZ 15792)
_dl_runtime_resolve and _dl_runtime_profile only preserved the integer
argument registers (r0-r3) across the inner call to _dl_fixup /
_dl_profile_fixup.  Two related ABI requirements demand more:

  * Under AAPCS-VFP, d0-d7 hold the caller's double arguments to the
    function being resolved.  Recent GCC emits VFP instructions inside
    the fixup routines, clobbering them, so the resolved function sees
    corrupted arguments (BZ 34144).

  * Per RTABI32, the __aeabi_mem* helpers (and similar runtime helpers
    reachable through the dynamic linker) must only corrupt integer
    core registers.  IFUNC resolvers, audit modules, and interposed
    malloc invoked during symbol resolution may also use VFP, even on
    softfp ABI builds (BZ 15792).

Save all call-clobbered VFP state -- d0-d15 unconditionally, d16-d31
when HWCAP_ARM_VFPD32 is set, and fpscr -- around the inner fixup
call.  Whether VFP is usable is a property of the hardware, not of
the ABI glibc was built with, so the decision is gated on AT_HWCAP at
runtime in both hardfp and softfp builds; hardfp builds will always
find HWCAP_ARM_VFP set, while softfp builds running on a non-VFP CPU
correctly skip the save.

For _dl_runtime_profile the save area is slipped in just before the
bl to _dl_profile_fixup; the outgoing framesizep argument is
recomputed to account for the extra frame, and both the fast path
(no audit framesize) and the slow path (audit wraps with
pltenter/pltexit) traverse the restore before splitting.

Checked on arm-linux-gnueabihf.

Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-06-15 14:59:10 +00:00
Adhemerval Zanella 6adb7400fd aarch64: Fix static PIE CPU feature detection (BZ 34205)
ARCH_INIT_CPU_FEATURES is called from __libc_start_main before
_dl_relocate_static_pie, so any code it runs must not rely on
relocations being applied yet.  Two issues break this under static PIE:

  1. The cpu_list table held 'const char *name' members, whose
     addresses are not link-time constants under PIE and thus require
     base-relative relocations that are not yet in place.  Replace the
     array of structs with a flat NUL-separated name string and a
     parallel midr array, removing the pointer relocations.

  2. tunable_strcmp pulls in memcmp, which is an IFUNC and is likewise
     unresolved at this point.  Redirect memcmp to __memcmp_generic in
     the aarch64 dl-symbol-redir-ifunc.h and include it from
     csu/libc-start.c.

Checked on aarch64-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-06-15 14:58:11 +00:00
Sana Kazi 1cba6073e5 nptl: open threads comm with O_WRONLY|O_CLOEXEC
pthread_setname_np opens the thread's comm file using O_RDWR, but the
function only ever writes to it.  This causes two distinct problems:

1. Missing O_CLOEXEC: the file descriptor is not marked close-on-exec,
   so it remains open across fork+exec.  A child process that audits
   its inherited file-descriptor set will encounter an unexpected /proc
   fd it did not open and may treat this as a security violation and
   abort.

2. Unnecessary O_RDWR: requesting read+write access when only write
   access is needed can cause open() to fail under security policies
   that permit writing to /proc/<tid>/comm but deny reading it.

Fix both issues by replacing O_RDWR with O_WRONLY|O_CLOEXEC

Similarly, updated pthread_getname_np to use O_CLOEXEC.

Bug-Id: 34192[https://sourceware.org/bugzilla/show_bug.cgi?id=34192]

Signed-off-by: Sana Kazi <Sana.Kazi@bmwtechworks.in>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-06-15 16:37:59 +02:00
Yury Khrustalev 9ed3576e61 malloc: aarch64: Add ifuncs for malloc functions
Introduce ifuncs and resolvers for functions pertinent to the
malloc interface on the AArch64 target: malloc, calloc, free,
realloc, memalign, valloc, pvalloc, posix_memalign, aligned_alloc,
free_sized, free_aligned_sized, malloc_usable_size.

A target can define the USE_MULTIARCH_MALLOC macro. In this case
it must provide alternative aliases for the malloc functions that
point to the ifuncs.

This implementation respects the --disable-multi-arch configure
flag. If multi-arch support is disabled, the generic aliases
are used on aarch64.

This patch contains aarch64-specific resolvers. At this moment they
return core implementations but in the future they can be changed
to support for features, e.g. to handle memory tagging.
2026-06-15 13:40:22 +01:00
Fabian Rast df83fa8813 rtld: cache cpuid results on the stack for intel
dl_init_cacheinfo retrieves various information about cache
sizes, using the cpuid instruction on x86.
Previously, the same cpuid leaves were queried multiple times.
This behavior caused intel_check_word to prominently show up in
profiles of dynamic loader startup on the Intel(R) Xeon(R) Gold 6430.
The big performance impact could not be reproduced on other Intel cpus.

This patch reduces the number of cpuid queries on startup
by caching their results on the stack for reuse when searching for a
different cache size value.
This approach does not change the overall design of
the cache enumeration code (repeated calls to handle_* functions).
The values are cached on the stack instead of globally (e.g.
in the cpu_features global) because they are never needed after
early initialization.

The cache is only active for Intel cpus, because it has not yet
been shown through benchmarks that it meaningfully improves performance
for other processors.

Signed-off-by: Fabian Rast <fabian.rast@tum.de>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2026-06-11 10:10:38 -07:00
Joseph Myers 8ae37adb21 Fix -Wconstant-logical-operand error for Hurd
Building for Hurd with GCC mainline produces an error in pt-block.c
(here MSG_OPTIONS is a macro that may be defined before pt-block.c is
included by another source file):

In file included from ../sysdeps/mach/htl/pt-block-intr.c:6:
../sysdeps/mach/htl/pt-block.c: In function '__pthread_block_intr':
../sysdeps/mach/htl/pt-block.c:49:42: error: use of logical '&&' with constant operand '1024' [-Werror=constant-logical-operand]
   49 |   if ((MSG_OPTIONS & MACH_RCV_INTERRUPT) && err == MACH_RCV_INTERRUPTED)
      |                                          ^~
../sysdeps/mach/htl/pt-block.c:49:42: note: use '&' for bitwise operation
   49 |   if ((MSG_OPTIONS & MACH_RCV_INTERRUPT) && err == MACH_RCV_INTERRUPTED)
      |                                          ^~
      |                                          &

Fix this, and a similar error in pt-timedblock.c, with an explicit != 0.

Tested with build-many-glibcs.py (compilers and glibcs builds) for
i686-gnu and x86_64-gnu.
2026-06-10 18:49:53 +00:00
Joseph Myers d8fa402f5e Fix -Werror=constant-logical-operand errors in soft-fp
Building for sparc64-linux-gnu with GCC mainline produces a series of
-Werror=constant-logical-operand errors in soft-fp code, relating to
calls to _FP_TO_INT where rsigned is -1 not 0 or 1.  Use explicit != 0
in the soft-fp code to avoid these errors.

Tested with build-many-glibcs.py (compilers and glibcs builds) for
sparc64-linux-gnu with GCC mainline.
2026-06-10 16:33:27 +00:00
Joseph Myers 690472e2a5 Fix -Wconstant-logical-operand error in tst-printf-format-skeleton.c
Building the glibc testsuite with GCC mainline fails with:

In file included from tst-printf-format-skeleton-double.c:33,
                 from tst-printf-format-p-double.c:20:
tst-printf-format-skeleton.c: In function 'do_test':
tst-printf-format-skeleton.c:308:12: error: use of logical '&&' with constant operand '53' [-Werror=constant-logical-operand]
  308 |   if (PREC && printf ("prec:%i\n", PREC) < 0)
      |            ^~
tst-printf-format-skeleton.c:308:12: note: use '&' for bitwise operation
  308 |   if (PREC && printf ("prec:%i\n", PREC) < 0)
      |            ^~
      |            &
cc1: all warnings being treated as errors

Fix this using an explicit "!= 0".  Tested with build-many-glibcs.py
for aarch64-linux-gnu.
2026-06-10 14:01:34 +00:00
Zihong Yao 9cf4dd03bd riscv: Keep __memcmpeq alias with RVV memcmp
Commit 2efc702628 replaces the generic RISC-V memcmp, which also exports
__memcmpeq.

A dedicated RISC-V __memcmpeq implementation is expected in a later patch,
which is still under review. Keep the alias here so this patch does not
temporarily drop the existing __memcmpeq ABI.

Tested on a Muse-Pi board with GCC 15.2.0 using `--with-arch=rv64g_zca_zcd --with-abi=lp64d`
and `CFLAGS="-march=rv64g_zca_zcd -mabi=lp64d -O2"`. Full make check was
run for both multiarch and non-multiarch builds.
This also fixes the string/inl-tester link failure caused by the missing
__memcmpeq symbol.

In both runs, the only FAILs are the unchanged cospi/sinpi/tanpi math test
failures.

Signed-off-by: Zihong Yao <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-09 09:06:07 -03:00
Brian Jorgensen 6f072238e9 fcntl-linux.h : Fix typo in comments. (bug 17119)
This commit fixes incorrect comments in set / get macros.

Signed-off-by: Brian Jorgensen <brjorgen98@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-09 09:05:59 -03:00
Florian Weimer e9325bd7d0 iconv: Suppress intermediate errors with //TRANSLIT (bug 34236)
When tentatively converting characters on behalf of
__gconv_transliterate, do not create a persistent error.  Just
produce a local error, and rely on __gconv_transliterate to
produce the error if all transliteration options are exhausted.

This fixes transliteration of “½” to ASCII, which cannot use the
“ 1⁄2 ” alternative.  Eventually, the “ 1/2 ” alternative is chosen,
but the error sticks.  Therefore, iconv exited with status 1 before
this change.

Adjust iconv/tst-iconv_prog.sh to test both C and en_US.UTF-8 locales.
This requires changing the way the ICONV template is defined, so that
run_program_env is evaluated multiple times.

Fixes commit 9a4b0eaf72 ("iconv: do not
report error exit with transliteration [BZ #32448]"),
commit 6cbf845fcd ("iconv: Preserve
iconv -c error exit on invalid inputs (bug 32046)"), and bug 34236.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
2026-06-09 07:28:02 +02:00
Josef Johansson 88099e289d nscd: Typo in comment
Fixes: https://sourceware.org/bugzilla/show_bug.cgi?id=34240

Signed-off-by: Josef Johansson <josef@oderland.se>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-06-08 17:32:27 +02:00
Andreas Schwab 4e22f95057 libio: use _IO_have_wbackup for wide streams
Fix two wrong uses of _IO_have_backup on a wide stream.
2026-06-08 17:01:15 +02:00
Sam James d0cc9bf859 elf: don't clobber ld.so.conf in tst-glibc-hwcaps-prepend-cache [BZ #34210]
dbe5065f21 and ae589cb84d
cater for setups where ld.so.conf{,.d} is required to find runtime support
libraries, but tst-glibc-hwcaps-prepend-cache clobbers the created ld.so.conf
with its own entry.

Fix it to instead use the ld.so.conf.d created in ae589cb84d
to co-exist with existing entries.

Bug: https://bugs.gentoo.org/976773
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31901
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34210
Tested-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reported-by: Eli Schwartz <eschwartz@gentoo.org>
Reviewed-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-06-06 21:22:46 +01:00
Adhemerval Zanella 2b6f6710a1 elf: Remove inhibit_stack_protector from __ifunc_resolver
With 01964c3ec8e fix ifunc resolvers can be fully instrumented with
stack protector.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu
built with --enable-stack-protector=all.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-06-05 16:20:20 -03:00
Adhemerval Zanella f9a11a380d elf: Set up TLS slotinfo for dlopen'd modules before relocation (BZ 34170)
An IFUNC resolver in a DSO that is being loaded by dlopen is allowed
to read its own TLS storage during the resolver call.  After
af34b1376a ("elf: Initialize static TLS before relocation processing
(BZ 34164)") that works for the initial-exec model on every supported
architecture.

However, it does not work for the dynamic-TLS path (on both -mtls-dialect mode,
if the ABI supports both).  Both lookup paths index the calling thread's
DTV by the new module's l_tls_modid and, on miss, walk
GL(dl_tls_dtv_slotinfo_list) to discover the module and lazily allocate
its TLS block.  The just-loaded DSO is however not yet in that list when
its resolver fires, so the lookup faults inside dlopen.  This is the
direct dlopen analog of BZ 34164.

The solution is to reorder dl_open_worker_begin so the slotinfo install
happens before the relocation pass.  The new order is:

  1. resize_scopes, resize_tls_slotinfo, add_to_global_resize
     (unchanged, still recoverable).
  2. update_tls_slotinfo: register the new modules in slotinfo, bump
     dl_tls_generation, initialise their static TLS images.
  3. Relocate the new objects.  IFUNC resolvers can now read their
     own DSO's __thread storage via any TLS model.
  4. Demarcation point.
  5. update_scopes, _dl_find_object_update.

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-06-05 16:20:20 -03:00
Wilco Dijkstra 49244da110 malloc: Simplify _int_free_chunk
Simplify _int_free_chunk() and always lock if needed.  Use
_int_free_merge_chunk() for cases that assume the arena has been locked
instead.  Move the errno save/restore to _int_free_maybe_trim().

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-06-05 13:56:37 +00:00
c275c424b3 riscv: Add RVV strrchr for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of strrchr 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 (__strrchr_vector) is added
alongside the generic fallback (__strrchr_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 strrchr().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-06-05 00:48:14 +00:00
bbc3867f8d riscv: Add RVV strchr for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of strchr 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 (__strchr_vector) is added
alongside the generic fallback (__strchr_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 strchr().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-06-05 00:48:09 +00:00
512f99e71d riscv: Add RVV memchr for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of memchr 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 (__memchr_vector) is added
alongside the generic fallback (__memchr_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 memchr().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-06-05 00:48:01 +00:00
496ccfe312 riscv: Add RVV memccpy for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of memccpy 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 (__memccpy_vector) is added
alongside the generic fallback (__memccpy_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 memccpy().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-06-05 00:47:51 +00:00
2efc702628 riscv: Add RVV memcmp for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of memcmp 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 (__memcmp_vector) is added
alongside the generic fallback (__memcmp_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 memcmp().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-06-04 19:02:07 -05:00
Wilco Dijkstra 93e6135904 malloc: Reduce maximum arenas
The default maximum arenas is 8 times the number of cores in a 64-bit system.
Since modern CPUs have many cores and big servers have 256 cores, this results
in excessive number of arenas, which wastes memory.  Limit the number of arenas
to max (8, ncores) which is less extreme.  In the future the limit should be
lowered further for large systems.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-04 14:25:37 +00:00
Adam Yi 13dc1040af resolv: reset _u._ext.nscount in __res_iclose [BZ #34154]
__res_iclose, when called with FREE_ADDR=true, frees and NULLs every
statp->_u._ext.nsaddrs[ns] but does not reset statp->_u._ext.nscount.
This breaks the invariant relied on by __res_context_send's cache
validation loop in resolv/res_send.c:293-312: when _u._ext.nscount
is non-zero, every _u._ext.nsaddrs[ns] corresponding to
statp->nsaddr_list[ns].sin_family != 0 is expected to be non-NULL.

res_init unconditionally calls __res_iclose(&_res, true) before
__res_vinit, so any __res_vinit failure (for example,
fopen("/etc/resolv.conf") returning EMFILE under file-descriptor
exhaustion, or any allocation failure in __resolv_conf_load,
__resolv_conf_allocate, or __resolv_conf_attach before
update_from_conf runs) leaves _u._ext.nscount non-zero with all
_u._ext.nsaddrs[] NULL.  The next name lookup walks the validation
loop and dereferences NULL in sock_eq.  A DNS lookup may fail after
a failed res_init, but it should not segfault.

Reset _u._ext.nscount = 0 alongside the existing __resolv_conf_detach
call.  The next __res_context_send call then re-enters its init
block (res_send.c:316-335) and repopulates _u._ext.nsaddrs[] from
statp->nsaddr_list[], which __res_iclose leaves untouched.  This
also lets support/resolv_test.c drop its now-redundant manual reset
after __res_iclose(&_res, true).

Add a regression test that drops RLIMIT_NOFILE so fopen of
/etc/resolv.conf fails with EMFILE inside __res_vinit, then verifies
the subsequent gethostbyname does not crash.

Signed-off-by: Adam Yi <ayi@janestreet.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-03 11:11:09 -03:00
Alejandro Colomar 20fffa2c39 sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c: Fix typo
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-03 11:11:06 -03:00
Wilco Dijkstra b7e256c32c malloc: Improve documentation of malloc tunables
Update default for tcache_count tunable.  Remove existing documentation and
mention removal of fastbins in mxfast tunable.  Improve wording of hugetlb
tunable, including default for AArch64.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-06-03 13:10:58 +00:00
Wilco Dijkstra 4a7805d05c malloc: Minor cleanups
Merge request2size into checked_request2size.  Improve interface of
clear_memory.  Fix incorrect use of __glibc_unlikely in __libc_calloc.
Fix missing tabs.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-06-03 13:10:06 +00:00
Adhemerval Zanella 0b27186151 support: Also run malloc hugetlb=1 tests when transparent hugepage is 'always'
The glibc.malloc.hugetlb=1 is redundant with kernel is n 'always'
mode, but the madvise does work, and the tunable should not fail.

Suggested-by: Yury Khrustalev <yury.khrustalev@arm.com>
Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-06-03 09:09:27 -03:00
Adhemerval Zanella e951752cd0 arm: Fix main-in-dso with non-BFD linkers (BZ 34098)
Commit c2d6afb4a0 changed the PIC && !SHARED path of start.S (used by
crt1.o and rcrt1.o) to load main via a R_ARM_REL32 data relocation.  When
main is provided by a shared object, BFD ld synthesizes a canonical PLT
entry for it, but other linkers (e.g. mold) do not, producing a broken
binary that crashes at startup.

Follow the aarch64 approach and reference main through a local __wrap_main
that tail-calls it with a branch relocation, which every linker turns into
a PLT entry.

Checked on armv7a-linux-gnueabihf with and without --enable-default-pie.
2026-06-03 09:09:12 -03:00
Adhemerval Zanella 5879990337 elf: Fix tst-ifunc-tls-init with --disable-default-pie
The test failed with --disable-default-pie because its primary check read
the resolver's diagnostic side effect before the resolver had run.

In a non-PIE executable the references to the IFUNC (fptr and ifunc_tls)
are satisfied through a canonical IPLT entry in the executable itself.
Under the default lazy binding that IPLT is resolved on first use, not
during startup relocation, so the resolver had not yet run when
'check_sentinel' inspected that value.  With a PIE executable
(or LD_BIND_NOW=1) the resolver runs eagerly at startup and the check
passed.  The dlopen path was unaffected because dlopen resolves the
data relocation eagerly.

This is a test ordering issue: the resolver always reads the initial-exec
TLS correctly whenever it runs, so the BZ 34164 fix is not involved.
Reorder test_tls_ifunc so that fptr/ifunc_tls force the IFUNC to be
resolved before the last_seen_sentinel value is inspected.

Checked on x86_64-linux-gnu and i686-linux-gnu with --disable-default-pie.

Reported-by: Yury Khrustalev <yury.khrustalev@arm.com>
Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-06-02 15:10:02 -03:00
Sachin Monga 7193069543 powerpc64le: Add optimized __memcmpeq for POWER10
__memcmpeq (added in glibc 2.35) was previously an alias to memcmp on
POWER10 via strong_alias. However, in the multiarch IFUNC path, this
caused __memcmpeq to resolve to the generic C memcmp.c implementation
rather than the optimized POWER10 memcmp.S, leaving a significant
performance gap.

Unlike memcmp, __memcmpeq only needs to return zero or nonzero with
no requirement on the sign or magnitude for unequal inputs, allowing
a simpler and faster implementation.

Performance on POWER10 :

  1) __memcmpeq (generic) -> __memcmpeq_power10
     The primary motivation - __memcmpeq was resolving to generic C
     in the multiarch path.

  - Small data (< 8B to < 512B) : ~52% - 82% improvement.
  - Bulk  (< 16MB to < 256MB)   : ~25% - 32% improvement.
  - Large (1GB)			: ~33% improvement

  2) memcmp_power10 (optimized .S) -> __memcmpeq_power10:
     Comparing dedicated __memcmpeq against the optimized memcmp
     it previously aliased to.

  - Small data (< 8B to < 256B) : No improvement observed.
    Real-world workloads predominantly operate on larger buffers
  - >= 512B			: ~9%  improvement.
  - 16MB - 128MB		: ~25% - 32% improvement.
  - 256MB			: ~3%  improvement.
  - Large (1GB)			: On par.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-06-02 00:51:36 -05:00
Adhemerval Zanella c5278a6428 arm: Redirect memcpy to __memcpy_arm for loader/static init code
After "elf: Initialize TCB and stack-protector before static IFUNC
resolvers (BZ 20680, BZ 27582, BZ 28817)", early loader and static
initialization code may run before the IFUNC resolvers are processed.

The armv7-a supports memcpy, so add a dl-symbol-redir-ifunc.h to
redirect the memcpy to to __memcpy_arm implementation.

Checked on armv7a-linux-gnueabihf.
2026-06-01 13:16:26 -03:00
Yury Khrustalev 0458560b5d misc: Fix typos in comments 2026-06-01 13:29:53 +01:00
Diego Nieto Cid 7d213541cb hurd: define SO_TIMESTAMP in socket.h
* sysdeps/mach/hurd/bits/socket.h: add SO_TIMESTAMP enum entry
  and define corresponding preprocessor macro.
Message-ID: <20260531195342.1633-1-dnietoc@gmail.com>
2026-05-31 21:55:26 +02:00
Yury Khrustalev 70be9819b5 malloc: aarch64: Remove broken memory tagging
Remove the --enable-memory-tagging configure option along with
all associated variables and macros.

Removing the glibc.mem.tagging tunable.

Remove the memory-tagging makefile variable.

Remove the USE_MTAG macro definition and code that is conditionally
compiled when this macro is defined.

As a result, we change 'mtag_mmap_flags' to 'extra_mmap_prot' that
is now always defined. Change of the name due to this being used
as part of PROT options in mmap syscalls rather than part of flags.

Remove 'mtag_enabled' that would become compile-time false. Also
remove any code that would never be compiled when 'mtag_enabled'
is false.

Remove AArch64-specific code pertinent to memory tagging, that is
currently broken, from the core malloc implementation. We keep
the assembly code, since we are going to need it in the future. to
preserve Git history.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2026-05-31 16:11:23 +01:00
Adhemerval Zanella 7052455f0e hesiod: use booleans in parser macro calls
The swallow argument in the INT_FIELD and STRING_FIELD macros is used as a
boolean, change all callers to use false and true instead of 0 and 1.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-29 13:58:58 -03:00
Adhemerval Zanella 41e9457c53 hesiod: fix swapped arguments in service parser
The port number in the service file is a decimal number followed by a
single slash.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-29 13:58:58 -03:00
Adhemerval Zanella 808035fdff math: Fix non-narrowing test build with arg-format conditions
auto-libm-test-in shares inputs between narrowing and non-narrowing
functions, and some carry arg-format conditions (e.g. "arg-ibm128").
When auto-libm-test-out-fma is regenerated, gen-libm-test.py turns these
into TEST_COND_arg_ibm128, which expands via ARG_MANT_DIG to ARG_PREFIX.
ARG_PREFIX is only defined for TEST_NARROW, so the non-narrowing fma test
failed to build with "ARG_PREFIX_MANT_DIG undeclared".

Define TEST_COND_arg_ibm128 to 0 when ARG_FLOAT is not defined, mirroring
the existing guard for TEST_COND_ibm128_libgcc; in the non-narrowing case
there is no separate argument format, so the condition is always false.

Regenerate auto-libm-test-out-fma accordingly.
2026-05-29 13:58:58 -03:00
Muhammad Kamran b9e893b60e aarch64: Use build attributes for asm feature marking
When the compiler defines __ARM_BUILDATTR64_FV, emit AArch64
feature-and-bits build attributes for BTI, PAC, and GCS from sysdep.h
instead of a GNU property note.  Keep the GNU property note as the
fallback for older toolchains.

Mirror the same marking logic in elf/tst-asm-helper.h so custom test
DSOs and assembly tests that cannot include sysdep.h get consistent
feature marking.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-29 13:58:58 -03:00
Martin Coufal bec480cbe6 misc: add a new test for gethostname
Add a simple test that runs in a UTS namespace: checks gethostname
after various sethostname values (including empty and HOST_NAME_MAX),
verifies ENAMETOOLONG when the buffer is too small for a maximal name,
EINVAL when sethostname is given a name longer than HOST_NAME_MAX.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-29 13:58:58 -03:00
Frédéric Bérat 9ef37798fa test: Fix and stabilize tst-wcsmbs-clone-overflow test
The test tst-wcsmbs-clone-overflow was initially added to tests-static.
However, this causes the test to be unstable because gconv modules
dynamically load libc.so. Any discrepancy between the statically linked
version and the dynamically loaded one can lead to a crash.

By removing the test from tests-static, it relies on dynamic linking,
safely bypassing the dlopen crash. Since the test is now dynamically
linked, it cannot use the internal thread-local symbol
_NL_CURRENT_DATA(LC_CTYPE) because _nl_current_LC_CTYPE is hidden in
libc.so, leading to undefined references. Thus, the test now uses
newlocale and uselocale, safely extracting the locale data from the
returned locale_t object.

Furthermore, using newlocale requires the gconv-modules configuration to
be built and available so that the ISO8859-1.so module can be
dynamically loaded. Otherwise, glibc falls back to the built-in C locale
conversions, leaving __shlib_handle as NULL and silently bypassing the
reference counter increment.
A new Makefile fragment, gen-gconv-modules.mk, is introduced to ensure
the gconv-modules are built before the test runs, and an explicit check
for __shlib_handle != NULL is added to the test.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-05-29 11:34:20 +02:00
Adhemerval Zanella 1e7935ae87 math: Fix fma alignment when exponent difference is exactly 64 (BZ 34183)
When d (the exponent difference between z and x*y) is exactly 64,
the alignment path shifts z left by 64 bits via (zhi = nz.m, zlo = 0)
and decrements d to 0, then takes the inner 'if (d < 64)' branch
which evaluates 'rhi << (64 - d)' with d == 0.  A shift by 64 of a
64-bit value is UB in C.

Add the explicit 'if (d == 0)' empty branch (present in the
original musl implementation).

Checked on x86_64-linux-gnu with --disable-multi-arch and
arm-linux-gnueabihf.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-28 10:22:48 -03:00
Adhemerval Zanella b20b94006c support: Skip malloc hugetlb={1,2} variants when kernel cannot honor them
The malloc test variants run with GLIBC_TUNABLES=glibc.malloc.hugetlb=1
exercise transparent huge pages via MADV_HUGEPAGE, which is only
meaningful when /sys/kernel/mm/transparent_hugepage/enabled is set to
'madvise' ('always' makes the madvise redundant and 'never' makes it
ineffective).  The hugetlb=2 variants rely on MAP_HUGETLB, which
requires a positive /proc/sys/vm/nr_hugepages.  On systems that do not
satisfy these prerequisites - including any non-Linux target - those
runs only consume CPU time in this case.

Add support/support_check_hugetlb.{c,h} exposing:

  - support_thp_is_madvise: true iff THP is in 'madvise' mode;
  - support_hugepages_reserved: true iff nr_hugepages > 0;
  - support_check_malloc_hugetlb: inspects GLIBC_TUNABLES and calls
    FAIL_UNSUPPORTED when the requested hugetlb mode cannot be honored.

Gate the check at compile time so only the variant binaries pay for
it.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-05-27 15:51:21 -03:00
Adhemerval Zanella eceaece54b elf: Re-initialise static TLS after .tdata relocation (BZ 34164)
The af34b1376a (BZ 34164) changed the
TLS setup from:

  relocation loop (applies relocations to .tdata in DSO memory)
  _dl_allocate_tls_init copies relocated .tdata -> main thread TLS

to a new order:

  _dl_allocate_tls_init copies unrelocated .tdata -> main thread TLS
  relocation loop (relocates .tdata in DSO memory, but the TLS block
  has stale copies)

This broke file-scope thread-local initialised with the address of a
function (for instance the cache structs in libmpfr).

Fix it by splitting ELF_DYNAMIC_RELOCATE inside
_dl_relocate_object_no_relro into the non-IRELATIVE and IRELATIVE
sub-passes (similar as done on static-pie startup by b75ad99d45)
and call _dl_init_static_tls between them.  By the time the IFUNC
pass fires, .tdata is fully relocated.

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-27 10:43:30 -03:00
Wilco Dijkstra b26cc4fbb7 Arch64: Add support for SVE2 ifuncs
Add support for SVE2 in cpu-features. Minor cleanup of init-arch.h.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-05-27 13:21:37 +00:00
Diego Nieto Cid c289868492 hurd: adjtime: on error return -1 and set errno
* sysdeps/mach/hurd/adjtime.c: use __hurd_fail to return
    errors back to the caller.
Message-ID: <20260527014103.10791-1-dnietoc@gmail.com>
2026-05-27 14:18:34 +02:00
Avinal Kumar 37318986e7 sunrpc/Makefile: Split and sort tests
This commit splits and sorts the tests in sunrpc/Makefile.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-05-27 08:15:34 -04:00
Samuel Thibault b507b6d4c6 Hurd: restore some SIOC ioctls
We do not define struct ifreq_short and ifreq_int, but we do
define _IOT_ifreq_short and _IOT_ifreq_int, and need these for
sysdeps/gnu/ifaddrs.c and sysdeps/mach/hurd/if_index.c
2026-05-26 23:12:46 +02:00
Samuel Thibault 7073112263 Hurd: comment ioctls which cannot currently compile
We don't currently have struct ifreq_short, ifreq_int and ifaliasreq, so
don't let applications even try to compile these.
2026-05-26 22:37:34 +02:00
Samuel Thibault ec98b25af5 Hurd: comment PF_ROUTE/AF_ROUTE defines
Comment out the PF_ROUTE and AF_ROUTE defines, since they would be used for
PF_ROUTE setsockopts, which are not available on Hurd.
2026-05-26 22:29:29 +02:00
Pino Toscano 59a0de89ba Hurd: comment PF_LINK/AF_LINK defines
Comment out the PF_LINK and AF_LINK defines, since they are usually associated
with struct sockaddr_dl, which is not available on Hurd.
2026-05-26 22:27:50 +02:00
Stefan Liebler c1b589b21c s390: Enabling lint-makefiles
The s390 specific Makefiles were adjusted to match the required format
for scripts/lint-makefiles.sh / scripts/sort-makefile-lines.py.

Afterwards the lines were sorted by those scripts.
And the testcase lint-makefiles is passing.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-26 11:05:40 +02:00
Diego Nieto Cid f531cab589 hurd: let the root user raise its priority
Check for task_max_priority RPC

      * config.h.in: add #undef for HAVE_MACH_TASK_MAX_PRIORITY.
      * sysdeps/mach/configure.ac: use mach_RPC_CHECK to check for
        task_max_priority RPC in mach_host.defs.
      * sysdeps/mach/configure: regenerate file.

    Use task_max_priority when setpriority is called by root

      * sysdeps/mach/hurd/setpriority.c: clamp the prio argument
        to the range [-NZERO, NZERO-1] and use task_max_priority
        when called by root.
Message-ID: <8e806c83d8d7b59b2894b4944e4ad82477ecc3cd.1779316637.git.dnietoc@gmail.com>
2026-05-25 23:38:23 +02:00
Etienne Brateau 156141a8f3 hurd: add validations in msync
POSIX specs specify that invalid flags shall return EINVAL and that
ENOMEM shall be returned in case of address outside of address space or
when one or more pages are not mapped.

Signed-off-by: Etienne Brateau <etienne.brateau@gmail.com>
Message-ID: <20260525211142.131508-1-etienne.brateau@gmail.com>
2026-05-25 23:29:13 +02:00
Diego Nieto Cid 58ae7f8f0c hurd: clamp the setpriority prio argument to the range [-NZERO, NZERO-1]
The Open Group Base Specifications Issue 8
getpriority ( https://pubs.opengroup.org/onlinepubs/9799919799/ )

<< The nice value is in the range [0,2*{NZERO} -1], while the
   return value for getpriority() and the third parameter for
   setpriority() are in the range [-{NZERO},{NZERO} -1]. >>

So given that NZERO is defined to 20, we shall use it to clamp to the range
specified by POSIX.

That range is then mapped to something similar to [0, 2*{NZERO}-1], as
specified by POSIX, through the usage of the macro NICE_TO_MACH_PRIORITY
and MACH_PRIORITY_TO_NICE. (i.e. [5, 45] )
2026-05-25 22:56:42 +02:00
Adhemerval Zanella 8560164813 intl: Fix tst-gettext under inherited LC_* environment
The final block of tst-gettext unsets LC_ALL plus LC_MESSAGES, LC_CTYPE,
LC_TIME and LC_NUMERIC, sets LANG=existing-locale, and then expects
setlocale (LC_ALL, "") to resolve every category through LANG.  Any
other LC_* category inherited from the invoking shell (e.g. LC_PAPER,
LC_MONETARY) still takes precedence over LANG, and if it points to a
locale that is not under the test's LOCPATH the setlocale call fails
with ENOENT.

Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-05-25 13:51:20 +00:00
Adhemerval Zanella 8eeed69baf nptl: Skip tst-pthread-gdb-attach{, -static} on env mismatches
The test previously failed with confusing diagnostics in two situations
that are properties of the runtime environment rather than of glibc:

1. find_gdb only checked access(X_OK), which is true for directories
   too.  A 'gdb' directory ahead of /usr/bin in PATH (e.g. one holding
   gdb python helpers) was therefore returned as the gdb executable,
   and the subsequent execl failed with errno != ENOENT, causing the
   test to fail with `numeric comparison failure ... status 256'.

2. The in-tree libthread_db.so.1 is built with -z mark-plt and
   therefore carries a versioned dependency on
   GLIBC_ABI_DT_X86_64_PLT in libc.so (see BZ #33212).  When the
   system gdb is linked against a libc older than 2.41, that version
   is not provided and gdb's dlopen of the in-tree libthread_db.so.1
   fails.  Thread debugging is then disabled, the gdb script's
   `thread 1' / `thread 2' commands fail, gdb exits non-zero, and the
   test reports a generic status mismatch.

Two changes:

* Require S_ISREG in find_gdb so a directory named 'gdb' on PATH is
  skipped, falling through to the next candidate.

* Before running the real gdb scenario, run a minimal probe script
  that triggers libthread_db loading (set debug libthread-db 1; set
  libthread-db-search-path; file /proc/self/exe; start).  If the
  probe output contains `dlopen failed', mark the test UNSUPPORTED
  with a clear message instead of letting the real run fail.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-05-25 13:51:08 +00:00
Matt Turner c056561d31 alpha: fix setrlimit compat symbol for negative rlim values besides -1
Old alpha glibc defined rlim_t as signed long, making RLIM_INFINITY
equal to LONG_MAX (0x7ffffffffffffffful).  The compat symbol
__old_setrlimit64 (setrlimit@GLIBC_2.0 and setrlimit64@GLIBC_2.1) was
introduced in 0d0bc784ca [BZ #22648] to translate this old RLIM_INFINITY
to the kernel's RLIM64_INFINITY (ULONG_MAX) before the prlimit64
syscall, using an exact equality check.

Because old rlim_t was signed, any value a caller treats as negative
(e.g. -2 = 0xfffffffffffffffe unsigned) is also an "infinity or beyond"
value in the old ABI.  Such values are >= OLD_RLIM64_INFINITY and
should be translated to RLIM64_INFINITY; passing them through unchanged
causes prlimit64 to treat them as large finite limits, resulting in
unexpected failures (EPERM or silent truncation).

Change the equality check to >= OLD_RLIM64_INFINITY in
__old_setrlimit64 so that all values the old signed-rlim_t ABI would
interpret as infinity-or-more are correctly mapped to RLIM64_INFINITY.

No change is made to __old_getrlimit64: prlimit64 returns only exact
RLIM64_INFINITY for unlimited resources, so the existing equality
check against RLIM64_INFINITY is correct and mirrors the kernel's own
rlim64_is_infinity() logic.

Fixes: 0d0bc784ca ("Alpha: Add wrappers to get/setrlimit64 to fix
RLIM64_INFINITY constant [BZ #22648]")
Fixes: https://sourceware.org/bugzilla/show_bug.cgi?id=30992
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-05-25 13:51:00 +00:00
Matt Turner b0f985a21e sh: reload r3 after arg evaluation in INTERNAL_SYSCALL [BZ #34167]
r3 is caller-saved. When a function call appears in the args list
(e.g. INTERNAL_SYSCALL_CALL(tgkill, __getpid(), tid, sig)),
SUBSTITUTE_ARGS evaluates __getpid() before r3 is reloaded, leaving
r3=20 (__NR_getpid) instead of __NR_tgkill=270. The trapa then
dispatches the wrong syscall and the signal is silently dropped.

Fix: declare r3 uninitialised, expand SUBSTITUTE_ARGS (all function
calls happen here), then assign the syscall number to r3 with no
intervening calls before the trapa. Applies to both INTERNAL_SYSCALL
and INTERNAL_SYSCALL_NCS.

signal/tst-raise is a regression test for this bug: raise() calls
tgkill(__getpid(), tid, sig), which triggers the clobber.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-25 13:50:54 +00:00
Adhemerval Zanella b75ad99d45 elf: Initialize TCB and stack-protector before static IFUNC resolvers (BZ 20680, BZ 27582, BZ 28817)
In static linking the IFUNC IPLT (apply_irel for non-PIE, the IRELATIVE
phase inside _dl_relocate_static_pie for static-pie) ran before
__libc_setup_tls and before _dl_setup_stack_chk_guard.  When a resolver
is compiled with -fstack-protector(-all) its prologue loads the canary
from the TCB (TCB-canary ABIs: x86_64, i386, powerpc, s390) or from
__stack_chk_guard (global-var ABIs).  On the former the resolver
crashed reading an unmapped TCB; on the latter it loaded a zero canary
(no crash, but the check is ineffective).  The same applies to a
resolver that reads any thread-local: it crashes on TCB-canary ABIs and
observes a zero-filled slot on the others (BZ 20680).  The pointer
guard has the same problem (e.g. resolvers that register an atexit
handler).

Reorder csu/libc-start.c so that ARCH_SETUP_TLS, the stack-protector
canary and the pointer guard are set up before any IFUNC resolver
runs.  For static-pie this requires splitting the existing
_dl_relocate_static_pie into two phases so the TCB/canary setup can be
interleaved between the non-IRELATIVE and IRELATIVE passes.

The historical ARCH_SETUP_IREL / ARCH_APPLY_IREL split (introduced for
powerpc so its IFUNC resolvers could read TCB fields like hwcap and
at_platform) is no longer required: TLS is now set up before either
macro runs.  ARCH_APPLY_IREL is removed, ARCH_SETUP_IREL does the work
uniformly on every arch, and the powerpc-specific libc-start.h becomes
redundant.

__libc_setup_tls reaches memcpy / mempcpy via _dl_allocate_tls_init in
elf/dl-tls.c, so it requires update ABI specific dl-symbol-redir-ifunc.h
with memcpy/memmove.

Tests added (each fails pre-fix on TCB-canary ABIs with SIGSEGV; the
static-protector variants additionally fail on global-var ABIs with a
"resolver_canary != main_canary" diagnostic):

  elf/tst-ifunc-bz28817                            static-pie + TLS in
                                                   resolver (BZ 28817)
  elf/tst-ifunc-resolver-protector                 dynamic
  elf/tst-ifunc-resolver-protector-static          static-pie
  elf/tst-ifunc-resolver-protector-static-non-pie  non-PIE static

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

I also ran the ELF tests on qemu system for loongarch64-linux-gnuf64,
powerpc-linux-gnu, powerpc-linux-gnu-power4, powerpc-linux-gnu-soft,
powerpc64-linux-gnu, powerpc64le-linux-gnu, riscv64-linux-gnu, and
s390x-linux-gnu.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-25 12:49:21 +00:00
Adhemerval Zanella af34b1376a elf: Initialize static TLS before relocation processing (BZ 34164)
An IFUNC resolver firing during dynamic linker relocation reads its
DSO's __thread storage from a zero-filled slot: init_tls() allocates
the static TLS block zero-filled, but .tdata is not copied in until
the trailing _dl_allocate_tls_init at the end of dl_main, long after
the per-object phase 2 resolvers from commit 63b31c05a8 have run.
A resolver that *writes* TLS is even worse off -- the write is
clobbered by that same trailing copy.

dl_main (elf/rtld.c): populate the DTV slotinfo, bump
dl_tls_generation, and call _dl_allocate_tls_init right after
init_tls(), before the relocation loop.

_dl_try_allocate_static_tls (elf/dl-reloc.c): drop the
"defer-if-not-relocated" branch and always run _dl_init_static_tls
inline, so a CHECK_STATIC_TLS allocation triggered mid-relocation
initialises the slot before the same object's phase 2 fires.

The new tests cheks some scenarios:

  elf/tst-ifunc-tls-init         resolver reads its DSO's IE TLS.
  elf/tst-ifunc-tls-init-dlopen  same, via dlopen.
  elf/tst-ifunc-tls-write        resolver write to TLS must survive
                                 to main.

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-25 12:49:14 +00:00
Adhemerval Zanella e563a57105 x86: Revert "x86: Lower non-temporal copy threshold for Hygon"
This version was superseeded by 213ffdfbba.
2026-05-22 10:00:05 -03:00
Wilco Dijkstra 746a560a62 string: Improve test-memchr page cross checks
The tests for memchr attempt to check for accidental overreads that cross a
page.  However they weren't done at the end of a page and don't check for the
case where we match right at the end.  Add buf1_size/buf2_size to make finding
end of buffer easier.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-05-21 16:13:07 +00:00
Thomas Daubney a7b6e53462 Vectorise special cases for SVE log1p(f)
This patch adds vectorised special cases for the SVE log functions
log1p and log1pf.

When built with GCC-15 and executed on a Neoverse V2 platform, the
following benchmarking throughput uplifts were measured:

log1pf -> 285% speed-up (4.85 ns/element to 1.26 ns/element)
log1p  -> 117% speed-up (8.25 ns/element to 3.80 ns/element)

Note that the numbers here are for the special case path only and that
the fast path performance has been maintained. These changes have also
maintained the same level of accuracy as before.
2026-05-21 10:05:52 -03:00
Rocket Ma 8ed4c70915 stdio-common: Optimize scanf %ms series array expansion
* stdio-common/vfscanf-internal.c: If user explicitly set the maximum
size of the string, respect it when reading characters. Instead of
always expanding exponentially, try to expand array to the exact size
user requested when `user_size < current_size * 2`.

Signed-off-by: Rocket Ma <marocketbd@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-21 09:08:06 -03:00
Thomas Daubney f7eea1b258 Vectorise special cases for SVE inverse hyperbolics
This patch adds vectorised special cases for the SVE inverse hyperbolic
functions atanh, acosh and asinh for single precision floats. It also
moves the commonly used inf and nan bit values into the sv_log1pf_inline
data struct for resuse.

When built with GCC-15 and executed on a Neoverse V2 platform, the
following benchmarking throughput uplifts were measured:

atanh -> 215% speed-up (5.51 ns/element to 1.75 ns/element)
acosh -> 152% speed-up (4.63 ns/element to 1.84 ns/element)
asinh ->  51% speed-up (5.00 ns/element to 3.31 ns/element)

Note that the numbers here are for the special case path only and that
the fast path performance has been maintained.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-21 09:07:48 -03:00
zombie12138 54abc8566f x86: Fix non-temporal memset unreachable on AMD Zen 3/4/5
On AMD Zen 3/4/5 with ERMS, the non-temporal memset path is unreachable
because rep_stosb_threshold is set to SIZE_MAX (vectorized loop is faster
than ERMS on these CPUs), but the non-temporal code path is nested inside
the rep_stosb branch.

The existing rescue logic at the Avoid_STOSB check only covers the case
where the CPU lacks ERMS hardware support.  It does not cover AMD Zen 3+
where ERMS is supported but deliberately unused for performance reasons.

Extend the condition to also lower rep_stosb_threshold when:
- The user has not explicitly set x86_rep_stosb_threshold (respect tunables)
- rep_stosb_threshold is higher than memset_non_temporal_threshold (NT gated)

This makes the non-temporal path reachable for large memset operations,
providing ~2x speedup on pre-faulted buffers larger than L3 cache.

Tested on AMD Ryzen 7 8745HS (Zen 4):
- Pre-faulted 64MB memset: 2.02 ms -> 0.94 ms (2.15x faster)
- First-touch 64MB memset: 19.3 ms -> 21.3 ms (11% regression, expected:
  kernel clear_page cache warming bypassed by NT stores)

	* sysdeps/x86/dl-cacheinfo.h (dl_init_cacheinfo): Extend
	rep_stosb_threshold lowering condition to cover AMD Zen 3/4/5
	where ERMS is supported but stosb is disabled via threshold.

Signed-off-by: zombie12138 <zombie12139@gmail.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34129
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-20 17:22:20 -03:00
Xiang Gao 97bd3b3d56 libio: Ignore doallocate for open_memstream and open_wmemstream [BZ #34019]
setvbuf (stream, NULL, _IOFBF, 0) takes a special path in
_IO_setvbuf: if the byte-oriented buffer base is NULL, it calls
_IO_DOALLOCATE and returns without invoking the stream setbuf hook.

For open_wmemstream, the byte-oriented buffer base is NULL although
the wide result buffer has already been initialized in _wide_data.
As a result, this path calls _IO_wdefault_doallocate, which may
replace the wide buffer managed by open_wmemstream.

Install an open_wmemstream-specific doallocate hook that leaves
the growable result buffer unchanged. Add a regression test for this
path.

Install a narrow memstream doallocate hook as well. It keeps both
memstream vtables consistent (generic stdio allocation must not
replace the growable result buffer).

Signed-off-by: Xiang Gao <gaoxiang@kylinos.cn>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-20 17:22:19 -03:00
Xiang Gao b1ab27286e libio: Ignore setbuf for open_memstream and open_wmemstream [BZ #34019]
open_memstream and open_wmemstream manage an internal growable buffer.
The default setbuf hook can reset that buffer, breaking the assumptions
used by the string stream overflow paths.

Install setbuf hooks that leave the internal buffer unchanged, and add
regression test cases for the narrow and wide cases, based on the
reproducer in BZ #34019.

Checked on x86_64 with no regression in the libio tests.

Reported-by: Rocket Ma <marocketbd@gmail.com>
Signed-off-by: Xiang Gao <gaoxiang@kylinos.cn>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-20 17:22:15 -03:00
xiejiamei 213ffdfbba x86: Lower non-temporal copy threshold for Hygon
Benchmarks on Hygon processors show that the default non-temporal
threshold is higher than ideal for large copy workloads.  As a result,
memcpy and memmove may continue to use the temporal copy path for
longer than is beneficial, increasing cache pollution and reducing
throughput for large copies.

Lower the copy non-temporal threshold to 3/8 of the shared cache size
per thread on Hygon.  This allows the non-temporal copy path to be
selected earlier while leaving the memset non-temporal threshold
unchanged.

Signed-off-by: xiejiamei <xiejiamei@hygon.cn>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-20 17:22:12 -03:00
Daan De Meyer 994a437878 elf: Don't crash in dlsym when tail-called from a constructor [BZ #34156]
If a shared library's constructor calls dlsym and discards the result,
the compiler is free to lower the call to a tail jump.  The dynamic
linker then resolves the apparent caller to ld.so's own link map, which
has no l_scope, and crashes in _dl_lookup_symbol_x dereferencing the
NULL scope pointer.

Tail-call optimization is a legal C transformation and there is no way
for the dynamic linker to recover the real caller from the elided frame.
Detect the situation by its observable effect -- a link map with no
l_scope -- and fall back to the main program's link map, the same
treatment used when the caller's address is otherwise unrecognized.

The check is written against l->l_scope rather than against _dl_rtld_map
directly because dl-sym-post.h is also compiled into libc.so, where
_dl_rtld_map is not visible (it lives only in ld.so).

Add dlfcn/tst-dlsym-ctor exercising the pattern.  Without the fix the
test SIGSEGVs during dlopen; with the fix dlopen returns cleanly.

Signed-off-by: Daan De Meyer <daan@amutable.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-20 17:22:07 -03:00
Avinal Kumar 566135bb77 SHARED-FILES: Update gettext sync record
Update the gettext section to reflect the 2026 sync with GNU
gettext 1.0 (through commit 2ebbdd0e2).  Add intl/eval-plural.h
which was missing from the shared files list.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-20 17:22:06 -03:00
Avinal Kumar 8aa4a70431 intl: Fix undefined pointer behaviour
In _nl_find_msg (dcigettext.c), outbuf was computed as
freemem + sizeof(size_t) before checking whether freemem_size is
large enough.  When freemem is NULL (initial state), this is
undefined behaviour i.e arithmetic on a null pointer.  Move the
outbuf assignment after the size check where freemem is guaranteed
to be a valid allocation.

In read_alias_file (localealias.c), after realloc the old
string_space pointer is dangling.  The expression
new_pool - string_space subtracts a valid pointer from a dangling
one, which is undefined behaviour per ISO C 23.
Rewrite as new_pool + (map[i].alias - string_space) so both
operands of the subtraction point into the same (old) object
before string_space is reassigned.

Based on GNU gettext commits 695429040 and 2ebbdd0e2.
Original author: Bruno Haible <bruno@clisp.org>

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-20 17:22:03 -03:00
Adhemerval Zanella 209ad6ff9d Fix hurd bootstrap after 4c6f92daea
Hurd bootstrap with build-many-glibc.py fails for i686-gnu since
4c6f92daea:

In file included from zic.c:16:
private.h:849:1: error: static declaration of ‘mempcpy’ follows non-static declaration
  849 | mempcpy(void *restrict s1, void const *restrict s2, size_t n)
      | ^~~~~~~
In file included from ../include/string.h:60,
                 from private.h:222:
../string/string.h:432:14: note: previous declaration of ‘mempcpy’ with type [...]
  432 | extern void *mempcpy (void *__restrict __dest,
      |              ^~~~~~~

The libc-symbols.h already defined some HAVE_*, but timezone files are
built with -D_ISOMAC.  Remove its usage and only define _ and N_
macros if not already defined.

Checked on x86_64-linux-gnu and with a build-many-glibcs.py build for
i686-gnu.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2026-05-20 14:55:00 -03:00
Adhemerval Zanella 999fa30b36 elf: Use dl_scratch_buffer for LD_LIBRARY_PATH copy in _dl_init_paths
_dl_init_paths used strdupa to make a mutable copy of LD_LIBRARY_PATH
for fillin_rpath to tokenize.  The env block is attacker-controllable
and Linux allows individual variables up to MAX_ARG_STRLEN (32 *
PAGE_SIZE = 128 KB), so the strdupa can push tens of KB onto the
loader's startup stack on top of the env block that already sits on
the initial stack.  With a reduced RLIMIT_STACK the doubled copy
overflows before main () is reached.

Replace the strdupa with a dl_scratch_buffer: short paths stay in
the 256-byte inline area, longer ones spill to anonymous mmap (malloc
is not yet available during _dl_init_paths).  Two follow-on changes
make the new scratch lifetime safe against _dl_signal_error:

  * Count entries directly off the const LD_LIBRARY_PATH and allocate
    __rtld_env_path_list.dirs *before* the scratch is live.  That way
    the larger of the two heap allocations the loader controls signals
    its OOM with no scratch to leak.

  * Convert fillin_rpath to return bool instead of calling
    _dl_signal_error internally on per-entry malloc failure.  Its
    only caller in the LLP path now frees the scratch first and then
    signals the error from a clean state.  decompose_rpath, the other
    caller, is updated symmetrically.  This also fixes a pre-existing
    leak in fillin_rpath's OOM path, where the to_free heap copy from
    expand_dynamic_string_token was not released before the
    _dl_signal_error.

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-20 14:50:59 -03:00
Adhemerval Zanella 3215ea5c45 elf: Use dl_scratch_buffer for DST expansion in _dl_map_object_deps
The expand_dst macro in _dl_map_object_deps performs an unbounded
alloca via DL_DST_REQUIRED, which scales with the link map's
l_origin length plus the count of dynamic-string tokens in the
input string.  When a DT_NEEDED entry carries several DSTs and the
link map sits in a deep directory, the resulting allocation grows
to several kilobytes -- enough to overflow a PTHREAD_STACK_MIN
thread that calls dlopen.

Convert the macro to a static function that draws from a caller-
owned dl_scratch_buffer, so oversized expansions land on the heap
(or anonymous mmap during early startup) instead of the stack.
The scratch buffer is reused across DT_NEEDED, DT_AUXILIARY, and
DT_FILTER entries of the same map and freed once dependency
expansion completes.

A new regression test, tst-dst-needed-minstack, builds a wrapper
library that inherits a five-DST SONAME from a leaf module,
deploys it under a deep temporary directory, and dlopens it from
a PTHREAD_STACK_MIN thread.  Without the fix the dlopen overflows
the thread stack and crashes; with the fix the dlopen returns
cleanly (with or without a successful load).

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-20 11:49:17 -03:00
Adhemerval Zanella 3e3b621910 elf: Replace alloca with dl_scratch_buffer in _dl_load_cache_lookup
The alloca added by commit ccdb048d ("Fix recursive dlopen") to
snapshot the matched cache entry before __strdup runs through
interposable malloc is sized by best_len, which can reach PATH_MAX.
On PTHREAD_STACK_MIN threads that's enough to overflow the stack
mid-dlopen.

Use dl_scratch_buffer with DL_SCRATCH_NO_MALLOC: short entries stay
in the 256-byte inline area, longer ones spill to anonymous mmap
rather than to interposable malloc.  The recursive-dlopen invariant
is preserved.

New container test elf/tst-dl-cache-long-path constructs a ~3.4 KB
deep directory, populates ld.so.cache with that entry, and dlopens
from a PTHREAD_STACK_MIN thread under deliberate stack pressure;
reliably SIGSEGVs against the alloca-based code and passes with the
fix.

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-20 11:49:12 -03:00
Adhemerval Zanella 26ed1cb8ca elf: Replace alloca/VLA with dl_scratch_buffer in dl-load.c
is_trusted_path_normalize, print_search_path, and open_path used
alloca or a VLA to hold a path scratch buffer sized by user-controlled
inputs (an RPATH directory length, or
max_dirnamelen + max_capstrlen + namelen).  On the worst case that
consumes up to PATH_MAX bytes of stack per call, which can overflow a
PTHREAD_STACK_MIN-sized stack mid-dlopen when combined with the
loader's other on-stack scratch (struct filebuf, etc.).

Replace those allocations with dl_scratch_buffer.  As a small cleanup,
print_search_path now takes the scratch buffer from its caller
(open_path's buffer is already large enough --
max_dirnamelen + max_capstrlen + namelen with namelen >= 1 covers the
max_dirnamelen + max_capstrlen + 1 print_search_path requires), so
LD_DEBUG=libs no longer pays for an extra allocation per open_path
invocation.

A new test elf/tst-dl-path-buf exercises the relevant paths -- dlopen
via DT_RPATH, open_path failure cleanup, dlopen with an over-long
name, dlopen from a PTHREAD_STACK_MIN thread.

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-20 11:49:11 -03:00
Adhemerval Zanella f86b51dd6a support: Add use_stack_min option to support_small_thread_stack_size
It allows it to return PTHREAD_STACK_MIN if defined.

Checked on x86_64-linux-gnu and with a build for i686-gnu.

Suggested-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-20 11:49:09 -03:00
Adhemerval Zanella 4e3489bd2a elf: Add dl_scratch_buffer, a loader-side scratch buffer
Several loader code paths need a short-lived scratch buffer sized
by attacker-influenced inputs (RPATH entries, ld.so.cache strings,
etc.).  The available primitives are all unsuitable:

  - alloca is unbounded and can overflow PTHREAD_STACK_MIN stacks.

  - <scratch_buffer.h> is unaware of __minimal_malloc: a malloc'd
    spill freed during early loader startup silently leaks because
    __minimal_free only releases the most-recent allocation.

  - A few paths cannot route through the interposable malloc at
    all -- ld.so.cache lookup in particular, because an interposed
    user malloc may recursively call dlopen and __munmap the cache
    mapping mid-copy (commit ccdb048d, "Fix recursive dlopen").

Add a loader-side analogue of <scratch_buffer.h>: a 256-byte inline
area for the common case, with spill to malloc by default or to
anonymous mmap when __minimal_malloc is active or the caller passes
DL_SCRATCH_NO_MALLOC.  Mmap spills are tagged " glibc: loader
scratch" via __set_vma_name for /proc/self/maps visibility.  On OOM
dl_scratch_buffer_allocate raises a loader error via _dl_signal_error
and does not return.  The one-shot contract (no second allocate
without an intervening free) is enforced by an assertion in
_dl_scratch_buffer_allocate.

No functional change in this commit; consumers are added separately.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-20 11:49:08 -03:00
Yury Khrustalev 1233e256f2 malloc: Small fix for code readability
A couple of small fixes for code readability, no functional change.

 - Add missing comments for #endif statements.
 - Move inclusion of string.h from malloc.c to calloc-clear-memory.h
   where it is actually used.
 - Re-order alias definitions for malloc functions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-05-20 10:38:59 +01:00
Stefan Liebler aadbf5a10a s390: Adjust configure check for static-pie support.
With the previous approach, the configure check fails for lld in version >=19.
While binutils and lld 18 is placing the R_390_IRELATIVE relocation in .rela.plt
and emits DT_JMPREL pointing to it, newer lld versions puts the R_390_IRELATIVE
relocation in .rela.dyn and therefore there is also no DT_JMPREL entry and the
configure check claims that lld does not support static-pie.

The R_390_IRELATIVE relocation is also processed fine in .rela.dyn, thus the
configure check is adjusted.  Now the configure checks that it exists a
R_390_IRELATIVE relocation at all. If the R_390_IRELATIVE relocation lands in
.rela.plt, it ensures that there is DT_JMPREL pointing to it.  Otherwise there
should be a .rela.dyn section.
2026-05-20 10:18:14 +02:00
Andreas Schwab aa56ccb98b nss_files: use booleans in parser macro calls
The swallow argument in the INT_FIELD and STRING_FIELD macros is used as a
boolean, change all callers to use false and true instead of 0 and 1.
2026-05-19 15:20:20 +02:00
Andreas Schwab 66efdda2f8 nss_files: fix swapped arguments in service parser
The port number in the service file is a decimal number followed by a
single slash.
2026-05-19 15:20:20 +02:00
Paul Eggert dee4e2446f Regenerate 'configure'
* configure: Regenerate from configure.ac,
which was updated in the recent commit
'Simplify tzdb-related configuration'.
2026-05-18 14:43:09 -07:00
Weihong Ye 3237d63b84 AArch64: Optimize memcmp for Kunpeng 950 with SVE
Key optimizations:
- Use SVE predication for branch-free handling of short inputs and tails
- Use 4-way loop unrolling to maximize pipeline utilization
- Optimize mismatch detection with early exit logic

Benchmark (bench-memcmp, generic -> this patch):
- Small (0-128B): 15% - 50% speedup
- Medium (129-1024B): 21% - 50% speedup
- Large (2048-4096B): 28% - 50% speedup

Note: regressions may be observed in edge cases where offsets
are near 4K boundaries. These instances are rare and the overall
performance gain remains significantly positive.

Also add IFUNC support for memcmp and correct the first-line
comment in memcpy_kunpeng950.S.
2026-05-18 17:32:54 +00:00
Paul Eggert d420b69b81 Simplify tzdb-related configuration
tzdb 2026b no longer needs -Wno-discarded-qualifiers or
-Wno-unused-variable.  From a suggestion by Joseph Myers in:
https://sourceware.org/pipermail/libc-alpha/2026-May/177312.html
* configure.ac (config-cflags-wno-discarded-qualifiers): Remove.
* timezone/Makefile (CFLAGS-zic.c): Remove -Wno-unused-variable,
$(config-cflags-wno-discarded-qualifiers).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-18 13:31:00 -03:00
Paul Eggert 4c6f92daea timezone: sync to tzdb 2026b
Sync tzselect, zdump, zic to tzdb 2026b.

This fixes some buffer and integer overflows in zic,
adds new zic options -D, -m and -u inspired by FreeBSD,
and raises zic’s maximum number of abbreviation bytes
per timezone from 50 to 256.

This patch incorporates the following tzdb source code changes:

f9d30685 Output a minimal time zone designation table
37a4d178 Fix zic overflow bug with too-large offsets
4392f2dc zic now checks for signals more often
99a08a66 Fix zic buffer overflow when computing TZ
d63b9287 zic: keep needed last transition to new type
d005045d Pacify clang -Wunterminated-string-initialization
e67b08d3 Port to C23 strchr macro
3d4b4e46 Add zic.c overflow commentary
d9101b88 zic now a bit safer for overflows near 2**63
b23fa8e0 zic now allows more than 50 leap seconds
4ff518d2 Increase TZ_MAX_CHARS from 50 to 256
75d3b73b New -DTZ_RUNTIME_LEAPS=0 build-time option
87343c6e TZ_MAX_TIMES must be at least 310 now
fc8f1b68 Simplify int_fast32_t definition on C89 platforms
24581465 Remove TZDEFRULES ("posixrules") from localtime.c
fc708427 zic now warns about -p
b09a3f23 Port TWOS_COMPLEMENT to signed-magnitude hosts
56b7a24a Make sure 2**31 - 1 is signed
9068ab78 zic no longer generates utoff == -2**31
cb6f9b3b Omit unnecessary L suffixes
c37fbc32 Clarify when ‘__attribute__((pure))’ is a hack
859690a7 Fix some unsequenced/reproducible commentary
9c772ca7 Port to POSIX.1-2001 fflush
10f93018 Omit no-op transitions when Rule+Zone cancel
a0b09b52 Fix unlikely backslash bug in scripts
2cbd3a71 Allow builder to override GRANDPARENTED
c7257626 not used at → used outside
faed4bd3 Clarify <sys/auxv.h> vs getauxval
df08e6a1 Port mode_t (and gid_t, uid_t) to MS-Windows
6127d375 New zic option -u, inspired by FreeBSD
813c9ee0 New zic option -m, inspired by FreeBSD
987ea89c New zic option -D, inspired by FreeBSD
cc377b07 Simplify mkdir situation
cd994a90 Simplify !HAVE_POSIX_DECLS situation
052ddf76 Minor gettext macro improvements
d9018f1c Refactor duplicate duplicate-option code
8d65db97 Prefer fdopen to umask in zic
d7edca6e Omit “'”s from zic usage message
a09ba7a5 getopt returns -1 (not EOF) on failure
e22d410c zic now uses is_digit
f57cadda Always invoke umask at start
242a8338 Fix mode_t issues on MS-Windows
2fecd606 MKDIR_UMASK → MKDIR_PERMS refactoring
90ef088a Move static_assert to top level
41576478 Port better to platforms lacking mempcpy
90a08d3e * private.h: Include stddef.h early enough
aa8b35fe Simplify port to NetBSD struct __state
cd2fddf7 Port to -DHAVE_SYS_STAT_H=0 -DHAVE_POSIX_DECLS=0
8470e759 Pacify GCC 15 -Wunterminated-string-initialization
8817d42f Prefer mempcpy to doing it by hand
87abb113 Tighten security checks on TZ values
c87f0918 Use strnlen
07f7f31a Fix preprocessor indenting
3adf4123 Add offtime_r à la FreeBSD and NetBSD
b807a31e Don’t depend on ‘true’ for tzselect
ddffc800 * zic.c: Fix misspelled comment (thanks to Jonathan Wakely).
7063d08c Fix bug with -d RELATIVE -t ABSOLUTE
e8920e76 Rename emalloc to xmalloc.
e8e1a3d2 NetBSD defines STD_INSPIRED functions
3411494c Define _CRT_DECLARE_NONSTDC_NAMES for MS-Windows
7c909166 Define NOMINMAX for MS-Windows
24a4d97f 'zdump -' now reads from stdin
e6d6bc3e Pacify gcc -Wsuggest-attribute=format sans snprintf in zdump
99557862 TZNAME_MAXIMUM defaults to 254, not 255
fe5be99d Be more consistent about macro true/false vs 1/0
31f483a1 Remove dependency of asctime on strftime
7ef7ed06 Simplify timeoff redefinition
1bd67a4b Move MKTIME_MIGHT_OVERFLOW definition
67f7e8ab Pacify GCC 15ish -Wzero-as-null-pointer-constant
535a4e8b Pacify GCC 15ish -Wleading-whitespace=blanks
0706ef0b Move iinntt definition
ea814e99 strftime %s no longer is limited to time_t range
41e5344e Fix bug near the year 2**31 - 1 - 1900
4e1de249 Pacify gcc -Wsuggest-attribute=const
ebd2ed92 Don’t define _FILE_OFFSET_BITS if _TIME_BITS
26a649a1 Improve zdump overflow checking
9c8221d7 * private.h: Fix timeoff comment.
9db906a0 Switch from RFC 8536 to 9636 for documentation
af54a9e8 Port better to glibc when used internally there

Checked on x86_64-linux-gnu.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-18 13:31:00 -03:00
xiejiamei 08e963f675 x86: Lower non-temporal copy threshold for Hygon
Benchmarks on Hygon processors show that the default non-temporal
threshold is higher than ideal for large copy workloads. As a result,
memcpy and memmove may continue to use the temporal copy path for
longer than is beneficial, increasing cache pollution and reducing
throughput for large copies.

Lower the copy non-temporal threshold to 3/8 of the shared cache size
per thread on Hygon. This allows the non-temporal copy path to be
selected earlier while leaving the memset non-temporal threshold
unchanged.

Signed-off-by: xiejiamei <xiejiamei@hygon.cn>
2026-05-18 13:31:00 -03:00
Rocket Ma 64efa1451b libio: Fix fmemopen_write on appending mode (BZ 34006)
* libio/fmemopen.c: Reference pos the variable instead of c->pos.
On the edge case, one byte should be written at the end of buffer,
instead of returning error.

Signed-off-by: Rocket Ma <marocketbd@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-18 13:31:00 -03:00
Adhemerval Zanella 63b31c05a8 elf: Defer all IRELATIVE relocations until after PLT setup
When a shared library is built with -z lazy and its IFUNC resolver calls
a PLT function, the dynamic linker can crash.  The resolver runs while
the PLT stubs still hold their raw ELF virtual addresses — l_addr has
not yet been added — so the call branches to an unmapped address.

The old code deferred IRELATIVE entries only to the end of the relocation
range currently being processed (via the r2/end2 scan-ahead mechanism in
elf_dynamic_do_Rel).  This was sufficient only when both IRELATIVE and the
JMP_SLOT entries for the PLT functions it needs are in the same section.
On x86-64, aarch64, arm, i386 and most other targets, a file-scope
initialiser of the form

  int (*fptr)(void) = some_ifunc;

causes the linker to place R_*_IRELATIVE in .rela.dyn, while JMP_SLOT
entries for any PLT calls made by the resolver live in .rela.plt.
Processing .rela.dyn before .rela.plt means the resolver fires before the
PLT is usable, regardless of where within .rela.dyn IRELATIVE appears.

Fix this by splitting IRELATIVE processing into a separate, explicitly
deferred pass.  In elf/do-rel.h:

 - Remove the r2/end2 variables and the post-loop IRELATIVE re-scan from
   elf_dynamic_do_Rel.  IRELATIVE entries are now always skipped in the
   non-bootstrap path.

 - Add a new elf_dynamic_do_Rel_irelative function that scans a
   relocation range and calls elf_machine_rel/elf_machine_lazy_rel for
   IRELATIVE and ifunc relocations.

In elf/dynamic-link.h, update _ELF_DYNAMIC_DO_RELOC to use a two-phase
approach for non-bootstrap builds unconditionally (regardless of whether
ranges[1].size is zero):

 Phase 1+2: elf_dynamic_do_Rel over .rela.dyn then .rela.plt — processes
            everything except IRELATIVE/STT_GNU_IFUNC.
 Phase 3+4: elf_dynamic_do_Rel_irelative over .rela.dyn then .rela.plt —
            processes only IRELATIVE, by which point all PLT stubs are
            valid.

This guarantees that IRELATIVE resolvers can call PLT stubs safely
regardless of which section the linker placed R_*_IRELATIVE in.

Add ELF_MACHINE_IRELATIVE to the architectures that were missing it so
the new skip logic in elf_dynamic_do_Rel is compiled for all targets.

This patch addresses the binutils BZ 13302 [1] from the glibc side, and
also fixes the mold-reported issue [2], which shows that IFUNC relocation
placement and processing can work differently across ABIs.

I checked on all ABIs that support IFUNC (x86_64, i686, aarch64, arm,
loongarch, powerpc, riscv, s390, and sparc), some via qemu-system.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=13302
[2] https://github.com/rui314/mold/issues/1550

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-18 13:31:00 -03:00
Wilco Dijkstra 17a79a5120 malloc: Remove dynamic mmap/trim threshold [BZ #30769]
v2: Update documentation

Whenever a large mmap is released the mmap and trim thresholds are updated.
As a result these thresholds grow ever larger which means huge allocations
are always served by arenas rather than mmap.  The thresholds can end up as
large as an arena, which completely stops all trimming of the top block.
Remove the code completely - the default thresholds seem way too low for
modern 64-bit targets, but they can be increased seperately.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-18 13:31:00 -03:00
Avinal Kumar bb91c88af7 intl: Fix memory leak in _nl_find_domain on allocation failure
When _nl_explode_name() returns -1 (out of memory) and the locale was
resolved through an alias, _nl_find_domain() returns immediately
without freeing the locale copy allocated earlier.  Similarly,
when _nl_make_l10nflist() returns NULL, the 'goto out' skips the
alias_value free.

Fix by nesting the _nl_make_l10nflist() call and its result handling
inside 'if (mask != -1)' instead of returning early.  Move the
normalized_codeset free inside the same block.  Both failure paths
now fall through to the unconditional alias_value free at the end.

Imported from GNU gettext commit 10eafd9e5.
Original author: Bruno Haible <bruno@clisp.org>

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-18 13:31:00 -03:00
Avinal Kumar 5ce8201bf5 intl: Remove pre-C99 fallbacks from plural-exp.c
glibc requires C11 since 2022, making pre-C99 compatibility
paths in plural-exp.c dead code:

- init_germanic_plural(): With C99+, GERMANIC_PLURAL is
initialized at compile time and this function is never called.
Remove the function and the INIT_GERMANIC_PLURAL macro.

- HAVE_STRTOUL guard: Protected strtoul() usage with a manual
digit-parsing fallback.  strtoul is in C89 <stdlib.h> and glibc
provides it.  Remove the guard and the fallback loop.

Imported from GNU gettext commits ab5990532 and c1d84d656.
Original author: Bruno Haible <bruno@clisp.org>

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-18 13:31:00 -03:00
Avinal Kumar 9985b162d8 intl: Remove PRI_MACROS_BROKEN from loadmsgcat.c
PRI_MACROS_BROKEN was a workaround for AIX 4, where inttypes.h
did not properly define the PRI* format macros (PRId8, PRIu32, etc.).
glibc has never supported AIX, the macro was always hardcoded to 0
under _LIBC, making it a dead code.

GNU gettext removed this in commit 267f61670 ("Drop portability to
AIX 4"), since no supported system has broken PRI macros post-C99.

Based on GNU gettext commit 267f61670.
Original author: Bruno Haible <bruno@clisp.org>

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-18 13:31:00 -03:00
Avinal Kumar 6f837cdedd intl: Remove IN_LIBGLOCALE dead code
Remove all IN_LIBGLOCALE conditional blocks from intl/.  libglocale
was a proposed API from 2005 that was never completed or shipped.
The macro is never defined in glibc or in current GNU gettext, making
every #ifdef IN_LIBGLOCALE block dead code.

GNU gettext removed these in commits starting from 2023.  Removing
them from glibc reduces noise and eases future syncs with gettext.

Imported from GNU gettext commit d6a6801c1.
Original author: Bruno Haible <bruno@clisp.org>

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-18 13:30:59 -03:00
Muhammad Kamran d093102297 AArch64: simplify __libc_arm_za_disable failure path
The failure tail of __libc_arm_za_disable only leads to
__libc_fatal, so it does not need to preserve call frame state.

Remove the PAC prologue, frame setup, saved cntd value, stack
stores, and associated CFI directives from the fatal path, leaving
only the required SME state shutdown and fatal call.

Add tst-sme-za-disable-fail to exercise the abort path by providing
a TPIDR2 block with non-zero reserved bytes and checking that the
process terminates with SIGABRT and the expected fatal message.
2026-05-18 14:06:58 +00:00
Adhemerval Zanella d9981b5439 stdio-common: Silence clang -Wfortify-source warning in tst-vfscanf-bz34008
clang does not recognize the 'm' scanf specifier and incorrectly warns
that the buf argument may overflow.  Suppress the warning with the
clang-specific DIAG_* macros.
2026-05-15 11:08:31 -03:00
Adhemerval Zanella 1172d0e9cf elf: Batch program-header reads in _dl_map_segments (oversight fix)
The fix for BZ 26577 ("Fix stack overflow in _dl_map_object_from_fd
with large e_phnum") removed the alloca for the program-header table
and introduced a streaming iterator (dl_pt_load_iterator) so segments
could be walked without staging the entire table on the stack.

That patch batched reads correctly in _dl_map_object_scan_phdrs (the
first walk, which collects PT_DYNAMIC/PT_TLS/PT_GNU_* metadata), but
overlooked the second walk in _dl_map_segments:
_dl_pt_load_iterator_next issued one pread64 per program header to
find the next PT_LOAD entry.  For an object with N program headers
this added N redundant per-phdr syscalls on every dlopen / loader
startup -- regardless of whether the table had already been read by
open_verify into struct filebuf.

Unify both walks behind a single batched helper,
_dl_pt_load_iterator_phdr_at:

  - When the program header table fits in the bytes already read by
    open_verify into fbp->buf (the common case for nearly all shared
    objects), all phdr accesses are served from that buffer with no
    syscall at all.

  - Otherwise, up to FILEBUF_SIZE / sizeof(ElfW(Phdr)) program headers
    are read into fbp->buf with a single pread64; subsequent indices
    in the same window hit the buffer.

Both _dl_map_object_scan_phdrs and _dl_pt_load_iterator_next now go
through this helper, eliminating the separate batching logic in
_dl_map_object_scan_phdrs.  struct filebuf moves from dl-load.c to
dl-load.h so the inline iterator in dl-map-segments.h can reach
fbp->buf.

The filebuf size is also bumped to ensure the cached fast path
triggers for all observed binaries.  A survey of an Ubuntu 24.04
installation (scanning /usr) shows:

    Candidate files       : 465834
    ELF files inspected   : 11624
    glibc-linked binaries : 10164
    Minimum e_phnum       : 5
    Maximum e_phnum       : 14
    Average e_phnum       : 11.37
    Median  e_phnum       : 11.0

shows e_phnum capped at 14 (for instance gcc's cc1, lto1, perl,
and gdb).  The previous FILEBUF_SIZE of 832 on 64-bit fit only 13
program headers after the ELF header (64 + 13*56 = 792), so 64-bit
binaries with 14 phdrs missed the cached path.  FILEBUF_SIZE is
bumped from 512/832 to 640/1024 (32-bit / 64-bit) -- enough for at
least 16 program headers on either ABI, leaving headroom over the
observed maximum.

For a typical shared library where open_verify's initial read covers
the program header table, this reduces _dl_map_segments from N
preads to 0.  For a worst-case e_phnum that does not fit in fbp->buf,
reads drop from N to ceil(N / phdrs_per_buf) -- the same cost
_dl_map_object_scan_phdrs already pays.

No functional change.  Tested on x86_64-linux-gnu, aaarch64-linux-gnu,
and i686-linux-gnu.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-15 10:58:46 -03:00
Adhemerval Zanella 3bd334037e elf: Fix 785a028ab7 for PTHREAD_STACK_MIN platforms
Due a missing ';'.
2026-05-14 19:02:10 -03:00
Adhemerval Zanella 785a028ab7 elf: Fix elf/tst-bz26577-minstack.c on hurd
Hurd does not defined PTHREAD_STACK_MIN, use support_small_thread_stack_size
instead.

Checked on a x86_64-gnu build.
2026-05-14 17:20:02 -03:00
Shamil Abdulaev 389ecf52bc libio: Fix race in _IO_new_file_init_internal initialization order [BZ #33785]
_IO_new_file_init_internal linked the new stream into _IO_list_all
before setting fp->_fileno to -1.  A concurrent thread that walks
_IO_list_all (for example via fflush (NULL)) could observe the stream
with an uninitialized _fileno before initialization completed.

Set _fileno = -1 before _IO_link_in so the stream is fully
initialized when it becomes visible in the global list.

This is the residual concurrency defect noted at the end of commit
b657f72fa3 ("libio: Fix deadlock between freopen, fflush (NULL) and
fclose (bug 24963)").

Add libio/tst-file-init-race exercising concurrent fopen/fclose and
fflush (NULL) to detect regressions.

Signed-off-by: Shamil Abdulaev <ashamil435@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-05-13 07:52:40 +02:00
Frédéric Bérat 1cc165baed test: Add gconv refcount leak test for swscanf
Add a new internal test, `tst-wcsmbs-clone-overflow`, to verify correct
gconv module reference counting. The Makefile is updated to include this
test in the `tests-internal` list and ensure it runs with generated locales.

This test specifically checks that the `__counter` for `gconv_fcts->towc`
does not leak references when `swscanf` is used with a stack-allocated
wide character stream. It ensures that `_IO_wstrfile_fclose_stack`
properly decrements the module reference counter, preventing a module
from staying loaded indefinitely due to unreleased references.

Assisted-by: LLM
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-12 11:09:46 +02:00
Frédéric Bérat 0981c03c27 libio: Fix gconv module reference counter overflow in swscanf
The swscanf family of functions creates a wide-oriented FILE stream
on the stack. Initialization of this stream invokes `_IO_fwide`, which
clones the global locale's gconv transformation steps via
`__wcsmbs_clone_conv`. This increments the reference counter (`__counter`)
of the gconv module.

Because the FILE stream is stack-allocated, `fclose` cannot be called,
and so `__gconv_release_step` is never invoked. The counter leaks,
eventually hitting the 32-bit integer overflow limit and aborting the
process.

To resolve this, we introduce `_IO_wstrfile_fclose_stack`, a dedicated
cleanup function for stack-allocated FILE streams. This function invokes
`_IO_FINISH` and correctly releases the gconv steps via
`__gconv_release_step` without attempting to `free` the FILE pointer.
This cleanup function is then hooked into all variants of swscanf right
before they return.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-12 11:09:34 +02:00
Adhemerval Zanella 18ff9235eb elf: Eliminate alloca for program-header table in the ELF loader
The ELF loader allocates the program-header table on the stack with
alloca(e_phnum * sizeof(ElfW(Phdr))) in two places: once in
open_verify to call elf_machine_reject_phdr_p, and again in
_dl_map_object_from_fd to scan segment types.  Both fall back to
alloca only when the table does not fit in the initial fbp->buf read;
for a crafted ELF with e_phnum == 0x7FFF this means up to ~1.8 MB
(32767 × 56 bytes on a 64-bit host) on the stack in each call, with
no guard against the combination exhausting the available stack space.

A latent variant of this problem exists even for ordinary shared
libraries when dlopen is called from a thread running with
PTHREAD_STACK_MIN stack (16 KB on Linux).  The nptl/tst-minstack-exit
test demonstrates that glibc code paths must operate correctly under
minimum-stack conditions; loading a shared library with even a modest
number of program headers can overflow the remaining stack through the
alloca-based phdr table.

This patch eliminates both allocas by replacing them with a single
_dl_map_object_scan_phdrs function that reads program headers in
fixed-size chunks into the existing fbp->buf scratch buffer (512 B on
32-bit, 832 B on 64-bit) using pread.  When all headers fit within
the bytes already captured by open_verify's initial read() call (the
common case), no extra syscall is needed.  This should be the case for
most of the ELF objects and should not required additional syscalls.

The slow path issues as many pread calls as necessary without any stack
growth proportional to e_phnum.  The elf_machine_reject_phdr_p interface
is redesigned around a new struct dl_machine_phdr_info and on MIPS this
captures the PT_MIPS_ABIFLAGS entry in-flight, so the compatibility check
in elf_machine_reject_phdr_p no longer needs to re-scan the program-header
table.

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

NB: this patch depends on https://sourceware.org/pipermail/libc-alpha/2026-May/177239.html
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-11 15:49:41 -03:00
Adhemerval Zanella fdd1684c85 elf: Fix stack overflow in _dl_map_object_from_fd with large e_phnum (BZ 26577)
The _dl_map_object_from_fd uses a VLA (loadcmds[l->l_phnum]) whose size
is proportional to e_phnum.  A crafted ELF with e_phnum == 0x7FFF
allocates ~1.5 MB (32767 × 48 bytes on 64-bit machine) on the stack,
which adds to the previous ~1.75 MB alloca for the phdr table that
precedes it.

This patch follow Florian's suggestion [1] to use a two-pass approach
(collect-then-map) with a single-pass struct dl_pt_load_iterator that
precomputes the metadata needed by _dl_map_segments (p_align_max,
has_holes, first/last segment bounds, nloadcmds) and then yields one
struct loadcmd at a time through _dl_pt_load_iterator_next, holding at
most one loadcmd on the stack at a time.  The same iterator is
threaded through _dl_map_segments in dl-map-segments.h.

The main complex part is the test, which adds python-generated crafted
ET_DYN that has e_phnum == 0x7FFF: one PT_LOAD covering the ELF header
so the loader exercises the full iterator path, and the remaining
headers PT_NULL.  The test runs two subtests under a reduced stack limit
(phdr alloca + 1 MB headroom ≈ 2.75 MB, well below the 3.25 MB the
unfixed VLA code requires).

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

[1] https://sourceware.org/pipermail/libc-alpha/2026-February/175136.html
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-11 15:49:41 -03:00
Avinal Kumar ba305d8268 intl: Add tests for plural expression hardening
The first test checks for stack overflow.  It uses a plural expression
nested 5000 levels deep using the !(1-(...)) pattern.  The parser
accepts it (below YYMAXDEPTH=10000), but evaluation exeeds
EVAL_MAXDEPTH=100 and falls back to index 0 instead of crashing with
SIGSEGV.

The second test checks for division by zero in plural expression.  The
expression (n!=1)+1/(n!=1729) triggers 1/0 for n=1729.  msgfmt only
validates 0<= n <= 1000, so the .mo file is accepted.  Evaluation
returns PE_INTDIV and falls back instead of raising SIGFPE.

Adaptations from gettext to glibc:

- gettext's plural-3 embeds the nested expresion as a literal string.
This test uses an AWK script (plural-depth.awk) to generate the same
expression.

- gettext uses LANGUAGE= (empty) with LC_ALL=ll and its own locale
setup.  glibc requires a real locale for setlocale() or else the "C"
locale override in dcigettext.c ignores LANGUAGE entirely.

The tests are derived from GNU gettext's plural-3 (commit 021348871a22)
and plural-4 (commit 429ba6c6b835), adapted to glibc's test framework.

Original author: Bruno Haible <bruno@clisp.org>

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-05-11 15:49:41 -03:00
Avinal Kumar e7f5359db7 intl: Import plural expression hardening from GNU gettext
The plural expression evaluator plural_eval() in eval-plural.h uses
unbounded recursion, which can cause a stack overflow crash with
deeply nested expressions in malicious .mo files.  This is
particularly dangerous on threads with small stacks (musl libc
default: 128 KB, AIX 7 default: 96 KB, glibc after ulimit -s 260:
~3919 recursions max).

Additionally, division by zero in plural expressions triggers
raise(SIGFPE), which is not multithread-safe, catching SIGFPE
requires per-process signal handlers that race with other threads.

Fix both by importing the hardening from GNU gettext:

- Replace unbounded plural_eval() with depth-limited
  plural_eval_recurse() (EVAL_MAXDEPTH=100), returning a
  struct eval_result with status instead of a bare unsigned long.

- Return PE_INTDIV status on division by zero instead of raising
  SIGFPE.  Remove the architecture-specific INTDIV0_RAISES_SIGFPE
  macro and the conditional #include <signal.h>.

- Update plural_lookup() in dcigettext.c to handle the new return
  type, falling back to index 0 on any evaluation failure.

Based on GNU gettext commits ef37a1540 and 726bfb1d1.
Discussed on: https://sourceware.org/pipermail/libc-alpha/2023-October/152010.html

Original author: Bruno Haible <bruno@clisp.org>

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-05-11 15:49:40 -03:00
Adhemerval Zanella c2d6afb4a0 arm: Enable static-pie support (BZ 34098)
It requires proper gcc support [1], and without proper compiler support
the arm configure disable static-pie support.

The start.S requires some adjustment to avoid loading main from
the GOT.

Checked on arm-linux-gnueabihf with and without the gcc patch applied.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598610.html

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
Reviewed-by: Sam James <sam@gentoo.org>
2026-05-11 11:15:13 -03:00
Andreas Schwab b28ffb926f riscv: redirect strlen in early startup
__tunables_init calls strlen before ifunc relocations have been set up,
redirect it to __strlen_generic.
2026-05-11 10:49:09 +02:00
Peter Collingbourne c20e60e350 resolv, rt: Change some extern inline functions to static inline
The following functions:

__aio_create_helper_thread
__aio_start_notify_thread
__gai_create_helper_thread
__gai_start_notify_thread

are declared as extern inline, but no translation unit provides their
real definitions. This can lead to a link failure if the functions are
not inlined. Fix it by declaring them as static inline instead.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-05-08 19:53:24 +02:00
9b8ff36d0c riscv: Add RVV strncmp for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of strncmp 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 (__strncmp_vector) is added
alongside the generic fallback (__strncmp_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 strncmp().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-05-08 09:32:11 -05:00
d62f110fd1 riscv: Add RVV strcmp for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of strcmp 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 (__strcmp_vector) is added
alongside the generic fallback (__strcmp_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 strcmp().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-05-08 09:32:11 -05:00
Yury Khrustalev 37ee8868dc support: add support_ptr_after_free
Some tests use pointers after the associated memory has been freed.
On targets that support memory tagging, using such pointers even
for test purposes might be impossible. To work around this, we add
new function that would allow to clear a pointer in a target-specific
way.

We modify 3 relevant malloc tests: tst-malloc-backtrace, tst-tcfree3,
and tst-safe-linking.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-05-08 09:40:40 +01:00
Rocket Ma 8398987772 stdio-common: Fix buffer overflow in scanf %mc [BZ #34008]
* stdio-common/vfscanf-internal.c: When enlarging allocated buffer with
format %mc or %mC, glibc allocates one byte less, leading to
user-controlled one byte overflow. This commit fixes BZ #34008, or
CVE-2026-5450.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Rocket Ma <marocketbd@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-08 12:27:04 +08:00
Uros Bizjak 1a70b352c3 i386: Replace inline asm rotates in pointer_guard with stdc_rotate_{left,right}
Use the C23 <stdbit.h> rotation helpers instead of inline assembly
for pointer mangling and demangling on i386.

The PTR_MANGLE and PTR_DEMANGLE macros previously used rol/ror
inline asm with a constant rotation of 9. Replace these with
stdc_rotate_left and stdc_rotate_right operating on uintptr_t,
preserving the exact rotation count via 2 * sizeof (uintptr_t) + 1.

This change removes inline assembly, improves portability and
readability and lets the compiler select optimal code generation.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-07 20:04:49 +02:00
Uros Bizjak 63545c6d2c x86_64: Replace inline asm rotates in pointer_guard with stdc_rotate_{left,right}
Use the C23 <stdbit.h> rotation helpers instead of inline assembly
for pointer mangling and demangling on x86_64.

The PTR_MANGLE and PTR_DEMANGLE macros previously used rol/ror
inline asm with a constant rotation of 2 * LP_SIZE + 1. Replace
these with stdc_rotate_left and stdc_rotate_right operating on
uintptr_t, preserving the exact rotation count via
2 * sizeof (uintptr_t) + 1.

This change removes inline assembly, improves portability and
readability and lets the compiler select optimal code generation.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-07 20:04:24 +02:00
Uros Bizjak f7623844a7 stdlib: Add internal stdc_rotate_left implementation
It follows the C2y N3367 proposed interface, along with some tests
imported from gnulib (and adapted to glibc libsupport).

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-07 20:04:06 +02:00
Carlos O'Donell 6b9135f75b Drop "(C) YYYY" from DCO'd contributions.
Contributions made under DCO use a generic statement to indicate that
the file has copyright, but that statement does not need to include a
year. Remove the year to avoid the work required to update that
statement to include future years as such updates are not required.
2026-05-07 10:41:36 -04:00
Rocket Ma ef3bfb5f91 libio: Fix ungetwc operating on byte stream [BZ #33998]
* libio/wgenops.c: When _IO_wdefault_pbackfail attempts to push back one
character, it accidently compare the wchar to push back with the last
char from byte stream, instead of wide stream. Under specific coding,
attacker may exploit this to leak information. This commit fix bug
33998, or CVE-2026-5928.

Signed-off-by: Rocket Ma <marocketbd@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-05-07 10:15:49 -04:00
Uros Bizjak 79dbb41f15 stdlib: add missing stdc_rotate_right_ull alias when builtin is available
When __builtin_stdc_rotate_right is supported, glibc defines type-specific
aliases for several unsigned integer types (uc, us, ui, ul), but omits the
unsigned long long variant. This leads to an inconsistency between the
builtin-backed path and the generic fallback, where unsigned long long
is handled.

Add the missing stdc_rotate_right_ull macro mapping to
stdc_rotate_right(__x, __n) to complete the set of type-specific helpers
and ensure consistent API coverage across all supported unsigned integer
types.

No functional change for existing users; this only exposes the expected
alias for unsigned long long.

Fixes: 331c7a4cd0 ("stdbit: Fix builtin name used in __glibc_has_builtin check for rotate_right")

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
2026-05-06 15:21:33 +02:00
Uros Bizjak 331c7a4cd0 stdbit: Fix builtin name used in __glibc_has_builtin check for rotate_right
The __glibc_has_builtin check in include/stdbit.h incorrectly refers to
___builtin_stdc_rotate_right (with three leading underscores) instead of the
correct __builtin_stdc_rotate_right (two leading underscores). As a result,
the builtin is not detected even when supported by the compiler.

Fix the spelling to use __builtin_stdc_rotate_right consistently in both the
feature test and the corresponding comment.

Fixes: 4adae8550a ("stdlib: Add internal stdc_rotate_right implementation")
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-05-06 14:09:12 +02:00
Yury Khrustalev d6a8c9d62f misc: fix lint-makefiles failures
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-05-05 12:08:36 +01:00
07122a9d8d riscv: Add RVV strlen for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of strlen 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 (__strlen_vector) is added
alongside the generic fallback (__strlen_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 strlen().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-05-04 14:37:48 -05:00
Florian Weimer 55873e86e1 support: Improve tst-support_descriptors compatibility with containers
If /dev/null is bind-mounted, /dev and /dev/null are on different
devices, so the expected failure has an additional line describe
the device change.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-05-04 17:18:38 +02:00
Jiho Lee 2c12af53da localedata: update LC_ADDRESS and LC_NAME for ko_KR
Update the South Korean (ko_KR) locale to reflect official standards:
- LC_ADDRESS: Follow the Large-to-Small hierarchy (Country, Postcode,
  City, Road, Recipient) as per Korea Post guidelines.
  (https://www.koreapost.go.kr/kpost/subIndex/135.do?pSiteIdx=125)
- LC_NAME: Follow the standard Korean order (Surname + Given Name)
  without Western-style salutations or tabs.

    * localedata/locales/ko_KR (LC_ADDRESS): Update postal_fmt.
    * localedata/locales/ko_KR (LC_NAME): Update name_fmt to "%f%g".

Signed-off-by: Jiho Lee <elmitash@gmail.com>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
2026-05-04 13:20:28 +02:00
Joseph Myers ef2e5453b1 Use Linux 7.0, MPC 1.4.1 in build-many-glibcs.py
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2026-05-01 00:26:05 +00:00
xiejiamei efb343f331 x86: Enable Prefer_No_AVX512 for Hygon model 0x8
Extend the Prefer_No_AVX512 tuning to cover Hygon model 0x8.

Benchmarks on Hygon platforms show that EVEX implementations
are often more profitable than AVX512 paths. The existing logic
already enables Prefer_No_AVX512 for model 0x7. Apply the same
preference to model 0x8 to ensure consistent IFUNC selection
behavior across newer Hygon processors.

Signed-off-by: xiejiamei <xiejiamei@hygon.cn>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-04-30 13:54:18 -03:00
Rocket Ma 4fd40bba95 stdio-common: Fix overflow registering modifier [BZ #34086]
* stdio-common/reg-modifier.c: The wchar in str can be greater or equal
than 0, and less or equal than UCHAR_MAX, that means, we need a buffer
with UCHAR_MAX + 1 elements, so that user input will not overflow
__printf_modifier_table.

Signed-off-by: Rocket Ma <marocketbd@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-30 10:52:59 -03:00
Petr Menšík 842ad56879 Return different exit codes when gai_result is > -100
Make the result checkable from the command line even without verbose
mode. Keep original exit status 2 for name not found error. But report
other errors by exit status greater than 10.

For too high values make it return 2 as before.

Signed-off-by: Petr Menšík <pemensik@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-30 10:52:59 -03:00
Petr Menšík d0e06e8254 nss: Add verbose flag to getent tool
Unlike older hosts database served by gethostbyname, getaddrinfo call
can return varying return codes. Those codes can be vital for providing
reason why name resolution on the system did not return address. Even
when getent tool is usually present on every small container image,
there is often no helpful tool to show getaddrinfo errors.

This simple change adds verbosity flag to getent. With that it can
provide more details about the reason of the failure. It can help to
obtain information whether the name queried exists or does not have
address of requested types only.

The only database where this will help is ahosts* variants. I have not
found any kind of test to expand with new verbose flag. But I think this
would be very useful on various limited system, where bind-utils is not
installed by default. Besides, sometimes getaddrinfo call can return
different information than DNS protocol itself.

Example of usage:

nss/getent -v ahosts com.

This will tell you the name exists, but has no address.

Signed-off-by: Petr Menšík <pemensik@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-30 10:52:59 -03:00
Shamil Abdulaev ddd5c8b0b4 hugepages: close fd on error path in __get_thp_mode
If __read_nocancel fails or overflows the buffer, the function returned
without closing the /sys/kernel/mm/transparent_hugepage/enabled fd.

Found while investigating BZ #34083.

Signed-off-by: Shamil Abdulaev <ashamil435@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-04-30 20:24:51 +08:00
Collin Funk dbc2b380fa Update link in SECURITY.md.
The cve.mitre.org site is an archive that redirects users to cve.org.
The linked about page has also been removed, so this patch changes it to
reference the current equivalent on cve.org.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-04-29 19:01:13 -07:00
Dmitry KovalenkoandFlorian Weimer ddc825d1b3 locale: memory leak in newlocale [BZ #25770]
It is a fix for memory leak in the function 'newlocale' (the real name is __newlocale).

There is not released a memory for the local buffer 'locale_path'.

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

---
Patch was tested on Ubuntu 24.04.

My 'LOCPATH' environment variable is "/snap/code/193/usr/lib/locale".

With an original (system) libc I have the following problem:

    #0 0x7d5c3aafc778 in realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:85
    #1 0x7d5c394b05f2 in __argz_add_sep string/argz-addsep.c:34
    #2 0x7d5c39439bdb in __newlocale locale/newlocale.c:111
    #3 0x7d5c370e58fc  (/lib/x86_64-linux-gnu/libp11-kit.so.0+0x1098fc) (BuildId: 1cbcd6ac7e0ff0259eb3acc14d556d2c1ec00cdc)
    #4 0x7d5c3b14571e in call_init elf/dl-init.c:74
    #5 0x7d5c3b145823 in call_init elf/dl-init.c:120
    #6 0x7d5c3b145823 in _dl_init elf/dl-init.c:121
    #7 0x7d5c3b15f59f  (/lib64/ld-linux-x86-64.so.2+0x1f59f) (BuildId: 1c8db5f83bba514f8fd5f1fb6d7be975be1bb855)

SUMMARY: AddressSanitizer: 46 byte(s) leaked in 1 allocation(s).

When I run with my corrected libc, through runtest.sh <my-application>, all is OK.

Signed-off-by: Dmitry Kovalenko <d.kovalenko@postgrespro.ru>

Co-authored-by: Florian Weimer <fweimer@redhat.com>
2026-04-28 15:25:30 -03:00
Shamil Abdulaev c82c07ff28 README: fix stale bug-reporting URL [BZ #34094]
The URL https://www.gnu.org/software/libc/bugs.html now redirects to
a page with no bug-reporting instructions.  Point to the glibc wiki
Bugzilla Procedures page instead.

Signed-off-by: Shamil Abdulaev <ashamil435@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-04-28 15:15:50 -03:00
Shamil Abdulaev f071e2b4a0 manual: clarify _FILE_OFFSET_BITS Y2038 implications [BZ #34095]
The existing paragraph warning about _FILE_OFFSET_BITS default changes
due to Y2038 is correct but confusing, as it does not explicitly state
why time_t concerns affect _FILE_OFFSET_BITS.

Clarify that _TIME_BITS=64 (needed for Y2038 safety) requires
_FILE_OFFSET_BITS=64, so when systems migrate to 64-bit time_t by
default, _FILE_OFFSET_BITS will also need to default to 64, even for
applications that do not handle large files.

This addresses the confusion noted in the bug report while keeping the
warning in place, as the transitive dependency makes it relevant to
the _FILE_OFFSET_BITS documentation.

Signed-off-by: Shamil Abdulaev <ashamil435@gmail.com>
2026-04-28 13:34:09 -03:00
Rocket Ma d6cb0f9de4 misc: Optimize getusershell.c
* misc/getusershell.c: Completely rewrite the unit. Only allocate one
big buffer to store shell names. Add a missing unit test.

The new implementation read the whole file into one buffer, and wipe out
every byte but shell names. Later when addressing shell names from first
shell, jump to next '\0' and then jump to next '/'. This could reduce
memory footprint and shall improve some performance.

Signed-off-by: Rocket Ma <marocketbd@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-28 13:32:01 -03:00
Carlos O'Donell 40a42fc187 advisories: Update GLIBC-SA-2026-0012 metadata
Update Vulernable-Commit based on glibc-2.1.9000 tag for the old releases.
2026-04-28 07:46:43 -04:00
Carlos O'Donell 86020ddf34 advisories: Update GLIBC-SA-2026-0012
Update GLIBC-SA-2026-0012 with similar language from GLIBC-SA-2026-0011.
2026-04-28 07:39:11 -04:00
Carlos O'Donell 82f067fd52 Add advisory text for CVE-2026-5435
Reviewed-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2026-04-28 07:37:54 -04:00
Stefan Liebler 82d9303976 Remove EXIT_UNSUPPORTED in stdlib/test-bz22786 if path is NULL
With commit 6c3a8a9d86 (2018-08-25), the test
used xmalloc instead of malloc and therefore removed the path == NULL check
as xmalloc is printing an error message and exit with a fail in this case.

On s390-32 this was always a FAIL instead of UNSUPPORTED, thus the previous
behaviour was re-enabled with commit 3bad2358d6
five days later on 2018-08-30. Therefore, we don't know if this also happens
on other systems.

While removing s390-32 with commit b01debcd8f
I've adjusted the comment and Adhemerval asked whether this can also happen
on other systems with little physical memory.  We've decided to remove the
EXIT_UNSUPPORTED in this extra commit instead of the large s390-32 removal one.
See libc-alpha:
https://inbox.sourceware.org/libc-alpha/20260409085102.3475867-1-stli@linux.ibm.com/T/#m28b5375bef4cfb10729b93c7e658b91a14b07b85

If this change leads to test fails somewhere, please add a comment about your
used system and revert this commit.

Nowadays path is allocated with support_blob_repeat_allocate which returns
an empty struct in case of malloc/mmap is not able to allocate enough memory.
All other tests using support_blob_repeat_allocate
(stdlib/tst-strtod-overflow.c, support/tst-support_blob_repeat.c and
string/tst-memmove-overflow.c) are properly checking the start or size field
directly or indirectly via TEST_COMPARE_BLOB.
While the test support/tst-support_blob_repeat.c just prints a warning if
allocating the large mappings is not possible, the other tests exit with
UNSUPPORTED.

At least for the realpath-part, the commit
855a67c3cc introduced support_accept_oom handling.
According to the discussion:
https://inbox.sourceware.org/libc-alpha/8a1fd5b2-5118-498e-babf-e46c0e6d1cdf@redhat.com/
Agreed, test-bz22786 can use a lot of memory.
OK. These convert OOM to UNSUPPORTED for the test if there isn't enough memory.

In case of not enough memory while allocating path, this change would lead to a
segmentation fault instead of UNSUPPORTED. As this is inconsistent compared to
the second realpath-part and also to the other tests using
support_blob_repeat_allocate, I would prefer keeping UNSUPPORTED if path is NULL.
Nevertheless, I've posted this patch for discussion as promised while reviewing
the s390-32 removal patch.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-28 11:08:42 +02:00
Siddhesh Poyarekar db5b939311 Document CVE-2026-6238
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2026-04-27 18:29:26 -04:00
Yury Khrustalev ce6b8627eb tests: misc: Use new tunable handling for BTI and GCS tests
Use new way of handling test tunables for BTI and GCS tests.

Fix tests that would fail when ambient GLIBC_TUNABLES variable
is used with the aarch64_gcs tunable.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-27 10:45:32 +01:00
Yury Khrustalev 7a33037765 tests: time: Use new tunable handling
Use new way of handling test tunables in the time folder.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-27 10:45:20 +01:00
Yury Khrustalev e08a2a3c8a tests: nptl: Remove unused code from makefile
There is no test named tst-pthread-proc-maps.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-27 10:45:20 +01:00
Yury Khrustalev fdfca46c38 tests: nptl: Use new tunable handling
Use new way of handling test tunables in the nptl folder.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-27 10:45:20 +01:00
Yury Khrustalev d24b6b046c tests: misc: Use new tunable handling
Use new way of handling test tunables in the misc folder.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-27 10:45:20 +01:00
Yury Khrustalev c65a27262a tests: gmon: Use new tunable handling
Use new way of handling test tunables in the gmon folder.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-27 10:45:20 +01:00
Yury Khrustalev bd9c1e5730 tests: elf: Use new tunable handling
Use new way of handling test tunables in the elf folder.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-27 10:45:20 +01:00
Yury Khrustalev 5ea36b2cf4 tests: Allow tests to append tunables
Many tests use Glibc tunables, and the values of the tunables are
provided via the GLIBC_TUNABLES env variable. Tests set it in
makefiles using

  tst-foo-ENV = GLIBC_TUNABLES=tunable=value

This overwrites environment for this test, so if another env var is
set elsewhere, one of these changes would be lost. The correct way
should be to append to test's environment:

  tst-foo-ENV += GLIBC_TUNABLES=tunable=value

However, if two or more tunables need to be set for the same test,
the 'tunable=value' part should be appended to previously defined
GLIBC_TUNABLES env variable, and it's not easy to achieve this via
existing tools available for tests.

Additionally, there are cases when it is useful to set ambient env
var GLIBC_TUNABLES in order to apply it to most of the tests except
those that require specific tunables. The existing mechanism that
relies on tst-foo-ENV would always override the ambient env var
even when it is not desirable.

To address all of this, in this commit we add support for using
constructs like

  tst-foo-TUNABLES += tunable=value

Using this, the test will receive appropriate GLIBC_TUNABLES contents,
and if there is an ambient env var GLIBC_TUNABLES, its value will be
prepended to the env var used by the test. Even if the ambient env var
contains the same tunable that is used by a test, the test's value will
override the ambient value, and the test will be executed correctly.

Additionally, we support cases when tests must have specific value
of the GLIBC_TUNABLES env var (ignoring any ambient value):

  tst-foo-TUNABLES-only += tunable=value

The existing mechanism that uses tst-foo-ENV will continue to work,
however if the same test uses both, the new mechanism will override
the old one.

Additional benefit is that the code in makefiles becomes shorter.

We also change tunable handling for malloc tests in this commit.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-27 10:45:20 +01:00
Collin Funk 1c21e96d4f posix: fix false regex match with backrefs and $ anchor
This fixes the $ anchor being ignored in the following grep command:

    $ grep -E '^(.?)(.?).?\2\1$' <<< ab
    ab

However, the regular expression should only match palindromes.

This patch is mostly copied from a commit in Gnulib from Jim Meyering
[1], and a followup commit by Paul Eggert [2]. It was found by Ed Morton
in GNU sed [3].

[1] https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=8c22765403cc34e87ad953cb3f6901e723c937f5
[2] https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=8b627431703c7e7d762f9e3174336d66b558314a
[3] https://bugs.gnu.org/68725

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-04-24 17:38:59 -07:00
Peter Bergner 5880459251 riscv: Remove duplicte memcpy redirect
Aplying a patch added a duplicate redirect of memcpy to memcpy_generic.
Remove it.

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
2026-04-23 08:32:24 -05:00
81eb2bb5ef riscv: Add RVV memcpy for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of memcpy 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 (__memcpy_vector) is added
alongside the generic fallback (__memcpy_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 memcpy().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-04-22 16:09:53 -05:00
Yury Khrustalev d4c66edeef support: add support_address_diff function
Some malloc tests compare pointers meaning to compare addresses.
On AArch64, the 64-bit value of the pointer may contain metadata
along with the values of the address.

In order to correctly compare addresses, we add new function for
AArch64 target that will use the AArch64 64 SUBP (subtract pointer)
instruction when it is available. This instruction uses the 56-bit
addresses ignoring top-byte metadata.

Best implementation is selected using ifunc resolver.

On other targets and also on AArch64 when MTE is not available this
function defaults to PTR_DIFF defined in libc-pointer-arith.h.

Three malloc tests are modified accordingly:
 - tst-memalign-2.c
 - tst-memalign-3.c
 - tst-realloc.c

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-04-22 14:55:12 +01:00
Carlos O'Donell 969cc1df8f advisories: Reject GLIBC-SA-2026-0008
Reviewed-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2026-04-22 08:59:03 -04:00
Carlos O'Donell 979e4dc4a0 advisories: Document rejection process in README.
Reviewed-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2026-04-22 08:59:03 -04:00
40fb13ac3d riscv: Add RVV strcpy for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of strcpy 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 (__strcpy_vector) is added
alongside the generic fallback (__strcpy_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 strcpy().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-04-21 13:19:46 -05:00
Stefan Liebler 79a7d01c9e s390: Remove Wno-CFLAGS for rtld.c/dl-load.c/dl-reloc.c
While review of s390-32 removal, Adhemerval asked if those CFLAGS are still
necessary:
https://inbox.sourceware.org/libc-alpha/20260409085102.3475867-1-stli@linux.ibm.com/T/#me5120906445f3941031e29c3a093f1699eae77b4

According to the git-history, the first s390-Makefile was introduced back in
2000-08-02 with those CFLAGS.  The same are also included now and past in
i386-Makefile.  But I haven't found a reason why those were added in the past
and if it was really necessary on s390.  I assume it was with old GCCs most
likely due to inclusion of dl-machine.h.

This patch removes those CFLAGS. If needed, we have to circumvent the issues
again.  At least I've used current GCCs 12.5, 13.4, 14.3, 15.2 and gcc-head
to successfully build current glibc on s390-64 with -O2, -O3 and -Os without
such warnings.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-04-21 14:54:29 +02:00
Carlos O'Donell e3e8f814e5 advisories: Fix spelling mistake in GLIBC-SA-2026-0009. 2026-04-20 16:37:37 -04:00
Carlos O'Donell 9895db657a Add advisory text for CVE-2026-5450 2026-04-20 16:23:09 -04:00
Siddhesh Poyarekar da3863e62e Document CVE-2026-5358 and CVE-2026-5928
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2026-04-20 16:21:46 -04:00
Pierre Blanchard 2ff2565df7 AArch64: Implement AdvSIMD and SVE powr(f) routines
Vector variants of the new C23 powr routines.

These provide same maximum error error as pow by virtue of
relying on shared approximation techniques and sources.

Note: Benchmark inputs for powr(f) are identical to pow(f).

Performance gain over pow on V1 with GCC@15:
- SVE powr: 10-12% on subnormal x, 12-13% on x < 0.
- SVE powrf: 15% on all x < 0.
- AdvSIMD powr: for x < 0, 40% if x subnormal, 60% otherwise.
- AdvSIMD powrf: 4% on x subnormals or x < 0.
2026-04-20 13:01:25 -03:00
Pierre Blanchard 4794e84a2f benchtests: add libmvec powr inputs
They are identical to the libmvec pow ones.
2026-04-20 13:01:25 -03:00
Pierre Blanchard 51c4069206 benchtests: add libmvec powrf inputs
They are identical to the libmvec powf ones.
2026-04-20 13:01:25 -03:00
Pierre Blanchard 3f97be129d AArch64: Improve AdvSIMD and SVE pow(f).
Optimize handling of subnormal x and/or negative x.

Some cleanup in attributes, macros and improving overall consistency.

Move core computation to header
Introduce config parameter to turn sign_bias on/off.

Performance improvement on V1 with GCC@15:
- AdvSIMD pow: 10-15% on subnormals.
- AdvSIMD powf: 30 to 70% on subnormals or x < 0, <=3% on x > 0.
- SVE pow: 10-15% on subnormals, <=3% otherwise.
- SVE powf: no significant variations in codegen/perf.
2026-04-20 13:01:25 -03:00
Adhemerval Zanella ed1eed7da7 io: Consolidate ftw implementation
Remove wordsize-64 and arch-specific implementations, for ABIs when
off_t is the same as off64_t (__OFF_T_MATCHES_OFF64_T) the ftw64.c
will create the requires aliases.

The ftw.c implementation is moved to ftw-common.c to simplify
the __OFF_T_MATCHES_OFF64_T usage.
2026-04-20 13:01:25 -03:00
Adhemerval Zanella b9a2dea54a io: Consolidate fts implementation
Remove wordsize-64 and arch-specific implementations, for ABIs when
off_t is the same as off64_t (__OFF_T_MATCHES_OFF64_T) the fts64.c
will create the requires aliases.

The fts.c implementation is moved to fts-common.c to simplify
the __OFF_T_MATCHES_OFF64_T usage.
2026-04-20 13:01:25 -03:00
9b5e9799b6 riscv: Add RVV strcat for both multiarch and non-multiarch builds
This patch adds an RVV-optimized implementation of strcat 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 (__strcat_vector) is added
alongside the generic fallback (__strcat_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 strcat().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-04-20 09:24:34 -05:00
Stefan Liebler 575ae6063d CONTRIBUTED-BY: Adjustments regarding s390-32, s390-64
After removing the files in s390-32 subfolder, we can also remove the
entries in CONTRIBUTED-BY file.
The entries for s390-64 files were adjusted to fit to the new paths.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-20 13:54:14 +02:00
Stefan Liebler 2388cad009 s390: Move files out of s390-64 folders
All the files in subfolders s390/s390-64 in sysdeps directory are moved
up to the s390/ ones.  If necessary the files were merged with the existing
ones.

sysdeps/s390/preconfigure.ac was updated to reflect the removal of s390-64
subdirectory.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-20 13:54:14 +02:00
Stefan Liebler 63c3de1386 s390: Switch to common-code headers
The removal of s390-32 allows us to switch to common-code headers
instead of providing s390-64 specific headers:

from sysdeps/unix/sysv/linux/s390/bits/environments.h
to bits/environments.h
-> We now only have a 64bit environment.

from sysdeps/s390/s390-64/bits/wordsize.h
to sysdeps/wordsize-64/bits/wordsize.h
-> All macros are defined equal

from sysdeps/unix/sysv/linux/s390/bits/utmp.h
to bits/utmp.h
-> On s390-64, __WORDSIZE_TIME64_COMPAT32 is defined to	0, then	the
64bit part of both headers is identical

from sysdeps/unix/sysv/linux/s390/bits/utmpx.h
to sysdeps/gnu/bits/utmpx.h
-> On s390-64, __WORDSIZE_TIME64_COMPAT32 is defined to 0, then the
64bit part of both headers is identical

from sysdeps/unix/sysv/linux/s390/bits/timesize.h
to bits/timesize.h
-> __TIMESIZE is defined to 64 in both cases

from sysdeps/unix/sysv/linux/s390/bits/procfs-id.h
to sysdeps/unix/sysv/linux/bits/procfs-id.h
-> The typedefs for __pr_uid_t and __pr_gid_t on s390-64 are equal
in both files. No need for an extra s390-specific header file anymore.

from sysdeps/unix/sysv/linux/s390/bits/procfs-extra.h
to sysdeps/unix/sysv/linux/bits/procfs-extra.h
-> Get rid of the "32-bit variants so that BFD can read 32-bit core files."
Furthermore it turned out that there is a hardcoded implementation
independent of procfs-extra.h in <binutils>/bfd/elf32-s390.c:
elf_s390_grok_prstatus(), elf_s390_grok_psinfo().
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-20 13:54:14 +02:00
Stefan Liebler b01debcd8f s390: Remove s390-32 specific code in non s390-32 specific files
This patch removes s390-32 specific code in either common-code files
or shared files between s390-64 and s390-32.

Such code was guarded with preprocessor guards which check the size
of __WORDSIZE or __ELF_NATIVE_CLASS and of course the existance of
__s390x__ and __s390__ macros.

Note, that if __s390x__ is defined then __s390__ is also defined.
This patch also adjust guards for __s390__ only to __s390x__ to
make clear that those are still needed.

Futhermore the macro names for ifunc variants were adjusted from
XYZ_Z900_G5 to XYZ_Z900 as G5 is a pre 64bit machine.

On s390-32 we've used the special assembler directive to enable
zarch instructions:
.machinemode "zarch_nohighgprs"
As this is not needed on s390-64 anymore as zarch is enabled by default,
just drop those lines.
Furthermore we do not check for HWCAP_S390_ZARCH and HWCAP_S390_HIGH_GPRS
anymore. Just simplify those checks for e.g. stfle- or cuXY-instructions.

The 32/64 abi-variants and the corresponding abi-conditions are now also
removed from the s390 Makefiles and thus we now only generate a single
gnu/stubs.h and gnu/lib-names.h file instead of also having the different
ones for both abi-variants.

After removing process_elf32_file in s390 readelflib.c, ldconfig is only
recognizing 64bit ELF files for ld.so.cache.

Various comments mentioning s390 (with meaning s390-32) were removed/adjusted.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-20 13:54:14 +02:00
Stefan Liebler 3d7ad79969 s390: Remove support for s390-32.
The linux 6.19 release has removed support for compat syscalls on s390x.
Therefore s390-linux-gnu (31bit) configuration was deprecated with glibc 2.43:
commit 638d437dbf
"Deprecate s390-linux-gnu (31bit)"
While deprecation, the build-many-glibcs.py script has already removed s390 (31bit).

Now explicitely exit with an error in sysdeps/s390/preconfigure
if somebody tries to build glibc for s390 (31bit).

Furthermore all s390-32 specific files are removed.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-20 13:54:13 +02:00
WANG Rui bb5c2cc2eb elf: Add test for THP alignment of large load segments
Add a new test to verify that large executable PT_LOAD segments are
mapped at addresses aligned to the THP size when the glibc tunable
glibc.elf.thp=1 is enabled and the system is configured to use THP
in "always" mode.

The test loads a shared object with a sufficiently large executable
segment via dlopen and inspects /proc/self/maps to check that the
mapping address is aligned to the THP page size reported by the kernel.

The test is skipped if the THP size cannot be determined or if THP is
not enabled in "always" mode.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-04-20 11:02:46 +00:00
mengqinggang 12df33b81e Fix 'cbaud_to_speed' defined but not used on LA32
cbaud_to_speed defined without condition, but used
if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_42)

If the condition is not met, a defined but not used
warning will be issued.

Define cbaud_to_speed if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_42)
is true.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-20 10:11:37 +08:00
Carlos O'Donell 0664c8e276 localedata: Consistently use one space after 'category'
Follow up to 7202604656 to make the
category format consistent with all other locales.
2026-04-17 18:18:01 -04:00
Garccez 7202604656 localedata: Add Hunsrickisch locale for Brazil (hrx_BR)
Signed-off-by: Garccez <joangarcez2100@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-04-17 18:15:29 -04:00
Garccez af73752b98 locale: Define Hunsrik (hrx) in iso-639.def
Signed-off-by: Garccez <joangarcez2100@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-04-17 18:15:25 -04:00
Carlos O'Donell 76fabd4141 advisories: Update GLIBC-SA-2026-0007.
Update NEWS to include GLIBC-SA-2026-0007.
2026-04-17 17:12:48 -04:00
Carlos O'Donell 1d10f6cd6d ga_IE: Add DCO header.
Commit 96e91d9e3c was under DCO.
2026-04-17 11:48:10 -04:00
Florian Weimer d6f08d1cf0 Use pending character state in IBM1390, IBM1399 character sets (CVE-2026-4046)
Follow the example in iso-2022-jp-3.c and use the __count state
variable to store the pending character.  This avoids restarting
the conversion if the output buffer ends between two 4-byte UCS-4
code points, so that the assert reported in the bug can no longer
happen.

Even though the fix is applied to ibm1364.c, the change is only
effective for the two HAS_COMBINED codecs for IBM1390, IBM1399.

The test case was mostly auto-generated using
claude-4.6-opus-high-thinking, and composer-2-fast shows up in the
log as well.  During review, gpt-5.4-xhigh flagged that the original
version of the test case was not exercising the new character
flush logic.

This fixes bug 33980.

Assisted-by: LLM
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-04-16 19:13:43 +02:00
WANG Rui ef044cc6d7 loongarch: Enable THP-aligned load segments by default on 64-bit
On LoongArch64 Linux, aligning ELF load segments to Transparent Huge Page
(THP) boundaries provides consistent performance benefits for large
binaries by reducing TLB pressure and improving instruction fetch
efficiency.

Enable THP-based load segment alignment by default on LoongArch64 by
setting `glibc.elf.thp=1` during startup. Define the default THP
page size for load segment alignment on LoongArch64 as 32MB.

This allows the dynamic loader to apply THP-friendly alignment without
requiring the `glibc.elf.thp` tunable to be explicitly set.

Benchmarks

Machine: Loongson 3A6000 (LoongArch64)
Kernel: 6.18.13
  CONFIG_READ_ONLY_THP_FOR_FS=y
  CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y

Workload 1: building Cargo 1.93.0
Rustc: nightly-2026-02-26

                Without patch        With patch
instructions    3,690,358,948,176    3,690,301,774,568
cpu-cycles      4,233,025,766,760    4,035,866,635,741
itlb-misses     9,708,829,532        2,700,014,717
time elapsed    302.40 s             289.68 s

Instructions remain essentially unchanged. iTLB misses drop by about
72%, reducing CPU cycles by about 4.7% and wall time by about 4.2%.

Workload 2: building Linux kernel v7.0-rc1
LLVM: 21.1.8

                Without patch        With patch
instructions    14,163,739,876,387   14,169,418,598,675
cpu-cycles      19,231,890,317,741   16,851,494,928,181
itlb-misses     91,142,010,440       90,779,245
time elapsed    1022.09 s            893.22 s

Instructions remain roughly the same. iTLB misses drop from about 91B
to about 90M (roughly 99.9% reduction), reducing CPU cycles by about
12% and wall time by about 12.6%.

Reviewed-by: caiyinyu <caiyinyu@loongson.cn>
Signed-off-by: WANG Rui <wangrui@loongson.cn>
2026-04-16 13:34:49 +00:00
WANG Rui 2f9fc3fba6 elf: Align large load segments to PMD huge page size for THP
Mapping segments that are at least the size of a PMD huge page to
huge-page-aligned addresses helps make them eligible for Transparent
Huge Pages (THP).

This patch introduces a Linux-specific helper, `_dl_map_segment_align`,
to determine an appropriate maximum alignment for ELF load segments based
on the system THP policy. The optimization is enabled only when the glibc
tunable `glibc.elf.thp=1` is set and THP is configured to be used
unconditionally.

The optimization depends on Linux kernel support for file-backed THP,
specifically:

* `CONFIG_READ_ONLY_THP_FOR_FS` (available since Linux kernel 5.4), and
* `CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS`.

When enabled, the helper queries the default THP page size and uses it
to align sufficiently large load segments that are already properly
aligned in both virtual address and file offset (e.g., zero).

For eligible segments, the alignment is bumped to the THP page size,
which improves THP eligibility, reduces TLB pressure, and improves
performance for large objects. To avoid excessive address space padding
on systems with very large THP sizes, the alignment is capped at 32MB.
The optimization is applied only to non-writable segments, matching
typical THP usage.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-04-16 13:34:49 +00:00
WANG Rui f9933bf832 tunables: Add glibc.elf.thp tunable for THP-aware segment alignment
Introduce a new tunable, `glibc.elf.thp`, to control Transparent Huge
Page (THP) aware alignment of ELF loadable segments.

When set to `1`, the dynamic loader will attempt to align sufficiently
large `PT_LOAD` segments to the PMD huge page size when mapping them.
This increases the likelihood that the kernel backs these mappings with
Transparent Huge Pages.

The default value is `0`, which preserves the traditional page-sized
alignment and keeps existing behavior unchanged.

On systems without THP support, or when THP is disabled in the kernel,
enabling this tunable has no effect.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
Signed-off-by: WANG Rui <wangrui@loongson.cn>
2026-04-16 13:34:49 +00:00
WANG Rui 88c3f481de elf: Introduce _dl_map_segment_align hook for segment alignment tuning
Introduce a new helper function, _dl_map_segment_align, to allow
architecture-specific adjustment of ELF load segment alignment during
object mapping.

The generic ELF loader now calls this hook when determining the maximum
segment alignment.  The generic implementation is a no-op and preserves
existing behavior.

This provides a well-defined extension point for architectures that
need to adjust segment alignment policies (for example, to improve
mapping efficiency or enable platform-specific optimizations) without
embedding such logic directly in the generic loader.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
Signed-off-by: WANG Rui <wangrui@loongson.cn>
2026-04-16 13:34:49 +00:00
WANG Rui 6696ad3879 elf: Remove redundant _dl_map_segments declaration from dl-load.h
The function `_dl_map_segments` is defined in `<dl-map-segments.h>`,
which provides the canonical implementation (optionally overridden
by sysdeps variants). All call sites include `<dl-map-segments.h>`
directly, so declaring `_dl_map_segments` in `dl-load.h` is unnecessary.

Keeping a static prototype in `dl-load.h` can trigger
-Wunused-function errors when the header is included by translation
units that do not include `<dl-map-segments.h>` and do not reference
`_dl_map_segments`. Since glibc builds with `-Werror`, this results
in build failures [1].

Remove the redundant declaration from `dl-load.h` to avoid these
spurious warnings and keep the declaration colocated with the
definition as intended.

[1] https://ci.linaro.org/job/tcwg_glibc_build--master-aarch64-precommit/4624/artifact/artifacts/artifacts.precommit/notify/mail-body.txt

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
Signed-off-by: WANG Rui <wangrui@loongson.cn>
2026-04-16 13:34:49 +00:00
Samuel Thibault 0d6295e203 mach: Fix tst-default-domain link
It links nisdomain.os directly, which uses __libc_lock_lock, thus
__gsync_wait from libmachuser
2026-04-16 01:30:19 +02:00
H.J. Lu fd156a609c elf: Remove _dl_process_pt_note
_dl_map_object_from_fd and rtld_setup_main_map have

  for (ph = &l->l_phdr[l->l_phnum]; ph != l->l_phdr; --ph)
    switch (ph[-1].p_type)
      {
      case PT_NOTE:
        _dl_process_pt_note (l, fd, &ph[-1]);
        break;
      case PT_GNU_PROPERTY:
        _dl_process_pt_gnu_property (l, fd, &ph[-1]);
        break;
      }

_dl_process_pt_note is empty, except for sysdeps/x86/dl-prop.h:

static inline void __attribute__ ((unused))
_dl_process_pt_note (struct link_map *l, int fd, const ElfW(Phdr) *ph)
{
  const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr);
  _dl_process_property_note (l, note, ph->p_memsz, ph->p_align);
}

Since all current CET enabled binaries have PT_GNU_PROPERTY, we can drop
_dl_process_pt_note.  This fixes BZ #34064.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-16 05:36:51 +08:00
Michael Kelly 04531a789b hurd: __adjtime() to support NULL delta whilst returning olddelta.
This is required to obtain the remaining time of day adjustment
without altering the required adjustment.
Message-ID: <20260415180318.109742-4-mike@weatherwax.co.uk>
2026-04-15 22:22:11 +02:00
Michael Kelly e1ca9dea05 hurd: __adjtime(): struct timeval and time_value_t are not identical.
'struct timeval' and 'struct time_value' have different types for the
microseconds component: int and long int. Casting one to the other
leads to negative numbers not being preserved properly within the
called code.
Message-ID: <20260415180318.109742-3-mike@weatherwax.co.uk>
2026-04-15 22:22:08 +02:00
Michael Kelly 4821a3e0bc hurd: Make adjtime reject out-of-range tv_usec values 2026-04-15 22:18:01 +02:00
Wilco Dijkstra 02d9614158 malloc: Remove unused aliases for malloc symbols
Malloc defines a lot of aliases which are unused, not exported and not needed.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2026-04-15 13:31:14 +00:00
Samuel Thibault 263efd5445 hurd: Fix looking up /dev/tty/ (BZ 34070)
We need to keep the heading / to properly get an ENOTDIR, and set
file_name rather than change the retryname content.

Also, *result is normally used for the startdir.
2026-04-15 00:41:31 +02:00
Carlos O'Donell f85ca9fbda localedata: Consistently use one space after 'category'
Consistently use one space after catgory keyword in all 352 locales.
We adjust gen_unicode_ctype.py to emit the same format for i18n_ctype.

This makes the files more consistent for command line tooling to
manipulate.
2026-04-14 13:33:46 -04:00
Charlotte Mcmenamin 96e91d9e3c Fix Irish date format.
The locales en_GB and en_IE use a date format of "%d//%m//%y",
as this is the most common shorthand format in both countries.
However the ga_IE locale does not conform to this. The format
"%d.%m.%y" is not commonly used in either the ROI or the UK,
and the forward-slash separator is the most common in both
languages when used in both countries.

This can be verified by checking the CLDR data for Irish:
https://www.unicode.org/cldr/charts/48/verify/dates/ga.html

Signed-off-by: Charlotte Mcmenamin <altronic25@protonmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-04-14 09:14:36 -04:00
DJ DelorieandFlorian Weimer d8997716a1 nss: fix __get_default_domain logic
Fix logic bug in __nss_get_default_domain that prevents
proper initialization.

Because this function is not exposed, the test case must link
against the object directly.

Bug origin commit: 64d1e08ea8

Co-authored-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2026-04-13 17:14:21 -04:00
H.J. Lu ee5d1db2a8 abilist.awk: Handle weak unversioned defined symbols
After

commit f685e3953f9a38a41bbd0a597f9882870cee13d5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Oct 29 09:49:57 2025 +0800

    elf: Don't set its DT_VERSYM entry for unversioned symbol

ld no longer assigns version index 1 to unversioned defined symbol.
For libmachuser.so, "objdump --dynamic-syms" reports:

0000dd30  w   DF .text	000000f8              processor_start

instead of

0000dd30  w   DF .text	000000f8 (Base)       processor_start

Also allow NF == 6 for weak unversioned dynamic symbols.  This fixes BZ
33650.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2026-04-13 12:27:09 +08:00
H.J. Lu 39f9e193ab sysdeps/unix/sysv/linux: Sort and put one test per line
Sort and put one test per line in sysdeps/unix/sysv/linux/Makefile.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2026-04-13 12:26:47 +08:00
Adhemerval Zanella dfb150f3aa math: Add fast-path to fma
For normal numbers there is no need to issue scalbn, the fma can set
the exponend directly.   Performance-wise on x86_64-linux-gnu without
multi-arch it shows a latency improvement of ~5% and throughput of %7
(and sligth more for ABIs witht tail-call optimization).

Checked on x86_64-linux-gnu and i686-linux-gnu with --disable-multi-arch.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-04-07 13:21:20 -03:00
Lucas Chollet 7594b4e5a7 posix: Add POSIX aliases to some spawn functions
Both `posix_spawn_file_actions_add{,f}chdir` functions are now fully
defined by POSIX-2024, this patch adds both functions as aliases of the
already existing `posix_spawn_file_actions_add{,f}chdir_np` GNU
extensions.

This makes glibc more compliant in regards to POSIX-2024.

Signed-off-by: Lucas Chollet <lucas.chollet@free.fr>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-07 13:21:13 -03:00
Rocket Ma a7fc50a540 manual: update recent malloc tunable defaults
manual/tunables.texi: update glibc.malloc.tcache_count to 16, in sync
with source code; fix a typo in glibc.mem.decorate_maps tunable

Signed-off-by: Rocket Ma <marocketbd@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-07 13:21:07 -03:00
Xiang Gao cd1b1c1035 libio: Fix wide stream backup buffer leak on fclose [BZ #33999]
This patch fixes a memory leak when ungetwc is used on a wide oriented stream.
The backup buffer was never freed on fclose, causing a memory leak per
ungetwc/fclose call.

The leak has two causes:

In iofclose.c, for wide streams (fp->mode > 0), _IO_new_fclose never calls
_IO_free_wbackup_area. Fixed by adding the missing call.

In wgenops.c, _IO_wdefault_finish checks fp->_IO_save_base (the narrow field,
always NULL for wide streams) instead of fp->_wide_data->_IO_save_base,
and uses a bare free() that leaves _IO_save_end and _IO_backup_base dangling.
Replace the hand-rolled cleanup with _IO_have_wbackup/_IO_free_wbackup_area,
which handles backup-mode switching and clears all three pointers.

This was independently reported by Rocket Ma [1], whose patch corrects the condition
but still uses the manual free path.

Apply the same _IO_have_backup condition in genops.c for consistency.

Tested by:
make test t=libio/tst-wbackup-leak

[1] https://patchwork.sourceware.org/project/glibc/patch/20260323171742.1039768-1-marocketbd@gmail.com/

Signed-off-by: Xiang Gao <gaoxiang@kylinos.cn>
2026-04-07 13:20:55 -03:00
WANG Rui 75d3fd11fd hugepages: Move THP helpers to generic hugepages abstraction
The helpers for determining the default transparent huge page size
and THP mode are currently implemented in malloc-hugepages. However,
these interfaces are not malloc-specific and are also needed by other
subsystems (e.g. the dynamic loader for segment alignment).

Introduce a new generic hugepages abstraction and move the THP mode
detection, default THP page size probing, and hugepage configuration
helpers there. The malloc code now calls into the generic helpers
instead of duplicating the sysfs parsing.

There is no functional change. This is a pure refactoring to make
the THP detection reusable outside of malloc.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
Signed-off-by: WANG Rui <wangrui@loongson.cn>
2026-04-07 14:25:49 +00:00
Florian Weimer 1b2f868fb4 resolv: Run tst-getaddrinfo-eai-again in a network namespace
This ensures that the test does not accidentally use a name server
running on 127.0.0.1.

Tested-by:  Frédéric Bérat <fberat@redhat.com>
Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2026-04-07 10:49:13 +02:00
Samuel Thibault 4ffc76bb0e htl: Fix SEM_FAILED type 2026-04-06 04:06:52 +02:00
Adhemerval Zanella 99303f3871 io: Use gnulib fts implementation (BZ 22944, BZ 20331)
This patch synchronizes the glibc fts implementation with the latest
version from gnulib (as of 2026-02-16).

The primary motivation is to address limitations in the legacy glibc
implementation, most notably BZ 22944, where fts fails with an
ENAMETOOLONG error when traversing very long paths or deeply nested
directory trees.  The gnulib implementation dynamically reallocates
path buffers and uses openat/fchdir optimizations, effectively
lifting the MAXPATHLEN limitation.

The gnulib implementation also added extra features, which are
used by different GNU projects (coreutils, diffutils):

 * FTS_TIGHT_CYCLE_CHECK: used to enable a strict, immediate
   cycle-detection algorithm during a file system traversal.  This is
   done internally using a hash table: every time the traversal enters
   a directory, it records the directory's device and inode (dev/ino)
   pair in the hash table, and before entering any directory, fts
   checks the hash table.

 * FTS_CWDFD: instead of actually changing the process's current
   working directory, it maintains a virtual current working directory
   using file descriptors.  The file descriptor is store at the
   fts_cwd_fd field and all subsequent file operations are performed
   relative to this file descriptor using *at functions.

 * FTS_DEFER_STAT: performance-oriented flag that instructs the file
   tree traversal engine to delay fetching file metadata.  When the
   flag is used, fts skips the immediate stat call.  Instead, it marks
   the entry with a special internal state (FTS_NSOK and
   FTS_STAT_REQUIRED).  The actual stat call is pushed down the line
   and executed by fts_read right before the application actually
   accesses the entry.

 * FTS_VERBATIM: fts_open accept and use the path strings exactly as
   they were provided in the arguments array without slash trimming.

 * FTS_MOUNT: it restrict the file tree walk to a single file system.

Hopefully,it would allow some GNU projects to use the glibc
implementation instead of pulling the gnulib one.

It requires some changes to keep compatibility, compared to gnulib:

 * The new required fields are added at the end of FTS structure, and
   the new FTS flags are adjusted to avoid change FTS_NAMEONLY/FTS_STOP
   (even though they are marked as private).

 * The FTSENT uses a flexible array (fts_name), so two adjustments are
   required: the two new members (fts_fts and fts_dirp) are place
   *before* the struct and the fts_statp is now always allocated and
   accounted (the gnulib implementation uses an alwyas allocated member).

Checked on x86_64-linux-gnu and i686-linux-gnu.
2026-04-03 07:50:18 -03:00
Adhemerval Zanella 4adae8550a stdlib: Add internal stdc_rotate_right implementation
It follows the C2y N3367 proposed interface, along with some tests
imported from gnulib (and adapted to glibc libsupport).

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

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2026-04-02 15:59:30 -03:00
Wilco Dijkstra 49ed3efdd3 AArch64: Remove unused MIDR entries
Remove the now unused eMAG MIDR check and unused entries from cpu_list[].

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-02 14:14:57 +00:00
Wilco Dijkstra d43c0b008e AArch64: Remove eMAG memset ifunc
As a cleanup remove the eMAG ifunc for memset.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-04-02 14:14:18 +00:00
Wilco Dijkstra 87083d062a AArch64: Remove eMAG memchr ifunc
As a cleanup remove the eMAG ifunc for memchr.

Reviewed-by: JiangNing OS<jiangning@amperemail.onmicrosoft.com>
2026-04-02 14:08:28 +00:00
Mike Kelly 2ff134eb63 hurd: Interrupted RPC returning EINTR when server has actually changed state.
An interrupted RPC call can return EINTR whilst the RPC is still in
progress on the server. Some RPC calls have permanent consequences
(eg. a write() to append data to a file) but a caller seeing EINTR
should expect that no state has changed. The signal thread now stores
the server's reply (which it already waited for) as the interrupted
thread's reply.
Message-ID: <20260401194948.90428-3-mike@weatherwax.co.uk>
2026-04-02 01:04:40 +02:00
Mike Kelly 4932f9d1fc hurd: alterations to MSG_EXAMINE interface (intr-msg.h)
MSG_EXAMINE has been broadened to allow the signal thread (for
example) to access additional arguments that are passed to
interruptible RPCs in other threads. All architecture specific
variants of intr-msg.h now comply with the revised interface and the
single user of MSG_EXAMINE (report-wait.c) adjusted accordingly.
Message-ID: <20260401194948.90428-2-mike@weatherwax.co.uk>
2026-04-02 01:04:40 +02:00
Wilco Dijkstra e87c151130 malloc: Show hugetlb tunable default in --list-tunables
Update the hugetlb tunable default in elf/dl-tunables.c so it is shown as 1
with /lib/ld-linux-aarch64.so.1 --list-tunables.
Move the intitialization of thp_mode/thp_pagesize to do_set_hugetlb() and
avoid accessing /sys/kernel/mm if DEFAULT_THP_PAGESIZE > 0.  Switch off THP if
glibc.malloc.hugetlb=0 is used - this behaves as if DEFAULT_THP_PAGESIZE==0.
Fix the --list-tunables testcase.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-04-01 12:22:26 +00:00
Adhemerval Zanella 418581126a io: ftw: Use state stack instead of recursion (BZ 33882)
The current implementation of ftw relies on recursion to traverse
directories (ftw_dir calls process_entry, which calls ftw_dir).  In deep
directory trees, this could lead to a stack overflow (as demonstrated by
the new tst-nftw-bz33882.c test).

This patch refactors ftw to use an explicit, heap-allocated stack to
manage directory traversal:

  * The 'struct ftw_frame' encapsulates the state of a single directory
    level (directory stream, stat buffer, previous base offset, and
    current state).

  * The ftw_dir is rewritten to use a loop instead of recursion and
    an iterative loop to enable immediate state transitions without
    function call overhead.

The patch also cleans up some unused definitions and assumptions (e.g.,
free-clobbering errno) and fixes a UB when handling the ftw callback.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-30 14:56:09 -03:00
Adhemerval Zanella 996885ecd8 math: Sync sinh from CORE-MATH
The CORE-MATH e756933f improved the error bound in the fast path for
x_0 <= x < 1/4, along with a formal proof [1].

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

[1] https://core-math.gitlabpages.inria.fr/sinh.pdf
2026-03-30 14:56:09 -03:00
Xi Ruoyao 7cc1f7683b testsuite: fix test-narrowing-trap failure on platforms where FE_INVALID is not defined
I didn't realize it can be undefined at all instead of simply
unsupported :(.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-30 14:56:09 -03:00
Siddhesh Poyarekar 4b73af327e Document CVE-2026-4046
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2026-03-30 13:26:29 -04:00
Sajan Karumanchi cd5fda114e x86_64: Prefer EVEX512 code-path on AMD Zen5 CPUs
Introduced a synthetic architecture preference flag (Prefer_EVEX512)
and enabled it for AMD Zen5 (CPUID Family 0x1A) when AVX-512 is supported.

This flag modifies IFUNC dispatch to prefer 512-bit EVEX variants over
256-bit EVEX variants for string and memory functions on Zen5 processors,
leveraging their native 512-bit execution units for improved throughput.
When Prefer_EVEX512 is set, the dispatcher selects evex512 implementations;
otherwise, it falls back to evex (256-bit) variants.

The implementation updates the IFUNC selection logic in ifunc-avx2.h and
ifunc-evex.h to check for the Prefer_EVEX512 flag before dispatching to
EVEX512 implementations. This change affects six string/memory functions:

  - strchr
  - strlen
  - strnlen
  - strrchr
  - strchrnul
  - memchr

Benchmarks conducted on AMD Zen5 hardware demonstrate significant
performance improvements across all affected functions:

Function    Baseline   Patched    Avg         Avg        Avg      Max
            Variant    Variant    Baseline    Patched    Change   Improve
                                  (ns)        (ns)       %        %
------------+----------+----------+-----------+----------+--------+--------
STRCHR      evex       evex512    16.408      12.293     25.08%   37.69%
STRLEN      evex       evex512    16.862      11.436     32.18%   56.74%
STRNLEN     evex       evex512    18.493      11.762     36.40%   64.40%
STRRCHR     evex       evex512    15.154      10.874     28.24%   44.38%
STRCHRNUL   evex       evex512    16.464      12.605     23.44%   45.56%
MEMCHR      evex       evex512    9.984       8.268      17.19%   39.99%

Additionally, a tunable option (glibc.cpu.x86_cpu_features.preferred)
is provided to allow runtime control of the Prefer_EVEX512 flag for testing
and compatibility.

Reviewed-by: Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-03-30 07:43:56 -07:00
Adhemerval Zanella 6abe432ec4 math: Fix lgammaf regression on i686
The new test from 19781c2221 triggers a failure on i686:

  testing float (without inline functions)
  Failure: lgamma (0x3.12be38p+120): errno set to 0, expected 34 (ERANGE)
  Failure: lgamma_upward (0x3.12be38p+120): errno set to 0, expected 34 (ERANGE)

Use math_narrow_eval on the multiplication to force the expected
precision.

Checked on i686-linux-gnu.
2026-03-27 14:02:30 -03:00
Adhemerval Zanella e6f161143b math: Use polydd_cosh instead of polydd on cosh
This is similar to original CORE-MATH code and why the function
exists.

Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
and arm-linux-gnueabihf.
2026-03-27 13:57:51 -03:00
Carlos O'Donell e0270d5e41 localedata: Add disclaimer to files contributed with assignment
Add the FSF's disclaimer to bi_VU, C, gbm_IN, hif_FJ, sah_RU,
sm_WS, and to_TO which were created under copyright assignment
(not DCO).

This change ensures that all 352 localedata files have either
the FSF disclaimer or the related DCO text we are using
e.g. ab_GE.

Link: https://inbox.sourceware.org/libc-alpha/80426eb7-70cd-4178-8fda-51d590aa38d4@redhat.com/
Link: https://inbox.sourceware.org/libc-alpha/20130220215701.B263F2C0A7@topped-with-meat.com/
Link: https://inbox.sourceware.org/libc-alpha/87pmtq54hs.fsf@oldenburg.str.redhat.com/

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2026-03-27 08:51:16 -04:00
Carlos O'Donell 2528b5d2e6 advisories: Update GLIBC-SA-2026-0005 and GLIBC-SA-2026-0006.
Update advisories with Fix-Commit information for 2.43.9000 and 2.44.

Update NEWS with advisory entries.
2026-03-27 08:08:19 -04:00
Carlos O'Donell e10977481f resolv: Check hostname for validity (CVE-2026-4438)
The processed hostname in getanswer_ptr should be correctly checked to
avoid invalid characters from being allowed, including shell
metacharacters. It is a security issue to fail to check the returned
hostname for validity.

A regression test is added for invalid metacharacters and other cases
of invalid or valid characters.

No regressions on x86_64-linux-gnu.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-26 13:44:10 -04:00
Florian Weimer 4a97c12302 Use #!/usr/bin/python3 in remaining Python scripts
Some distributions ban the /usr/bin/python path in their build
systems due to the ambiguity of whether it refers to Python 2 or
Python 3.  Python 2 has been out of support for many years, and
glibc has required Python 3 at build time for a while.  So it seems
safe to switch the remaining scripts over to /usr/bin/python3.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-25 10:44:52 +01:00
mengqinggang 9091a47332 LoongArch: Add new files for LA32 in sysdeps/unix/sysv/linux/loongarch/ilp32
Add implies, abilist, c++-types and syscall files.
2026-03-25 09:43:06 +08:00
mengqinggang ade878605d LoongArch: Add support for LA32 in sysdeps/unix/sysv/linux/loongarch 2026-03-25 09:43:06 +08:00
mengqinggang 706a2ca2ec LoongArch: Add new file for LA32 in sysdeps/loongarch/ilp32 2026-03-25 09:43:06 +08:00
mengqinggang e228970623 LoongArch: Add support for LA32 in sysdeps/loongarch/fpu
Move the loongarch64 implementation to sysdeps/loongarch/lp64/fpu.
2026-03-25 09:43:06 +08:00
mengqinggang 81e6ad75b0 LoongArch: Add support for LA32 in sysdeps/loongarch 2026-03-25 09:43:06 +08:00
Xi Ruoyao 5274604915 LoongArch: fix missing trap for enabled exceptions on narrowing operation
The libc_feupdateenv_test macro is supposed to trap when the trap for a
previously held exception is enabled.  But
libc_feupdateenv_test_loongarch wasn't doing it properly: the comment
claims "setting of the cause bits" would cause "the hardware to generate
the exception" but that's simply not true for the LoongArch movgr2fcsr
instruction.

To fix the issue, we need to call __feraiseexcept in case a held exception
is enabled to trap.

Reviewed-by: caiyinyu <caiyinyu@loongson.cn>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2026-03-25 09:15:18 +08:00
mengqinggang 47b306376c nptl: Fix nptl/tst-cancel31 fail sometimes
tst-cancel31 fail on la32 qemu-system with a single-core
system sometimes.

IF the test and a infinite loop run on a same x86_64 core,
the test also fail sometimes.
  taskset -c 0 make test t=nptl/tst-cancel31
  taskset -c 0 ./a.out (a.out is a infinite loop)

After writeopener thread opens the file, it may switch to
main thread and find redundant files.

pthread_cancel and pthread_join writeopener thread
before support_descriptors_check.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-03-24 12:21:33 -04:00
Carlos O'Donell 9f5f18aab4 resolv: Count records correctly (CVE-2026-4437)
The answer section boundary was previously ignored, and the code in
getanswer_ptr would iterate past the last resource record, but not
beyond the end of the returned data.  This could lead to subsequent data
being interpreted as answer records, thus violating the DNS
specification.  Such resource records could be maliciously crafted and
hidden from other tooling, but processed by the glibc stub resolver and
acted upon by the application.  While we trust the data returned by the
configured recursive resolvers, we should not trust its format and
should validate it as required.  It is a security issue to incorrectly
process the DNS protocol.

A regression test is added for response section crossing.

No regressions on x86_64-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2026-03-23 16:33:51 -04:00
Carlos O'Donell eb1fb45c8b Add advisory text for CVE-2026-4438
Explain the security issue and set the context for the vulnerability to
help downstreams get a better understanding of the issue.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-23 12:26:12 -04:00
Carlos O'Donell e539926124 Add advisory text for CVE-2026-4437
Explain the security issue and set the context for the vulnerability to
help downstreams get a better understanding of the issue.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2026-03-23 12:26:12 -04:00
Joseph Myers 8f326d6c17 Use binutils 2.46, MPC 1.4.0 in build-many-glibcs.py
Note that MPC 1.4.0 has moved from .tar.gz to .tar.xz distribution.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2026-03-23 14:03:19 +00:00
Xi Ruoyao cd013efb93 LoongArch: feclearexcept: skip clearing CAUSE
The comment explaining the reason to clear CAUSE does not make any
sense: it says the next "CTC" instruction would raise the FP exception
of which both the CAUSE and ENABLE bits are set, but LoongArch does not
have the CTC instruction.  LoongArch has the movgr2fcsr instruction but
movgr2fcsr never raises any FP exception, different from the MIPS CTC
instruction.

So we don't really need to care CAUSE at all.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2026-03-22 00:01:03 +08:00
Adhemerval Zanella Netto 89edb2e8c6 riscv: Resolve calls to memcpy using memcpy-generic in early startup
This patch from Adhemerval sets up the ifunc redirections so that we
resolve memcpy to memcpy_generic in early startup.  This avoids infinite
recursion for memcpy calls before the loader is fully initialized.

Tested-by: Jeff Law <jeffrey.law@oss.qualcomm.com>
2026-03-21 08:16:23 -06:00
Zihong Yao a604d62daa riscv: Treat clang separately in RVV compiler checks
Detect clang explicitly and apply compiler-specific version checks for
RVV support.

Signed-off-by: Zihong Yao <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2026-03-20 16:44:28 -05:00
Adhemerval Zanella 19781c2221 math: Fix spurious overflow and missing errno for lgammaf
It syncs with CORE-MATH 9a75500ba1831 and 20d51f2ee.

Checked on aarch64-linux-gnu.
2026-03-20 17:47:41 +00:00
Yury Khrustalev e8ece2e66b misc: Fix a few typos in comments 2026-03-20 12:34:57 +00:00
Adhemerval Zanella e5ef7b3c85 math: Sync lgammaf with CORE-MATH
It removes some unnecessary corner-case checks and uses a slightly
different binary algorithm for the hard-case database binary search.

Checked on aarch64-linux-gnu, arm-linux-gnueabihf,
powerpc64le-linux-gnu, i686-linux-gnu, and x86_64-linux-gnu.
2026-03-19 13:52:16 -03:00
Adhemerval Zanella d752bd6398 math: Sync tgammaf with CORE-MATH
It adds a minor optimization on fast path.

Checked on aarch64-linux-gnu, arm-linux-gnueabihf,
powerpc64le-linux-gnu, i686-linux-gnu, and x86_64-linux-gnu.
2026-03-19 13:52:16 -03:00
Martin Coufal 5c28a3cf9f Makefile: add allow-list for failures
Enable adding known failures to allowed-failures.txt and ignore failures
in case they are in the list.  In case the allowed-failures.txt does not
exist, all failures lead to a failed status as before.

When the file is present, failures of listed tests are ignored and reported
on stdout. If tests not in the allowed list fail, summarize-tests exits with
status 1 and reports the failing tests.

The expected format of allowed-failures.txt file is:
<test_name> # <comment>

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-03-19 14:09:22 +01:00
Adhemerval Zanella d398b76bb8 string: Add fallback implementation for ctz/clz
The libgcc implementations of __builtin_clzl/__builtin_ctzl may require
access to additional data that is not marked as hidden, which could
introduce additional GOT indirection and necessitate RELATIVE relocs.
And the RELATIVE reloc is an issue if the code is used during static-pie
startup before self-relocation (for instance, during an assert).

For this case, the ABI can add a string-bitops.h header that defines
HAVE_BITOPTS_WORKING to 0. A configure check for this issue is tricky
because it requires linking against the standard libraries, which
create many RELATIVE relocations and complicate filtering those that
might be created by the builtins.

The fallback is disabled by default, so no target is affected.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-03-18 16:28:50 -03:00
Wilco Dijkstra 057e7c9aa1 AArch64: Remove prefer_sve_ifuncs
Remove the prefer_sve_ifuncs CPU feature since it was intended for older
kernels. Current distros all use modern Linux kernels with improved support
for SVE save/restore, making this check redundant.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-03-16 19:09:14 +00:00
Dev Jain 729fe686d1 This reverts commit 6e8f32d39a.
First off, apologies for my misunderstanding on how madvise(MADV_HUGEPAGE)
works. I had the misconception that doing madvise(p, 1, MADV_HUGEPAGE) will set
VM_HUGEPAGE on the entire VMA - it does not, it will align the size to
PAGE_SIZE (4k) and then *split* the VMA. Only the first page-length of the
virtual space will VM_HUGEPAGE'd, the rest of it will stay the same.

The above is the semantics for all madvise() calls - which makes sense from a
UABI perspective. madvise() should do the proposed thing to only the length
(page-aligned) which it was asked to do, doing any more than that is not
something the user is expecting.

Commit 6e8f32d39a tries to optimize around the madvise() call by determining
whether the VMA got madvise'd before. This will work for most cases except
the following: if check_may_shrink_heap() is true, shrink_heap() re-maps the
shrunk portion, giving us a new VMA altogether. That VMA won't have the
VM_HUGEPAGE flag.

Reverting this commit, we will again mark the new VMA with VM_HUGEPAGE, and
the kernel will merge the two into a single VMA marked with VM_HUGEPAGE.

This may be the only case where we lose VM_HUGEPAGE, and we could micro-optimize
by extending the current if-condition with !check_may_shrink_heap. But let us
not do this - this is very difficult to reason about, and I am soon going
to propose mmap(MAP_HUGEPAGE) in Linux to do away with all these workarounds.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-16 19:09:14 +00:00
DJ Delorie 68d9acdb61 elf: factor out ld.conf parsing
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-03-16 13:00:23 -04:00
Adhemerval Zanella ebb12ffa3e x86: Fix tanh ifunc selection
The inclusion of generic tanh implementation without undefining the
libm_alias_double (to provide the __tanh_sse2 implementation) makes
the exported tanh symbol pointing to SSE2 variant.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-16 13:52:21 -03:00
Adhemerval Zanella c7a7bfe54e x86_64: Add cosh with FMA
The cosh shows an improvement of about ~35% when building for
x86_64-v3.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-16 13:52:21 -03:00
Adhemerval Zanella f05c4907a2 math: Consolidated common definition/data for cosh/sinh/tanh
Common data definitions are moved to e_coshsinh_data, cosh only
data is moved to e_cosh_data, sinh to e_sinh_data, and tanh to
e_tanh_data.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-16 13:52:20 -03:00
Adhemerval Zanella e658f35935 math: Use tanh from CORE-MATH
The current implementation precision shows the following accuracy, on
three ranges ([-DBL_MAX,-10], [-10,10], [10,DBL_MAX]) with 10e9 uniform
randomly generated numbers for each range (first column is the
accuracy in ULP, with '0' being correctly rounded, second is the
number of samples with the corresponding precision):

* Range [-DBL_MAX, -10]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

* Range [-10, -10]
 * FE_TONEAREST
     0:       4059325526  94.51%
     1:        231023238   5.38%
     2:          4618531   0.11%
 * FE_UPWARD
     0:       2106654900  49.05%
     1:       2145413180  49.95%
     2:         40847554   0.95%
     3:          2051661   0.05%
 * FE_DOWNWARD
     0:       2106618401  49.05%
     1:       2145409958  49.95%
     2:         40880992   0.95%
     3:          2057944   0.05%
 * FE_TOWARDZERO
     0:       4061659952  94.57%
     1:        221006985   5.15%
     2:         12285512   0.29%
     3:            14846   0.00%

* Range [10, DBL_MAX]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Performance-wise, it shows:

latency                      master        patched        improvement
x86_64                     109.7420       184.5950            -68.21%
x86_64v2                   109.1230       187.1890            -71.54%
x86_64v3                    99.4471        49.1104             50.62%
aarch64                     43.0474        32.2933             24.98%
armhf-vpfv4                 41.0954        35.8473             12.77%
powerpc64le                 27.3282        22.7134             16.89%

reciprocal-throughput        master        patched        improvement
x86_64                      42.5562       158.1820           -271.70%
x86_64v2                    42.5734       159.2560           -274.07%
x86_64v3                    35.9899        24.2877             32.52%
aarch64                     24.7660        22.8466              7.75%
armhf-vpfv4                 27.0251        25.8150              4.48%
powerpc64le                 11.7350        11.2504              4.13%

* x86_64:        gcc version 15.2.1 20260112, Ryzen 9 5900X, --disable-multi-arch
* aarch64:       gcc version 15.2.1 20251105, Neoverse-N1
* armv7a-vpfv4:  gcc version 15.2.1 20251105, Neoverse-N1
* powerpc64le:   gcc version 15.2.1 20260128, POWER10

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-16 13:51:58 -03:00
Adhemerval Zanella a702a425d0 math: Remove the SVID error handling from sinh
It improves throughput from 8 to 18% and latency from 1 to 10%,
dependending of the ABI.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-16 13:51:58 -03:00
Adhemerval Zanella 106f8c2ed6 math: Use sinh from CORE-MATH
The current implementation precision shows the following accuracy, on
three ranges ([-DBL_MAX,-10], [-10,10], [10,DBL_MAX]) with 10e9 uniform
randomly generated numbers for each range (first column is the
accuracy in ULP, with '0' being correctly rounded, second is the
number of samples with the corresponding precision):

* Range [-DBL_MAX, -10]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

* Range [-10, -10]
 * FE_TONEAREST
     0:       3169388892  73.79%
     1:       1125270674  26.20%
     2:           307729   0.01%
 * FE_UPWARD
     0:       1450068660  33.76%
     1:       2146926394  49.99%
     2:        697404986  16.24%
     3:           567255   0.01%
 * FE_DOWNWARD
     0:       1449727976  33.75%
     1:       2146957381  49.99%
     2:        697719649  16.25%
     3:           562289   0.01%
 * FE_TOWARDZERO
     0:       2519351889  58.66%
     1:       1773434502  41.29%
     2:          2180904   0.05%

* Range [10, DBL_MAX]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Performance-wise, it shows:

latency                      master        patched        improvement
x86_64                     101.0710       129.4710            -28.10%
x86_64v2                   101.1810       127.6370            -26.15%
x86_64v3                    96.0685        48.5911             49.42%
aarch64                     41.4229        22.3971             45.93%
armhf-vpfv4                 42.8620        25.6011             40.27%
powerpc64le                 29.2630        13.1450             55.08%

reciprocal-throughput        master        patched        improvement
x86_64                      42.6895       105.7150           -147.64%
x86_64v2                    42.7255       104.7480           -145.17%
x86_64v3                    39.6949        25.9087             34.73%
aarch64                     26.0104        19.2236             26.09%
armhf-vpfv4                 29.4362        23.6350             19.71%
powerpc64le                 12.9170        8.34582             35.39%

* x86_64:        gcc version 15.2.1 20260112, Ryzen 9 5900X, --disable-multi-arch
* aarch64:       gcc version 15.2.1 20251105, Neoverse-N1
* armv7a-vpfv4:  gcc version 15.2.1 20251105, Neoverse-N1
* powerpc64le:   gcc version 15.2.1 20260128, POWER10

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-16 13:51:57 -03:00
Adhemerval Zanella 514129fad2 math: Remove the SVID error handling from cosh
It improves throughout from 3.5% to 9%.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-16 09:34:28 -03:00
Adhemerval Zanella 291fc87155 math: Use cosh from CORE-MATH
The current implementation precision shows the following accuracy, on
three ranges ([-DBL_MAX,-10], [-10,10], [10,DBL_MAX]) with 10e9 uniform
randomly generated numbers for each range (first column is the
accuracy in ULP, with '0' being correctly rounded, second is the
number of samples with the corresponding precision):

* Range [-DBL_MAX, -10]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

* Range [-10, -10]
 * FE_TONEAREST
     0:       3291614060  76.64%
     1:       1003353235  23.36%
 * FE_UPWARD
     0:       2295272497  53.44%
     1:       1999675198  46.56%
     2:            19600   0.00%
 * FE_DOWNWARD
     0:       2294966533  53.43%
     1:       1999981461  46.57%
     2:            19301   0.00%
 * FE_TOWARDZERO
     0:       2306015780  53.69%
     1:       1988942093  46.31%
     2:             9422   0.00%

* Range [10, DBL_MAX]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Performance-wise, it shows:

latency                      master        patched     improvement
x86_64                      52.1066       126.4120        -142.60%
x86_64v2                    49.5781       119.8520        -141.74%
x86_64v3                    45.0811        50.5758         -12.19%
aarch64                     19.9977        21.7814          -8.92%
armhf-vpfv4                 20.5969        27.0479         -31.32%
powerpc64le                 12.6405        13.6768          -8.20%

reciprocal-throughput        master        patched     improvement
x86_64                      18.4833        102.9120       -456.78%
x86_64v2                    17.5409        99.5179        -467.35%
x86_64v3                    18.9187        25.3662         -34.08%
aarch64                     10.9045        18.8217         -72.60%
armhf-vpfv4                 15.7430        24.0822         -52.97%
powerpc64le                  5.4275         8.1269         -49.73%

* x86_64:        gcc version 15.2.1 20260112, Ryzen 9 5900X, --disable-multi-arch
* aarch64:       gcc version 15.2.1 20251105, Neoverse-N1
* armv7a-vpfv4:  gcc version 15.2.1 20251105, Neoverse-N1
* powerpc64le:   gcc version 15.2.1 20260128, POWER10

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-16 09:34:23 -03:00
Samuel Thibault e0e34185e5 nptl/htl: Add missing AC_PROVIDES 2026-03-16 13:19:32 +01:00
Samuel Thibault d2298311af nptl/htl: Fix confusion over PTHREAD_IN_LIBC and __PTHREAD_NPTL/HTL
The last uses of PTHREAD_IN_LIBC is where it should have been
__PTHREAD_NPTL/HTL. The latter was not conveniently available everywhere.
Defining it from config.h makes things simpler.
2026-03-16 13:02:19 +01:00
Samuel Thibault dd5ebf3ed8 nptl: Drop comment about PTHREAD_IN_LIBC
nptl is now always in libc.
2026-03-16 10:14:01 +01:00
Samuel Thibault f5ed4272da elf: directly call dl_init_static_tls
htl can now have it directly in ld.so
2026-03-16 05:29:06 +00:00
Samuel Thibault f6143a7848 resolv: Move libanl symbols to libc on hurd too 2026-03-15 21:24:00 +01:00
Samuel Thibault 62d3f3a10f elf: Drop librt.so from localplt-built-dso
It's always empty now.
2026-03-15 21:24:00 +01:00
Samuel Thibault 85a1155a02 rt: Move librt symbols to libc on hurd too 2026-03-15 18:07:58 +01:00
Samuel Thibault 0608f46fc6 htl: Use pthread_rwlock for libc_rwlock
Like nptl does, so we really get rwlock behavior.
2026-03-14 21:00:12 +00:00
Samuel Thibault 5f11203d34 mach: Add __mach_rwlock_*
We cannot use pthread_rwlock for these until we have reimplemented
pthread_rwlock with gsync, so fork __libc_rwlock off for now.
2026-03-14 17:59:08 +00:00
Adhemerval Zanella 9da7ad6d74 configure: Remove extra ')' from b4c110022c 2026-03-13 11:25:59 -03:00
Adhemerval Zanella b4c110022c configure: Fix bootstrap build after 570c46d36b (BZ 33985)
The 570c46d36b make libgcc_s to be defined for have-cc-with-libunwind=noi
(default for gcc builds) without taking into consideration that the compiler
can link against -lgcc_s (defined by have-libgcc_s).

Checked with a build-many-glibc.py for x86_64-linux-gnu.
2026-03-13 10:09:17 -03:00
Arjun Shankar fe8b5b2c55 linux: Fix aliasing violations and assert address in __check_pf (bug #33927)
The Linux implementation of __check_pf retrieves interface data via
make_request, which queries the kernel via netlink.  The IFA_ADDRESS
received from the kernel's RTM_NEWADDR netlink message is (a)
type-punned via pointer-casting leading to strict aliasing violations,
and (b) dereferenced assuming that it is non-NULL.

This commit removes the strict-aliasing violations using memcpy, and
adds an assert that the address is indeed non-NULL before dereferencing
it.

Reported-by: Siteshwar Vashisht <svashisht@redhat.com>
Reviewed-by: Sam James <sam@gentoo.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-03-13 12:25:09 +01:00
Collin Funk d3c8dce086 x86: Don't left shift negative values
GCC warns about this with -Wshift-negative-value:

    In file included from ../sysdeps/x86/cpu-features.c:24:
    ../sysdeps/x86/dl-cacheinfo.h: In function ‘get_common_cache_info’:
    ../sysdeps/x86/dl-cacheinfo.h:913:45: warning: left shift of negative value [-Wshift-negative-value]
      913 |                           count_mask = ~(-1 << (count_mask + 1));
          |                                             ^~
    ../sysdeps/x86/dl-cacheinfo.h:930:45: warning: left shift of negative value [-Wshift-negative-value]
      930 |                           count_mask = ~(-1 << (count_mask + 1));
          |                                             ^~

This is because C23 § 6.5.8 specifies that this is undefined behavior.
We can cast it to unsigned which would be equivelent to UINT_MAX.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-03-12 19:00:18 -07:00
Adhemerval Zanella 5d89e7c47c Support loading libunwind instead of libgcc_s
The 'unwind-link' facility allows glibc to support thread cancellation
and exit (pthread_cancel, pthread_exiti, backtrace) by dynamically
loading the  unwind library at runtime, preventing a hard dependency on
libgcc_s within libc.so.

When building with libunwind (for clang/LLVM toolchains [1]), two
assumptions in the existing code break:

  1. The runtime library is libunwind.so instead of libgcc_s.so.

  2. libgcc relies on __gcc_personality_v0 to handle unwinding mechanics.
     libunwind exposes the standard '_Unwind_*' accessors directly.

This patch adapts `unwind-link` to handle both environments based on
the HAVE_CC_WITH_LIBUNWIND configuration:

  * The UNWIND_SONAME macro now selects between LIBGCC_S_SO and
    LIBUNWIND_SO.

  * For libgcc, it continues to resolve `__gcc_personality_v0`.

  * For libunwind, it instead resolves the standard
    _Unwind_GetLanguageSpecificData, _Unwind_SetGR, _Unwind_SetIP,
     and _Unwind_GetRegionStart helpers.

   * unwind-resume.c is updated to implement wrappers for these
     accessors that forward calls to the dynamically loaded function
     pointers, effectively shimming the unwinder.

Tests and Makefiles are updated to link against `$(libunwind)` where
appropriate.

Reviewed-by: Sam James <sam@gentoo.org>

[1] https://github.com/libunwind/libunwind
2026-03-12 13:52:50 -03:00
Adhemerval Zanella 570c46d36b configure: Repurpose have-cc-with-libunwind for clang support
The `have-cc-with-libunwind` check (and its corresponding macro
HAVE_CC_WITH_LIBUNWIND) was historically specific to IA64, intended
to supplement libgcc with libunwind.  Since this logic is unused in
current GCC configurations, this patch repurposes it to support
clang-based toolchains that utilize LLVM's libunwind instead of
libgcc_s.

The configure script now detects if the compiler natively supports
unwinding via `-lunwind`.

Additionally, when this mode is enabled, `-lclang_rt.builtins` is
explicitly added to the `libgcc_eh` definition.  This is necessary
because `links-dso-program` otherwise fails to link due to a missing
`__gcc_personality_v0` symbol.  It appears that clang does not
automatically link the builtins providing this personality routine
when `rlink-path` is actively used during the build.

Reviewed-by: Sam James <sam@gentoo.org>
2026-03-12 13:52:50 -03:00
Adhemerval Zanella 79942df7c5 configure: Parametrize runtime libraries to support compiler-rt
Historically, the build system has hardcoded references to `-lgcc` and
`-lgcc_eh`, explicitly assuming the use of the GCC runtime.  This
prevents building glibc with alternative toolchains, specifically clang
configured with `--rtlib=compiler-rt`, where these libraries are
replaced by `libclang_rt.builtins`.

This patch introduces a mechanism to dynamically detect the compiler's
underlying runtime library.

The logic works as follows:

1. It queries the compiler using `-print-libgcc-file-name`.
2. It parses the output path to determine if `libgcc` or `compiler-rt`
   is in use.
3. Based on this detection, it parametrizes the build variables for
   the static runtime and exception handling libraries (replacing
   hardcoded `-lgcc` and `-lgcc_eh`).

This ensures that the build system correctly links against the active
compiler runtime—whether it is the traditional libgcc or LLVM's
compiler-rt—without requiring manual overrides.

Reviewed-by: Sam James <sam@gentoo.org>
2026-03-12 13:52:50 -03:00
Adhemerval Zanella 3daf1a3379 malloc: Remove lingering DIAG_POP_NEEDS_COMMENT
From 0ea9ebe48a.
2026-03-12 13:49:50 -03:00
Collin Funk 1bce191b67 conform: Add initial support for XOPEN2K24
Make XOPEN2K24 checks the same as XOPEN2K8 using the following command:

$ find conform -name '*.h-data' | xargs sed -i \
        -e 's| !defined XOPEN2K8| !defined XOPEN2K8 \&\& !defined XOPEN2K24|g' \
        -e 's| defined XOPEN2K8| defined XOPEN2K8 \|\| defined XOPEN2K24|g' \
        -e 's|ifdef XOPEN2K8|if defined XOPEN2K8 \|\| defined XOPEN2K24|g' \
        -e 's|ifndef XOPEN2K8|if !defined XOPEN2K8 \&\& !defined XOPEN2K24|g'

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-03-11 21:17:08 -07:00
Collin Funk f7c3acb4df conform: Add initial support for POSIX.1-2024
Make POSIX.1-2024 checks the same as POSIX.1-2008 using the following
command:

$ find conform -name '*.h-data' | xargs sed -i \
        -e 's| !defined POSIX2008| !defined POSIX2008 \&\& !defined POSIX2024|g' \
        -e 's| defined POSIX2008| defined POSIX2008 \|\| defined POSIX2024|g' \
        -e 's|ifdef POSIX2008|if defined POSIX2008 \|\| defined POSIX2024|g' \
        -e 's|ifndef POSIX2008|if !defined POSIX2008 \&\& !defined POSIX2024|g'

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-03-11 21:17:08 -07:00
Wilco Dijkstra 0ea9ebe48a malloc: Cleanup warnings
Cleanup warnings - malloc builds with -Os and -Og without needing any
complex warning avoidance defines.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-11 18:30:45 +00:00
Siddhesh Poyarekar 656d923a47 Document CVE-2026-3904
All branches already have a fix, so this is mainly for distributions
that may have cherry-picked the SSE2 memcmp implementation.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
2026-03-11 09:12:46 -04:00
Deng Jianbo 41e2067a8f LoongArch: Optimize float environment functions
In LoongArch, fcsr1 is the alias of enables field in fcsr0, fscr3 is the
alias of RM field in fscr0. This patch use fcsr1 and fcsr3 register to
optimize fedisableexcept, feenableexcept, fegetexcept, fegetround,
fesetround, get_rounding_mode functions, which could reduce the
additional andi instruction.
2026-03-11 15:23:02 +08:00
Adhemerval Zanella dafe64e2ee nptl: Only issues __libc_unwind_link_get for SHARED
The compiler already optimizes it away for static builds.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2026-03-10 19:42:05 +00:00
Adhemerval Zanella 0f5e379798 x86_64: Conditionally define __sfp_handle_exceptions for compiler-rt
The LLVM compiler-rt builtins library does not currently provide an
implementation for __sfp_handle_exceptions.  On x86_64, this causes
unresolved symbol errors when building glibc in environments that
exclude libgcc.

This patch implements __sfp_handle_exceptions specifically for x86_64,
bridging the gap for non-GNU compiler runtimes.

The implementation is used conditionally, only if the compiler does
not already provide the symbol.

NB: the implementation is based on libgcc and raises bosh SSE and i387
    exceptions (different that the one from 460ee50de0)

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2026-03-10 19:42:01 +00:00
Tomasz Kamiński 660c52dc21 test-assert-c++-variadic.cc: Disable assert_works for GCC 14.2 and 14.1
PR118629 [1] resolved issue with usage of __PRETTY_FUNCTION__
(to which assert expands) inside unevaluated context for GCC 14.3.
This affects only versions 14.1 and 14.2, as -std=c++26 option is
supported since 14.1.

clang supports above snippet for all version that supports --std=c++26
flag (since 17.0.1).

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

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-10 13:24:50 -03:00
Yunze Zhu 7a5d6adc8e libio: Properly link in function _IO_wfile_doallocate in static binaries
This patch addresses Bug 33935 - _IO_wfile_doallocate not linked correctly
when linking glibc statically.
https://sourceware.org/bugzilla/show_bug.cgi?id=33935

The function _IO_wfile_doallocate has been added with pragma weak in vtable.c,
while it is the only one symbol contained in wfiledoalloc.c,
and has not been directly called in libio.

In static binaries the true function symbol _IO_wfile_doallocate may not
be correctly linked when linking glibc with cases contains wchar functions,
but the weak symbol in vtable is linked instead,
and cause segmentation fault when running.

This patch fixes this with similar way to symbol _IO_file_doallocate,
that add libio_static_fn_required(_IO_wfile_doallocate) in wgenops.c
to make _IO_wfile_doallocate always link in static binaries.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-10 13:24:17 -03:00
Wilco Dijkstra 28882c408c malloc: Improve memalign alignment
Use generic stdc_bit_width to safely adapt to input types. Move rounding up of
alignments that are not powers of 2 to __libc_memalign.  Simplify alignment
handling of aligned_alloc and __posix_memalign. Add a testcase for non-power
of 2 memalign and fix malloc-debug.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-10 12:17:52 +00:00
Frédéric Bérat 9181dc6eb6 feat(rtld): Allow LD_DEBUG category exclusion
Adds support for excluding specific categories from `LD_DEBUG` output.

The `LD_DEBUG` environment variable now accepts category names prefixed
with a dash (`-`) to disable their debugging output. This allows users
to enable broad categories (e.g., `all`) while suppressing verbose or
irrelevant information from specific sub-categories (e.g., `-tls`).

The `process_dl_debug` function in `rtld.c` has been updated to parse
these exclusion options and unset the corresponding bits in
`GLRO(dl_debug_mask)`. The `LD_DEBUG=help` output has also been updated
to document this new functionality. A new test `tst-dl-debug-exclude.sh`
is added to verify the correct behavior of category exclusion.

 Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-10 11:36:21 +01:00
Frédéric Bérat 1e47dbcce4 elf(tls): Add debug logging for TLS operations
This commit introduces extensive debug logging for thread-local storage
(TLS) operations within the dynamic linker. When `LD_DEBUG=tls` is
enabled, messages are printed for:
- TLS module assignment and release.
- DTV (Dynamic Thread Vector) resizing events.
- TLS block allocations and deallocations.
- `__tls_get_addr` slow path events (DTV updates, lazy allocations, and
  static TLS usage).

The log format is standardized to use a "tls: " prefix and identifies
modules using the "modid %lu" convention. To aid in debugging
multithreaded applications, thread-specific logs include the Thread
Control Block (TCB) address to identify the context of the operation.

A new test module `tst-tls-debug-mod.c` and a corresponding shell script
`tst-tls-debug-recursive.sh` have been added. Additionally, the existing
`tst-dl-debug-tid` NPTL test has been updated to verify these TLS debug
messages in a multithreaded context.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-10 11:35:47 +01:00
Weixie Cui eb6364974e elf: should check result of openat with -1 not 1
Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2026-03-09 09:46:11 +00:00
Samuel Thibault 4972c2e1d2 htl: Fix pthread_once memory ordering
We need to tie the fast-path read with the store, to make sure that when
fast-reading 1, we see all the effects performed by the init routine.

(and we don't need a full barrier, only an acquire/release pair is
needed)

Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
2026-03-08 19:04:53 +01:00
Samuel Thibault b874221766 htl: Make sure the exit path of last thread sees all thread cleanups
In case e.g. some atexit() handlers expect all threads to have finished
their side effects.

Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
2026-03-08 18:19:19 +01:00
Samuel Thibault 9ec6f2d466 hurd: Check for _hurdsig_preempted_set with _hurd_siglock held
Without taking _hurd_siglock, we could be missing the addition of a global
preemptor.

Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
2026-03-08 11:41:29 +01:00
Samuel Thibault 15134aabfb htl: Call thread-specific destructors for last thread too
As required by posix.

Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
2026-03-08 01:10:01 +01:00
Samuel Thibault 0f2a0a45d2 htl: Fix checking for mutex not being recoverable
pthread_mutex_unlock sets __owner_id to NOTRECOVERABLE_ID

Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
2026-03-08 01:05:10 +01:00
Adhemerval Zanella 05d00ade8e benchtests: Adapt tanh
Random values in the range of [-4,4].
2026-03-05 16:19:09 -03:00
Adhemerval Zanella 5ff573204b benchtests: Adapt sinh
Random values in the range of [-10,10].
2026-03-05 16:10:19 -03:00
Adhemerval Zanella 740d29d59b benchtests: Adapt cosh
Random values in the range of [-10,10].
2026-03-05 16:10:19 -03:00
Samuel Thibault 66f930ebe0 Fix Makefile alphabetical ordering 2026-03-05 14:28:26 +01:00
Samuel Thibault 4fd4c273ed hurd; Fix return value for sigwait
It is supposed to return an error code, not just -1.

Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
2026-03-05 01:29:37 +01:00
Samuel Thibault 8a616a7872 hurd: Fix cleaning on sigtimedwait timing out
sigtimedwait also needs to clean up preemptors and the blocked mask before
returning EAGAIN.

Also add some sigtimedwait testing.
2026-03-05 01:21:46 +01:00
Florian Weimer d12b017cdd Linux: Only define OPEN_TREE_* macros in <sys/mount.h> if undefined (bug 33921)
There is a conditional inclusion of <linux/mount.h> earlier in the file.
If that defines the macros, do not redefine them.  This addresses build
problems as the token sequence used by the UAPI macro definitions
changes between Linux versions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-04 18:32:36 +01:00
Wilco Dijkstra 2e8a940df1 malloc: Avoid accessing /sys/kernel/mm files
On AArch64 malloc always checks /sys/kernel/mm/transparent_hugepage/enabled to
set the THP mode.  However this check is quite expensive and the file may not
be accessible in containers. If DEFAULT_THP_PAGESIZE is non-zero, use
malloc_thp_mode_madvise so that we take advantage of THP in all cases.  Since
madvise is a fast systemcall, it adds only a small overhead compared to the
cost of mmap and populating the pages.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
2026-03-04 14:21:40 +00:00
Yury Khrustalev 41918174fc misc: Fix a few typos in comments 2026-03-04 09:04:14 +00:00
Samuel Thibault 7053778703 htl: Fix race between timedrd/wrlock and unlock
In case the rwlock is unlocked right before we time out, we will have been
given ownership, so we shouldn't time out.

Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
2026-03-04 02:25:33 +01:00
Samuel Thibault 7fdb0ab264 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: Brent Baccala <cosine@freesoft.org> 's Claude assistant
2026-03-04 02:14:43 +01:00
Carlos Peón CostaandFlorian Weimer dc9ca785a5 resolv: Avoid duplicate query if search list contains '.' (bug 33804)
Co-authored-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-03-03 21:31:26 +01:00
Florian Weimer c995686e2c support: no_override_resolv_conf_search flag for resolver test framework
It is required to test "search ." in /etc/resolv.conf files.  The
default is to override the search path isolate from unexpected
settings in the test execution environment.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-03-03 18:48:47 +01:00
Wilco Dijkstra d2bbf8aeda AArch64: Improve memset when len is 64
Change the mask to 48 to support len==64. The second memory store now accesses
offset 32, whereas the third one accesses offset 16.  As a result performance
for len==64 almost doubles.
2026-03-03 14:32:42 +00:00
Wilco Dijkstra c37b8d9f34 malloc: Add asserts for malloc assumptions
Currently malloc has various assumptions, some documented, some implicit.
Add a few asserts to check the most fundamental assumptions using verify().
Remove some odd #define void.

Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2026-03-03 14:31:14 +00:00
Yury Khrustalev 0d28f1f1a0 tests: posix: use cpu clock for sleep
On some emulated targets sleep may result in inconsistent wait
times which will lead to the failure of the tst-chmod test.

To account for this we use the CLOCK_PROCESS_CPUTIME_ID clock ID
while also consuming CPU time by repeatedly calling clock_gettime.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-03-03 09:15:40 +00:00
Jonathan WakelyandTomasz Kamiński ea37298b65 assert: Support assert as variadic macro for C++26 [PR27276]
C++26 changes assert into a variadic macro to support using
assignment-expressions that would be interpreted as multiple macro
arguments, in particular one containing:
* template parameter lists: func<int, float>()
* calls to overloaded operator[] that accepts multiple arguments: arr[1, 2]
  this is C++23 feature, see libstdc++ PR/119855 [1]
* lambdas with explicit captures: [x, y] { ... }

The new expansion in form:
  (__VA_ARGS__) ? void (1 ? 1 : bool (__VA_ARGS__))
                : __assert_fail (...)
Has the following properties:
* Use of (__VA_ARGS__) ? ... : ..., requires that __VA_ARGS__
  is contextually convertible to bool. This means that enumerators
  of scoped enumeration are no longer accepted (they are only
  explicitly convertible). Thus this patch address the glibc PR/27276 [2].
* Nested ternary 1 ? 1 : bool (__VA_ARGS__) guarantees that
  expression expanded from __VA_ARGS__ is not evaluated twice.
  This is used instead of unevaluated context (like sizeof...)
  to support C++ expressions that are not allowed in unevaluated
  context (lambdas until C++20, co_await, co_yield).
* bool (__VA_ARGS__) is ill-formed if __VA_ARGS__ expands to
  multiple arguments: assert(1, 2)
* bool (__VA_ARGS__) also triggers warnings when __VA_ARGS__
  expands to x = 1: assert(x = 1)

To guarantee that the code snippets from assert/test-assert-c++-variadic.cc,
are actually checked for validity, we need to compile this test in C++26
(-std=c++26) mode. To achieve that, this patch compiles the file with
test-config-cxxflags-stdcxx26 variable as additional flag, that is set to
-std=c++26 if $(TEST_CXX) executable supports that flag, and empty otherwise.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119855
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=27276

Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-03-02 14:24:17 -03:00
Adhemerval Zanella 44ce02b6a8 math: Sync atanh with CORE-MATH
It speeds the fast-path for |x|<0.25.  The CORE-MATH muldd is the
same as muldd2 from glibc ddcoremath.h.

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

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-03-02 10:10:08 -03:00
Adhemerval Zanella 85e47a333b math: Sync log10p1f with CORE-MATH
The new code shows a small performance increase in x86_64:

latency                      patched        sync   improvement
x86_64                       41.8873     40.2864         3.82%
x86_64v2                     40.5859     39.2079         3.40%
x86_64v3                     34.6393     33.5018         3.28%
aarch64                      15.2731     14.5953         4.44%
armhf-vpfv4                  17.0373     17.0186         0.11%
powerpc64le                   8.3341      8.3298         0.05%

reciprocal-throughput        patched        sync   improvement
x86_64                       15.6516     13.6373        12.87%
x86_64v2                     15.0551     13.2769        11.81%
x86_64v3                     12.8994     11.0628        14.24%
aarch64                       8.8306      9.1898        -4.07%
armhf-vpfv4                   9.5855     10.0199        -4.53%
powerpc64le                   4.0074      4.4466       -10.96%

x86_64 / i686      gcc version 15.2.1 20260112. Ryzen 5900X
aarch64:           gcc version 15.2.1 20251105, Neoverse-N1
armv7a-vpfv4:      gcc version 15.2.1 20251105, Neoverse-N1
powerpc64le:       gcc version 14.2.1 20241230, POWER10

The code size also show slight improvement, the s_log10pf.os
'size' output shows:

size                patched     sync   improvement
x86_64                 2345     2243         4.35%
x86_64v2               2345     2243         4.35%
x86_64v3               2226     2162         2.88%
aarch64                2104     2112        -0.38%
armhf-vpfv4            2016     2012         0.20%
powerpc64le            2324     2340        -0.69%

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

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-03-02 10:10:08 -03:00
Adhemerval Zanella 0b949d5d57 math: Sync log10f with CORE-MATH
The performance is similar:

latency                        master        sync  improvement
x86_64                        34.6851     32.7977        5.44%
x86_64v2                      34.0921     32.4295        4.88%
x86_64v3                      27.8292     27.6070        0.80%
aarch64                       11.7246     11.1351        5.03%
armhf-vpfv4                   13.3748     12.9055        3.51%
powerpc64le                    6.4036      6.5825       -2.79%

reciprocal-throughput          master        sync  improvement
x86_64                        10.2653     10.0437        2.16%
x86_64v2                      10.8432     10.7040        1.28%
x86_64v3                      10.9006     11.0765       -1.61%
aarch64                        6.6447      6.2743        5.57%
armhf-vpfv4                    6.8916      6.7538        2.00%
powerpc64le                    2.9494      2.7661        6.21%

x86_64 / i686      gcc version 15.2.1 20260112. Ryzen 5900X
aarch64:           gcc version 15.2.1 20251105, Neoverse-N1
armv7a-vpfv4:      gcc version 15.2.1 20251105, Neoverse-N1
powerpc64le:       gcc version 14.2.1 20241230, POWER10

The code size is also similar.

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

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-03-02 10:10:08 -03:00
Adhemerval Zanella 236171bb87 math: Sync log2p1f with CORE-MATH
The new code shows better performance overall:

latency                      patched        sync   improvement
x86_64                       48.5909     33.3368        31.39%
x86_64v2                     49.1357     33.9981        30.81%
x86_64v3                     39.2397     28.0957        28.40%
aarch64                      16.5372     12.8133        22.52%
armhf-vpfv4                  18.1434     14.5273        19.93%
powerpc64le                   9.0999     7.49235        17.67%

reciprocal-throughput        patched        sync   improvement
x86_64                       14.5197     10.9726        24.43%
x86_64v2                     14.7640     11.1358        24.57%
x86_64v3                     11.5523     9.83253        14.89%
aarch64                       8.2854      7.8479         5.28%
armhf-vpfv4                   8.8586      8.5245         3.77%
powerpc64le                   3.8995      4.0069        -2.75%

x86_64 / i686      gcc version 15.2.1 20260112. Ryzen 5900X
aarch64:           gcc version 15.2.1 20251105, Neoverse-N1
armv7a-vpfv4:      gcc version 15.2.1 20251105, Neoverse-N1
powerpc64le:       gcc version 14.2.1 20241230, POWER10

The sync also improves the internal table size, the s_log1pf.os
'size' output shows:

size                         master        sync   improvement
x86_64                         3417        2089        38.86%
x86_64v2                       3417        2089        38.86%
x86_64v3                       3228        2001        38.01%
i686                           3490        2151        38.37%
aarch64                        3200        1888        41.00%
armhf-vpfv4                    3080        1804        41.43%
powerpc64le                    3408        2148        36.97%

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

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-03-02 10:10:05 -03:00
Adhemerval Zanella 3069c7951d math: Sync log1pf with CORE-MATH
The performance is similar, with some minor regression:

latency                      master        sync   improvement
x86_64                      38.2841     38.1375         0.38%
x86_64v2                    37.7338     37.4292         0.81%
x86_64v3                    31.3500     32.3576        -3.21%
aarch64                     13.7384     13.9030        -1.20%
armhf-vpfv4                 15.5730     16.5105        -6.02%
powerpc64le                  7.6038      7.5757         0.37%

reciprocal-throughput        master        sync   improvement
x86_64                      12.4910     11.9683         4.18%
x86_64v2                    12.2935     11.7614         4.33%
x86_64v3                    11.5444     10.6369         7.86%
aarch64                      7.7262      7.8954        -2.19%
armhf-vpfv4                  8.3502      8.8741        -6.27%
powerpc64le                  3.5883      3.5259         1.74%

x86_64 / i686      gcc version 15.2.1 20260112. Ryzen 5900X
aarch64:           gcc version 15.2.1 20251105, Neoverse-N1
armv7a-vpfv4:      gcc version 15.2.1 20251105, Neoverse-N1
powerpc64le:       gcc version 14.2.1 20241230, POWER10

The sync also improves the internal table size, the s_log1pf.os
'size' output shows:

size                         master       sync    improvement
x86_64                         2078       1641         21.03%
x86_64v2                       2078       1641         21.03%
x86_64v3                       1975       1514         23.34%
aarch64                        1808       1336         26.11%
armhf-vpfv4                    1716       1284         25.17%
powerpc64le                    2132       1616         24.20%

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

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2026-03-02 10:08:38 -03:00
Samuel Thibault 4b5a74412e htl: Fix mt-safeness of libio
Since d2e0491883 ("Single threaded stdio optimization")
we are supposed to call _IO_enable_locks when creating the first thread,
but that commit missed doing it for htl.
2026-03-01 17:57:54 +01:00
Samuel Thibault 1d19ddf714 hurd: Sign-extend the sigcode passed to msg_sig_post
The negative sigcodes are reserved for SI_* values, we need to keep them
negative when extending to exc_subcode's long type.

This fixes the comparison in HURD_PREEMPT_SIGNAL_P for the signal preemptor
for setitimer, thus fixing considering it.it_interval.

Reported-by: David Yang <mmyangfl@gmail.com>
2026-03-01 17:04:09 +01:00
Cosmina.Dunca@arm.com dedebed24f Vectorise inverse hyperbolic special cases
Vectorise SVE and AdvSIMD special-case handling for inverse
hyperbolic functions (acosh, asinh, atanh).

General-case improvements yield an average 11% speedup, with
peak gains of up to 80%.

For benchmarking I used Neoverse V2 with GCC@15.
2026-02-26 13:43:30 -03:00
Richard.Wild@arm.com 5179ae2756 AArch64: Single and Double precision entire exp family, SVE and AdvSIMD optimisations
This patch vectorises remaining special cases and optimises some
fast path performance for single and double precision exp, SVE and
AdvSIMD.

Moves most special case functions to header files to minimise code size.

Uses NOINLINE in main case where half width alias is used to minimise
codegen.

Special case vectorisation performance increase of average 8x to
greatest 9.5x.

Special case improvements performance increase average 15% speed
improvement to greatest 40%.

Some fast path gains during rework of files. Fastest notable increase
in exp2m1 AdvSIMD double precision of 26% improvement. Most fast
paths improved by 5-10%. 8 unchanged. No regressions.

Benchmarked on Neoverse V2 with GCC@15
2026-02-26 13:43:30 -03:00
Nicolas Boulenguez da5fc86c57 manual: Document that EOPNOTSUPP and ENOTSUP are equal, not distinct (BZ 2363)
The section 2.1 of the glibc manual says that EWOULDBLOCK == EAGAIN,
but forgets to mention that ENOTSUP == EOPNOTSUPP.

https://sourceware.org/legacy-ml/libc-alpha/2019-08/msg00629.html
https://sourceware.org/bugzilla/show_bug.cgi?id=2363
https://bugs.debian.org/337013

Signed-off-by: Nicolas Boulenguez <nicolas@debian.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-02-26 13:43:30 -03:00
Richard.Wild@arm.com 447a8a74dc AArch64: Vectorise SVE log/log2/log10 single and double precision special cases.
This patch vectorises scalar fallbacks for SVE logB(f) functions.

Special case performance increase of around 3x speedup for double
and 5x speedup for single precision.

Some fast path gains during rework of files. Most fast paths improved
by 2-3%. 2 unchanged. No regressions.

Benchmarked on Neoverse V2 with GCC@15.
2026-02-26 13:43:30 -03:00
Richard.Wild@arm.com f562fec7df AArch64: Single and Double precision hyperbolics, SVE and AdvSIMD optimisations
This patch vectorises special cases and optimises some fast path
performance for single and double precision hyperbolics, sve and
advsimd.

Special case performance increase of average 4x to greatest 10x.

Some fast path gains during rework of files. Fastest notable increase
in sinh advsimd double precision of 2x. Most fast paths improved by
5-10%.

Benchmarked on Neoverse V2 with GCC@15.
2026-02-26 13:43:30 -03:00
Paul Eggert 64d851cef3 malloc: alignment might change in future versions
This follows up on a comment by Wilco Dijkstra; see:
https://sourceware.org/pipermail/libc-alpha/2026-February/174934.html
* NEWS: Mention this.
* manual/memory.texi (Malloc Examples):
Say that alignment guarantee might change for small allocations.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-02-26 08:35:05 -08:00
Paul Eggert feda85454d Say malloc (0) != NULL is now common; resection
* manual/memory.texi (Portable Allocation):
New section, split off from Malloc Examples.
Say that almost every system follows glibc's example
in having successful malloc (0) return non-null;
AIX is the only exception nowadays.
Document fundamental alignment portability.
Have examples match the new text, and use NULL rather than 0.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-02-26 08:35:05 -08:00
Paul Eggert b4b5c64c03 Document malloc alignment
* manual/memory.texi (Malloc Examples, Changing Block Size)
(Allocating Cleared Space):
Document the alignment of the returned value.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-02-26 08:35:05 -08:00
Paul Eggert d0348243f9 Document max_align_t
* manual/lang.texi (Important Data Types): Mention max_align_t.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-02-26 08:35:05 -08:00
Florian Weimer e1a036b1a2 manual: Fix typo in documentation of iconv character set options
Reported-by: Andreas Schwab <schwab@suse.de>
2026-02-26 16:44:23 +01:00
Adhemerval Zanella f96e9bd2fe debug: Fix build with --enable-fortify-source=1 (BZ 33904)
The libio/bits/stdio2-decl.h only defined the prototypes for
__vasprintf_chk and __vfprintf_chk for __USE_FORTIFY_LEVEL > 1.
Also defined them for the internal header regardless.

Checked with a build with --enable-fortify-source=1 and
--enable-fortify-source=2 for all afftected ABIs.
2026-02-26 10:12:56 -03:00
Xi Ruoyao c19cdbf66f linux/mips: handle wait status 0x7f specially for WIFSIGNALED and WIFSTOPPED
MIPS Linux has SIGRTMAX=127, thus the wait status 0x7f means the program
is terminated by SIGRTMAX, not stopped.

This cannot happen on other ports so make a special version of
waitstatus.h for MIPS to avoid adding redundant calculation to others.
I cannot find a way to use status only once in the expression, so use
inline functions instead of macros to avoid double-evaluating status.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-02-26 11:50:53 +01:00
Adhemerval Zanella 493fac9ac8 elf: Fix tst-link-map-contiguous-ldso build for Hurd
Checked with a make check for i686-gnu.
2026-02-25 15:35:41 -03:00
Xi Ruoyao aed8390a6a elf: parse /proc/self/maps as the last resort to find the gap for tst-link-map-contiguous-ldso
The initialization process of libc.so calls mmap() several times and the
kernel may lay the maps into the gap.  If all pages in the gap are
occupied, the test would not be able to find the gap with mmap() and the
test would fail.

The failure reproduces most frequently on LoongArch because with the
commonly used page size (16 KiB) the gap only contains 4 pages and the
probability they are all occupied is not near to zero.

With the changes in the patch, a test run may output:

    info: ld.so link map is not contiguous
    info: object "/dev/zero" found at 0x7ffff1fe0000 - 0x7ffff1fe4000
    info: anonymous mapping found at 0x7ffff1fe4000 - 0x7ffff1fec000

Also take the chance to fix a mistake in the "object found at" message
which has puzzled me during the initial debug session.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-02-24 17:43:11 -03:00
Michael Jeanson 67f303b47d tests: fix tst-rseq with Linux 7.0
A sub-test of tst-rseq is to validate the return code and errno of the
rseq syscall when attempting to register the exact same rseq area as was
done in the dynamic loader.

This involves finding the rseq area address by adding the
'__rseq_offset' to the thread pointer and calculating the area size from
the AT_RSEQ_FEATURE_SIZE auxiliary vector. However the test currently
calculates the size of the rseq area allocation in the TLS block which
must be a multiple of AT_RSEQ_ALIGN.

Up until now that happened to be the same value since the feature size
and alignment exposed by the kernel were below the minimum ABI size of
32. Starting with Linux 7.0 the feature size has reached 33 while the
alignment is now 64.

This results in the test trying to re-register the rseq area with a
different size and thus not getting the expected errno value.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2026-02-24 17:42:57 -03:00
Florian Weimer b657f72fa3 libio: Fix deadlock between freopen, fflush (NULL) and fclose (bug 24963)
The canonical lock ordering for stream list processing is
locking list_all_lock first, then individual streams as needed.
The fclose implementation reversed that, and the freopen
implementation performed list operations under the reverse order,
too.

Unlinking in fclose was already unconditional, and the early unlinking
looks unnecessary: _IO_file_close_it would call it even for
!_IO_IS_FILEBUF streams.

There is still a remaining concurrency defect because
_IO_new_file_init_internal links in the stream before it is
fully initialized, and it is not locked at this point.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2026-02-23 14:19:38 +01:00
Samuel Thibault 9af18a94e0 hurd: Define _POSIX_TIMERS to 200809L
We now have monotonic vs realtime clocks, and high-precision.
2026-02-22 23:34:25 +01:00
Adhemerval Zanella 0a380fe9a3 elf: Use dl-symbol-redir-ifunc.h instead _dl_strlen
Also replace the loop with strlen And remove
-fno-tree-loop-distribute-patterns usage.

It requires redirect the strlen to the baseline implementation
for x86_64, aarch64, and loongarch64.

Checked on x86_64-linux-gnu{-v2,v3} and aarch64-linux-gnu with
both gcc-15 and clang-21.

Reviewed-by: DJ Delorie <dj@redhat.com>
2026-02-18 09:35:03 -03:00
Pádraig Brady ecb60726d0 posix: execvpe: skip $PATH components that are too long [BZ #33626]
* posix/execvpe.c (__execvpe_common): Rather than error out
with ENAMETOOLONG, just ignore and try the next path.
Note we know the FILE length is <= NAME_MAX, so the ENAMETOOLONG
almost certainly pertains to the current $PATH entry.
* posix/tst-execvpe7.c: A new test based on tst-execvp3.c.
* posix/Makefile: Reference the new test.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-02-18 09:34:26 -03:00
Jakub Jelinek 243bdfec8f Rename __unused fields to __glibc_reserved.
__unused is often defined to __attribute__((unused)) in BSD
sources and furthermore libstdc++ testsuite uses it as a macro
to verify libstdc++ headers don't use __unused identifiers.
In ~2012 glibc headers have been cleaned up, but some new
uses of __unused have reappeared (s390 fenv.h already many
years ago, the rest last November).

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2026-02-17 17:06:48 +01:00
Yury Khrustalev ad9784419e aarch64: Tests for locking GCS
Check that GCS is locked properly based on the value of the
glibc.cpu.aarch64_gcs tunable.

Test tst-gcs-execv checks that a child process can be spawned correctly
when GCS is locked for the parent process.

Test tst-gcs-fork checks that if GCS is not locked for the parent
process, the forked child can disable GCS.

Tests tst-gcs-lock and tst-gcs-lock-static check that GCS is locked
for dynamic and static executables when run with aarch64_gcs=1.

Tests tst-gcs-unlock and tst-gcs-unlock-static check that GCS is not
locked for dynamic and static executables when run with aarch64_gcs=0.

Test tst-gcs-lock-ptrace checks via ptrace that when GCS is locked,
all GCS features are locked.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-02-17 15:33:54 +00:00
Yury Khrustalev 5061f524a2 aarch64: Lock GCS status at startup
If GCS is enabled (see tunable glibc.cpu.aarch64_gcs), we lock all GCS
operations (including status, write on shadow stack, and push to shadow
stack) unless OPTIONAL policy is used.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-02-17 15:22:47 +00:00
Yury Khrustalev 4db97f4d04 tests: aarch64: fix makefile dependencies for dlopen tests for BTI
Some BTI tests in the sysdeps/unix/sysv/linux/aarch64 directory use
test shared objects via dlopen. Due to lack of direct makefile level
dependencies on these modules these tests could be run before the
required .so files would be created. This could lead to flaky test
results when running make check with -j flag. This commit fixes it.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-02-17 10:25:26 +00:00
Mike Kelly 288b55f463 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>
2026-02-14 14:39:38 +01:00
Florian Weimer 5b713b4944 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>
2026-02-13 09:02:07 +01:00
Florian Weimer 28660f4b45 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>
2026-02-13 09:02:07 +01:00
Florian Weimer 7bb859f419 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>
2026-02-13 09:02:07 +01:00
Florian Weimer f5bab97a99 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>
2026-02-12 12:18:54 +01:00
Florian Weimer bba1920c8b support: Add support for starting and stopping nscd
Reviewed-by: DJ Delorie <dj@redhat.com>
2026-02-12 12:18:54 +01:00
Florian Weimer 68fe46a2ca 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>
2026-02-12 12:18:54 +01:00
Florian Weimer c9c4ff0b77 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>
2026-02-12 12:18:54 +01:00
Florian Weimer a1a730b011 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>
2026-02-12 12:18:54 +01:00
DJ Delorie 419245719c 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>
2026-02-11 15:05:10 -05:00
Adhemerval Zanella 60a3b44f60 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.
2026-02-11 10:26:49 -03:00
Mike Kelly 807b3d5e48 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>
2026-02-11 01:03:05 +01:00
John David Anglin 98dee6c96f 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>
2026-02-10 09:41:43 -05:00
Joseph Myers 5f554e478c Use Linux 6.19 in build-many-glibcs.py
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2026-02-10 13:53:46 +00:00
George Hu d71a81ab37 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>
2026-02-09 20:22:35 +01:00
Carlos O'Donell af79874ffd SHARED-FILES: Update Unicode version to 17.0.0.
In commit 88dc93cb40 we updated to
Unicode 17.0.0.
2026-02-06 17:08:59 -05:00
Wilco Dijkstra ea4c36c36b 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>
2026-02-06 18:20:17 +00:00
Yury Khrustalev 672aec0de0 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>
2026-02-06 12:56:56 +00:00
Yury Khrustalev 280119e974 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>
2026-02-06 12:56:49 +00:00
Stefan Liebler 0d0e439439 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>
2026-02-06 09:55:38 +01:00
Samuel Thibault c4a81e882e 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>
2026-02-05 00:12:29 +01:00
Adhemerval Zanella 9054973ce6 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.
2026-02-04 16:56:04 -03:00
Adhemerval Zanella cec336bac7 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.
2026-02-04 16:54:27 -03:00
Jiamei Xie 22f9d87fcf 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>
2026-02-04 09:46:07 +01:00
Florian Weimer fff40098b0 support: Also put libaudit, libcap into the testroot if present
Some configurations of nscd are linked against those libraries.
2026-02-04 09:46:07 +01:00
Florian Weimer 4bea40d7c8 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.
2026-02-04 09:46:07 +01:00
Samuel Thibault 8fe63ae314 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.")
2026-02-04 08:15:57 +01:00
Mike Kelly 826484111a 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.
2026-02-04 08:15:46 +01:00
Paul Eggert 67322498c4 gnulib: sync comment from upstream 2026-02-03 09:28:23 -08:00
Wilco Dijkstra 707658b428 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.
2026-02-03 17:19:19 +00:00
Weihong Ye 9399998f72 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>
2026-02-03 17:19:19 +00:00
Andreas Schwab 0e47414ce8 Don't include <bits/openat2.h> directly (bug 33848)
Headers from bits directories should never be included directly, only via
the official headers.
2026-02-03 14:04:07 +01:00
Collin Funk bcbd673600 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>
2026-02-02 18:08:18 -08:00
Florian Weimer 364426a59e 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.
2026-02-02 21:15:48 +01:00
Florian Weimer 229f65f5f3 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>
2026-02-02 21:15:48 +01:00
Adhemerval Zanella ba0fedc2b9 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>
2026-02-02 14:37:05 -03:00
Luca Boccassi f8dac91ca3 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>
2026-02-02 14:37:04 -03:00
Avinal Kumar 19e84d59a4 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>
2026-02-02 14:37:03 -03:00
Adhemerval Zanella d8d2615666 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>
2026-02-02 14:36:41 -03:00
Adhemerval Zanella 1405c0fe2d 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>
2026-02-02 14:36:29 -03:00
Adhemerval Zanella 8a7675663e 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>
2026-02-02 14:36:24 -03:00
Adhemerval Zanella c3ced14f88 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>
2026-02-02 14:36:11 -03:00
Adhemerval Zanella a95db490b5 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>
2026-02-02 14:35:51 -03:00
Adhemerval Zanella 822bb11278 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>
2026-02-02 14:35:44 -03:00
Adhemerval ZanellaandJames Y Knight bdb07a03fb 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>
2026-02-02 14:35:19 -03:00
Adhemerval Zanella d8658e02d5 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>
2026-02-02 14:34:58 -03:00
Adhemerval Zanella cef254944c 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>
2026-02-02 14:34:51 -03:00
Adhemerval Zanella 6bbe7ae5f3 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>
2026-02-02 14:34:33 -03:00
Adhemerval Zanella 92ff5e9d91 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>
2026-02-02 14:34:29 -03:00
Adhemerval Zanella b9fc08c0a9 x86: Add __issignalingl inline
Checked on x86_64-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2026-02-02 14:34:25 -03:00
Wilco DijkstraandAdhemerval Zanella 570fc094c3 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>
2026-02-02 14:34:18 -03:00
Avinal Kumar 1dd9951d85 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>
2026-02-02 16:26:13 +01:00
Florian Weimer caab55393a 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>
2026-02-02 15:20:57 +01:00
Alejandro Colomar 67494ceb5d 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>
2026-01-31 12:13:55 -08:00
Samuel Thibault 9513e9e5a4 hurd: copy over start/end and entry too on fork
gdb needs them to properly find libraries etc.
2026-01-31 17:04:53 +01:00
Collin Funk ed3d8dd2b3 manual: Fix some typos in the Threads chapter. 2026-01-27 23:44:51 -08:00
Collin Funk 2415a06f97 manual: Fix some typos in the Low-Level Terminal Interface chapter. 2026-01-27 23:44:39 -08:00
Yao Zihong 39d9fa9e31 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>
2026-01-26 15:28:00 -06:00
Yao Zihong 343b7918da 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>
2026-01-26 15:25:15 -06:00
Florian Weimer bed2db02f3 posix: Run tst-wordexp-reuse-mem test
The test was not properly scheduled for execution with a Makefile
dependency.

Fixes commit 80cc58ea2d ("posix: Reset
wordexp_t fields with WRDE_REUSE (CVE-2025-15281 / BZ 33814").
2026-01-26 17:12:37 +01:00
Florian Weimer f99481e75e manual: Updates for the dynamic linker hardening recommendations
This update addresses text relocations, and clarifies
constructor/destructor priorities by mentioning the relevant
GCC attributes.
2026-01-26 16:57:02 +01:00
Arjun Shankar b52619f2e8 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>
2026-01-26 13:49:37 +01:00
Andreas K. Hüttel bad2da7f77 po: Incorporate translatins (nl updated, ar new)
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-26 01:29:30 +01:00
Aurelien Jarno 6f4b28b20a 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>
2026-01-24 11:38:10 +01:00
Florian Weimer 8faea5cda6 malloc: Correct Makefile sorting glitches
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-01-24 10:29:39 +01:00
Florian Weimer 458a6a2b93 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>
2026-01-24 10:29:39 +01:00
Florian Weimer e8502182f0 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>
2026-01-24 10:29:22 +01:00
Florian Weimer 34d98aea6c support: Fix memory leaks in support_subprogram, support_subprogram_wait
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2026-01-24 10:29:22 +01:00
Florian Weimer 0df04c5b0d 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>
2026-01-24 10:29:22 +01:00
Andreas K. Hüttel ae2192ee90 version.h: Increase version number
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-23 23:51:31 +01:00
Andreas K. Hüttel 5a836551bc NEWS: add 2.44 section
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-23 23:50:10 +01:00
Andreas K. Hüttel f762ccf84f Create ChangeLog.old/ChangeLog.32
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-23 21:54:00 +01:00
Andreas K. Hüttel d71bb8ab31 version.h, include/features.h: Increase version number
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-23 21:49:16 +01:00
Andreas K. Hüttel 145ff72025 contrib.texi: Add missing accent
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-23 12:22:19 +01:00
Aurelien Jarno ab1aba6eb7 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>
2026-01-23 01:01:42 +01:00
Andreas K. Hüttel da9e56ca3a install.texi, INSTALL: update versions
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-22 23:18:14 +01:00
Andreas K. Hüttel d9503d1b63 contrib.texi: Updates
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-22 23:11:05 +01:00
Andreas K. Hüttel bf047617c0 NEWS: Insert list of fixed security advisories
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-22 22:00:10 +01:00
Andreas K. Hüttel 42903d2146 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>
2026-01-22 21:57:31 +01:00
Andreas K. Hüttel f921e0a13a NEWS: Insert list of fixed bugs
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-22 17:34:40 +01:00
Andreas K. Hüttel 2942e34e6b NEWS: Editorial changes
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-22 17:12:18 +01:00
Andreas K. Hüttel f7e64ebc5c NEWS: Additional items and minor consolidation
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-22 17:04:32 +01:00
Andreas K. Hüttel e724b25eee NEWS: Group ISO C23 related changes
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-22 12:56:58 +01:00
Andreas K. Hüttel c9753cf643 po: Incorporate translations
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-22 12:44:43 +01:00
Adhemerval Zanella c809f90e5e 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.
2026-01-21 13:38:46 -03:00
Carlos O'Donell 04e750e75b 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>
2026-01-20 10:18:56 -05:00
Adhemerval Zanella 80cc58ea2d 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>
2026-01-20 11:34:12 -03:00
Andreas K. Hüttel c42baf0c08 libc.pot: regenerate
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-19 16:24:36 +01:00
Xi Ruoyao efe341ae0e 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>
2026-01-19 15:40:05 +01:00
Florian Weimer 7b543dcdf9 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>
2026-01-19 08:36:56 +01:00
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
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
Adhemerval Zanella 9021707ca7 elf: Support vDSO with more than one PT_LOAD with v_addr starting at 0 (BZ 32583)
The setup_vdso assumes that vDSO will contain only one PT_LOAD segment
and that 0 is the sentinel for the start mapping address.  Although
the kernel avoids adding more than one PT_LOAD to avoid compatibility
issues, there is no impending issue that prevents glibc from supporting
vDSO with multiple PT_LOAD (as some wrapper tools do [1]).

To support multiple PT_LOAD segments, replace the sentinel with a bool
to indicate that the VMA start has already been set.

Testing is really tricky, since the bug report does not indicate which
tool was used to trigger the issue, nor a runtime that provides a vDSO
with multiple PT_LOAD.  I had to modify the qemu user with a custom
script to create 2 PT_LOAD sections, remove checks that prevent the
vDSO object from being created, and remove the load bias adjustment
in load_elf_vdso.  I could not come up with an easy test case to
integrate with glibc.

The Linux kernel provides vDSO with only one PT_LOAD due to
compatibility reasons. For instance

* arch/arm64/kernel/vdso/vdso.lds.S

86 /*
87  * We must supply the ELF program headers explicitly to get just one
88  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
89  /
90 PHDRS
91 {
92         text            PT_LOAD         FLAGS(5) FILEHDR PHDRS; / PF_R|PF_X /
93         dynamic         PT_DYNAMIC      FLAGS(4);               / PF_R /
94         note            PT_NOTE         FLAGS(4);               / PF_R */
95 }

* arch/x86/entry/vdso/vdso-layout.lds.S

95 /*
96  * We must supply the ELF program headers explicitly to get just one
97  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
98  /
99 PHDRS
100 {
101         text            PT_LOAD         FLAGS(5) FILEHDR PHDRS; / PF_R|PF_X /
102         dynamic         PT_DYNAMIC      FLAGS(4);               / PF_R /
103         note            PT_NOTE         FLAGS(4);               / PF_R */
104         eh_frame_hdr    PT_GNU_EH_FRAME;
105 }

Checked on aarch64-linux-gnu.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=32583#c2

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-19 13:23:06 -03:00
Adhemerval Zanella 440108ce9e nptl: Make pthread_{clock, timed}join{_np} act on all cancellation (BZ 33717)
The pthread_join/pthread_timedjoin_np/pthread_clockjoin_np will not act
on cancellation if 1. some other thread is already waiting on the 'joinid'
or 2. If the thread has already exited.

On nptl/pthread_join_common.c, the 1. is due to the CAS doing an early
return:

 80   else if (__glibc_unlikely (atomic_compare_exchange_weak_acquire (&pd->joinid,
 81                                                                    &self,
 82                                                                    NULL)))
 83     /* There is already somebody waiting for the thread.  */
 84     return EINVAL;

And 2. is due to the pd->tid equal to 0:

 99       pid_t tid;
100       while ((tid = atomic_load_acquire (&pd->tid)) != 0)
101         {

The easiest solution would be to add an __pthread_testcancel () on
__pthread_clockjoin_ex () if 'cancel' is true.

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

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-19 13:23:06 -03:00
Adhemerval Zanella 793f680101 support: Add support_thread_state_wait
Same as support_process_state_wait, but wait for the task TID
(obtained with gettid) from the current process.  Since the kernel
might remove the /proc/<pid>/task/<tid>/status at any time if the
thread terminates, the code needs to handle possible
fopen/getline/fclose failures due to an inexistent file.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-19 13:23:06 -03:00
Adhemerval Zanella f7648bf443 nptl: Remove INVALID_TD_P
And use the new __pthread_descriptor_valid function that checks
for 'joinstate' to get the thread state instead of 'tid'.  The
joinstate is set by the kernel when the thread exits.

Checked on x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-19 13:23:06 -03:00
Adhemerval Zanella 5da15b15ad nptl: Do not use pthread set_tid_address as state synchronization (BZ #19951)
The use-after-free described in BZ#19951 is due to the use of two
different PD fields, 'joinid' and 'cancelhandling', to describe the
thread state and to synchronise the calls of pthread_join,
pthread_detach, pthread_exit, and normal thread exit.

Any state change may require checking both fields atomically to handle
partial state (e.g., pthread_join() with a cancellation handler to
issue a 'joinstate' field rollback).

This patch uses a different PD member with 4 possible states (JOINABLE,
DETACHED, EXITING, and EXITED) instead of the pthread 'tid' field, with
the following logic:

 1. On pthread_create, the initial state is set either to JOINABLE or
    DETACHED depending on the pthread attribute used.

 2. On pthread_detach, a CAS is issued on the state.  If the CAS fails,
    the thread is already detached (DETACHED) or being terminated (EXITING).
    For the former, an EINVAL is returned; for the latter, pthread_detach
    should be responsible for joining the thread (and for deallocating any
    internal resources).

 3. In the exit phase of the wrapper function for the thread start routine
    (reached either if the thread function has returned, pthread_exit has
    been called, or cancellation handled has been acted upon), we issue a
    CAS on state to set it to the EXITING mode.

    If the thread is previously in DETACHED mode, the thread is responsible
    for deallocating any resources; otherwise, the thread must be joined
    (detached threads cannot deallocate themselves immediately).

 4. The clear_tid_field on 'clone' call is changed to set the new 'state'
    field on thread exit (EXITED).  This state is only reached at thread
    termination.

 5. The pthread_join implementation is now simpler: the futex wait is done
    directly on thread state, and there is no need to reset it in case of
    timeout since the state is now set either by pthread_detach() or by the
    kernel on process termination.

The race condition on pthread_detach is avoided with a single atomic
operation on the PD state: once the mode is set to THREAD_STATE_DETACHED, it
is up to the thread itself to deallocate its memory (done during the exit
phase at pthread_create()).

Also, the INVALID_NOT_TERMINATED_TD_P is removed since a negative yid is
not possible, and the macro is not used anywhere.

This change triggers an invalid C11 thread test: it creates a thread that
detaches, and after a timeout, the creating thread checks whether the join
fails.  The issue is that once thrd_join() is called, the thread's lifetime
is not defined.

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

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-19 13:23:05 -03:00
Adhemerval Zanella 2d865eaa12 nptl: Set cancellation type and state on pthread_exit (BZ #28267)
It is required by POSIX XSH 2.9.5 Thread Cancellation under the
heading Thread Cancellation Cleanup Handlers.

Checked x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-19 11:45:47 -03:00
Adhemerval Zanella 0d5f77cd3a nptl: Use __futex_abstimed_wait64 on pthread_create (BZ 33715)
The pthread_create is annotated as __THROWNL.

Checked on x86_64-linux-gnu.

Suggested-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-19 11:45:47 -03:00
Stefan Liebler 5116301943 build-many-glibcs.py: Fix s390x-linux-gnu.
The recent commit 638d437dbf
"Deprecate s390-linux-gnu (31bit)"
leads to:
FAIL: compilers-s390x-linux-gnu gcc build
when it tries to build 31bit libgcc.

The build is fixed by explicitely disabling multilib.
2025-12-19 11:19:53 +01:00
Uros Bizjak 342f456ff5 hurd/i386: Remove stale __GNUC_PREREQ (6, 0) test from tls.h
GCC 12 is currently the minimum supported compiler version.
Remove no longer needed __GNUC_PREREQ (6, 0) test and corresponding
dead code from tls.h.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2025-12-19 08:05:42 +01:00
Sunil K PandeyandAlex M Wells 63716823db nptl: Optimize trylock for high cache contention workloads (BZ #33704)
Check lock availability before acquisition to reduce cache line
bouncing.  Significantly improves trylock throughput on multi-core
systems under heavy contention.

Tested on x86_64.

Fixes BZ #33704.

Co-authored-by: Alex M Wells <alex.m.wells@intel.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-12-18 08:46:36 -08:00
Adhemerval Zanella 15e0560ad3 Regenerate sysdeps/x86_64/configure
It fixes the 9b8c2b8294 commit.
2025-12-18 11:10:12 -03:00
Adhemerval Zanella faca1b55e0 x86_64: Fix mark-plt configure test
The configure check might ignore if compiler driver warns that the
option is no support, so force fatal warnings.

If fixes the elf/tst-plt-rewrite{1,2} regressions when ld.lld is used.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-18 10:55:36 -03:00
Adhemerval Zanella 7d9a8408ec math: Fix potential underflow on ldbl-128 erfl
The multiplication operation is required only if the branch is taken,
and the compiler might not optimize it away.

It fixes the following issues when the testcase is built with clang:

FAIL: math/test-ldouble-erf
Failure: erf (-0x4p-16384): Exception "Underflow" set
Failure: erf (0x1p-10000): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded552p-16384): Exception "Underflow" set
Failure: erf (0x4p-16384): Exception "Underflow" set
Failure: erf_downward (-0x4p-16384): Exception "Underflow" set
Failure: erf_downward (0x1p-10000): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded552p-16384): Exception "Underflow" set
Failure: erf_downward (0x4p-16384): Exception "Underflow" set
Failure: erf_towardzero (-0x4p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x1p-10000): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded552p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x4p-16384): Exception "Underflow" set
Failure: erf_upward (-0x4p-16384): Exception "Underflow" set
Failure: erf_upward (0x1p-10000): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded552p-16384): Exception "Underflow" set
Failure: erf_upward (0x4p-16384): Exception "Underflow" set

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-18 10:55:32 -03:00
Wilco Dijkstra 9da0585852 atomic: Reinstate HAVE_64B_ATOMICS configure check
Reinstate HAVE_64B_ATOMICS configure check that was reverted by commit
7fec8a5de6 due to BZ #33632.  This was
fixed by 3dd2cbfa35 by only allowing
64-bit atomics on sem_t if its type is 8-byte aligned.  Rebase and add
in cleanups in include/atomic.h that were omitted.

Fix an issue with sparcv8-linux-gnu-leon3 forcing -mcpu=v8 for rtld.c which
overrules -mcpu=leon3 and causes __atomic_always_lock_free (4, 0) to
incorrectly return 0 and trigger asserts in atomics.  Remove this as it
seems to be a workaround for an issue in 1997.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-17 22:57:00 +00:00
Wilco Dijkstra 1c588a2187 malloc: Improve thp_init
Cleanup thp_init, change it so that the DEFAULT_THP_PAGESIZE
setting can be overridden with glibc.malloc.hugetlb=0 tunable.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-17 19:11:01 +00:00
Adhemerval Zanella fcd88791e9 linux: Update kernel version to 6.17 in tst-openat2-consts.py
No need constant was added between 6.8 and 6.17.
2025-12-17 14:57:35 -03:00
Jiayuan Chen 7e46c2aae4 Updates struct tcp_info and TCP_AO_XX corresponding struct from 6.17 to netinet/tcp.h
This patch updates struct tcp_info to include new fields from Linux 6.17:
- tcpi_pacing_rate, tcpi_max_pacing_rate
- tcpi_bytes_acked, tcpi_bytes_received
- tcpi_delivery_rate, tcpi_busy_time
- tcpi_delivered, tcpi_delivered_ce
- and many other TCP metrics

Additionally, this patch adds:
- TCP_AO_* definitions (Authentication Option)
- struct tcp_diag_md5sig for INET_DIAG_MD5SIG
- Netlink attribute types for SCM_TIMESTAMPING_OPT_STATS

All changes are synchronized from the Linux kernel's tcp.h without
functional modifications, only code style changes.

Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-17 14:57:27 -03:00
Dev Jain 0b9210bd76 malloc: set default tcache fill count to 16
Now that the fastbins are gone, set the default per size class length of
tcache to 16. We observe that doing this retains the original performance
of malloc.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain dacc2ade92 malloc: Remove fastbin comments
Now that all the fastbin code is gone, remove the remaining comments
referencing fastbins.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain bb5a4f5295 malloc: Remove fastbin infrastructure
Now that all users of the fastbin code are gone, remove the fastbin
infrastructure.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain 73245de202 malloc: Remove do_check_remalloced_chunk
do_check_remalloced_chunk checks properties of fastbin chunks. But, it is also
used to check properties of other chunks. Hence, remove this and merge the body
of the function in do_check_malloced_chunk.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain 7447efa962 malloc: remove fastbin code from malloc_info
In preparation for removal of fastbins, remove all fastbin code from
malloc_info.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain 433ee9c02f malloc: remove fastbin code from do_check_malloc_state
In preparation for removal of fastbins, remove all fastbin code from
do_check_malloc_state.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain 80ee32910f malloc: remove mallopt fastbin stats
In preparation for removal of fastbins, remove all fastbin code from
mallopt.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain bf1015fb2d malloc: remove allocation from fastbin, and trim_fastbins
In preparation for removal of fastbins, remove the fastbin allocation
path, and remove the TRIM_FASTBINS code.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain e3062b06c5 malloc: remove malloc_consolidate
In preparation for removal of fastbins, remove the consolidation
infrastructure of fastbins.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Dev Jain 7632ba6018 malloc: remove fastbin tests
Remove all the fastbin tests in preparation for removing the fastbins.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-12-17 15:32:53 +00:00
Stefan Liebler 638d437dbf Deprecate s390-linux-gnu (31bit)
The next linux 6.19 release will remove support for compat syscalls on s390x with those commits:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0d79affa31cbee477a45642efc49957d05466307
0d79affa31cb Merge branch 'compat-removal'
4ac286c4a8d9 s390/syscalls: Switch to generic system call table generation
f4e1f1b1379d s390/syscalls: Remove system call table pointer from thread_struct
3db5cf935471 s390/uapi: Remove 31 bit support from uapi header files
8e0b986c59c6 s390: Remove compat support
169ebcbb9082 tools: Remove s390 compat support
7afb095df3e3 s390/syscalls: Add pt_regs parameter to SYSCALL_DEFINE0() syscall wrapper
b2da5f6400b4 s390/kvm: Use psw32_t instead of psw_compat_t
8c633c78c23a s390/ptrace: Rename psw_t32 to psw32_t

This patch also removes s390-linux-gnu (31bit) from build-many-glibcs.py.
Then the next update of syscall numbers for Linux 6.19 won't change
sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-12-17 13:57:21 +01:00
Sunil K Pandey eba6ed454f benchtests: Add pthread mutex trylock recursive throughput test (BZ #33704)
This benchmark measures number of successful updates per second
under high cache contention.

Tested on x86_64.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-16 17:18:55 -08:00
Sunil K Pandey c1e8d1fdd9 benchtests: Refactor pthread trylock throughput test (BZ #33704)
Refactor pthread trylock throughput benchmark test.
No functionality change.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-16 16:32:00 -08:00
Sunil K PandeyandAlex M Wells ded9c1e525 benchtests: Add pthread mutex trylock throughput test (BZ #33704)
This benchmark measures number of successful updates per second
under high cache contention.

Tested on x86_64.

Co-authored-by: Alex M Wells <alex.m.wells@intel.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-13 08:32:58 -08:00
Adhemerval Zanella Netto f56382e67e posix: Fix getconf symbolic constants defined in limits.h (BZ# 29147)
POSIX-1.2018 defines that getconf utility shall print symbolic constant
listed under the heading Maximum value and Minimum Values [1], however
current behaviour is to print the values using pathconf or sysconf,
which represents the specific implementation values instead of the
system agnostics ones.

Another issue is for such the symbolic constants, getconf handles them
as a path_var which requires an additional pathname (which does not
make sense for constants values).

The patch fixes it adding a new internal type, LIMITS_H, which only
prints the constant symbolic without requiring an additional path.
Only the values define in glibc provided limits.h plust the GNU
extensions are handled.

Checked on x86_64-linux-gnu.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/getconf.html)

Tested-by: Yury Khrustalev <yury.khrustalev@arm.com>
Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2025-12-11 09:38:21 -03:00
Adhemerval Zanella 910c6bdcf6 configure: use TEST_CC to check for --depaudit
The ld.lld does not support this option.
Reviewed-by: Sam James <sam@gentoo.org>
2025-12-11 08:27:16 -03:00
Adhemerval Zanella a8455a0b7f configure: use TEST_CC to check for --no-error-execstack
The ld.lld does not support the --no-error-execstack option, and it is
required only to suppress the linker warning while building tests. A new
configure macro, LIBC_TEST_LINKER_FEATURE, is added to check for linker
features using TEST_CC instead of CC.

Checked on x86_64-linux-gnu and aarch64-linux-gnu with gcc and
TEST_CC set to clang-18 and clan-21.

Reviewed-by: Sam James <sam@gentoo.org>
2025-12-11 08:27:16 -03:00
Florian Weimer 522310e26b manual: Fix madvise typo in mseal documentation 2025-12-11 11:57:52 +01:00
Dev Jain 7cee1b4b40 malloc: Enable 2MB THP by default on Aarch64
Add missing files from previous commit.
2025-12-10 14:51:49 +00:00
Dev Jain 321e1fc73f malloc: Enable 2MB THP by default on Aarch64
Linux supports multi-sized Transparent Huge Pages (mTHP). For the purpose
of this patch description, we call the block size mapped by a non-last
level pagetable level, the traditional THP size (2M for 4K basepage,
512M for 64K basepage). Linux now also supports intermediate THP sizes
mapped by the last level pagetable - we call that the mTHP size.

The support for mTHP in Linux has grown to be better and stable over time -
applications can benefit from reduced page faults and reduced kernel
memory management overhead, albeit at the cost of internal fragmentation.
We have observed consistent performance boosts with mTHP with little
variance.

As a result, enable 2M THP by default on Aarch64. This enables THP even if
user hasn't passed glibc.malloc.hugetlb=1. If user has passed it, we avoid
making the system call to check the hugepage size from sysfs, and override
it with the hardcoded 2MB.

There are two additional benefits of this patch, if the transparent
hugepage sysctl is set to madvise or always:

1) The THP size is now hardcoded to 2MB for Aarch64. This avoids a
syscall for fetching the THP size from sysfs.

2) On 64K basepage size systems, the traditional THP size is 512M, which
is unusable and impractical. We can instead benefit from the mTHP size of
2M. Apart from the usual benefit of THPs/mTHPs as described above, Aarch64
systems benefit from reduced TLB pressure on this mTHP size, commonly
known as the "contpte" size. If the application takes a pagefault, and
either the THP sysctl settings is "always", or the virtual memory area
has been madvise(MADV_HUGEPAGE)'d along with sysctl being "madvise", then
Linux will fault in a 2M mTHP, mapping contiguous pages into the pagetable,
and painting the pagetable entries with the cont-bit. This bit is a hint to
the hardware that the concerned pagetable entry maps a page which is part
of a set of contiguous pages - the TLB then only remembers a single entry
for this set of 2M/64K = 32 pages, because the physical address of any
other page in this contiguous set is computable by the TLB cached physical
address via a linear offset. Hence, what was only possible with the
traditional THP size, is now possible with the mTHP size.

We see a 6.25% performance improvement on SPEC.

If the sysctl is set to never, no transparent hugepages will be created by
the kernel. But, this patch still sets thp_pagesize = 2MB. The benefit is
that on MORECORE() invocation, we extend the heap by 2MB instead of 4KB,
potentially reducing the frequency of this syscall's invocation by 512x.
Note that, there is no difference in cost between an sbrk(2M) and sbrk(4K);
the kernel only does a virtual reservation and does not touch user physical
memory.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-12-10 12:18:16 +00:00
Dev Jain 26e6e4d51e malloc: Do not make out-of-bounds madvise call on non-aligned heap
Currently, if the initial program break is not aligned to the system page
size, then we align the pointer down to the page size. If there is a gap
before the heap VMA, then such an adjustment means that the madvise() range
now contains a gap. The behaviour in the upstream kernel is currently this:
madvise() will return -ENOMEM, even though the operation will still succeed
in the sense that the VM_HUGEPAGE flag will be set on the heap VMA. We
*must not* depend on this behaviour - this is an internal kernel
implementation, and earlier kernels may possibly abort the operation
altogether.

The other case is that there is no gap, and as a result we may end up
setting the VM_HUGEPAGE flag on that other VMA too, which is an
unnecessary side effect.

Let us fix this by aligning the pointer up to the page size. We should
also subtract the pointer difference from the size, because if we don't,
since the pointer is now aligned up, the size may cross the heap VMA, thus
leading to the same problem but at the other end.

There is no need to check this new size against mp_.thp_pagesize to decide
whether to make the madvise() call. The reason we make this check at the
start of madvise_thp() is to check whether the size of the VMA is enough
to map THPs into it. Since that check has passed, all that we need to
ensure now is that q + size does not cross the heap VMA.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-12-10 12:18:16 +00:00
Adhemerval Zanella 0f0a5cd338 linux: Add openat2 (BZ 31664)
The openat2 syscall was added on Linux 5.6, as an extension of openat.
Unlike other open-like functions, the kernel only provides the LFS
variant (so files larger than 4GB always succeed, unlike other
functions with an offset larger than off_t).  Also, similar to other
open functions, the new symbol is a cancellable entrypoint.

The test case added only stress tests for some of the syscalls' provided
functionality, and it is based on an existing kernel self-test.

A fortify wrapper is added to verify the argument size if not larger
than the current support open_how struct.

Gnulib added an openat2 module, which uses read-only for the open_how
argument [1].  There is no clear indication whether the kernel will
indeed use the argument as in-out, how it would do so, or for which
kind of functionality [2]. Also, adding a potentially different prototype
than gnulib only would add extra unnecessary friction and extra
wrappers to handle it.

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

[1] https://gitweb.git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=0b97ffdf32bdab909d02449043447237273df75e
[2] https://sourceware.org/pipermail/libc-alpha/2025-September/169740.html

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-12-09 11:14:16 -03:00
Adhemerval Zanella d89e3a77c4 malloc: Extend malloc function hiding to tst-reallocarray (BZ #32366)
clang 20 optimize out reallocarray.

Reviewed-by: Sam James <sam@gentoo.org>
2025-12-09 11:14:14 -03:00
Adhemerval Zanella 54516bb385 malloc: Extend malloc function hiding to tst-pvalloc (BZ #32366)
clang 21 optimize out reallocarray.

Reviewed-by: Sam James <sam@gentoo.org>
2025-12-09 11:14:12 -03:00
Adhemerval Zanella be48ae12b1 configure: Enable experimental support for clang
The clang support is still experimental and not all testcases run
correctly.  Only clang 18 and onwards is supported and only
for x86_64-linux-gnu and aarch64-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-12-09 08:58:10 -03:00
Adhemerval Zanella 67b631db87 configure: Only use -Wno-discarded-qualifiers iff compiler supports it
The clang analogous option is
-Wno-incompatible-pointer-types-discards-qualifiers, so add a configure
option to check which one compiler supports.
2025-12-09 08:58:10 -03:00
Adhemerval Zanella 6b7067460f Handle clang -Wignored-attributes on weak aliases
Clang issues a warning for double alias redirection, indicating that thei
original symbol is used even if a weak definition attempts to override it.

For instance, in the construction:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, external_impl);
  #if SOMETHING
  weak_alias (external_impl, another_external_impl)
  #endif

Clang warns that another_external_impl always resolves to __internal_impl,
even if external_impl is a weak reference. Using the internal symbol for
both aliases resolves this warning.

This issue also occurs with certain libc_hidden_def usage:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, __internal_alias)
  libc_hidden_weak (__internal_alias)

In this case, using a strong_alias is sufficient to avoid the warning
(since the alias is internal, there is no need to use a weak alias).

However, for the constructions like:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, __internal_alias)
  libc_hidden_def (__internal_alias)
  weak_alias (__internal_impl, external_alias)
  libc_hidden_def (external_alias)

Clang warns that the internal external_alias will always resolve to
__GI___internal_impl, even if a weak definition of __GI_internal_impl is
overridden.  For this case, a new macro named static_weak_alias is used
to create a strong alias for SHARED, or a weak_alias otherwise.

With these changes, there is no need to check and enable the
-Wno-ignored-attributes suppression when using clang.

Checked with a build on affected ABIs, and a full check on aarch64,
armhf, i686, and x86_64.

Reviewed-by: Sam James <sam@gentoo.org>
2025-12-09 08:58:10 -03:00
Florian Weimer 2677916d1c build-many-glibcs.py: Include URL in download exception
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-12-09 01:23:05 +01:00
H.J. Lu 6afabde23e x32: Implement prctl in assembly
Since the variadic prctl function takes at most 5 integer arguments which
are passed in the same integer registers on x32 as the function with 5
integer arguments, we can use assembly for prctl.  Since upper 32-bits in
the last 4 arguments of pcrtl must be cleared to match the x32 prctl
syscall interface where the last 4 arguments are unsigned 64 bit longs,
implement prctl in assembly to clear upper 32-bits in the last 4 arguments
and add a test to verify it.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-09 06:41:55 +08:00
Florian Weimer f56a71097f build-many-glibcs.py: Switch Git URLs to https://
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2025-12-08 11:52:27 +01:00
Collin Funk 866fa41ef8 libio: null terminate the buffer upon initial allocation in getdelim
Commit 33eff78c8b caused issues in nbdkit
which had code similar to this to get the last line of the file:

    while (getline (&line, &len, fp) != -1)
      ;
    /* Process LINE.  */

After that commit, line[0] would be equal to '\0' instead of containing
the last line of the file like before that commit. A recent POSIX issue
clarified that the behavior before and after that commit are allowed,
since the contents of LINE are unspecified after -1 is returned
[1]. However, some programs rely on the previous behavior.

This patch null terminates the buffer upon getdelim/getline's initial
allocation. This is compatible with previous glibc versions, while also
protecting the caller from reading uninitialized memory if the file is
empty, as long as getline/getdelim does the initial allocation.

[1] https://www.austingroupbugs.net/bug_view_page.php?bug_id=1953

Suggested-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2025-12-05 20:09:36 -08:00
James Chesterman e2b00d59eb aarch64: Implement AdvSIMD and SVE rsqrt(f) routines
Vector variants of the new C23 rsqrt routines for both AdvSIMD and
SVE, as well as in both single and double precision.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-05 15:05:54 -03:00
James Chesterman 09d85861f1 benchtests: Add benchtests for rsqrt
Add benchtests for double precision vector rsqrt routine. They are
identical to those found in log2.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-05 11:15:44 -03:00
James Chesterman bd0a3526cc benchtests: Add benchtests for rsqrtf
Add benchtests for vector single precision rsqrtf. They are
identical to those found in log2f.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-05 11:15:42 -03:00
Adhemerval Zanella eb03df5404 i386: Fix fmod/fmodf/remainder/remainderf for gcc-12
The __builtin_fmod{f} and __builtin_remainder{f} were added on gcc 13,
and the minimum supported gcc is 12.  This patch adds a configure test
to check whether the compiler enables inlining for fmod/remainder, and
uses inline assembly if not.

Checked on i686-linux-gnu wih gcc-12.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-04 13:12:50 -03:00
Wilco Dijkstra 83dd79dffb nptl: Check alignment of pthread structs
Report assertion failure if the alignment of external pthread structs is
lower than the internal version.  This triggers on type mismatches like
in BZ #33632.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2025-12-04 15:45:15 +00:00
James Chesterman f9bb6bcff6 aarch64: Optimise AdvSIMD atanhf
Optimise AdvSIMD atanhf by vectorising the special case.
There are asymptotes at x = -1 and x = 1. So return inf for these.
Values for which |x| > 1, return NaN.

R.Throughput difference on V2 with GCC@15:
58-60% improvement in special cases.
No regression in fast pass.
2025-12-04 10:54:49 -03:00
James Chesterman 0e734b2b0c aarch64: Optimise AdvSIMD asinhf
Optimise AdvSIMD asinhf by vectorising the special case.
For values greater than 0x1p64, scale the input down first.
This is because the output will overflow with inputs greater than
or equal to this value as there is a squaring operation in the
algorithm.
To scale, do:
2asinh(sqrt[(x-1)/2])
Because:
2asinh(x) = +-acosh(2x^2 + 1)
Apply opposite operations in opposite order for x, and you get:
asinh(x) = 2acosh(sqrt[(x-1)/2]).
Found that using asinh instead of acosh also very closely
approximates asinh(x) for a high input x.

R.Throughput difference on V2 with GCC@15:
25-58% improvement in special cases.
4% regression in fast pass.
2025-12-04 10:54:49 -03:00
James Chesterman 0e80864c07 aarch64: Optimise AdvSIMD acoshf
Optimise AdvSIMD acoshf by vectorising the special case.
For values greater than 0x1p64, scale the input down first.
This is because the output will overflow with inputs greater than
or equal to this value as there is a squaring operation in the
algorithm.
To scale, do:
2acosh(sqrt[(x+1)/2])
Because:
acosh(x) = 1/2acosh(2x^2 - 1) for x>=1.
Apply opposite operations in opposite order for x, and you get:
acosh(x) = 2acosh(sqrt[(x+1)/2]).

R.Throughput difference on V2 with GCC@15:
30-49% improvement in special cases.
2% regression in fast pass.
2025-12-04 10:54:49 -03:00
Yury Khrustalev 6f869f54fb aarch64: Add tests for glibc.cpu.aarch64_bti behaviour
Check that the new tunable changes behaviour correctly:

 * When BTI is enforced, any unmarked binary that is loaded
   results in an error: either an abort or dlopen error when
   this binary is loaded via dlopen.
 * When BTI is not enforced, it is OK to load an unmarked
   binary.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-04 12:44:45 +00:00
Yury Khrustalev dba95d2887 aarch64: Support enforcing BTI on dependencies
Add glibc.cpu.aarch64_bti tunable with 2 values:

 - permissive (default)
 - enforced

and use this tunable to enforce BTI marking on dependencies
when the enforced option is selected.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Tested-by: Jeremy Linton <jeremy.linton@arm.com>
2025-12-04 12:44:42 +00:00
Yury Khrustalev 59bac0d5d2 aarch64: Add configure checks for BTI support
We add configure checks for 3 things:
 - Compiler (both CC and TEST_CC) supports -mbranch-protection=bti.
 - Linker supports -z force-bti.
 - The toolchain supplies object files and target libraries with
   the BTI marking.

All three must be true in order for the tests to be valid, so
we check all flags and set the makefile variable accordingly.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-04 12:44:39 +00:00
Yury Khrustalev ccb5083553 aarch64: fix makefile formatting 2025-12-04 12:40:47 +00:00
James Chesterman e3c40c8db0 aarch64: Optimise AdvSIMD log10
Optimise AdvSIMD log10 by vectorising the special case.
For subnormal input values, use the same scaling technique as
described in the single precision equivalent.
Then check for inf, nan and x<=0.
2025-12-04 08:35:25 -03:00
James Chesterman 59c706b418 aarch64: Optimise AdvSIMD log2
Optimise AdvSIMD log2 by vectorising the special case.
For subnormal input values, use the same scaling technique as
described in the single precision equivalent.
Then check for inf, nan and x<=0.
2025-12-04 08:35:25 -03:00
James Chesterman 82d3a8a738 aarch64: Optimise AdvSIMD log
Optimise AdvSIMD log by vectorising the special case.
For subnormal input values, use the same scaling technique as
described in the single precision equivalent.
Then check for inf, nan and x<=0.
2025-12-04 08:35:25 -03:00
James Chesterman 015a13e780 aarch64: Optimise AdvSIMD log1p
Optimise AdvSIMD log1p by vectorising the special case.
The special cases are for when the input is:
Less than or equal to -1
+/- INFINITY
+/- NaN
2025-12-04 08:35:25 -03:00
James Chesterman 57215df30e aarch64: Optimise AdvSIMD log10f
Optimise AdvSIMD log10f by vectorising the special case.
Use scaling technique on subnormal values, then check for inf and
nan values.
The scaling technique will sqrt the input then multiply the output
by 2 because:
log(sqrt(x)) = 1/2(log(x)), so log(x) = 2log(sqrt(x))

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-04 08:31:19 -03:00
James Chesterman fe83660a7e aarch64: Optimise AdvSIMD log2f
Optimise AdvSIMD log2f by vectorising the special case.
Use scaling technique on subnormal values, then check for inf and
nan values.
The scaling technique used will sqrt the input then multiply the
output by 2 because:
log(sqrt(x)) = 1/2 log(x), so log(x) = 2log(sqrt(x))

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-04 08:31:15 -03:00
James Chesterman ab8138303c aarch64: Optimise AdvSIMD logf
Optimise AdvSIMD logf by vectorising the special case.
Use scaling technique on subnormal values, then check for inf and
nan values.
The scaling technique used will sqrt the input then multiply the
output by 2 because:
log(sqrt(x)) = 1/2 log(x), so log(x) = 2log(sqrt(x))

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-04 08:31:08 -03:00
James Chesterman f42c135157 aarch64: Optimise AdvSIMD log1pf
Optimise AdvSIMD log1pf by vectorising the special case and by
reducing the range of values passed to the special case.
Previously, high values such as 0x1.1p127 where treated as special
cases, but now the special cases are for when the input is:
Less than or equal to -1
+/- INFINITY
+/- NaN

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-04 08:31:02 -03:00
H.J. Lu 762bb01d4e int128: Check BITS_PER_MP_LIMB == 32 instead of __WORDSIZE == 32
commit 8cd6efca5b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Nov 20 15:30:06 2025 -0300

    Add add_ssaaaa and sub_ssaaaa to gmp-arch.h

checks __WORDSIZE == 32 to decide if int128 should be used, which breaks
x32 which has int128 and __WORDSIZE == 32.  Check BITS_PER_MP_LIMB == 32,
instead of __WORDSIZE == 32.  This fixes BZ #33677.

Tested on x32, x86-64 and i686.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-04 07:46:20 +08:00
Adhemerval ZanellaandYonggang Luo f28a11e43f time: Add TIME_MONOTONIC, TIME_ACTIVE, and TIME_THREAD_ACTIVE
The TIME_MONOTONIC maps to POSIX's CLOCK_MONOTONIC, TIME_ACTIVE to
CLOCK_PROCESS_CPUTIME_ID, and TIME_THREAD_ACTIVE to
CLOCK_THREAD_CPUTIME_ID.

No Linux specific timer are added as extension.

Co-authored-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2025-12-03 11:03:58 -03:00
Joseph Myers 56d0e2cca1 Use Linux 6.18 in build-many-glibcs.py
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2025-12-02 16:34:07 +00:00
Yury Khrustalev 11d3cfb570 misc: fix some typos
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-02 12:25:36 +00:00
H.J. Lu 3dd2cbfa35 Use 64-bit atomic on sem_t with 8-byte alignment [BZ #33632]
commit 7fec8a5de6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Nov 13 14:26:08 2025 -0300

    Revert __HAVE_64B_ATOMICS configure check

uses 64-bit atomic operations on sem_t if 64-bit atomics are supported.
But sem_t may be aligned to 32-bit on 32-bit architectures.

1. Add a macro, SEM_T_ALIGN, for sem_t alignment.
2. Add a macro, HAVE_UNALIGNED_64B_ATOMICS.  Define it if unaligned 64-bit
atomic operations are supported.
3. Add a macro, USE_64B_ATOMICS_ON_SEM_T.  Define to 1 if 64-bit atomic
operations are supported and SEM_T_ALIGN is at least 8-byte aligned or
HAVE_UNALIGNED_64B_ATOMICS is defined.
4. Assert that size and alignment of sem_t are not lower than those of
the internal struct new_sem.
5. Check USE_64B_ATOMICS_ON_SEM_T, instead of USE_64B_ATOMICS, when using
64-bit atomic operations on sem_t.

This fixes BZ #33632.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-12-02 06:50:49 +08:00
Yury KhrustalevandCarlos O'Donell d605dea0a4 scripts: Support custom Git URLs in build-many-glibcs.py
Use environment variables to provide mirror URLs to checkout
sources from Git. Each component has a corresponding env var
that will be used if it's present: <component>_GIT_MIRROR.

Note that '<component>' should be upper case, e.g. GLIBC.

Co-authored-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-12-01 16:22:02 +00:00
Yury Khrustalev af5ce3ec8f scripts: Support custom FTP mirror URL in build-many-glibcs.py
Allow to use custom mirror URLs to download tarballs from a mirror
of ftp.gnu.org using the FTP_GNU_ORG_MIRROR env variable (default
value is 'https://ftp.gnu.org').

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-12-01 16:21:54 +00:00
Kacper Piwiński 82f4758410 strops: use strlen instead of strchr for string length
For wide string the equivalent funtion __wcslen is used. This change
makes it more symetrical.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-01 16:42:54 +01:00
Yury Khrustalev 20092f2ef6 nptl: tests: Fix test-wrapper use in tst-dl-debug-tid.sh
Test wrapper script was used twice: once to run the test
command and second time within the text command which
seems unnecessary and results in false errors when running
this test.

Fixes 332f8e62af

Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2025-12-01 14:39:39 +00:00
Osama Abdelkader 57ce2d8243 Fix allocation_index increment in malloc_internal
The allocation_index was being incremented before checking if mmap()
succeeds.  If mmap() fails, allocation_index would still be incremented,
creating a gap in the allocations tracking array and making
allocation_index inconsistent with the actual number of successful
allocations.

This fix moves the allocation_index increment to after the mmap()
success check, ensuring it only increments when an allocation actually
succeeds.  This maintains proper tracking for leak detection and
prevents gaps in the allocations array.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-12-01 13:35:36 +01:00
Adhemerval Zanella f9e61cd446 NEWS: Add new generic fma/fmaf note
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-28 09:29:35 -03:00
Florian Weimer e98bd0c54d iconvdata: Fix invalid pointer arithmetic in ANSI_X3.110 module
The expression inptr + 1 can technically be invalid: if inptr == inend,
inptr may point one element past the end of an array.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-28 13:20:39 +01:00
Joseph Myers e535fb910c Define C23 header version macros
C23 defines library macros __STDC_VERSION_<header>_H__ to indicate
that a header has support for new / changed features from C23.  Now
that all the required library features are implemented in glibc,
define these macros.  I'm not sure this is sufficiently much of a
user-visible feature to be worth a mention in NEWS.

Tested for x86_64.

There are various optional C23 features we don't yet have, of which I
might look at the Annex H ones (floating-point encoding conversion
functions and _Float16 functions) next.

* Optional time bases TIME_MONOTONIC, TIME_ACTIVE, TIME_THREAD_ACTIVE.
  See
  <https://sourceware.org/pipermail/libc-alpha/2023-June/149264.html>
  - we need to review / update that patch.  (I think patch 2/2,
  inventing new names for all the nonstandard CLOCK_* supported by the
  Linux kernel, is rather more dubious.)

* Updating conform/ tests for C23.

* Defining the rounding mode macro FE_TONEARESTFROMZERO for RISC-V (as
  far as I know, the only architecture supported by glibc that has
  hardware support for this rounding mode for binary floating point)
  and supporting it throughout glibc and its tests (especially the
  string/numeric conversions in both directions that explicitly handle
  each possible rounding mode, and various tests that do likewise).

* Annex H floating-point encoding conversion functions.  (It's not
  entirely clear which are optional even given support for Annex H;
  there's some wording applied inconsistently about only being
  required when non-arithmetic interchange formats are supported; see
  the comments I raised on the WG14 reflector on 23 Oct 2025.)

* _Float16 functions (and other header and testcase support for this
  type).

* Decimal floating-point support.

* Fully supporting __int128 and unsigned __int128 as integer types
  wider than intmax_t, as permitted by C23.  Would need doing in
  coordination with GCC, see GCC bug 113887 for more discussion of
  what's involved.
2025-11-27 19:32:49 +00:00
Adhemerval ZanellaandWilco Dijkstra 8a0152b61b math: New generic fmaf implementation
The current implementation relies on setting the rounding mode for
different calculations (FE_TOWARDZERO) to obtain correctly rounded
results.  For most CPUs, this adds significant performance overhead
because it requires executing a typically slow instruction (to
get/set the floating-point status), necessitates flushing the
pipeline, and breaks some compiler assumptions/optimizations.

The original implementation adds tests to handle underflow in corner
cases, whereas this implementation uses a different strategy that
checks both the mantissa and the result to determine whether the
result is not subject to double rounding.

I tested this implementation on various targets (x86_64, i686, arm,
aarch64, powerpc), including some by manually disabling the compiler
instructions.

Performance-wise, it shows large improvements:

reciprocal-throughput       master       patched       improvement
x86_64 [1]                   58.09          7.96             7.33x
i686 [1]                    279.41         16.97            16.46x
aarch64 [2]                  26.09          4.10             6.35x
armhf [2]                    30.25          4.20             7.18x
powerpc [3]                   9.46          1.46             6.45x

latency                     master       patched       improvement
x86_64                       64.50         14.25             4.53x
i686                        304.39         61.04             4.99x
aarch64                      27.71          5.74             4.82x
armhf                        33.46          7.34             4.55x
powerpc                      10.96          2.65             4.13x

Checked on x86_64-linux-gnu and i686-linux-gnu with —disable-multi-arch,
and on arm-linux-gnueabihf.

[1] gcc 15.2.1, Zen3
[2] gcc 15.2.1, Neoverse N1
[3] gcc 15.2.1, POWER10

Signed-off-by: Szabolcs Nagy <nsz@gcc.gnu.org>
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-27 14:52:25 -03:00
Florian Weimer 15de570246 Linux: Ignore PIDFD_GET_INFO in tst-pidfd-consts
The constant is expected to change between kernel releases.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-27 14:34:58 +01:00
Adhemerval Zanella a61f7fd59d math: Sync atanh from CORE-MATH
The CORE-MATH commit dc9465e7 fixes some issues:

Failure: Test: atanh_towardzero (0x8.3f79103b3c64p-4)
Result:
 is:          5.7018661316561103e-01   0x1.23ef7ff0539c6p-1
 should be:   5.7018661316561092e-01   0x1.23ef7ff0539c5p-1
 difference:  1.1102230246251565e-16   0x1.0000000000000p-53
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: atanh_towardzero (0x8.3f7d95aabaf7p-4)
Result:
 is:          5.7019248543911060e-01   0x1.23f044fac5997p-1
 should be:   5.7019248543911049e-01   0x1.23f044fac5996p-1
 difference:  1.1102230246251565e-16   0x1.0000000000000p-53
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: atanh_towardzero (0x8.3f805380d6728p-4)
Result:
 is:          5.7019604623795527e-01   0x1.23f0bc75cd113p-1
 should be:   5.7019604623795516e-01   0x1.23f0bc75cd112p-1
 difference:  1.1102230246251565e-16   0x1.0000000000000p-53
 ulp       :  1.0000
 max.ulp   :  0.0000
Maximal error of `atanh_towardzero'
 is      : 1 ulp
 accepted: 0 ulp

Checked on x86_64-linux-gnu, x86_64-linux-gnu-v3, aarch64-linux-gnu,
and i686-linux-gnu.
2025-11-26 14:10:07 -03:00
Yury Khrustalev bc4bc1650b aarch64: make GCS configure checks aarch64-only
We only need to enable GCS tests on AArch64 targets, however previously
the configure checks for GCS support in compiler and linker were added
for all targets which was not efficient.

To enable tests for GCS we need 4 things to be true:

 - Compiler supports GCS branch protection.
 - Test compiler supports GCS branch protection.
 - Linker supports GCS marking of binaries.
 - The CRT objects provided by the toolchain have GCS marking.

To check for the latter, we add new macro to aclocal.m4 that allows to
grep output from readelf.

We check all four and then put the result in one make variable to
simplify checks in makefiles.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-26 13:50:15 +00:00
Adhemerval Zanella bf211c3499 math: New generic fma implementation
The current implementation relies on setting the rounding mode for
different calculations (first to FE_TONEAREST and then to FE_TOWARDZERO)
to obtain correctly rounded results. For most CPUs, this adds a significant
performance overhead since it requires executing a typically slow
instruction (to get/set the floating-point status), it necessitates
flushing the pipeline, and breaks some compiler assumptions/optimizations.

This patch introduces a new implementation originally written by Szabolcs
for musl, which utilizes mostly integer arithmetic.  Floating-point
arithmetic is used to raise the expected exceptions, without the need for
fenv.h operations.

I added some changes compared to the original code:

  * Fixed some signaling NaN issues when the 3-argument is NaN.

  * Use math_uint128.h for the 64-bit multiplication operation.  It allows
    the compiler to use 128-bit types where available, which enables some
    optimizations on certain targets (for instance, MIPS64).

  * Fixed an arm32 issue where the libgcc routine might not respect the
    rounding mode [1].  This can also be used on other targets to optimize
    the conversion from int64_t to double.

  * Use -fexcess-precision=standard on i686.

I tested this implementation on various targets (x86_64, i686, arm, aarch64,
powerpc), including some by manually disabling the compiler instructions.

Performance-wise, it shows large improvements:

reciprocal-throughput       master       patched       improvement
x86_64 [2]                289.4640       22.4396            12.90x
i686 [2]                  636.8660      169.3640             3.76x
aarch64 [3]                46.0020       11.3281             4.06x
armhf [3]                   63.989       26.5056             2.41x
powerpc [4]                23.9332       6.40205             3.74x

latency                     master       patched       improvement
x86_64                    293.7360       38.1478             7.70x
i686                      658.4160      187.9940             3.50x
aarch64                    44.5166       14.7157             3.03x
armhf                      63.7678       28.4116             2.24x
power10                    23.8561       11.4250             2.09x

Checked on x86_64-linux-gnu and i686-linux-gnu with —disable-multi-arch,
and on arm-linux-gnueabihf.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91970
[2] gcc 15.2.1, Zen3
[3] gcc 15.2.1, Neoverse N1
[4] gcc 15.2.1, POWER10

Signed-off-by: Szabolcs Nagy <nsz@gcc.gnu.org>
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-26 10:10:06 -03:00
Adhemerval Zanella 5dab2a3195 stdlib: Remove longlong.h
The gmp-arch.h now provides all the required definitions.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-26 10:10:06 -03:00
Adhemerval Zanella 7a0471f149 Add umul_ppmm to gmp-arch.hdoc
To enable “longlong.h” removal, the umul_ppmm is moved to a gmp-arch.h.
The generic implementation now uses a static inline, which provides
better type checking than the GNU extension to cast the asm constraint
(and it works better with clang).

Most of the architecture uses the generic implementation, which is
expanded from a macro, except for alpha, arm, hppa, x86, m68k, mips,
powerpc, and sparc.  The 32 bit architectures the compiler generates
good enough code using uint64_t types, where for 64 bit architecture
the patch leverages the math_u128.h definitions that uses 128-bit
integers when available (all 64 bit architectures on gcc 15).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-26 10:10:06 -03:00
Adhemerval Zanella 8cd6efca5b Add add_ssaaaa and sub_ssaaaa to gmp-arch.h
To enable “longlong.h” removal, add_ssaaaa and sub_ssaaaa are moved to
gmp-arch.h.  The generic implementation now uses a static inline.  This
provides better type checking than the GNU extension, which casts the
asm constraint; and it also works better with clang.

Most architectures use the generic implementation, with except of
arc, arm, hppa, x86, m68k, powerpc, and sparc.  The 32 bit architectures
the compiler generates good enough code using uint64_t types, where
for 64 bit architecture the patch leverages the math_u128.h definitions
that uses 128-bit integers when available (all 64 bit architectures
on gcc 15).

The strongly typed implementation required some changes.  I adjusted
_FP_W_TYPE, _FP_WS_TYPE, and _FP_I_TYPE to use the same type as
mp_limb_t on aarch64, powerpc64le, x86_64, and riscv64.  This basically
means using “long” instead of “long long.”

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-26 10:10:02 -03:00
Adhemerval Zanella 476e962af7 Add gmp-arch and udiv_qrnnd
To enable “longlong.h” removal, the udiv_qrnnd is moved to a gmp-arch.h
file.  It allows each architecture to implement its own arch-specific
optimizations.  The generic implementation now uses a static inline,
which provides better type checking than the GNU extension to cast the
asm constraint (and it works better with clang).

Most of the architecture uses the generic implementation, which is
expanded from a macro, except for alpha, x86, m68k, sh, and sparc.
I kept that alpha, which uses out-of-the-line implementations and x86,
where there is no easy way to use the div{q} instruction from C code.
For the rest, the compiler generates good enough code.

The hppa also provides arch-specific implementations, but they are not
routed in “longlong.h” and thus never used.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-25 14:52:15 -03:00
Adhemerval Zanella e45174fe8c Add new math improvemenst to NEWS
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-11-25 14:51:56 -03:00
Yury Khrustalev 6a29bbcf5a scripts: Fix minor lint warnings in build-many-glibcs.py
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-25 13:56:56 +00:00
Arjun Shankar 244c404ae8 malloc: Add threaded variants of single-threaded malloc tests
Single-threaded malloc tests exercise only the SINGLE_THREAD_P paths in
the malloc implementation.  This commit runs variants of these tests in
a multi-threaded environment in order to exercise the alternate code
paths in the same test scenarios, thus potentially improving coverage.

$(test)-threaded-main and $(test)-threaded-worker variants are
introduced for most single-threaded malloc tests (with a small number of
exceptions).  The -main variants run the base test in a main thread
while the test environment has an alternate thread running, whereas the
-worker variants run the test in an alternate thread while the main
thread waits on it.

The tests themselves are unmodified, and the change is accomplished by
using -DTEST_IN_THREAD at compile time, which instructs support/
infrastructure to run the test while an alternate thread waits on it.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-24 16:47:52 +01:00
Arjun Shankar bd0e88f05c support: Add support for running tests in a multi-threaded environment
It can be useful to be able to write a single-threaded test but run it
as part of a multi-threaded program simply to exercise glibc
synchronization code paths, e.g. the malloc implementation.

This commit adds support to enable this kind of testing.  Tests that
define TEST_IN_THREAD, either as TEST_THREAD_MAIN or TEST_THREAD_WORKER,
and then use support infrastructure (by including test-driver.c) will be
accordingly run in either the main thread, or in a second "worker"
thread while the other thread waits.

This can be used in new tests, or to easily make and run copies of
existing tests without modifying the tests themselves.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-24 16:47:52 +01:00
Samuel Thibault 0f7b73f2ed htl: Fix conditions for thread list variables
_dl_stack_used/user/etc. vs _dl_pthread_num_threads etc. is really an
nptl vs htl question rather than pthread being in libc.
2025-11-22 21:55:02 +01:00
Samuel Thibault c71ee65a79 pthread: Simplify condition for hidden proto
This is not needed yet for htl (only the Linux mq_notify), but we can as
well just simplify the header.
2025-11-22 21:55:02 +01:00
gfleury 585eee3962 htl: move c11 symbols into libc.
thrd_{create,detach,exit,join}.
mtx_{init,destroy,lock,trylock,unlock,timeelock}.
cnd_{broadcast,destroy,init,signal,timewait,wait,destroy}
tss_{create,delete,get,set}. call_once.
Message-ID: <20251121191336.1224485-1-gfleury@disroot.org>
2025-11-22 03:28:48 +01:00
Samuel Thibault 604bdb0f8e htl: Also use __libc_thread_freeres to clean TLS state 2025-11-22 03:27:40 +01:00
Adhemerval Zanella aa6066087f benchtests: Fix bench-build after cd748a63ab
The benchtests does not define _LIBC.
2025-11-21 13:22:34 -03:00
Adhemerval Zanella 907089ba36 linux: Handle EINVAL as unsupported on tst-pidfd_getinfo
Some kernels returns EINVAL for ioctl (PIDFD_GET_INFO) on pidfd
descriptors.

Checked on aarch64-linux-gnu with Linux 6.12.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-21 13:13:26 -03:00
Adhemerval Zanella 52524467af bench-malloc-thread: Add libm for powf
The compiler might not constant fold the call, which issues
linker error.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:24 -03:00
Adhemerval Zanella 4d695077b8 benchtests: Remove clang warnings
clangs warns of the implicit cast of RAND_MAX to float:

  error: implicit conversion from 'int' to 'float' changes value from
  2147483647 to 2147483648 [-Werror,-Wimplicit-const-int-float-conversion]

So make it explicit.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:21 -03:00
Adhemerval Zanella 9849a61b34 benchtests: Add attribute_optimize
Similar to tst-printf-bz18872.sh, add the attribute_optimize to avoid
build failures with compilers that do not support "GCC optimize" pragma.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:15 -03:00
Adhemerval Zanella 46be3e521c benchtests: Use __f128 on ilogbf128-inputs constants
The f128 is not a valid floating constant suffix on clang.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:14 -03:00
Adhemerval Zanella 8d26bed1eb Enable --enable-fortify-source with clang
clang generates internal calls for some _chk symbol, so add internal
aliases for them, and stub some with rtld-stubbed-symbols to avoid
ld.so linker issues.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:11 -03:00
Adhemerval Zanella 25de0771ec configure: Only use -fno-fp-int-builtin-inexact if compiler supports it
Checked on x86_64-linux-gnu.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:10 -03:00
Adhemerval Zanella 2885d8a3ab benchtests: Add fmaf benchtests
Random inputs in the range [0,10].

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-21 13:13:05 -03:00
Adhemerval Zanella 42f07a44ef math: Remove ldbl-96 fma implementation
It is worse than the ldbl-64 version on recent x86 hardware.  With
Zen3 and gcc-15:

ldbl-96 removal
reciprocal-throughput        master        patched   improvement
x86_64                    1176.2200       289.4640         4.06x
i686                      1476.0600       636.8660         2.32x

latency                      master        patched   improvement
x86_64                    1176.2200        293.7360        4.00x
i686                      1480.0700        658.4160        2.25x

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-21 13:13:02 -03:00
Adhemerval Zanella 8ce2b5dd27 benchtests: Add fma benchtests
Random inputs in the range [0,10].

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-21 13:12:58 -03:00
Samuel Thibault ff92750112 htl: Move pthread_atfork compatibility symbol to libc
There is no new symbol version because of the compatibility symbol
status.
2025-11-21 00:29:44 +01:00
gfleury b36a126f7d htl: move pthread_spin_{destroy, lock, init, trylock, unlock) and remove _pthread_spin_lock, into libc.
Message-ID: <20251120085647.326643-1-gfleury@disroot.org>
2025-11-21 00:29:44 +01:00
Joseph Myers cd748a63ab Implement C23 const-preserving standard library macros
C23 makes various standard library functions, that return a pointer
into an input array, into macros that return a pointer to const when
the relevant argument passed to the macro is a pointer to const.  (The
requirement is for macros, with the existing function types applying
when macro expansion is suppressed.  When a null pointer constant is
passed, such as integer 0, that's the same as a pointer to non-const.)

Implement this feature.  This only applies to C, not C++, since such
macros are not an appropriate way of doing this for C++ and all the
affected functions other than bsearch have overloads to implement an
equivalent feature for C++ anyway.  Nothing is done to apply such a
change to any non-C23 functions with the same property of returning a
pointer into an input array.

The feature is also disabled when _LIBC is defined, since there are
various places in glibc that either redefine these identifiers as
macros, or define the functions themselves, and would need changing to
work in the presence of these macro definitions.  A natural question
is whether we should in fact change those places and not disable the
macro definitions for _LIBC.  If so, we'd need a solution for the
places in glibc that define the macro *before* including the relevant
header (in order in effect to disable the header declaration of the
function by renaming that declaration).

One testcase has #undef added to avoid conflicting with this feature
and another has const added; -Wno-discarded-qualifiers is added for
building zic (but could be removed once there's a new upstream tzcode
release that's const-safe with this C23 change and glibc has updated
to code from that new release).  Probably other places in glibc proper
would need const added if we remove the _LIBC conditionals.

Another question would be whether some GCC extension should be added
to support this feature better with macros that only expand each
argument once (as well as reducing duplication of diagnostics for bad
usages such as non-pointer and pointer-to-volatile-qualfied
arguments).

Tested for x86_64.
2025-11-20 19:31:04 +00:00
Adhemerval Zanella 64b6813338 Check if linker supports -Wl,--undefined-version
Although binutils has supported --no-undefined-version for a long timei
(319416359200 back in 2002), --undefined-version was only added more
recently (27fb6a1a7fcd on 2.40).

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-20 14:33:13 -03:00
Adhemerval Zanella 20e92c9512 nptl: Replace FALLTHROUGH with [[fallthrough]]
The b9579342c6 reinstate '/* FALLTHROUGH */' that were replaced
the the C23 [[fallthrough]] by 970364dac0.
2025-11-20 14:23:43 -03:00
Samuel Thibault 951bb5c458 hurd: Add missing free_sized and free_aligned_sized
56549264d1 ("malloc: add free_sized and free_aligned_sized from C23")
missed adding them.
2025-11-20 17:41:45 +01:00
Andreas Schwab 0df50640a4 Use __fstat64_time64 in __fts64_children_time64 (bug 33653)
Make sure that fts_safe_changedir can handle a directory with a time stamp
after y2038.
2025-11-20 14:33:59 +01:00
Wilco Dijkstra 7f670284d8 malloc: Use _int_free_chunk in tcache_thread_shutdown
Directly call _int_free_chunk during tcache shutdown to avoid recursion.
Calling __libc_free on a block from tcache gets flagged as a double free,
and tcache_double_free_verify checks every tcache chunk (quadratic
overhead).

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-11-20 12:28:46 +00:00
Adhemerval Zanella 92186652d8 math: Sync atanh from CORE-MATH
The CORE-MATH commit 703d7487 fixes some issues for RNDZ:

Failure: Test: atanh_towardzero (0x5.96200b978b69cp-4)
Result:
 is:          3.6447730550366463e-01   0x1.753989ed16faap-2
 should be:   3.6447730550366458e-01   0x1.753989ed16fa9p-2
 difference:  5.5511151231257827e-17   0x1.0000000000000p-54
 ulp       :  1.0000
 max.ulp   :  0.0000
Maximal error of `atanh_towardzero'
 is      : 1 ulp
 accepted: 0 ulp

Checked on x86_64-linux-gnu, x86_64-linux-gnu-v3, aarch64-linux-gnu,
and i686-linux-gnu.
2025-11-19 15:21:44 -03:00
Justin King 56549264d1 malloc: add free_sized and free_aligned_sized from C23
Signed-off-by: Justin King <jcking@google.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-19 13:47:53 -03:00
Adhemerval Zanella 4567204feb math: Sync acosh from CORE-MATH
The CORE-MATH commit 6736002f fixes some issues for RNDZ:

Failure: Test: acosh_towardzero (0x1.08000c1e79fp+0)
Result:
 is:          2.4935636091994373e-01   0x1.feae8c399b18cp-3
 should be:   2.4935636091994370e-01   0x1.feae8c399b18bp-3
 difference:  2.7755575615628913e-17   0x1.0000000000000p-55
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: acosh_towardzero (0x1.080016353964ep+0)
Result:
 is:          2.4935874767710369e-01   0x1.feafcc91f518ep-3
 should be:   2.4935874767710367e-01   0x1.feafcc91f518dp-3
 difference:  2.7755575615628913e-17   0x1.0000000000000p-55
 ulp       :  1.0000
 max.ulp   :  0.0000
Maximal error of `acosh_towardzero'
 is      : 1 ulp
 accepted: 0 ulp

This only happens when the ISA supports fma, such as x86_64-v3, aarch64,
or powerpc.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-v3, aarch64-linux-gnu,
and i686-linux-gnu.
2025-11-19 12:58:56 -03:00
H. Peter Anvin 40a751b004 linux/termios: test the kernel-side termios canonicalization
Verify that the kernel side of the termios interface gets the various
speed fields set according to our current canonicalization policy.

[ v2.1: fix formatting - Adhemerval Netto ]
[ v4: fix typo in patch description - Dan Horák ]

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (v2.1)
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-19 07:54:51 +08:00
Florian Weimer cdb0e9dc70 nss: Remove effectively unused __nss_*_database variables
Use of this cache was removed in commit f8847d83e1
("nsswitch: use new internal API (core)").

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-18 20:18:06 +01:00
Dylan Fleming fd1d642ef8 AArch64: Remove WANT_SIMD_EXCEPT from aarch64 AdvSIMD math routines
Remove legacy code for supporting an old Arm Optimised Routines
deprecated feature for throwing SIMD Exceptions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-18 15:51:15 +00:00
Pierre Blanchard bb6519de1e AArch64: Fix and improve SVE pow(f) special cases
powf:

Update scalar special case function to best use new interface.

pow:

Make specialcase NOINLINE to prevent str/ldr leaking in fast path.
Remove depency in sv_call2, as new callback impl is not a
performance gain.
Replace with vectorised specialcase since structure of scalar
routine is fairly simple.

Throughput gain of about 5-10% on V1 for large values and 25% for subnormal `x`.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-18 15:51:15 +00:00
Pierre Blanchard e889160273 AArch64: fix SVE tanpi(f) [BZ #33642]
Fixed svld1rq using incorrect predicates (BZ #33642).
Next to no performance variations (tested on V1).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-18 15:51:15 +00:00
gfleury d989840693 htl: move pthread_hurd_cond_timedwait_np, pthread_hurd_cond_wait_np into libc.
Message-ID: <20251118125044.1160780-3-gfleury@disroot.org>
2025-11-18 15:01:35 +01:00
gfleury bb3524a879 htl: move pthread_getname_np/setname_np into libc.
Message-ID: <20251118125044.1160780-2-gfleury@disroot.org>
2025-11-18 15:01:35 +01:00
gfleury 77f446346a htl: fix compatibility
This fix 91fb9914d8 which break a system
built with an old glibc
Message-ID: <20251118125044.1160780-1-gfleury@disroot.org>
2025-11-18 15:01:35 +01:00
Adhemerval Zanella 8c66b742cf Add new AArch64 HWCAP3 definitions from Linux 6.17 to bits/hwcap.h
Linux 7c7f55039b8d6 added HWCAP3_MTE_FAR and f620372209bfe added
HWCAP3_MTE_STORE_ONLY.
2025-11-18 10:35:32 -03:00
Arjun Shankar e53d85947f malloc: Simplify tst-free-errno munmap failure test
The Linux specific test-case in tst-free-errno was backing up malloc
metadata for a large mmap'd block, overwriting the block with its own
mmap, then restoring malloc metadata and calling free to force an munmap
failure.  However, the backed up pages containing metadata can
occasionally be overlapped by the overwriting mmap, leading to a
metadata corruption.

This commit replaces this Linux specific test case with a simpler,
generic, three block allocation, expecting the kernel to coalesce the
VMAs, then cause a fragmentation to trigger the same failure.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-18 14:28:42 +01:00
Stefan Liebler b9579342c6 Remove support for lock elision.
The support for lock elision was already deprecated with glibc 2.42:
commit 77438db8cf
"Mark support for lock elision as deprecated."
See also discussions:
https://sourceware.org/pipermail/libc-alpha/2025-July/168492.html

This patch removes the architecture specific support for lock elision
for x86, powerpc and s390 by removing the elision-conf.h, elision-conf.c,
elision-lock.c, elision-timed.c, elision-unlock.c, elide.h, htm.h/hle.h files.
Those generic files are also removed.

The architecture specific structures are adjusted and the elision fields are
marked as unused.  See struct_mutex.h files.
Furthermore in struct_rwlock.h, the leftover __rwelision was also removed.
Those were originally removed with commit 0377a7fde6
"nptl: Remove rwlock elision definitions"
and by chance reintroduced with commit 7df8af43ad
"nptl: Add struct_rwlock.h"

The common code (e.g. the pthread_mutex-files) are changed back to the time
before lock elision was introduced with the x86-support:
- commit 1cdbe57948
"Add the low level infrastructure for pthreads lock elision with TSX"
- commit b023e4ca99
"Add new internal mutex type flags for elision."
- commit 68cc29355f
"Add minimal test suite changes for elision enabled kernels"
- commit e8c659d74e
"Add elision to pthread_mutex_{try,timed,un}lock"
- commit 49186d21ef
"Disable elision for any pthread_mutexattr_settype call"
- commit 1717da59ae
"Add a configure option to enable lock elision and disable by default"

Elision is removed also from the tunables, the initialization part, the
pretty-printers and the manual.

Some extra handling in the testsuite is removed as well as the full tst-mutex10
testcase, which tested a race while enabling lock elision.

I've also searched the code for "elision", "elide", "transaction" and e.g.
cleaned some comments.

I've run the testsuite on x86_64 and s390x and run the build-many-glibcs.py
script.
Thanks to Sachin Monga, this patch is also tested on powerpc.

A NEWS entry also mentions the removal.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-18 14:21:13 +01:00
Florian Weimer 5029b63280 nss: Remove effectively unused struct nss_database_default_cache
We always start with a zero-initialized cache, so this is completely
ineffective.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-18 09:51:02 +01:00
Florian Weimer a025a9deef nss: Clean up function pointer/void * unions
All our targets support casts between function pointers and void *,
so we might as well use them.

This change was largely auto-generated, with the following prompts.

@getXXbyYY_r.c Remove the use of the `fct` union and replace it by
pointer casts.

Apply the same change to ether_* getnetgrent_r getnssent_r netname
publickey .

Do not use explicit `*` in function pointer calls. Replace
`(*((lookup_function) fct))` and similar with `((lookup_function) fct)`.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-11-18 08:35:44 +01:00
H. Peter Anvin 6463953fec linux/termios: factor out the kernel interface from termios_internal.h
Factor out the internal kernel interface from termios_internal.h, so
that it can be used in test code without causing breakage due to glibc
internals used in headers.

[ v3: fix Alpha build breakage ]

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-18 12:05:20 +08:00
H. Peter Anvin 8d999a6993 linux/termios: clear k_termios.c_cflag & CIBAUD for non-split speed [BZ 33340]
After getting more experience with the various broken direct-to-ioctl
termios2 hacks using Fedora 43 beta, I have found a fair number of
cases where the software would fail to set, or clear CIBAUD for
non-split-speed operation.

Thus it seems will help improve compatibility to clear the kernel-side
version of c_cflag & CIBAUD (having the same meaning to the Linux
kernel as the speed 0 has for cfsetibaud(), i.e. force the input speed
to equal the output speed) for non-split-speed operation, rather than
having it explicitly equal the output speed in CBAUD.

When writing the code that went into glibc 2.42 I had considered this
issue, and had to make an educated guess which way would be more
likely to break fewer things.  Unfortunately, it appears I guessed
wrong.

A third option would be to *always* set CIBAUD to __BOTHER, even for
the standard baud rates.  However, that is an even bigger departure
from legacy behavior, whereas this variant mostly preserves current
behavior in terms of under what conditions buggy utilities will
continue to work.

This change is in tcsetattr() rather than
___termios2_canonicalize_speeds(), as it should not be run for
tcgetattr(); that would break split speed support for the legacy
interface versions of cfgetispeed() and cfsetispeed().

[ v2: fixed comment style ]

Resolves: BZ #33340
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-18 12:04:55 +08:00
Collin Funk 04eea3aa48 manual: don't use the FSF's old address in license text.
Update to latest text from Gnulib commit
08f579c56d81cf78c60fcd3568190f97e6e7f684, file doc/lgpl-2.1.texi.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-17 18:46:12 -08:00
Pádraig Brady efc8642051 posix: execvpe: fix UMR with file > NAME_MAX [BZ #33627]
* posix/execvpe.c (__execvpe_common): Since strnlen doesn't inspect
beyond NAME_MAX and NAME_MAX does not cover the NUL, we need
to explicitly check for the NUL.  I.e. the existing check for,
file_len-1 > NAME_MAX, was never true.  This check is required
so that we're guaranteed that file_len includes the NUL, as we
depend on that in the following memcpy to properly terminate
the file buffer passed to execve().  Otherwise that call will trigger
UMR when inspecting the passed file, which can be seen with valgrind.
Note returning ENAMETOOLONG early here for FILE names > NAME_MAX
will also avoid redundant processing of ENAMETOOLONG on each entry
in $PATH, after the change in [BZ #33626] is applied.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-17 11:57:07 -08:00
Adhemerval Zanella 03db446659 configure: Remove for redirection of built-in functions
The check was initially used to define HAVE_BUILTIN_REDIRECTION, which
enables or not libc_hidden_builtin_proto support. It was later removed
with 3ce1f29594, making the feature
mandatory. The configure check was kept as a transition knob.

Current minimum gcc/linker always supports this, as well as clang with
some extra care. Also, missing hidden_proto/hidden_def support is
already flagged in the check-localplt test.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-17 11:17:07 -03:00
Adhemerval Zanella 1abdb38135 math: Handle fabsf128 !__USE_EXTERN_INLINES
Work around the clang limitation wrt inline function and attribute
definition, where it does not allow to 'add' new attribute if a
function is already defined:

clang on x86_64 fails to build s_fabsf128.c with:

../sysdeps/ieee754/float128/../ldbl-128/s_fabsl.c:32:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
   32 | libm_alias_ldouble (__fabs, fabs)
      | ^
../sysdeps/generic/libm-alias-ldouble.h:63:38: note: expanded from macro 'libm_alias_ldouble'
   63 | #define libm_alias_ldouble(from, to) libm_alias_ldouble_r (from, to, )
      |                                      ^
../sysdeps/ieee754/float128/float128_private.h:133:43: note: expanded from macro 'libm_alias_ldouble_r'
  133 | #define libm_alias_ldouble_r(from, to, r) libm_alias_float128_r (from, to, r)
      |                                           ^
../sysdeps/ieee754/float128/s_fabsf128.c:5:3: note: expanded from macro 'libm_alias_float128_r'
    5 |   static_weak_alias (from ## f128 ## r, to ## f128 ## r);       \
      |   ^
./../include/libc-symbols.h:166:46: note: expanded from macro 'static_weak_alias'
  166 | #  define static_weak_alias(name, aliasname) weak_alias (name, aliasname)
      |                                              ^
./../include/libc-symbols.h:154:38: note: expanded from macro 'weak_alias'
  154 | # define weak_alias(name, aliasname) _weak_alias (name, aliasname)
      |                                      ^
./../include/libc-symbols.h:156:52: note: expanded from macro '_weak_alias'
  156 |   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
      |                                                    ^
../include/math.h:134:1: note: previous definition is here
  134 | fabsf128 (_Float128 x)

If compiler does not support __USE_EXTERN_INLINES we need to route
fabsf128 call to an internal symbol.
2025-11-17 11:17:07 -03:00
Adhemerval Zanella 53ad1eae0f x86: Fix strstr ifunc on clang
Work around the clang limitation wrt inline function and attribute
definition, where it does not allow to 'add' new attribute if a
function is already defined:

Buildint with clang triggers multiple issue on how ifunc macro are
used:

  ../sysdeps/x86_64/multiarch/strstr.c:38:54: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
     38 | extern __typeof (__redirect_strstr) __strstr_generic attribute_hidden;
        |                                                      ^
  ./../include/libc-symbols.h:356:43: note: expanded from macro 'attribute_hidden'
    356 | # define attribute_hidden __attribute__ ((visibility ("hidden")))
        |                                           ^
  ../string/strstr.c:76:1: note: previous definition is here
     76 | STRSTR (const char *haystack, const char *needle)
        | ^
  ../sysdeps/x86_64/multiarch/strstr.c:27:16: note: expanded from macro 'STRSTR'
     27 | #define STRSTR __strstr_generic
        |                ^
  ../sysdeps/x86_64/multiarch/strstr.c:65:43: error: redefinition of '__libc_strstr'
     65 | libc_ifunc_redirected (__redirect_strstr, __libc_strstr, IFUNC_SELECTOR ());
        |                                           ^

And

  ../sysdeps/x86_64/multiarch/strstr.c:65:43: error: redefinition of '__libc_strstr'
     65 | libc_ifunc_redirected (__redirect_strstr, __libc_strstr, IFUNC_SELECTOR ());
        |                                           ^
  ../sysdeps/x86_64/multiarch/strstr.c:59:13: note: previous definition is here
     59 | libc_ifunc (__libc_strstr,
        |             ^

Refactor to use a auxiliary function like other selection (for instance,
x86_64/multiarch/strcmp.c).
2025-11-17 11:17:07 -03:00
Adhemerval Zanella edd4dc7dc8 x86: Use -mavx instead of -msse2avx
clang supports -msse2avx from version 19 and onwards, but it should
be gated as an option to assembler (either with -Wa or -Xassembler).

The -DSSE2AVX option was used because there were asm statements with
SSE-only instructions which was fixed by commit ff8be6152b.

Now we can simply use -mavx.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-17 11:17:07 -03:00
Adhemerval Zanella 13cfd77bf5 math: Don't redirect inlined builtin math functions
When we want to inline builtin math functions, like truncf, for

  extern float truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));
  extern float __truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));

  float (truncf) (float) asm ("__truncf");

compiler may redirect truncf calls to __truncf, instead of inlining it
(for instance, clang).  The USE_TRUNCF_BUILTIN is 1 to indicate that
truncf should be inlined.  In this case, we don't want the truncf
redirection:

  1. For each math function which may be inlined, we define

  #if USE_TRUNCF_BUILTIN
   # define NO_truncf_BUILTIN inline_truncf
   #else
   # define NO_truncf_BUILTIN truncf
   #endif

in <math-use-builtins.h>.

  2. Include <math-use-builtins.h> in include/math.h.

  3. Change MATH_REDIRECT to

   #define MATH_REDIRECT(FUNC, PREFIX, ARGS)		\
    float (NO_ ## FUNC ## f ## _BUILTIN) (ARGS (float))	\
      asm (PREFIX #FUNC "f");

With this change If USE_TRUNCF_BUILTIN is 0, we get

  float (truncf) (float) asm ("__truncf");
  truncf will be redirected to __truncf.

And for USE_TRUNCF_BUILTIN 1, we get:

  float (inline_truncf) (float) asm ("__truncf");

In both cases either truncf will be inlined or the internal alias
(__truncf) will be called.

It is not required for all math-use-builtin symbol, only the one
defined in math.h.  It also allows to remove all the math-use-builtin
inclusion, since it is now implicitly included by math.h.

For MIPS, some math-use-builtin headers include sysdep.h and this
in turn includes a lot of extra headers that do not allow ldbl-128
code to override alias definition (math.h will include
some stdlib.h definition).  The math-use-builtin only requires
the __mips_isa_rev, so move the defintion to sgidefs.h.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-17 11:17:07 -03:00
Florian Weimer a0ce8b0779 Update COPYING, COPYING.LIB from gnulib, using gnulib file names
The new file names are COPYINGv2 and COPYING.LESSERv2.  Lots of
copyright headers mention COPYING.LIB, so add a symbolic link.
(This is not the first symbolic link in the repository, so this
should be fine.)

The files come from gnulib commit 3cc5b69dda06890929a2d0433f30708.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-17 11:15:13 +01:00
Florian Weimer e067e53080 Add COPYINGv3 with the GPL version 3 text
The license is referenced in various headers, so we should ship it.
The text was copied from gnulib commit d64d66cc4897d605f543257dcd0,
file doc/COPYINGv3.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Florian Weimer <fweimer@redhat.com>
2025-11-17 11:15:13 +01:00
Florian Weimer c6f151839b Reference COPYING.LIB in <sframe.h> copyright header
Commit 3360913c37 ("elf: Add SFrame
stack tracing") added this file with an inconsistent copyright header.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-17 11:15:13 +01:00
Samuel Thibault 5b6ee0e0ba htl: move pthread_create to into libc
This is notably needed for the main thread structure to be always
initialized so that some pthread functions can work from the main thread
without other threads, e.g. pthread_cancel.
2025-11-17 00:38:37 +00:00
Samuel Thibault f63dd92431 htl: Move __pthread_enable/disable_asynccancel into libc
This is actually needed before we make pthread_cancel available in libc.
2025-11-17 00:38:36 +00:00
Samuel Thibault 5db67a03e9 hurd: Fix getting rlimit in _hurd_alloc_fd
rlim_t is unsigned, and RLIM_INFINITY can be (rlim_t) -1
2025-11-17 00:38:35 +00:00
Samuel Thibault c7d699b55b htl: Add missing include
For IS_IN.
2025-11-16 11:53:46 +01:00
Samuel Thibault a064213785 loongarch: Remove TLS_TCB_ALIGN
This reverts a part of 9f18265a8e ("Remove TLS_TCB_ALIGN and
TLS_INIT_TCB_ALIGN"), as loongarch uses this macro internally.
2025-11-16 11:27:47 +01:00
Samuel Thibault ce61fcf702 hurd: Fix restoring SSE state on signal
mach_port_mod_refs() needs to avoid using SSE&MMX for __sigreturn2 to be
able to use it without thrashing SSE&MMX.
2025-11-16 01:33:02 +01:00
Samuel Thibault 9f18265a8e Remove TLS_TCB_ALIGN and TLS_INIT_TCB_ALIGN
This is the rest of 627f5ede70 ("Remove TLS_TCB_ALIGN and
TLS_INIT_TCB_ALIGN"), for loongarch and or1k which missed it.
2025-11-15 22:01:07 +01:00
Osama Abdelkader 4f18501498 math: Optimize frexpl (intel96) with fast path for normal numbers
Add fast path optimization for frexpl (80-bit x87 extended precision) using
a single unsigned comparison to identify normal floating-point numbers and
return immediately via arithmetic on the exponent field.

The implementation uses arithmetic operations (se - ex ) to
adjust the exponent directly, which is simpler than bit masking. For subnormals,
the traditional multiply-based normalization is retained as it handles the
split word format more reliably.

The zero/infinity/NaN check groups these special cases together for better
branch prediction.

Benchmark results on Intel Core i9-13900H (13th Gen):
  Baseline:     25.543 ns/op
  Optimized:    25.531 ns/op
  Speedup:      1.00x (neutral)
  Zero:         17.774 ns/op
  Denormal:     23.900 ns/op

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-14 19:52:38 +00:00
Adhemerval Zanella 7fec8a5de6 Revert __HAVE_64B_ATOMICS configure check
The 53807741fb added a configure check
for 64-bit atomic operations that were not previously enabled on some
32-bit ABIs.

However, the NPTL semaphore code casts a sem_t to a new_sem and issues
a 64-bit atomic operation for __HAVE_64B_ATOMICS.  Since sem_t has
32-bit alignment on 32-bit architectures, this prevents the use of
64-bit atomics even if the ABI supports them.

Assume 64-bit atomic support from __WORDSIZE, which maps to how glibc
defines it before the broken change.  Also rename __HAVE_64B_ATOMICS
to USE_64B_ATOMICS to define better the flag meaning.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-14 14:05:20 -03:00
Carlos O'Donell 5bdf3c9092 x86: Increase allowable TSX abort rate to 6%.
In pre-commit CI on an E5-2698 v4 we sometimes see ~5% aborts.

Set the trip point to 6%.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-14 08:18:36 -05:00
Samuel Thibault 91fb9914d8 htl: Remove errno and herrno from libpthread
libc already has them.
2025-11-13 23:45:42 +01:00
Samuel Thibault 23b8e6ae4f htl: Drop pthread-functions infrastructure
All previously forwarded functions are now called directly (either via local
call in libc, or through a __export).t
2025-11-13 23:23:13 +01:00
Samuel Thibault 6c933807a9 htl: Move __pthread_cleanup_stack out of libc_pthread_init.c
It does not actually need to be extern any more.
2025-11-13 23:22:57 +01:00
Samuel Thibault f6a60e9867 htl: move {,_IO_}f{,un,try}lockfile implementation into libc 2025-11-13 23:01:07 +01:00
Adhemerval Zanella c6908c4e24 linux: Add mseal to mips32 nofpu abilist
It was missing from 3d52fd274e.
2025-11-13 15:32:26 -03:00
Florian Weimer 2254e871f4 hppa: Consistently reference LGPL in copyright header
The file was added with a GPL reference (but LGPL statement) in
commit 0d6bed7150 ("hppa: Add
____longjmp_check C implementation.").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-13 09:46:15 +01:00
Joseph Myers 1f79bc4838 Change fromfp functions to return floating types following C23 (bug 28327)
As discussed in bug 28327, C23 changed the fromfp functions to return
floating types instead of intmax_t / uintmax_t.  (Although the
motivation in N2548 was reducing the use of intmax_t in library
interfaces, the new version does have the advantage of being able to
specify arbitrary integer widths for e.g. assigning the result to a
_BitInt, as well as being able to indicate an error case in-band with
a NaN return.)

As with other such changes from interfaces introduced in TS 18661,
implement the new types as a replacement for the old ones, with the
old functions remaining as compat symbols but not supported as an API.
The test generator used for many of the tests is updated to handle
both versions of the functions.

Tested for x86_64 and x86, and with build-many-glibcs.py.

Also tested tgmath tests for x86_64 with GCC 7 to make sure that the
modified case for older compilers in <tgmath.h> does work.

Also tested for powerpc64le to cover the ldbl-128ibm implementation
and the other things that are handled differently for that
configuration.  The new tests fail for ibm128, but all the failures
relate to incorrect signs of zero results and turn out to arise from
bugs in the underlying roundl, ceill, truncl and floorl
implementations that I've reported in bug 33623, rather than
indicating any bug in the actual new implementation of the functions
for that format.  So given fixes for those functions (which shouldn't
be hard, and of course should add to the tests for those functions
rather than relying only on indirect testing via fromfp), the fromfp
tests should start passing for ibm128 as well.
2025-11-13 00:04:21 +00:00
Wilco Dijkstra 989e538224 math: Remove float_t and double_t [BZ #33563]
Remove uses of float_t and double_t. This is not useful on modern machines,
and does not help given GCC defaults to -fexcess-precision=fast.
One use of double_t remains to allow forcing the precision to double
on targets where FLT_EVAL_METHOD=2. This fixes BZ #33563 on
i486-pc-linux-gnu.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-12 19:33:23 +00:00
Wilco Dijkstra 3b7bb7b2f2 math: Remove ldbl-128/s_fma.c
Remove ldbl-128/s_fma.c - it makes no sense to use emulated float128
operations to emulate FMA.  Benchmarking shows dbl-64/s_fma.c is about
twice as fast.  Remove redundant dbl-64/s_fma.c includes in targets
that were trying to work around this issue.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-12 18:57:29 +00:00
Adhemerval Zanella 3d52fd274e linux: Add mseal syscall support
It has been added on Linux 6.10 (8be7258aad44b5e25977a98db136f677fa6f4370)
as a way to block operations such as mapping, moving to another location,
shrinking the size, expanding the size, or modifying it to a pre-existing
memory mapping.

Although the system only works on 64-bit CPUs, the entrypoint was added
for all ABIs (since the kernel might eventually implement it for additional
ones and/or the ABI can execute on a 64-bit kernel).

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

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-12 15:27:28 -03:00
Yury Khrustalev a9c426bcca aarch64: fix includes in SME tests
Use the correct include for the SIGCHLD macro: signal.h

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-12 13:45:52 +00:00
Xi Ruoyao 2f5e68dea9 LoongArch: Call elf_ifunc_invoke for R_LARCH_IRELATIVE in elf_machine_rela
When R_LARCH_IRELATIVE is resolved by apply_irel, the ifunc resolver is
called via elf_ifunc_invoke so it can read HWCAP from the __ifunc_arg_t
argument.  But when R_LARCH_IRELATIVE is resolved by elf_machine_rela (it
will happen if we dlopen() a shared object containing R_LARCH_IRELATIVE),
the ifunc resolver is invoked directly with no or different argument.
This causes a segfault if the resolver uses the __ifunc_arg_t.

Despite the LoongArch psABI does not specify this argument, IMO it's
more convenient to have this argument IMO and per hyrum's rule there may
be objects in wild which already relies on this argument (they just
didn't blow up because they are not dlopen()ed yet).  So make the
behavior handling R_LARCH_IRELATIVE of elf_machine_rela same as
apply_irel.

This fixes BZ #33610.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2025-11-12 09:12:48 +08:00
Samuel Thibault f851a74346 hurd: Drop remnants of cthreads
These are not used in GNU/Hurd since very long now.
2025-11-12 01:11:11 +01:00
Bruno Haible e06a1962e6 cdefs: Fix some typos in comments.
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-11 11:04:29 -08:00
Florian Weimer 2eff71d289 stdlib: Do not define once_flag, ONCE_FLAG_INIT for C++
The definition of once_flag conflicts with std::once_flag in
if “using namespace std;” is active.

Updates commit a7ddbf456d
("Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23").

Suggested-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-11 18:20:10 +01:00
H.J. Lu 71d9f47b5a x86-64: Fix a typo in fesetenv.c [BZ #33619]
Fix a typo in

commit 427c25278d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 31 17:00:46 2025 -0300

    x86: Adapt "%v" usage on clang to emit VEX enconding

@@ -103,8 +104,8 @@ __fesetenv (const fenv_t *envp)
       temp.__mxcsr = envp->__mxcsr;
     }

-  __asm__ ("fldenv %0\n"
-          "%vldmxcsr %1" : : "m" (temp), "m" (temp.__mxcsr));
+  asm volatile ("fldenv %0" : "=m" (temp));
+  ldmxcsr_inline_asm (&temp.__mxcsr);

   /* Success.  */
   return 0;

"temp" is input not output.  This fixes BZ #33619.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-11 17:06:34 +08:00
Xie jiamei 1707b23382 Set Prefer_No_AVX512 flag for hygon platform
Benchmarks indicate evex can be more profitable on Hygon hardware
than AVX512. So add Prefer_No_AVX512 to make it run with evex.

Change-Id: Icc59492f71fde7a783a8bd315714ffd6f7ecaf29
Signed-off-by: Li jing <lijing@hygon.cn>
Signed-off-by: Xie jiamei <xiejiamei@hygon.cn>
2025-11-11 10:47:26 +08:00
Osama Abdelkader e52d9542cd math: Optimize frexpl (binary128) with fast path for normal numbers
Add fast path optimization for frexpl (128-bit IEEE quad precision) using
a single unsigned comparison to identify normal floating-point numbers and
return immediately via arithmetic on the exponent field.

The implementation uses arithmetic operations hx = hx - (ex << 48)
to adjust the exponent in place, which is simpler and more efficient than
bit masking. For subnormals, the traditional multiply-based normalization
is retained for reliability with the split 64-bit word format.

The zero/infinity/NaN check groups these special cases together for better
branch prediction.

This optimization provides the same algorithmic improvements as the other
frexp variants while maintaining correctness for all edge cases.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-10 08:58:19 -03:00
Osama Abdelkader e05476b5c8 math: Optimize frexp (binary64) with fast path for normal numbers
Add fast path optimization for frexp using a single unsigned comparison
to identify normal floating-point numbers and return immediately via
arithmetic on the bit representation.

The implementation uses asuint64()/asdouble() from math_config.h and arithmetic
operations to adjust the exponent, which generates better code than bit masking
on ARM and RISC-V architectures. For subnormals, stdc_leading_zeros provides
faster normalization than the traditional multiply approach.

The zero/infinity/NaN check is simplified to (int64_t)(ix << 1) <= 0, which
is more efficient than separate comparisons.

Benchmark results on Intel Core i9-13900H (13th Gen):
  Baseline:     6.778 ns/op
  Optimized:    4.007 ns/op
  Speedup:      1.69x (40.9% faster)
  Zero:         3.580 ns/op (fast path)
  Denormal:     6.096 ns/op (slower, rare case)

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-10 08:58:18 -03:00
Osama Abdelkader 4d2582150e math: Optimize frexpf (binary32) with fast path for normal numbers
Add fast path optimization for frexpf using a single unsigned comparison
to identify normal floating-point numbers and return immediately via
arithmetic on the bit representation.

The implementation uses asuint()/asfloat() from math_config.h and arithmetic
operations to adjust the exponent, which generates better code than bit masking
on ARM and RISC-V architectures. For subnormals, stdc_leading_zeros provides
faster normalization than the traditional multiply approach.

The zero/infinity/NaN check is simplified to (int32_t)(hx << 1) <= 0, which
is more efficient than separate comparisons.

Benchmark results on Intel Core i9-13900H (13th Gen):
  Baseline:     5.858 ns/op
  Optimized:    4.003 ns/op
  Speedup:      1.46x (31.7% faster)
  Zero:         3.580 ns/op (fast path)
  Denormal:     5.597 ns/op (slower, rare case)

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-10 08:58:18 -03:00
Osama Abdelkader ff041e8f8e benchtests: Add benchmarks for frexp functions
Add benchmark support for frexp, frexpf, and frexpl to measure the
performance improvement of the fast path optimization.

- Created frexp-inputs, frexpf-inputs, frexpl-inputs with random test values
- Added frexp, frexpf, frexpl to bench-math list
- Added CFLAGS to disable builtins for accurate benchmarking

These benchmarks will be used to quantify the performance gains from the
fast path optimization for normal floating-point numbers.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
2025-11-10 08:58:16 -03:00
Adhemerval Zanella b983c854e6 math: Sync acosh from CORE-MATH
The c9abdf80 fix handle some cases for RNDZ.

Checked on x86_64-linux-gnu.
2025-11-10 08:58:14 -03:00
Adhemerval Zanella 50000da305 Filter out internal abort during ld.so build
clang might generate an abort call when cleanup functions (set by
__attribute__ ((cleanup)) calls functions not marked as nothrow.

The hurd already provides abort for the loader at
sysdeps/mach/hurd/dl-sysdep.c, and adding it rtld-stubbed-symbols
triggers duplicate symbols.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-10 08:58:12 -03:00
Adhemerval Zanella e3394859ee x86: Fix THREAD_GSCOPE_RESET_FLAG build on clang
clang does not support __seg_fs in asm constraint.

Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
2025-11-10 08:58:10 -03:00
Adhemerval Zanella 427c25278d x86: Adapt "%v" usage on clang to emit VEX enconding
clang does not support the %v to select the AVX encoding, nor the '%d' asm
contrain, and for AVX build it requires all 3 arguments.

This patch add a new internal header, math-inline-asm.h, that adds
functions to abstract the inline asm required differences between
gcc and clang.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-10 08:58:06 -03:00
Adhemerval Zanella d25db12c2a x86: math: Use of __libgcc_cmp_return__ iff compiler supports it
clang does not support '__attribute__ ((mode (__libgcc_cmp_return__)))',
so use a more close related type instead fo the default 'int'.
2025-11-10 08:57:59 -03:00
Adhemerval Zanella bd6b49e11d string: Check if attribute can declared after function declaration
Some symbols that might be auto-generated by the compiler are redefined
to internal alias (for instance mempcpy to __mempcpy).  However, if fortify
is enabled, the fortify wrapper is define before the alias re-defined and
clang warns attribute declaration must precede definition.

Use an asm alias if compiler does not support it, instead of an
attribute.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-10 08:57:56 -03:00
Adhemerval Zanella 9044d61ff9 nss: Suppress clang -Wstring-plus-int on __nss_shlib_revision definition
clang issues an warning that adding 'unsigned long' to a string does not
append to the string.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-10 08:57:53 -03:00
Adhemerval Zanella ab1a96c978 stdlib: Remove mp_clz_tab.c
The count_leading_zeros is not used anymore, so there is no need to
provide the table for possible usage.  The hppa already provides
the compat symbol on libgcc-compat.c.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-10 08:57:52 -03:00
Samuel Thibault 494ba55d0b hurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614] 2025-11-09 11:43:35 +01:00
Samuel Thibault a701ecc9f6 Revert "hurd: Make rename refuse trailing slashes [BZ #32570]"
This reverts commit 2ae4ec56c2.

This introduced regressions, as rename should accept trailing slashes
for directories: BZ #33607, BZ #33608

This was rather fixed on the server side:
https://cgit.git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=e34000cb395a135dd2ad5c13e6f6d4c5c1006389
2025-11-09 00:06:38 +01:00
Samuel Thibault 23db68ed9d Add missing $(rpath-link) to elf/ld.so --library-path
This is notably needed for GNU/Hurd's libmachuser.so and libhurduser.so.
2025-11-08 21:47:25 +01:00
Samuel Thibault 4b5eeec17b Add missing $(rpath-link) to /elf/ld.so --library-path
This is notably needed for GNU/Hurd's libmachuser.so and libhurduser.so.
2025-11-08 17:44:48 +01:00
Carlos O'DonellandPatsy Griffin ea8e2b96d8 nss: Add ERANGE testing to tst-nss-test4 (bug 33361)
This adds testing for the fix added in commit:
0fceed2545
"nss: Group merge does not react to ERANGE during merge (bug 33361)"

The in-use group size is increased large enough to trigger ERANGE
for initial buffers and cause a retry.  The actualy size is
approximately twice that required to trigger the defect, though
any size larger than NSS_BUFLEN_GROUP triggers the defect.

Without the fix the group is not merged and the failure is detected,
but with the fix the ERANGE error is handled, buffers are enlarged
and subsequently correctly merged.

Tested with a/b testing before and after patching.
Tested on x86_64 with no regression.

Co-authored-by: Patsy Griffin <patsy@redhat.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-11-08 09:28:11 -05:00
Florian Weimer 259adb087d aarch64: Remove $(aarch64-bti) check
The variable was removed in commit 2c421fc430
("AArch64: Cleanup PAC and BTI"), so this Makefile fragment is
always excluded.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2025-11-07 14:12:01 +01:00
Yury Khrustalev 58a31b4316 posix: Fix invalid flags test for p{write,read}v2
Two tests fail from time to time when a new flag is added for the
p{write,read}v2 functions in a new Linux kernel:

 - misc/tst-preadvwritev2
 - misc/tst-preadvwritev64v2

This disrupts when testing Glibc on a system with a newer kernel
and it seems we can try improve testing for invalid flags setting
all the bits that are not supposed to be supported (rather than
setting only the next unsupported bit).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-07 08:57:09 +00:00
Florian Weimer b64335ff11 support: Exit on consistency check failure in resolv_response_add_name
Using TEST_VERIFY (crname_target != crname) instructs some analysis
tools that crname_target == crname might hold.  Under this assumption,
they report a use-after-free for crname_target->offset below, caused
by the previous free (crname).

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-07 08:50:44 +01:00
Joe Ramsay e45af510bc AArch64: Fix instability in AdvSIMD sinh
Previously presence of special-cases in one lane could affect the
results in other lanes due to unconditional scalar fallback. The old
WANT_SIMD_EXCEPT option (which has never been enabled in libmvec) has
been removed from AOR, making it easier to spot and fix
this. No measured change in performance. This patch applies cleanly as
far back as 2.41, however there are conflicts with 2.40 where sinh was
first introduced.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-06 18:30:47 +00:00
Joe Ramsay 6c22823da5 AArch64: Fix instability in AdvSIMD tan
Previously presence of special-cases in one lane could affect the
results in other lanes due to unconditional scalar fallback. The old
WANT_SIMD_EXCEPT option (which has never been enabled in libmvec) has
been removed from AOR, making it easier to spot and fix this. 4%
improvement in throughput with GCC 14 on Neoverse V1. This bug is
present as far back as 2.39 (where tan was first introduced).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-06 18:30:47 +00:00
Joe Ramsay 5b82fb1882 AArch64: Optimise SVE scalar callbacks
Instead of using SVE instructions to marshall special results into the
correct lane, just write the entire vector (and the predicate) to
memory, then use cheaper scalar operations.

Geomean speedup of 16% in special intervals on Neoverse with GCC 14.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-06 15:45:37 +00:00
Florian Weimer 20a2a75608 support: Fix FILE * leak in check_for_unshare_hints in test-container
The file opened via fopen is never closed.
2025-11-06 16:27:51 +01:00
H.J. Lu 975c8c4e22 i386: Simplify powl computation for small integral y [BZ #33586]
On i386, tests added by

commit 1b657c53c2
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Fri Oct 10 20:21:13 2025 -0400

    Simplify powl computation for small integral y [BZ #33411]

exposed the same bug in i386 e_powl.S:

FAIL: math/test-float64x-pow
original exit status 1
testing _Float64x (without inline functions)
Failure: pow (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_downward (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_towardzero (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_upward (0x1p+8192, 0x1p+0): Exception "Overflow" set

FAIL: math/test-ldouble-pow
original exit status 1
testing long double (without inline functions)
Failure: pow (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_downward (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_towardzero (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_upward (0x1p+8192, 0x1p+0): Exception "Overflow" set

Port x86-64 e_powl.S fix to i386 e_powl.S.  This fixes BZ #33586.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2025-11-06 07:04:17 +08:00
Adhemerval Zanella 3078358ac6 math: Remove the SVID error handling from tgammaf
It improves latency for about 1.5% and throughput for about 2-4%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-05 10:19:37 -03:00
Adhemerval Zanella de0e623434 math: Remove the SVID error handling from lgammaf/lgammaf_r
It improves latency throughput for about 2%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-05 09:27:07 -03:00
Adhemerval Zanella c0be0b4527 Add FD_PIDFS_ROOT from Linux 6.17 to bits/fcntl-linux.h
It was added by commit 3941e37f62fe2c3c8b8675c12183185f20450539

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 1e750f62c4 Add AT_EXECVE_CHECK from Linux 6.14 to bits/fcntl-linux.h
It was added by commit a5874fde3c0884a33ed4145101052318c5e17c74

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 04e6bdb437 Add AT_HANDLE_CONNECTABLE from Linux 6.13 to bits/fcntl-linux.h
It was added by commit c374196b2b9f4b803fccd59ed82f0712041e21e1.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-05 07:15:52 -03:00
Adhemerval Zanella f8a6b02223 linux: Update statx-generic.h with linux 6.16
It adds the new fields on generic statx struct from Linux commit
5d894321c49e61379189b0ff605f316e39cbd1e9.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-05 07:15:52 -03:00
Adhemerval Zanella cf73362a7e linux: Update statx-generic.h with linux 6.14
It adds the new constant STATX_DIO_READ_ALIGN and related fields in
generic statx struct from Linux commit
7ed6cbe0f8caa6ee38a2dc8f1b925acb904cc01f.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 5a2ace34fc linux: Add STATX_WRITE_ATOMIC/STATX_ATTR_WRITE_ATOMIC definitions to generic statx
The commit fc650bfd71 added
STATX_WRITE_ATOMIC/STATX_ATTR_WRITE_ATOMIC on the statx-generic.h
without updating the generic statx struct.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 4540cc2237 linux: Add STATX_SUBVOL definition to generic statx
The commit bbb6a742c8 added
STATX_SUBVOL on the statx-generic.h without updating the
generic statx struct.
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 2ae6152144 linux: Add STATX_DOALIGN definition to generic statx
The commit 07937809ac added
STATX_MNT_ID_UNIQUE on the statx-generic.h without updating the
generic statx struct.
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 0d0726e4eb linux: Add STATX_MNT_ID_UNIQUE definition to generic statx
The commit 88a2cf6c4b added
STATX_MNT_ID_UNIQUE on the statx-generic.h without updating the
generic statx struct.
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 03d9cb23b8 Update syscall lists for Linux 6.17
Linux 6.16 adds no new syscalls, while Linux 6.17 adds file_getattr
and file_setattr (commit be7efb2d20d67f334a7de2aef77ae6c69367e646).
Update syscall-names.list and regenerate the arch-syscall.h headers
with build-many-glibcs.py update-syscalls.
2025-11-05 07:15:52 -03:00
Adhemerval Zanella c0c9524a11 Update PIDFD_* constants for Linux 6.17
The pidfd interface was extended with:

  * PIDFD_GET_INFO and pidfd_info (along with related extra flags) to
    allow get information about the process without the need to parse
    /proc (commit cdda1f26e74ba, Linux 6.13).

  * PIDFD_SELF_{THREAD,THREAD_GROUP,SELF,SELF_PROCESS} to allow
    pidfd_send_signal refer to the own process or thread lead groups
    without the need of allocating a file descriptor (commit f08d0c3a71114,
    Linux 6.15).

  * PIDFD_INFO_COREDUMP that extends PIDFD_GET_INFO to obtain coredump
    information.

Linux uAPI header defines both PIDFD_SELF_THREAD and
PIDFD_SELF_THREAD_GROUP on linux/fcntl.h (since they reserve part of the
AT_* values), however for glibc I do not see any good reason to add pidfd
definitions on fcntl-linux.h.

The tst-pidfd.c is extended with some PIDFD_SELF_* tests and a new
‘tst-pidfd_getinfo.c’ test is added to check PIDFD_GET_INFO. The
PIDFD_INFO_COREDUMP tests would require very large and complex tests
that are already covered by kernel tests.

Checked on aarch64-linux-gnu and x86_64-linux-gnu on kernels 6.8 and
6.17.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-05 07:15:52 -03:00
Adhemerval Zanella bd7be9f447 Update kernel version to 6.17 in header constant tests
There are no new constants covered by tst-mman-consts.py,
tst-mount-consts.py or tst-sched-consts.py in Linux 6.17.
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 7ec8eb5676 math: Remove the SVID error handling from atan2f
It improves latency for about 3-6% and throughput for about 5-12%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-05 07:15:52 -03:00
Collin Funk a5cc3018f3 Add feature test macros for POSIX.1-2024.
* include/features.h (_POSIX_C_SOURCE): Document the value of 202405L
for POSIX.1-2024.  Set it to 202405L when _GNU_SOURCE or _DEFAULT_SOURCE
is defined.
(_XOPEN_SOURCE): Document the value of 800 for POSIX-1.2024.  Set it to
800 when _GNU_SOURCE is defined.
(__USE_XOPEN2K24, __USE_XOPEN2K24XSI): New internal macros.  Set them
when _POSIX_C_SOURCE is 202405L or greater and/or when _XOPEN_SOURCE is
800 or greater.
* manual/creature.texi (Feature Test Macros): Document the new values
for _POSIX_C_SOURCE and _XOPEN_SOURCE.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2025-11-04 18:00:57 -08:00
Joseph Myers 26e4810210 Rename fromfp files in preparation for changing types for C23
As discussed in bug 28327, the fromfp functions changed type in C23
(compared to the version in TS 18661-1); they now return the same type
as the floating-point argument, instead of intmax_t / uintmax_t.

As with other such incompatible changes compared to the initial TS
18661 versions of interfaces (the types of totalorder functions, in
particular), it seems appropriate to support only the new version as
an API, not the old one (although many programs written for the old
API might in fact work wtih the new one as well).  Thus, the existing
implementations should become compat symbols.  They are sufficiently
different from how I'd expect to implement the new version that using
separate implementations in separate files is more convenient than
trying to share code, and directly sharing testcases would be
problematic as well.

Rename the existing fromfp implementation and test files to names
reflecting how they're intended to become compat symbols, so freeing
up the existing filenames for a subsequent implementation of the C23
versions of these functions (which is the point at which the existing
implementations would actually become compat symbols).

gen-fromfp-tests.py and gen-fromfp-tests-inputs are not renamed; I
think it will make sense to adapt the test generator to be able to
generate most tests for both versions of the functions (with extra
test inputs added that are only of interest with the C23 version).
The ldbl-opt/nldbl-* files are also not renamed; since those are for a
static only library, no compat versions are needed, and they'll just
have their contents changed when the C23 version is implemented.

Tested for x86_64, and with build-many-glibcs.py.
2025-11-04 23:41:35 +00:00
Joseph Myers 26d11a0944 Add C23 long_double_t, _FloatN_t
C23 Annex H adds <math.h> typedefs long_double_t and _FloatN_t
(originally introduced in TS 18661-3), analogous to float_t and
double_t.  Add these typedefs to glibc.  (There are no _FloatNx_t
typedefs.)

C23 also slightly changes the rules for how such typedef names should
be defined, compared to the definition in TS 18661-3.  In both cases,
<TYPE>_t corresponds to the evaluation format for <TYPE>, as specified
by FLT_EVAL_METHOD (for which <math.h> uses glibc's internal
__GLIBC_FLT_EVAL_METHOD).  Specifically, each FLT_EVAL_METHOD value
corresponds to some type U (for example, 64 corresponds to U =
_Float64), and for types with exactly the same set of values as U, TS
18661-3 says expressions with those types are to be evaluated to the
range and precision of type U (so <TYPE>_t is defined to U), whereas
C23 only does that for types whose values are a strict subset of those
of type U (so <TYPE>_t is defined to <TYPE>).

As with other cases where semantics changed between TS 18661 and C23,
this patch only implements the newer version of the semantics
(including adjusting existing definitions of float_t and double_t as
needed).  The new semantics are contradictory between the main
standard and Annex H for the case of FLT_EVAL_METHOD == 2 and the
choice of double_t when double and long double have the same values
(the main standard says it's defined as long double in that case,
whereas Annex H would define it as double), which I've raised on the
WG14 reflector (but I think setting FLT_EVAL_METHOD == 2 when double
and long double have the same values is a fairly theoretical
combination of features); for now glibc follows the value in the main
standard in that case.

Note that I think all existing GCC targets supported by glibc only use
values -1, 0, 1, 2 or 16 for FLT_EVAL_METHOD (so most of the header
code is somewhat theoretical, though potentially relevant with other
compilers since the choice of FLT_EVAL_METHOD is only an API choice,
not an ABI one; it can vary with compiler options, and these typedefs
should not be used in ABIs).  The testcase (expanded to cover the new
typedefs) is really just repeating the same logic in a second place
(so all it really tests is that __GLIBC_FLT_EVAL_METHOD is consistent
with FLT_EVAL_METHOD).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2025-11-04 17:12:00 +00:00
Peter Bergner 47975914fb riscv: Add vector registers to __SYSCALL_CLOBBERS
The Linux kernel ABI specifies that the vector registers are not preserved
across system calls, but the __SYSCALL_CLOBBERS macro doesn't mention them.
This could possibly lead to compilers trying to keep data in the vector
registers across the syscall leading to corruption.  Add the vector registers
to __SYSCALL_CLOBBERS when the vector extension is enabled.  If the vector
extension is enabled, then require GCC 15 or later and RVV 1.0 or later.

Fixes: 36960f0c76 ("RISC-V: Linux Syscall Interface")

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
2025-11-04 09:18:56 -06:00
Collin Funk 376e336d92 Regenerate charmap-kw.h and locfile-kw.h with gperf 3.3
In commit 970364dac0 we switched some
/*FALLTHROUGH*/ comments to [[fallthrough]] to avoid warnings with
Clang. However, since gperf emitted different output the buildbot
failed. The buildbot has been updated to use gperf 3.3 which will use
__attribute__ ((__fallthrough__)) where needed to avoid warnings [1].
This patch regenerates these files with the same version.

[1] https://sourceware.org/pipermail/libc-testresults/2025q4/014123.html

Reviewed-by: Mark Wielaard <mark@klomp.org>
2025-11-04 06:15:54 -08:00
Adhemerval Zanella 0dfc849eff math: Remove the SVID error handling wrapper from sqrt
i386 and m68k architectures should use math-use-builtins-sqrt.h rather
than relying on architecture-specific or inline assembly implementations.

The PowerPC optimization for PPC 601/603 (30 years old) is removed.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella f27a146409 math: Remove the SVID error handling from sinhf
It improves latency for about 3-10% and throughput for about 5-15%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 0e1a1178ee math: Remove the SVID error handling from remainder
The optimized i386 version is faster than the generic one, and
gcc implements it through the builtin. This optimization enables
us to migrate the implementation to a C version.  The performance
on a Zen3 chip is similar to the SVID one.

The m68k provided an optimized version through __m81_u(remainderf)
(mathimpl.h), and gcc does not implement it through a builtin
(different than i386).

Performance improves a bit on x86_64 (Zen3, gcc 15.2.1):

reciprocal-throughput           input    master   NO-SVID  improvement
x86_64                     subnormals   18.8522   16.2506       13.80%
x86_64                         normal  421.8260  403.9270        4.24%
x86_64                 close-exponent   21.0579   18.7642       10.89%
i686                       subnormals   21.3443   21.4229       -0.37%
i686                           normal  525.8380   538.807       -2.47%
i686                   close-exponent   21.6589   21.7983       -0.64%

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella c4c6c79d70 math: Remove the SVID error handling from remainderf
The optimized i386 version is faster than the generic one, and gcc
implements it through the builtin.  This optimization enables us to
migrate the implementation to a C version.  The performance on a Zen3
chip is similar to the SVID one.

The m68k provided an optimized version through __m81_u(remainderf)
(mathimpl.h), and gcc does not implement it through a builtin (different
than i386).

Performance improves a bit on x86_64 (Zen3, gcc 15.2.1):

reciprocal-throughput          input   master  NO-SVID  improvement
x86_64                    subnormals  17.5349  15.6125       10.96%
x86_64                        normal  53.8134  52.5754        2.30%
x86_64                close-exponent  20.0211  18.6656        6.77%
i686                      subnormals  21.8105  20.1856        7.45%
i686                          normal  73.1945  71.2199        2.70%
i686                  close-exponent  22.2141   20.331        8.48%

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Wilco DijkstraandAdhemerval Zanella 324c088a18 nptl: Remove ATOMIC_EXCHANGE_USES_CAS usage
The only usage was for pthread_spin_lock, introduced by 12d2dd7060,
as a way to optimize the code for certain architectures. Now that atomic
builtins are used by default, let the compiler use the best code sequence
for the atomic exchange.

Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Wilco DijkstraandAdhemerval Zanella 53807741fb Define __HAVE_64B_ATOMICS from compiler support
Now that atomic builtins are used by default, we can rely on the
compiler to define when to use 64-bit atomic operations.

It allows the use of 64-bit atomic operations on some 32-bit ABIs where
they were not previously enabled due to missing pre-processor handling:
hppa, mips64n32, s390, and sparcv9.

Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval ZanellaandWilco Dijkstra 95a0ad1ea1 atomic: Consolidate atomic_write_barrier implementation
All ABIs, except alpha and sparc, define it to
atomic_full_barrier/__sync_synchronize, which can be mapped to
__atomic_thread_fence (__ATOMIC_RELEASE).

For alpha, it uses a 'wmb' which does not map to any of C11
barriers.

For sparc it uses a stronger 'member #LoadStore | #StoreStore',
where the release barrier maps to just 'membar #StoreLoad'.  The
patch keeps the sparc definition.

For PowerPC, it allows the use of lwsync for additional chips
(since _ARCH_PWR4 does not cover all chips that support it).

Tested on aarch64-linux-gnu.

Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval ZanellaandWilco Dijkstra 304b22d7f9 atomic: Consolidate atomic_read_barrier implementation
All ABIs, except alpha, powerpc, and x86_64, define it to
atomic_full_barrier/__sync_synchronize, which can be mapped to
__atomic_thread_fence (__ATOMIC_SEQ_CST) in most cases, with the
exception of aarch64 (where the acquire fence is generated as
'dmb ishld' instead of 'dmb ish').

For s390x, it defaults to a memory barrier where __sync_synchronize
emits a 'bcr 15,0' (which the manual describes as pipeline
synchronization).

For PowerPC, it allows the use of lwsync for additional chips
(since _ARCH_PWR4 does not cover all chips that support it).

Tested on aarch64-linux-gnu, where the acquire produces a different
instruction that the current code.

Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval ZanellaandWilco Dijkstra 70ee250fb8 atomic: Consolidate atomic_full_barrier implementation
All ABIs save for sparcv9 and s390 defines it to __sync_synchronize,
which can be mapped to __atomic_thread_fence (__ATOMIC_SEQ_CST).

For Sparc, it uses a stricter #StoreStore|#LoadStore|#StoreLoad|#LoadLoad
instead of the #StoreLoad generated by __sync_synchronize.

For s390x, it defaults to a memory barrier where __sync_synchronize
emits a 'bcr 15,0' (which the manual describes as pipeline synchronization).

The barrier is used only in one place (pthread_mutex_setprioceiling),
and using a stricter barrier for s390 is ok performance-wise.

Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella c797303237 microblaze: Remove USE_ATOMIC_COMPILER_BUILTINS definition
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella f6dedc65fd alpha: Remove USE_ATOMIC_COMPILER_BUILTINS definition
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 7e5fe1974c sh: Move atomic-machine to generic sysdep
There is no Linux specific definitions.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 1f5d8663ea riscv: Consolidade atomic-machine.h and remove ununsed atomic macros
The resulting definitions are not Linux specific, so move the header
to generic sysdep folder.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella d76e20791b powerpc: Consolidate atomic-machine.h
The __HAVE_64B_ATOMICS can be define based on __WORDSIZE, and
the __ARCH_ACQ_INSTR, MUTEX_HINT_*, and barriers definition are
defined by the target cpu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 9201eabed8 loongarch: Consolidate atomic-machine.h and remove ununsed atomic macros
These are already provided by the generic include/atomic.h and
the resulting macros are not Linux specific.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 3642bf4800 m68k: Consolidade atomic-machine.h and Remove ununsed atomic macros
Both m68k and m68k-colfire do not support 64 bit atomis.  The
atomic_barrier syscall on m68k is a no-op, so it can use the compiler
builtin.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 6322a325fc hppa: Move atomic-machine to generic sysdep
There is no Linux specific definitions.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 5a7a9a57c2 arm: Consolidate atomic-machine.h and Remove ununsed atomic macros
The libgcc provides the required support to calling the kernel
auxiliary routines for !__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella fd27081d8e x86: Remove ununsed atomic macros
These are already provided by the generic include/atomic.h.

Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella ebfd1b9e4d sparc: Remove ununsed atomic macros
These are already provided by the generic include/atomic.h.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 08c345104f s390: Remove ununsed atomic macros
These are already provided by the generic include/atomic.h.  Also
remove outdated comment from unsupported gcc versions.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella c0fc170c78 or1k: Remove ununsed atomic macros
These are already provided by the generic include/atomic.h.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella c787f0ec3e mips: Remove ununsed atomic macros
These are already provided by the generic include/atomic.h.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella ba69286641 csky: Remove ununsed atomic macros
These are already provided by the generic include/atomic.h.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella eeeb882c97 arc: Remove ununsed atomic macros
These are already provided by the generic include/atomic.h.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella b299332fb4 aarch64: Remove ununsed atomic macros
These are already provided by the generic include/atomic.h.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
H.J. Lu b93632ede7 Build programs in $(others-noinstall) like tests if libgcc_s is available
Build programs in $(others-noinstall) like tests only if libgcc_s is
available.  Otherwise, "build-many-glibcs.py compilers" will fail to
build the initial glibc with the initial limited gcc due to the missing
libgcc_s.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-04 14:48:18 +08:00
Joseph Myers fa7f43a982 Support assert as a variadic macro for C23
C23 makes assert into a variadic macro to handle cases of an argument
that would be interpreted as a single function argument but more than
one macro argument (in particular, compound literals with an
unparenthesized comma in an initializer list); this change was made by
N2829.  Note that this only applies to assert, not to other macros
specified in the C standard with particular numbers of arguments.

Implement this support in glibc.  This change is only for C; C++ would
need a separate change to its separate assert implementations.  It's
also applied only in C23 mode.  It depends on support for (C99)
variadic macros, and also (in order to detect calls where more than
one expression is passed, via an unevaluated function call) a C99
boolean type.  These requirements are encapsulated in the definition
of __ASSERT_VARIADIC.  Tests with -std=c99 and -std=gnu99 (using
implementations continue to work.

I don't think we have a way in the glibc testsuite to validate that
passing more than one expression as an argument does produce the
desired error.

Tested for x86_64.
2025-11-03 19:56:42 +00:00
Frédéric Bérat d4d472366b docs: Add dynamic linker environment variable docs
The Dynamic Linker chapter now includes a new section detailing
environment variables that influence its behavior.

This new section documents the `LD_DEBUG` environment variable,
explaining how to enable debugging output and listing its various
keywords like `libs`, `reloc`, `files`, `symbols`, `bindings`,
`versions`, `scopes`, `tls`, `all`, `statistics`, `unused`, and `help`.

It also documents `LD_DEBUG_OUTPUT`, which controls where the debug
output is written, allowing redirection to a file with the process ID
appended.

This provides users with essential information for controlling and
debugging the dynamic linker.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-11-03 10:47:56 +01:00
Frédéric Bérat 332f8e62af tls: Add debug logging for TLS and TCB management
Introduce the `DL_DEBUG_TLS` debug mask to enable detailed logging for
Thread-Local Storage (TLS) and Thread Control Block (TCB) management.

This change integrates a new `tls` option into the `LD_DEBUG`
environment variable, allowing developers to trace:
- TCB allocation, deallocation, and reuse events in `dl-tls.c`,
  `nptl/allocatestack.c`, and `nptl/nptl-stack.c`.
- Thread startup events, including the TID and TCB address, in
  `nptl/pthread_create.c`.

A new test, `tst-dl-debug-tid`, has been added to validate the
functionality of this new debug logging, ensuring that relevant messages
are correctly generated for both main and worker threads.

This enhances the debugging capabilities for diagnosing issues related
to TLS allocation and thread lifecycle within the dynamic linker.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-11-03 10:47:28 +01:00
Pincheng Wang 720e891637 riscv: Add Zbkb optimized repeat_bytes helper
Introduce a RISC-V specific string-misc.h to provide an optimized
repeat_bytes implementation when the Zbkb extension is available.
The new version uses packh/packw/pack instruction count and avoiding
high latency instructions. This helper is used by several mem and string
functions, and falls back to the generic implementation when Zbkb is not
present.

Signed-off-by: Pincheng Wang <pincheng.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2025-10-31 16:23:57 -05:00
Wilco Dijkstra 1136c036a3 math: Remove xfail from pow test [BZ #33563]
Remove xfail from pow testcase since pow and powf have been fixed.
Also check float128 maximum value.  See BZ #33563.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-31 19:13:53 +00:00
Wilco Dijkstra 0212fc23b0 math: Fix pow special case [BZ #33563]
Fix pow (DBL_MAX, 1.0) to return DBL_MAX when rouding upwards without FMA.
This fixes BZ #33563.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-31 19:13:41 +00:00
Wilco Dijkstra 8917bd3eb3 math: Fix powf special case [BZ #33563]
Fix powf (0x1.fffffep+127, 1.0f) to return 0x1.fffffep+127 when
rouding upwards.  Cleanup the special case code - performance
improves by ~1.2%.  This fixes BZ #33563.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-31 19:12:47 +00:00
Yury Khrustalev 7d99ff550f debug: mark __libc_message_wrapper as always inline
When building with -Og to enable debugging, there is currently a compiler error
because if __libc_message_wrapper() is not inline, the __va_arg_pack_len macro
cannot be used.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-31 10:01:33 +00:00
Yury Khrustalev 2f77aec043 aarch64: fix cfi directives around __libc_arm_za_disable
Incorrect CFI directive corrupted call stack information
and prevented debuggers from correctly displaying call
stack information.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-31 09:48:47 +00:00
Eric Wong 3ac0112b5d cdefs: allow __attribute__ on tcc
According to the tcc (tiny C compiler) Changelog, tcc supports
__attribute__ since 0.9.3.  Looking at history of tcc at
<https://repo.or.cz/tinycc.git>, __attribute__ support was added
in commit 14658993425878be300aae2e879560698e0c6c4c on 2002-01-03,
which also looks like the release of 0.9.3.  While I'm unable to
find release tags for tcc before 0.9.18 (2003-04-14), the next
release (0.9.28) will include __attribute__((cleanup(func)) which
I rely on.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-30 20:03:00 -07:00
Collin Funk 3fe3f62833 Cleanup some recently added whitespace.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-30 18:56:58 -07:00
Yao Zihong 09a94c86ca riscv: memcpy_noalignment: Reorder to store via a3, then bump a3
Rewrite the copy micro-step from:

    REG_L  a4, 0(a5)
    addi   a3, a3, SZREG
    addi   a5, a5, SZREG
    REG_S  a4, -SZREG(a3)

to:

    REG_L  a4, 0(a5)
    addi   a5, a5, SZREG
    REG_S  a4, 0(a3)
    addi   a3, a3, SZREG

Semantics are unchanged: both read *(a5_old), write *(a3_old), and then
increment a3/a5 by SZREG. memcpy assumes non-overlapping regions, so the
reordering preserves correctness.

No functional change.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2025-10-30 17:49:21 -05:00
Yao Zihong 0698fd462a riscv: memcpy_noalignment: Fold SZREG/BLOCK_SIZE alignment to single andi
Simplify the alignment steps for SZREG and BLOCK_SIZE multiples. The previous
three-instruction sequences

    addi    a7, a2, -SZREG
    andi    a7, a7, -SZREG
    addi    a7, a7, SZREG

and

    addi    a7, a2, -BLOCK_SIZE
    andi    a7, a7, -BLOCK_SIZE
    addi    a7, a7, BLOCK_SIZE

are equivalent to a single

    andi    a7, a2, -SZREG
    andi    a7, a2, -BLOCK_SIZE

because SZREG and BLOCK_SIZE are powers of two in this context, making the
surrounding addi steps cancel out. Folding to one instruction reduces code
size with identical semantics.

No functional change.

sysdeps/riscv/multiarch/memcpy_noalignment.S: Remove redundant addi around
alignment; keep a single andi for SZREG/BLOCK_SIZE rounding.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2025-10-30 17:47:24 -05:00
Yao Zihong 444d81284e riscv: memcpy_noalignment: Make register allocation Zca-friendly
Tidy the temporary register allocation to favor registers eligible for
compressed encodings when Zca/Zcb are enabled. This keeps the ABI and
clobber set unchanged and does not alter control flow or memory access
behavior.

No functional change.

sysdeps/riscv/multiarch/memcpy_noalignment.S: Reassign temps to improve
compressed encoding opportunities.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2025-10-30 17:44:58 -05:00
Adhemerval Zanella ee946212fe math: Remove the SVID error handling wrapper from yn/jn
Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:35 -03:00
Adhemerval Zanella 8d4815e6d7 math: Remove the SVID error handling wrapper from y1/j1
Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:33 -03:00
Adhemerval Zanella b050cb53b0 math: Remove the SVID error handling wrapper from y0/j0
Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:31 -03:00
Adhemerval Zanella 03eeeba705 math: Remove the SVID error handling from coshf
It improves latency for about 3-10% and throughput for about 5-15%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:28 -03:00
Adhemerval Zanella 555c39c0fc math: Remove the SVID error handling from atanhf
It improves latency for about 1-10% and throughput for about 5-10%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:26 -03:00
Adhemerval Zanella 8facb464b4 math: Remove the SVID error handling from acoshf
It improves latency for about 3-7% and throughput for about 5-10%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:24 -03:00
Adhemerval Zanella f92aba68bc math: Remove the SVID error handling from asinf
It improves latency for about 2% and throughput for about 5%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:22 -03:00
Adhemerval Zanella 9f8dea5b5d math: Remove the SVID error handling from acosf
It improves latency for about 2-10% and throughput for about 5-10%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:20 -03:00
Adhemerval Zanella 0b484d7b77 math: Remove the SVID error handling from log10f
It improves latency for about 3-10% and throughput for about 5-10%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:17 -03:00
Adhemerval Zanella 6deadd4eb6 m68k: Remove SVID error handling on fmod
The m68k provided an optimized version through __m81_u(fmod)
(mathimpl.h), and gcc does not implement it through a builtin
(different than i386).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:15 -03:00
Adhemerval Zanella b19904cfb2 m68k: Avoid include e_fmod.c on fmod/remainder implementation
And open-code each implementation.  It simplifies SVID error handling
removal.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:12 -03:00
Adhemerval Zanella ade9f30ce2 m68k: Remove the SVID error handling from fmodf
The m68k provided an optimized version through __m81_u(fmodf)
(mathimpl.h), and gcc does not implement it through a builtin
(different than i386).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:10 -03:00
Adhemerval Zanella 1dd2163e51 i386: Remove the SVID error handling from fmodf
The optimized i386 version is faster than the generic one, and gcc
implements it through the builtin. It allows us to move the
implementation to a C one.

The performance on a Zen3 chip is slight better:

reciprocal-throughput           input   master  no-SVID  improvement
i686                       subnormals  22.4741  20.1571       10.31%
i686                           normal  74.1631  70.3606        5.13%
i686                   close-exponent  22.5625  20.2435       10.28%

Tested on i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:07 -03:00
Adhemerval Zanella bfee89dc8a i386: Remove the SVID error handling from fmod
The optimized i386 version is faster than the generic one, and gcc
implements it through the builtin. It allows us to move the
implementation to a C one. The performance on a Zen3 chip is
similar to the SVID one.

Tested on i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:40:41 -03:00
Jiamei Xie 4d86b6cdd8 x86: fix wmemset ifunc stray '!' (bug 33542)
The ifunc selector for wmemset had a stray '!' in the
X86_ISA_CPU_FEATURES_ARCH_P(...) check:

  if (X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, AVX2)
      && X86_ISA_CPU_FEATURES_ARCH_P (cpu_features,
                                      AVX_Fast_Unaligned_Load, !))

This effectively negated the predicate and caused the AVX2/AVX512
paths to be skipped, making the dispatcher fall back to the SSE2
implementation even on CPUs where AVX2/AVX512 are available. The
regression leads to noticeable throughput loss for wmemset.

Remove the stray '!' so the AVX_Fast_Unaligned_Load capability is
tested as intended and the correct AVX2/EVEX variants are selected.

Impact:
- On AVX2/AVX512-capable x86_64, wmemset no longer incorrectly
  falls back to SSE2; perf now shows __wmemset_evex/avx2 variants.

Testing:
- benchtests/bench-wmemset shows improved bandwidth across sizes.
- perf confirm the selected symbol is no longer SSE2.

Signed-off-by: xiejiamei <xiejiamei@hygon.com>
Signed-off-by: Li jing <lijing@hygon.cn>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-29 12:54:14 -03:00
Jiayuan Chen 1177d2f26c Updates struct tcp_zerocopy_receive from 5.11 to netinet/tcp.h.
This patch updates struct tcp_zerocopy_receive to contain filed including
copybuf_address, copybuf_len, and others.

Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-29 12:54:12 -03:00
Adhemerval Zanella 8711c29bb7 aarch64: Fix tst-ifunc-arg-4 on clang-18
It issues:

../sysdeps/aarch64/tst-ifunc-arg-4.c:39:1: error: unused function 'resolver' [-Werror,-Wunused-function]
   39 | resolver (uint64_t arg0, const uint64_t arg1[])
      | ^~~~~~~~
1 error generated.

clang-19 and onwards do not trigger the warning.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-29 12:54:10 -03:00
Adhemerval Zanella d49d917b90 Enable --no-undefined-version by default
Recent lld version default to --no-undefined-version, which triggers
errors when building multiple libraries.  For ld.so on x86_64  it fails
with:

ld.lld: error: version script assignment of 'GLIBC_2.4' to symbol '__stack_chk_guard' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '__nptl_set_robust_list_avail' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '__pointer_chk_guard' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '_dl_starting_up' failed: symbol not defined

While for libc.so:

ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_clearerr' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fgetc' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fileno' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_freopen' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fscanf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fseek' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_peekc_unlocked' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stderr_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stdin_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stdout_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_pclose' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_perror' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_rewind' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_scanf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_setlinebuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_wdefault_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_wfile_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '__ctype32_tolower' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '__ctype32_toupper' failed: symbol not defined
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)

The version script is created with multiple missing symbols to simplify
the build for multiple ABIs, each of which may have different symbols.
For instance, __stack_chk_guard is defined by default. This avoids
requiring each ABI to add this symbol to its version script, depending
on the stack protector ABI it uses.

The libc.so warnings do show unused symbols being defined (like
_IO_clearerr), which might trigger potential errors depending on how
symbols are exported.  However, since we already have ABI checks for
missing and extra symbols, the linker's extra checks are not really
necessary.

The --no-undefined-version is the default for ld.bfd.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-29 12:54:06 -03:00
Adhemerval Zanella 1ab6a62e68 Supress unused command arguments warning with clang
clang 20 issues an warning for the unused '-c' argument used to create
errlist-data-aux-shared.S, errlist-data-aux.S, siglist-aux-shared.S,
and siglist-aux.S.  Filter out the '-c' from the $(compile-command.c).

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-29 12:54:03 -03:00
Adhemerval Zanella 970364dac0 Annotate swtich fall-through
The clang default to warning for missing fall-through and it does
not support all comment-like annotation that gcc does.  Use C23
[[fallthrough]] annotation instead.
proper attribute instead.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-29 12:54:01 -03:00
Adhemerval Zanella 543ddd628f argp: Move attribute_hidden to argp-fmtstream.h
The internal header redefines the some internal argp functions with
attribute_hidden, which triggers clang warning of mismatched attributes.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-29 12:54:00 -03:00
Adhemerval Zanella 110ec4954e argp: Expand argp_usage, _option_is_short, and _option_is_end
The argp code uses macro redefinitions to avoid duplicating static inline
implementations for argp_usage, _option_is_short, and _option_is_end.
However, this causes build issues with clang, as some function prototypes
are redefined to add the hidden attribute with libc_hidden_proto.

To avoid extensive changes to internal headers, just expand the function
implementations and avoid the macro redefine tricks.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-29 12:53:57 -03:00
Adhemerval Zanella 36b4c553e6 Replace count_leading_zeros with stdc_leading_zeros
Checked on x86_64-linux-gnu and aarch64-linux-gnu.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-29 12:53:55 -03:00
Adhemerval Zanella f91abbde02 malloc: Remove unused tcache_set_inactive
clang warns that this function is not used.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-29 12:53:53 -03:00
Adhemerval Zanella 602fdf5d69 include: Sync gnulib intprops
It syncs with gnulib commit 1790ef25d81983d1d25a77d452c0080345df459b.

The main change is to proper support clang by using builtins.  It
fixes a sprof build issue, where previous version uses the generic
code path when building with clang:

sprof.c:682:8: error: result of comparison of constant 288230376151711743 with expression of type 'Elf64_Half' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
  682 |           if (INT_MULTIPLY_WRAPV (ehdr2.e_shnum, sizeof (ElfW(Shdr)), &size))
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:415:34: note: expanded from macro 'INT_MULTIPLY_WRAPV'
  415 |    _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
      |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:504:45: note: expanded from macro '_GL_INT_OP_WRAPV'
  504 |     : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
../include/intprops.h:511:41: note: expanded from macro '_GL_INT_OP_WRAPV_LONGISH'
  511 |         : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  512 |                            unsigned long int, 0, ULONG_MAX)) \
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:533:4: note: expanded from macro '_GL_INT_OP_CALC'
  533 |   (overflow (a, b, tmin, tmax) \
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:608:22: note: expanded from macro '_GL_INT_MULTIPLY_RANGE_OVERFLOW'
  608 |       : (tmax) / (b) < (a)))
      |         ~~~~~~~~~~~~ ^ ~~~
1 error generated.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-29 12:53:50 -03:00
Adhemerval Zanella 5ee722d3ac i386: Build s_erf_common.c with -fexcess-precision=standard
It is requires to provide correctly rounded results.

Checked on i686-linux-gnu.
2025-10-29 10:17:34 -03:00
H.J. Lu 14243c9db6 Build programs in $(others-noinstall) like tests
Programs in $(others-noinstall) are internal to glibc build and they
aren't installed.  They should be treated like programs in $(others),
but linked like tests so that --enable-hardcoded-path-in-tests also
applies to them.

Also replace run-via-rtld-prefix with test-via-rtld-prefix when running
container tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-29 12:04:40 +08:00
Osama Abdelkader 96073e9f34 Fix incorrect setrlimit return value checks in tests
The setrlimit(2) function returns 0 on success and -1 on error, but
several test files were incorrectly checking for a return value of 1
to detect errors.  This means the error checks would never trigger,
causing tests to continue silently even when setrlimit() failed.

This commit fixes the error checks in five files to correctly test
for -1, matching both the documented behavior and the pattern used
correctly in other parts of the codebase.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-28 18:51:51 -07:00
Joseph Myers 096fcdc0a5 Rename uimaxabs to umaxabs (bug 33325)
The C2y function uimaxabs has been renamed to umaxabs.  Implement this
change in glibc, keeping a compat symbol under the old name, copying
the test to test the new name and changing the old test to test the
compat symbol.  Jakub has done the corresponding change to the
built-in function in GCC.

Tested for x86_64 and x86.
2025-10-28 12:15:02 +00:00
Adhemerval Zanella 013f5167b9 math: Consolidate CORE-MATH double-double routines
For lgamma and tgamma the muldd, mulddd, and polydd are renamed
to muldd2, mulddd2, and polydd2 respectively.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:46:04 -03:00
Adhemerval Zanella e4d812c980 math: Consolidate erf/erfc definitions
The common code definitions are consolidated in s_erf_common.h
and s_erf_common.c.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:46:01 -03:00
Adhemerval Zanella fc419290f9 math: Consolidate internal erf/erfc tables
The shared internal data definitions are consolidated in
s_erf_data.c and the erfc only one are moved to s_erfc_data.c.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella acaad9ab06 math: Use erfc from CORE-MATH
The current implementation precision shows the following accuracy, on
three ranges ([-DBL_MAX,5], [-5,5], [5,DBL_MAX]) with 10e9 uniform
randomly generated numbers for each range (first column is the
accuracy in ULP, with '0' being correctly rounded, second is the
number of samples with the corresponding precision):

* Range [-DBL_MAX, -5]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

* Range [-5, 5]
 * FE_TONEAREST
     0:       8069309665  80.69%
     1:       1882910247  18.83%
     2:         47485296   0.47%
     3:           293749   0.00%
     4:             1043   0.00%
 * FE_UPWARD
     0:       5540301026  55.40%
     1:       2026739127  20.27%
     2:       1774882486  17.75%
     3:        567324466   5.67%
     4:         86913847   0.87%
     5:          3820789   0.04%
     6:            18259   0.00%
 * FE_DOWNWARD
     0:       5520969586  55.21%
     1:       2057293099  20.57%
     2:       1778334818  17.78%
     3:        557521494   5.58%
     4:         82473927   0.82%
     5:          3393276   0.03%
     6:            13800   0.00%
 * FE_TOWARDZERO
     0:       6220287175  62.20%
     1:       2323846149  23.24%
     2:       1251999920  12.52%
     3:        190748245   1.91%
     4:         12996232   0.13%
     5:           122279   0.00%

* Range [5, DBL_MAX]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                      49.0980       267.0660      -443.94%
x86_64v2                    49.3220       257.6310      -422.34%
x86_64v3                    42.9539        84.9571       -97.79%
aarch64                     28.7266        52.9096       -84.18%
power10                     14.1673        25.1273       -77.36%

Latency                      master        patched   improvement
x86_64                      95.6640       269.7060      -181.93%
x86_64v2                    95.8296       260.4860      -171.82%
x86_64v3                    91.1658       112.7150       -23.64%
aarch64                     37.0745        58.6791       -58.27%
power10                     23.3197        31.5737       -35.39%

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella 72a48e45bd math: Use erf from CORE-MATH
The current implementation precision shows the following accuracy, on
three rangeis ([-DBL_MIN, -4.2], [-4.2, 4.2], [4.2, DBL_MAX]) with
10e9 uniform randomly generated numbers for each range (first column
is the accuracy in ULP, with '0' being correctly rounded, second is the
number of samples with the corresponding precision):

* Range [-DBL_MIN, -4.2]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

* Range [-4.2, 4.2]
 * FE_TONEAREST
     0:       9764404513  97.64%
     1:        235595487   2.36%
 * FE_UPWARD
     0:       9468013928  94.68%
     1:        531986072   5.32%
 * FE_DOWNWARD
     0:       9493787693  94.94%
     1:        506212307   5.06%
 * FE_TOWARDZERO
     0:       9585271351  95.85%
     1:        414728649   4.15%

* Range [4.2, DBL_MAX]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master       patched   improvement
x86_64                      38.2754       78.0311      -103.87%
x86_64v2                    38.3325       75.7555       -97.63%
x86_64v3                    34.6604       28.3182        18.30%
aarch64                     23.1499       21.4307         7.43%
power10                     12.3051       9.3766         23.80%

Latency                      master       patched   improvement
x86_64                      84.3062      121.3580       -43.95%
x86_64v2                    84.1817      117.4250       -39.49%
x86_64v3                    81.0933       70.6458        12.88%
aarch64                      35.012       29.5012        15.74%
power10                     21.7205       18.4589        15.02%

For x86_64/x86_64-v2, most performance hit came from the fma call
through the ifunc mechanism.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella 1cae0550e8 math: Use tgamma from CORE-MATH
The current implementation precision shows the following accuracy, on
one range ([-20,20]) with 10e9 uniform randomly generated numbers for
each range (first column is the accuracy in ULP, with '0' being
correctly rounded, second is the number of samples with the
corresponding precision):

* Range [-20,20]
 * FE_TONEAREST
     0:       4504877808  45.05%
     1:       4402224940  44.02%
     2:        947652295   9.48%
     3:        131076831   1.31%
     4:         13222216   0.13%
     5:           910045   0.01%
     6:            35253   0.00%
     7:              606   0.00%
     8:                6   0.00%
 * FE_UPWARD
     0:       3477307921  34.77%
     1:       4838637866  48.39%
     2:       1413942684  14.14%
     3:        240762564   2.41%
     4:         27113094   0.27%
     5:          2130934   0.02%
     6:           102599   0.00%
     7:             2324   0.00%
     8:               14   0.00%
 * FE_DOWNWARD
     0:       3923545410  39.24%
     1:       4745067290  47.45%
     2:       1137899814  11.38%
     3:        171596912   1.72%
     4:         20013805   0.20%
     5:          1773899   0.02%
     6:            99911   0.00%
     7:             2928   0.00%
     8:               31   0.00%
 * FE_TOWARDZERO
     0:       3697160741  36.97%
     1:       4731951491  47.32%
     2:       1303092738  13.03%
     3:        231969191   2.32%
     4:         32344517   0.32%
     5:          3283092   0.03%
     6:           193010   0.00%
     7:             5175   0.00%
     8:               45   0.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                     237.7960       175.4090        26.24%
x86_64v2                   232.9320       163.4460        29.83%
x86_64v3                   193.0680        89.7721        53.50%
aarch64                    113.6340        56.7350        50.07%
power10                     92.0617        26.6137        71.09%

Latency                      master        patched   improvement
x86_64                     266.7190       208.0130        22.01%
x86_64v2                   263.6070       200.0280        24.12%
x86_64v3                   214.0260       146.5180        31.54%
aarch64                    114.4760        58.5235        48.88%
power10                     84.3718        35.7473        57.63%

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella d67d2f4688 math: Use lgamma from CORE-MATH
The current implementation precision shows the following accuracy, on
one range ([-1,1]) with 10e9 uniform randomly generated numbers for
each range (first column is the accuracy in ULP, with '0' being
correctly rounded, second is the number of samples with the
corresponding precision):

* Range [-20, 20]
 * FE_TONEAREST
     0:       6701254075  67.01%
     1:       3230897408  32.31%
     2:         63986940   0.64%
     3:          3605417   0.04%
     4:           233189   0.00%
     5:            20973   0.00%
     6:             1869   0.00%
     7:              125   0.00%
     8:                4   0.00%
 * FE_UPWARDA
     0:       4207428861  42.07%
     1:       5001137116  50.01%
     2:        740542213   7.41%
     3:         49116304   0.49%
     4:          1715617   0.02%
     5:            54464   0.00%
     6:             4956   0.00%
     7:              451   0.00%
     8:               16   0.00%
     9:                2   0.00%
 * FE_DOWNWARD
     0:       4155925193  41.56%
     1:       4989821364  49.90%
     2:        770312796   7.70%
     3:         72014726   0.72%
     4:         11040522   0.11%
     5:           872811   0.01%
     6:            12480   0.00%
     7:              106   0.00%
     8:                2   0.00%
 * FE_TOWARDZERO
     0:       4225861532  42.26%
     1:       5027051105  50.27%
     2:        706443411   7.06%
     3:         39877908   0.40%
     4:           713109   0.01%
     5:            47513   0.00%
     6:             4961   0.00%
     7:              438   0.00%
     8:               23   0.00%

* Range [20, 0x5.d53649e2d4674p+1012]
 * FE_TONEAREST
     0:       7262241995  72.62%
     1:       2737758005  27.38%
 * FE_UPWARD
     0:       4690392401  46.90%
     1:       5143728216  51.44%
     2:        165879383   1.66%
 * FE_DOWNWARD
     0:       4690333331  46.90%
     1:       5143794937  51.44%
     2:        165871732   1.66%
 * FE_TOWARDZERO
     0:       4690343071  46.90%
     1:       5143786761  51.44%
     2:        165870168   1.66%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                     112.9740       135.8640       -20.26%
x86_64v2                   111.8910       131.7590       -17.76%
x86_64v3                   108.2800        68.0935        37.11%
aarch64                     61.3759        49.2403        19.77%
power10                     42.4483        24.1943        43.00%

Latency                      master        patched   improvement
x86_64                     144.0090       167.9750       -16.64%
x86_64v2                   139.2690       167.1900       -20.05%
x86_64v3                   130.1320        96.9347        25.51%
aarch64                     66.8538        53.2747        20.31%
power10                     49.5076        29.6917        40.03%

For x86_64/x86_64-v2, most performance hit came from the fma call
through the ifunc mechanism.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella 140e802cb3 math: Move atanh internal data to separate file
The internal data definitions are moved to s_atanh_data.c.
It helps on ABIs that build the implementation multiple times for
ifunc optimizations, like x86_64.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella cb8d1575b6 math: Consolidate acosh and asinh internal table
The shared internal data definitions are consolidated in
s_asincosh_data.c.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella 79b70fc09f math: Use atanh from CORE-MATH
The current implementation precision shows the following accuracy, on
one range ([-1,1]) with 10e9 uniform randomly generated numbers for
each range (first column is the accuracy in ULP, with '0' being
correctly rounded, second is the number of samples with the
corresponding precision):

* Range [-1, 1]
 * FE_TONEAREST
     0:       8180011860  81.80%
     1:       1819865257  18.20%
     2:           122883   0.00%
 * FE_UPWARDA
     0:       3903695744  39.04%
     1:       4992324465  49.92%
     2:       1096319340  10.96%
     3:          7660451   0.08%
 * FE_DOWNWARDA
     0:       3904555484  39.05%
     1:       4991970864  49.92%
     2:       1095447471  10.95%
     3:          8026181   0.08%
 * FE_TOWARDZERO
     0:       7070209165  70.70%
     1:       2908447434  29.08%
     2:         21343401   0.21%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                      26.4969        22.4625       15.23%
x86_64v2                    26.0792        22.9822       11.88%
x86_64v3                    25.6357        22.2147       13.34%
aarch64                     20.2295        19.7001        2.62%
power10                     10.0986         9.3846        7.07%

Latency                      master        patched   improvement
x86_64                      80.2311        59.9745       25.25%
x86_64v2                    79.7010        61.4066       22.95%
x86_64v3                    78.2679        58.5804       25.15%
aarch64                     34.3959        28.1523       18.15%
power10                     23.2417        18.2694       21.39%

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella 30e66b085c math: Use asinh from CORE-MATH
The current implementation precision shows the following accuracy, on
tthree different ranges ([-DBL_MAX, -10], [-10,10], and [10, DBL_MAX))
with 10e9 uniform randomly generated numbers for each range (first
column is the accuracy in ULP, with '0' being correctly rounded, second
is the number of samples with the corresponding precision):

* range [-DBL_MAX, -10]
 * FE_TONEAREST
     0:       5164019099  51.64%
     1:       4835980901  48.36%
 * FE_UPWARD
     1:       4836053540  48.36%
     2:       5163946460  51.64%
 * FE_DOWNWARD
     1:       5163926134  51.64%
     2:       4836073866  48.36%
 * FE_TOWARDZERO
     0:       5163937001  51.64%
     1:       4836062999  48.36%

* Range [-10, 10)
 * FE_TONEAREST
     0:       8679029381  86.79%
     1:       1320934581  13.21%
     2:            36038   0.00%
 * FE_UPWARD
     0:       3965704277  39.66%
     1:       4993616710  49.94%
     2:       1039680225  10.40%
     3:           998788   0.01%
 * FE_DOWNWARD
     0:       3965806523  39.66%
     1:       4993534438  49.94%
     2:       1039601726  10.40%
     3:          1057313   0.01%
 * FE_TOWARDZEROA
     0:       7734210130  77.34%
     1:       2261868439  22.62%
     2:          3921431   0.04%

* Range [10, DBL_MAX)
 * FE_TONEAREST
     0:       5163973212  51.64%
     1:       4836026788  48.36%
 * FE_UPWARD
     0:       4835991071  48.36%
     1:       5164008929  51.64%
 * FE_DOWNWARD
     0:       5163983594  51.64%
     1:       4836016406  48.36%
 * FE_TOWARDZERO
     0:       5163993394  51.64%
     1:       4836006606  48.36%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                      26.5178        45.3754       -71.11%
x86_64v2                    26.3167        44.7870       -70.18%
x86_64v3                    25.9109        25.4887         1.63%
aarch64                     18.0555        17.3374         3.98%
power10                     19.8535        20.5586        -3.55%

Latency                      master        patched   improvement
x86_64                      82.6755        91.2026       -10.31%
x86_64v2                    82.4581        90.7152       -10.01%
x86_64v3                    80.7000        71.9454        10.85%
aarch64                     32.8320        28.8565        12.11%
power10                     44.5309        37.0096        16.89%

For x86_64/x86_64-v2, most performance hit came from the fma call
through the ifunc mechanism.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Adhemerval Zanella d1509f2ce3 math: Use acosh from CORE-MATH
The current implementation precision shows the following accuracy, on
two different ranges ([1,21) and [21, DBL_MAX)) with 10e9 uniform
randomly generated numbers (first column is the accuracy in ULP, with
'0' being correctly rounded, second is the number of samples with the
corresponding precision):

* range [1,21]

 * FE_TONEAREST
    0:       8931139411  89.31%
    1:       1068697545  10.69%
    2:           163044   0.00%
 * FE_UPWARD
    0:       7936620731  79.37%
    1:       2062594522  20.63%
    2:           783977   0.01%
    3:              770   0.00%
 * FE_DOWNWARD
    0:       7936459794  79.36%
    1:       2062734117  20.63%
    2:           805312   0.01%
    3:              777   0.00%
 * FE_TOWARDZERO
    0:       7910345595  79.10%
    1:       2088584522  20.89%
    2:          1069106   0.01%
    3:              777   0.00%

* Range [21, DBL_MAX)
 * FE_TONEAREST
    0:       5163888431  51.64%
    1:       4836111569  48.36%
 * FE_UPWARD
    0:       4835951885  48.36%
    1:       5164048115  51.64%
 * FE_DOWNWARD
    0:       5164048432  51.64%
    1:       4835951568  48.36%
 * FE_TOWARDZERO
    0:       5164058042  51.64%
    1:       4835941958  48.36%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master       patched   improvement
x86_64                      20.9131       47.2187      -125.79%
x86_64v2                    20.8823       41.1042       -96.84%
x86_64v3                    19.0282       25.8045       -35.61%
aarch64                     14.7419       18.1535       -23.14%
power10                     8.98341       11.0423       -22.92%

Latency                      master       patched   improvement
x86_64                      75.5494       89.5979      -18.60%
x86_64v2                    74.4443       87.6292      -17.71%
x86_64v3                    71.8558       70.7086        1.60%
aarch64                     30.3361       29.2709        3.51%
power10                     20.9263       19.2482        8.02%

For x86_64/x86_64-v2, most performance hit came from the fma call
through the ifunc mechanism.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-10-27 09:34:04 -03:00
Collin Funk 3d20d746c3 Linux: fix tst-copy_file_range-large test on 32-bit platforms.
Since SSIZE_MAX is less than UINT_MAX on 32-bit platforms we must AND
the expression with SSIZE_MAX.

Tested on x86_64 and x86.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-26 19:39:49 -07:00
litenglong 00d406e77b x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3
- Performance testing revealed significant memcpy performance degradation
  when bit_arch_AVX_Fast_Unaligned_Load is enabled on Hygon 3.
- Hygon confirmed AVX performance issues in certain memory functions.
- Glibc benchmarks show SSE outperforms AVX for
  memcpy/memmove/memset/strcmp/strcpy/strlen and so on.
- Hardware differences primarily in floating-point operations don't justify
  AVX usage for memory operations.

Reviewed-by: gaoxiang <gaoxiang@kylinos.cn>
Signed-off-by: litenglong <litenglong@kylinos.cn>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-27 05:16:30 +08:00
Sachin Monga b59799f14f ppc64le: Power 10 rawmemchr clobbers v20 (bug #33091)
Replace non-volatile(v20) by volatile(v17)
since v20 is not restored

Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2025-10-26 12:19:53 -05:00
Dev Jain b2b4b46a52 malloc: fix large tcache code to check for exact size match
The tcache is used for allocation only if an exact match is found. In the
large tcache code added in commit cbfd798810, we currently extract a
chunk of size greater than or equal to the size we need, but don't check
strict equality. This patch fixes that behaviour.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-24 16:55:02 +00:00
Adhemerval Zanella 48e040d568 Fix configure from ab22e5ec37
The "-Wno-unused-command-line-argument" was incorrectly added.
2025-10-22 17:23:12 -03:00
Adhemerval Zanella 6e862a07f7 misc: Fix clang -Wstring-plus-int warnings on syslog
clang issues:

syslog.c:193:9: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
  193 |                       SYSLOG_HEADER (pri, timestamp, &msgoff, pid));
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
syslog.c:180:7: note: expanded from macro 'SYSLOG_HEADER'
  180 |   "[" + (pid == 0), pid, "]" + (pid == 0)

Use array indexes instead of string addition (it is simpler than
add a supress warning).
2025-10-22 16:35:39 -03:00
Collin Funk 9681f645ba sprof: fix -Wformat warnings on 32-bit hosts
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-22 09:48:44 -07:00
Paul Zimmermann 48fde7b026 various fixes detected with -Wdouble-promotion
Changes with respect to v1:
- added comment in e_j1f.c to explain the use of float is enough
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-22 12:35:40 +02:00
Bruno Haible 1eba0b35ad posix: Fix memory leak a memory leak in glob.
Found by Coverity in Gnulib.

* posix/glob.c (__glob): Add scratch_buffer_free invocation, to match
scratch_buffer_init invocation.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-21 19:09:45 -07:00
H.J. Lu eb35513d3d plot_strings.py: Replace np.complex with complex
Replace np.complex with complex to fix numpy error:

AttributeError: module 'numpy' has no attribute 'complex'.
`np.complex` was a deprecated alias for the builtin `complex`. To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-22 07:52:54 +08:00
DJ DelorieandFlorian Weimer 2bf2188fae malloc: avoid need for tcache == NULL checks
Avoid needing to check for tcache == NULL by initializing it
to a dummy read-only tcache structure.  This dummy is all zeros,
so logically it is both full (when you want to put) and empty (when
you want to get).  Also, there are two dummies, one used for
"not yet initialized" and one for "tunables say we shouldn't have
a tcache".

The net result is twofold:

1. Checks for tcache == NULL may be removed from the fast path.
    Whether this makes the fast path faster when tcache is
    disabled is TBD, but the normal case is tcache enabled.

2. no memory for tcache is allocated if tunables disable caching.

Co-authored-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-21 16:51:03 -04:00
DJ Delorie 324084649b sprof: check pread size and offset for overflow
Add a bit of descriptive paranoia to the values we read from
the ELF headers and use to access data.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-21 14:45:35 -04:00
Siddhesh Poyarekar 1b657c53c2 Simplify powl computation for small integral y [BZ #33411]
The powl implementation for x86_64 ends up multiplying X once more than
necessary and then throwing away that result.  This results in an
overflow flag being set in cases where there is no overflow.

Simplify the relevant portion by special casing the -3 to 3 range and
simply multiplying repetitively.

Resolves: BZ #33411
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2025-10-21 14:00:10 -04:00
Adhemerval Zanella 87e850fb26 sunrpc: Fix clang build
clang-21 issues:

rtime.c:96:36: error: variable 'thetime' is uninitialized when passed as a const pointer argument here
      [-Werror,-Wuninitialized-const-pointer]
   96 |       res = __sendto (s, (char *) &thetime, sizeof (thetime), 0,
      |                                    ^~~~~~~

For SOCK_DGRAM the sendto sends an uninitialized value.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-21 09:27:05 -03:00
Adhemerval Zanella 0e4ca88bd2 math: Fix compare sort function on compoundn
To use the fabs function to the used type, instead of the double
variant.  it fixes a build issue with clang:

./s_compoundn_template.c:64:14: error: absolute value function 'fabs' given an argument of type 'const long double' but has parameter of type 'double' which may cause truncation of value [-Werror,-Wabsolute-value]
   64 |   FLOAT pd = fabs (*(const FLOAT *) p);
      |              ^
./s_compoundn_template.c:64:14: note: use function 'fabsl' instead
   64 |   FLOAT pd = fabs (*(const FLOAT *) p);
      |              ^~~~
      |              fabsl

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-21 09:27:05 -03:00
Adhemerval Zanella ab22e5ec37 gmon: Only used -fno-tree-loop-distribute-patterns if compiler supports it
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-21 09:27:01 -03:00
Adhemerval Zanella 062510a0c1 termios: Suppress clang -Winitializer-overrider on ___cbaud_to_speed
clang-18 and onwards issues:

../sysdeps/unix/sysv/linux/speed.c:71:23: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
   71 |       [_cbix(__B0)] = 0,
      |                       ^
../sysdeps/unix/sysv/linux/speed.c:70:34: note: previous initialization is here
   70 |       [0 ... _cbix(CBAUDMASK)] = -1,
[...]

The override is explicit used to support the same initialization on
multiple platforms (since the baud values differ on alpha and powerpc).

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-21 09:26:04 -03:00
Adhemerval Zanella 228ae5a354 stdio: Only use __va_arg_pack if compiler supports it
Otherwise route __libc_message_wrapper to __libc_message_impl.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:26:04 -03:00
Adhemerval Zanella 2ebfb31b35 elf: Fix tunable handing with clang
Recent clang version optimizes some loops contructions to strlen [1],
which might generate function calls when self-relocation is not
already done (on tunable parsing).  Use an out-of-line function
with __attribute_optimization_barrier__ to avoid this.

[1] https://github.com/llvm/llvm-project/pull/132572/commits/facd7dfc80d655fe49baf4bf27e144a4c890a149

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:26:04 -03:00
Adhemerval Zanella ff758345eb elf: Suppress unused function clang warning for __ifunc_resolver
The __ifunc_resolver macro expands to:

   extern __typeof (__redirect_name) name __attribute__ ((ifunc ("iname_ifunc")));
   static __typeof (__redirect_name) *name_ifunc (void) { [...] };

And although NAME_IFUNC is and alias for NAME, clang still emits
an 'unused function 'name_ifunc' [-Werror,-Wunused-function]'
warning.  The static is used to avoid name pollution on static
linkage.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:26:04 -03:00
Adhemerval Zanella 77bab6dd99 support: Handle clang support/dtotimespec.c on dtotimespec
clang issues:

dtotimespec.c:31:25: error: implicit conversion from 'time_t' (aka
'long') to 'double' changes value from 9223372036854775807 to
9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
  else if (sec >= 1.0 + TYPE_MAXIMUM (time_t))
                      ~ ^~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:57:4: note: expanded from macro 'TYPE_MAXIMUM'
  ((t) (! TYPE_SIGNED (t)
\
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So explicit cast it to double.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:26:04 -03:00
Adhemerval Zanella ca3e2f12af stdio: Fix -Wtautological-constant-out-of-range-compare on clang
clang emits an error while building vfprintf-internal for default
case:

error: result of comparison of constant 255 with expression of type
'char' is always true
[-Werror,-Wtautological-constant-out-of-range-compare]
          if (spec <= UCHAR_MAX

The test is indeed not required for default non-wide build.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-21 09:26:04 -03:00
Adhemerval Zanella b9b28ce35f math: Suppress more aliases builtin type conflicts
Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:26:02 -03:00
Adhemerval Zanella b0eb01ef48 support: Use CHAR_MAX as maximum value
On ABIs with defined 'char' was unsigned type, clang fails to build
support_process_state.c with:

  support_process_state.c:70:21: error: result of comparison of constant  -1 with expression of type 'char' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
     70 |       if (cur_state == -1)
        |           ~~~~~~~~~ ^  ~~
  1 error generated.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:29 -03:00
Adhemerval Zanella 9d0b7ec87c math: Suppress clang -Wincompatible-library-redeclaration on s_llround
Clang issues:

  ../sysdeps/ieee754/dbl-64/s_llround.c:83:30: error: incompatible
  redeclaration of library function 'lround'
  [-Werror,-Wincompatible-library-redeclaration]
  libm_alias_double (__lround, lround)
                               ^
  ../sysdeps/ieee754/dbl-64/s_llround.c:83:30: note: 'lround' is a builtin
  with type 'long (double)'

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:27 -03:00
Adhemerval Zanella 407b2eea75 math: use fabs on __ieee754_lgamma_r
clang issues:

  ../sysdeps/ieee754/dbl-64/e_lgamma_r.c:234:29: error: absolute value function 'fabsf'
  given an argument of type 'double' but has parameter of type 'float' which may cause \
  truncation of value [-Werror,-Wabsolute-value]

It should not matter because the value is 0.0, but using fabs is
simpler than adding a warning suppresion.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:24 -03:00
Adhemerval Zanella 39bf95c1ba math: Suppress clang -Wabsolute-value warning on math_check_force_underflow
clang warns:

  ../sysdeps/x86/fpu/powl_helper.c:233:3: error: absolute value function
  '__builtin_fabsf' given an argument of type 'typeof (res)' (aka 'long
  double') but has parameter of type 'float' which may cause truncation of
  value [-Werror,-Wabsolute-value]
    math_check_force_underflow (res);
    ^
  ./math-underflow.h:45:11: note: expanded from macro
  'math_check_force_underflow'
        if (fabs_tg (force_underflow_tmp)                         \
            ^
  ./math-underflow.h:27:20: note: expanded from macro 'fabs_tg'
  #define fabs_tg(x) __MATH_TG ((x), (__typeof (x)) __builtin_fabs, (x))
                     ^
  ../math/math.h:899:16: note: expanded from macro '__MATH_TG'
                 float: FUNC ## f ARGS,           \
                        ^
  <scratch space>:73:1: note: expanded from here
  __builtin_fabsf
  ^

Due the use of _Generic from TG_MATH.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:21 -03:00
Adhemerval Zanella 717d44840a catgets: Remove catgets/config.h
It simplifies the code a bit and avoid the clang warning:

  ./config.h:12:2: error: #include_next in file found relative to primary
  source file or found by absolute path; will search from start of include
  path [-Werror,-Winclude-next-absolute-path]
  #include_next <config.h>
   ^

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:19 -03:00
Adhemerval Zanella ea3f174e85 iconvdata: Fix clang -Wstring-plus-int clang warning
clang issues an warning adding '{unsigned} int' to a string does not
append to the string.

Use array indexes instead of string addition (it is simpler than
add a supress warning).

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:14 -03:00
Adhemerval Zanella d7dbcab417 elf: Fix clang -Wstring-plus-int on rtld.c
clang issues an warning adding 'const unsigned char' to a string
does not append to the string.

Use array indexes instead of string addition (it is simpler than
add a warning suppression).

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:13 -03:00
Adhemerval Zanella 6eb1d9a9ed sunrpc: Suppress clang -Wgnu-variable-sized-type-not-at-end warning on struct cmessage
clang issues:

svc_unix.c:318:18: error: field 'cmsg' with variable sized type 'struct cmsghdr' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
  318 |   struct cmsghdr cmsg;
      |                  ^

The __msgread explicitly expects that 'struct ucred' is after the 'cmsg',
so suppress the warning.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:10 -03:00
Adhemerval Zanella c6278687d9 nptl: Fix Wincompatible-pointer-types on clang
clang 18 issues:

pthread_join_common.c:32:3: error: incompatible pointer types passing 'struct pthread **' to parameter of type 'void **' [-Werror,-Wincompatible-pointer-types]
   32 |   atomic_compare_exchange_weak_acquire (&arg, &self, NULL);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/atomic.h:188:39: note: expanded from macro 'atomic_compare_exchange_weak_acquire'
  188 |   __atomic_compare_exchange_n ((mem), (expected), (desired), 1,

Use a void * type instead.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:06 -03:00
Adhemerval Zanella 76dfd91275 Suppress -Wmaybe-uninitialized only for gcc
The warning is not supported by clang.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:05 -03:00
Adhemerval Zanella 848342ae15 configure: Use -Wno-maybe-uninitialized iff compiler supports it
clang does not support the flag.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:24:03 -03:00
Adhemerval Zanella e96e426caf Disable __USE_EXTERN_INLINES for clang
clang does not allow to redefine attributes after function declaration.
Although it work for external usage, its breaks the build for internal
symbol that glibc provides as optimization (for instance bsearch
with stdlib-bsearch.h or __cmsg_nxthdr).

Disable such optimization for clang while building glibc.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21 09:23:59 -03:00
Dev Jain 6e8f32d39a malloc: Do not call madvise if heap's oldsize >= THP size
Linux handles virtual memory in Virtual Memory Areas (VMAs). The
madvise(MADV_HUGEPAGE) call works on a VMA granularity, which sets the
VM_HUGEPAGE flag on the VMA. This flag is invariant of the mprotect()
syscall which is used in growing the secondary heaps. Therefore, we
need to call madvise() only when we are sure that VM_HUGEPAGE was not
previously set, which is only in the case when h->size < mp_.thp_pagesize.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-20 11:33:54 -03:00
Luc Michel c284fd5eaf microblaze: fix __syscall_cancel_arch (BZ 33547)
The __syscall_cancel_arch function has an epilogue that does not match
the prologue. The stack is not used and the return address still lies in
r15 when reaching the epilogue. Fix the epilogue by simply returning
from the function.

Signed-off-by: Luc Michel <luc.michel@amd.com>
Tested-by: gopi@sankhya.com
Reviewed-by: Neal Frager <neal.frager@amd.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella bbc7caeeeb locale: Fix implicit conversion on collate_finish
Clang issues:

programs/ld-collate.c:1824:55: error: implicit conversion from 'unsigned
long' to 'unsigned int' changes value from 18446744073709551615 to
4294967295 [-Werror,-Wconstant-conversion]
  collate->undefined.used_in_level = need_undefined ? ~0ul : 0;
                                   ~                  ^~~~

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 419908e0c5 posix: Only enable -Wmaybe-uninitialized suppression on gcc
clang does not support this option.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 41e27c400d malloc: Use INT_ADD_OVERFLOW instead of __builtin_add_overflow_p
clang does not support the __builtin_*_overflow_p builtins, on gcc
the macros will call __builtin_*_overflow_p.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 047b0e08ac Adjust stdint for clang-20
clang 20 adds both __INT64_C and __UINT64_C as builtins, but different
than gcc it does not undef them in its stdint wrapper.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 111f2367f4 Build glibc with -ftrapping-math
GCC enables it by default, clang in the other hand sets -fno-trapping-math.
This is required to fix some math and stdlib tests that explicit raises
floating point exceptions:

math/test-double-canonicalize.out
testing double (without inline functions)
Failure: canonicalize (max_value): Exception "Overflow" set
Failure: canonicalize (max_value): Exception "Inexact" set
Failure: canonicalize (-max_value): Exception "Overflow" set
Failure: canonicalize (-max_value): Exception "Inexact" set
Failure: canonicalize_downward (max_value): Exception "Overflow" set
Failure: canonicalize_downward (max_value): Exception "Inexact" set
Failure: canonicalize_downward (-max_value): Exception "Overflow" set
Failure: canonicalize_downward (-max_value): Exception "Inexact" set
Failure: canonicalize_towardzero (max_value): Exception "Overflow" set
Failure: canonicalize_towardzero (max_value): Exception "Inexact" set
Failure: canonicalize_towardzero (-max_value): Exception "Overflow" set
Failure: canonicalize_towardzero (-max_value): Exception "Inexact" set
Failure: canonicalize_upward (max_value): Exception "Overflow" set
Failure: canonicalize_upward (max_value): Exception "Inexact" set
Failure: canonicalize_upward (-max_value): Exception "Overflow" set
Failure: canonicalize_upward (-max_value): Exception "Inexact" set

test-float-catanh.out
testing float (without inline functions)
Failure: Real part of: catanh (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella a252205e1c linux: Fix function point cast on vDSO handling
There is no need to cast to avoid, both pointer already have the
expected type.

It fixes the clang -Wpointer-type-mismatch error:

../sysdeps/unix/sysv/linux/gettimeofday.c:43:6: error: pointer type mismatch ('int (*)(struct timeval *, void *)' and 'void *') [-Werror,-Wpointer-type-mismatch]
   41 | libc_ifunc (__gettimeofday,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |             GLRO(dl_vdso_gettimeofday) != NULL
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |             ? VDSO_IFUNC_RET (GLRO(dl_vdso_gettimeofday))
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   44 |             : (void*) __gettimeofday_syscall)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:789:53: note: expanded from macro 'libc_ifunc'
  789 | #define libc_ifunc(name, expr) __ifunc (name, name, expr, void, INIT_ARCH)
      |                                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:705:34: note: expanded from macro '__ifunc'
  705 |   __ifunc_args (type_name, name, expr, init, arg)
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./../include/libc-symbols.h:677:38: note: expanded from macro '__ifunc_args'
  677 |   __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__);  \
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:667:33: note: expanded from macro '__ifunc_resolver'
  667 |     __typeof (type_name) *res = expr;                                   \
      |                                 ^~~~

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 7e872036c4 elf: Only define _dl_tls_allocate_active for SHARED
clang issues:

dl-tls.c:108:1: error: unused function '_dl_tls_allocate_active' [-Werror,-Wunused-function]
  108 | _dl_tls_allocate_active (void)
      | ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella f8b5413001 Fix -Wno-ignored-attributes configure check
The configure check always fail with clang:

conftest.c:5:58: error: expected string literal as argument of 'alias' attribute
    5 | extern __typeof (__foo) foo __attribute__ ((weak, alias (__foo)));
      |                                                          ^
conftest.c:6:58: error: expected string literal as argument of 'alias' attribute
    6 | extern __typeof (__foo) bar __attribute__ ((weak, alias (foo)));
      |                                                          ^

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 8ec0754067 aarch64: Fix gcs linker flags
clang does not work by using whitespace for defining the -z option:

$ make test t=misc/tst-gcs-disabled
[...]
clang: error: no such file or directory: 'gcs=always'

Use the usual comma separate way.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 917425ca6d posix: Defined _POSIX_VDISABLE as integer literal
The constant should be used with c_cc, which for all supported ABIs
is defined as unsigned char.  By using it as literar char constant,
clang triggers an error when compared with signal literal on ABIs that
define 'char' as unsigned.

On aarch64, clang shows:

  ../sysdeps/posix/fpathconf.c:118:21: error: right side of operator
  converted from negative value to unsigned: -1 to 18446744073709551615
  [-Werror]
  #if _POSIX_VDISABLE == -1
    ~~~~~~~~~~~~~~~ ^  ~~

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 847fed2c05 iconvdata: Remove use of GNU old-style field designator extension
Use the C99 syntax instead.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella f6d559f2f1 sunrpc: Remove extra parenthesis on comparison
clang issues:

key_call.c:459:20: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
  459 |   if ((kcp->client == (CLIENT *) NULL))

Instead of suppress the warning, just use the more usual comparison style.

Reviewed-by: Sam James <sam@gentoo.org>
2025-10-20 11:33:54 -03:00
Adhemerval Zanella 64a0f4b776 stdlib: Remove -Wmaybe-uninitialized supression on setenv.c
It is not required on current supported gcc.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-10-20 11:33:54 -03:00
Joseph Myers 0807a262de Make <inttypes.h> printf macros narrow arguments (bug 31470)
A late change in C23, the resolution to CD2 comment GB-108, specified
that <inttypes.h> macros such as PRId8 expand to formats such that,
when an argument is passed in the promoted type that isn't
representable in the original type such as int8_t corresponding to the
format, it gets converted to that type before printing.  (Previously,
the proper handling of such arguments was unclear; the case of direct
use of formats such as %hhd was clarified earlier in C23 development,
and had been fixed in glibc in 2006.)  Implement the change to use
formats such as "hhd" for the affected macros, with associated tests.

Tested for x86_64 and x86.
2025-10-20 12:44:40 +00:00
Wilco Dijkstra 0375e6e233 AArch64: Use math-use-builtins for roundeven(f)/lrint(f)/lround(f)
Remove target implementations of roundeven(f)/lrint(f)/lround(f) and
use the math-use-builtins mechanism instead.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-17 17:03:54 +00:00
Wilco Dijkstra 35807cc5cd math: Add builtin support for (l)lround(f)
Add builtin support for (l)lround(f) via the math-use-builtins
header mechanism.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-17 17:03:54 +00:00
Wilco Dijkstra e974b1b7eb malloc: Cleanup _int_memalign
Cleanup _int_memalign. Simplify the logic. Add a seperate check
for mmap. Only release the tail chunk if it is at least MINSIZE.
Use the new mmap abstractions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-17 17:03:54 +00:00
Joseph Myers ea18d5a4c2 Implement C23 memalignment
Add the C23 memalignment function (query the alignment of a pointer)
to glibc.

Given how simple this operation is, it would make sense for compilers
to inline calls to this function, but I'm treating that as a compiler
matter (compilers should add it as a built-in function) rather than
adding an inline version to glibc headers (although such an inline
version would be reasonable as well).  I've filed
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122117 for this feature
in GCC.

Tested for x86_64 and x86.
2025-10-17 16:56:59 +00:00
Adhemerval Zanella 850d93f514 math: Use binary search on lgammaf slow path
And remove some unused entries of the fallback table.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-14 11:12:08 -03:00
Adhemerval Zanella 6610a293b3 math: Use stdbit.h instead of builtin in math_config.h
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-14 11:12:04 -03:00
Adhemerval Zanella ae49afe74d math: Optimize fma call on log2pf1
The fma is required only for x == -0x1.da285cp-5 in FE_TONEAREST
to provide correctly rounded results.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-14 11:12:00 -03:00
Adhemerval Zanella 82a4f50b4e math: Optimize fma call on asinpif
The fma is required only for x == +/-0x1.6371e8p-4f in FE_TOWARDZERO
to provide correctly rounded results.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-14 11:11:56 -03:00
Adhemerval Zanella fab32b6526 math: Remove erfcf fma usage
The fma is not required to provide correctly rounded and it helps
on !__FP_FAST_FMA ISAs.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2025-10-14 08:46:06 -03:00
Adhemerval Zanella 68cb78eccc math: Remove asinhf fma usage
The fma is not required to provide correctly rounded and it helps
on !__FP_FAST_FMA ISAs.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2025-10-14 08:46:06 -03:00
Adhemerval Zanella c075ff00a6 math: Optimize fma call on acospif
The fma is required only for inputs less than 0x1.0fd288p-127.  Also
only add the extra check for !__FP_FAST_FMA targets.

Checked on x86_64-linux-gnu and aarch64-linux-gnu.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2025-10-14 08:46:06 -03:00
Adhemerval Zanella c9d9336f50 math: Remove acoshf fma usage
The fma is not strickly required to provide correctly rounded and
it helps on !__FP_FAST_FMA ABIs.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2025-10-14 08:46:06 -03:00
Adhemerval Zanella 1c459af1ee math: Update auto-libm-test-out-log2p1
The 0797283910 did not update log2p1 output with the newer values.
2025-10-14 08:46:06 -03:00
Yury KhrustalevandAdhemerval Zanella Netto ecb0fc2f0f aarch64: tests for SME
This commit adds tests for the following use cases relevant to handing of
the SME state:

 - fork() and vfork()
 - clone() and clone3()
 - signal handler

While most cases are trivial, the case of clone3() is more complicated since
the clone3() symbol is not public in Glibc.

To avoid having to check all possible ways clone3() may be called via other
public functions (e.g. vfork() or pthread_create()), we put together a test
that links directly with clone3.o. All the existing functions that have calls
to clone3() may not actually use it, in which case the outcome of such tests
would be unexpected. Having a direct call to the clone3() symbol in the test
allows to check precisely what we need to test: that the __arm_za_disable()
function is indeed called and has the desired effect.

Linking to clone3.o also requires linking to __arm_za_disable.o that in
turn requires the _dl_hwcap2 hidden symbol which to provide in the test
and initialise it before using.

Co-authored-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-14 09:42:46 +01:00
Yury Khrustalev 27effb3d50 aarch64: clear ZA state of SME before clone and clone3 syscalls
This change adds a call to the __arm_za_disable() function immediately
before the SVC instruction inside clone() and clone3() wrappers. It also
adds a macro for inline clone() used in fork() and adds the same call to
the vfork implementation. This sets the ZA state of SME to "off" on return
from these functions (for both the child and the parent).

The __arm_za_disable() function is described in [1] (8.1.3). Note that
the internal Glibc name for this function is __libc_arm_za_disable().

When this change was originally proposed [2,3], it generated a long
discussion where several questions and concerns were raised. Here we
will address these concerns and explain why this change is useful and,
in fact, necessary.

In a nutshell, a C library that conforms to the AAPCS64 spec [1] (pertinent
to this change, mainly, the chapters 6.2 and 6.6), should have a call to the
__arm_za_disable() function in clone() and clone3() wrappers. The following
explains in detail why this is the case.

When we consider using the __arm_za_disable() function inside the clone()
and clone3() libc wrappers, we talk about the C library subroutines clone()
and clone3() rather than the syscalls with similar names. In the current
version of Glibc, clone() is public and clone3() is private, but it being
private is not pertinent to this discussion.

We will begin with stating that this change is NOT a bug fix for something
in the kernel. The requirement to call __arm_za_disable() does NOT come from
the kernel. It also is NOT needed to satisfy a contract between the kernel
and userspace. This is why it is not for the kernel documentation to describe
this requirement. This requirement is instead needed to satisfy a pure userspace
scheme outlined in [1] and to make sure that software that uses Glibc (or any
other C library that has correct handling of SME states (see below)) conforms
to [1] without having to unnecessarily become SME-aware thus losing portability.

To recap (see [1] (6.2)), SME extension defines SME state which is part of
processor state. Part of this SME state is ZA state that is necessary to
manage ZA storage register in the context of the ZA lazy saving scheme [1]
(6.6). This scheme exists because it would be challenging to handle ZA
storage of SME in either callee-saved or caller-saved manner.

There are 3 kinds of ZA state that are defined in terms of the PSTATE.ZA
bit and the TPIDR2_EL0 register (see [1] (6.6.3)):

- "off":       PSTATE.ZA == 0
- "active":    PSTATE.ZA == 1 TPIDR2_EL0 == null
- "dormant":   PSTATE.ZA == 1 TPIDR2_EL0 != null

As [1] (6.7.2) outlines, every subroutine has exactly one SME-interface
depending on the permitted ZA-states on entry and on normal return from
a call to this subroutine. Callers of a subroutine must know and respect
the ZA-interface of the subroutines they are using. Using a subroutine
in a way that is not permitted by its ZA-interface is undefined behaviour.

In particular, clone() and clone3() (the C library functions) have the
ZA-private interface. This means that the permitted ZA-states on entry
are "off" and "dormant" and that the permitted states on return are "off"
or "dormant" (but if and only if it was "dormant" on entry).

This means that both functions in question should correctly handle both
"off" and "dormant" ZA-states on entry. The conforming states on return
are "off" and "dormant" (if inbound state was already "dormant").

This change ensures that the ZA-state on return is always "off". Note,
that, in the context of clone() and clone3(), "on return" means a point
when execution resumes at certain address after transferring from clone()
or clone3(). For the caller (we may refer to it as "parent") this is the
return address in the link register where the RET instruction jumps. For
the "child", this is the target branch address.

So, the "off" state on return is permitted and conformant. Why can't we
retain the "dormant" state? In theory, we can, but we shouldn't, here is
why.

Every subroutine with a private-ZA interface, including clone() and clone3(),
must comply with the lazy saving scheme [1] (6.7.2). This puts additional
responsibility on a subroutine if ZA-state on return is "dormant" because
this state has special meaning. The "caller" (that is the place in code
where execution is transferred to, so this include both "parent" and "child")
may check the ZA-state and use it as per the spec of the "dormant" state that
is outlined in [1] (6.6.6 and 6.6.7).

Conforming to this would require more code inside of clone() and clone3()
which hardly is desirable.

For the return to "parent" this could be achieved in theory, but given that
neither clone() nor clone3() are supposed to be used in the middle of an
SME operation, if wouldn't be useful. For the "return" to "child" this
would be particularly difficult to achieve given the complexity of these
functions and their interfaces. Most importantly, it would be illegal
and somewhat meaningless to allow a "child" to start execution in the
"dormant" ZA-state because the very essence of the "dormant" state implies
that there is a place to return and that there is some outer context that
we are allowed to interact with.

To sum up, calling __arm_za_disable() to ensure the "off" ZA-state when the
execution resumes after a call to clone() or clone3() is correct and also
the most simple way to conform to [1].

Can there be situations when we can avoid calling __arm_za_disable()?

Calling __arm_za_disable() implies certain (sufficiently small) overhead,
so one might rightly ponder avoiding making a call to this function when
we can afford not to. The most trivial cases like this (e.g. when the
calling thread doesn't have access to SME or to the TPIDR2_EL0 register)
are already handled by this function (see [1] (8.1.3 and 8.1.2)). Reasoning
about other possible use cases would require making code inside clone() and
clone3() more complicated and it would defeat the point of trying to make
an optimisation of not calling __arm_za_disable().

Why can't the kernel do this instead?

The handling of SME state by the kernel is described in [4]. In short,
kernel must not impose a specific ZA-interface onto a userspace function.
Interaction with the kernel happens (among other thing) via system calls.
In Glibc many of the system calls (notably, including SYS_clone and
SYS_clone3) are used via wrappers, and the kernel has no control of them
and, moreover, it cannot dictate how these wrappers should behave because
it is simply outside of the kernel's remit.

However, in certain cases, the kernel may ensure that a "child" doesn't
start in an incorrect state. This is what is done by the recent change
included in 6.16 kernel [5]. This is not enough to ensure that code that
uses clone() and clone3() function conforms to [1] when it runs on a
system that provides SME, hence this change.

[1]: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst
[2]: https://inbox.sourceware.org/libc-alpha/20250522114828.2291047-1-yury.khrustalev@arm.com
[3]: https://inbox.sourceware.org/libc-alpha/20250609121407.3316070-1-yury.khrustalev@arm.com
[4]: https://www.kernel.org/doc/html/v6.16/arch/arm64/sme.html
[5]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cde5c32db55740659fca6d56c09b88800d88fd29

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-14 09:42:46 +01:00
Yury Khrustalev b4b713bd89 aarch64: define macro for calling __libc_arm_za_disable
A common sequence of instructions is used in several places
in assembly files, so define it in one place as an assembly
macro.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-14 09:42:46 +01:00
Paul Zimmermann ea5b996be9 replace use of double by float [BZ#29326] 2025-10-14 09:46:00 +02:00
Collin Funk bb1d27b94a posix: Avoid a stack overflow when glob is given many slashes [BZ #30635]
* posix/glob.c (__glob): Strip trailing slashes before the recursive
call, so it is not called for every slash in the pattern.
* posix/tst-glob-bz30635.c: Add two test cases that would previously
segmentation fault. The first test has many trailing slashes and the
second has many slashes following a wildcard character.
* posix/Makefile (tests): Add the new test.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-13 18:19:18 -07:00
Arjun ShankarandAdhemerval Zanella 88ce558a31 string: Add tests for unique strerror and strsignal strings
strerror, strsignal, and their variants should return unique strings for
each known (and, depending on the function, unknown) error/signal.  Add
tests to verify this for strerror, strerror_r (GNU and XSI compliant
variants), and strerror_l (for the C locale), strerrordesc_np,
strsignal, sigabbrev_np, and sigdescr_np.

Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-13 19:04:44 +02:00
Uros Bizjak 3a0a8eae50 x86: Fix trivial code formatting erros in my last two commits
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
2025-10-12 17:59:16 +02:00
Uros Bizjak bb019bc68f i386: Use __seg_gs qualifiers in PTR_{MANGLE,DEMANGLE}() macros
Use __seg_gs named address space qualifiers in PTR_MANGLE() and
PTR_DEMANGLE() macros to access the pointer_guard field in the TCB.

This change allows the compiler to eliminate redundant reads of
the variable, reducing the number of reads from 105 to 94 and
decreasing the text size of the library by 280 bytes.

While at it, fix a few trivial whitespace issues as well

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-12 17:48:55 +02:00
Uros Bizjak 60e3ada68d x86_64: Use __seg_fs qualifiers in PTR_{MANGLE,DEMANGLE}() macros
Use __seg_fs named address space qualifiers in PTR_MANGLE() and
PTR_DEMANGLE() macros to access the pointer_guard field in the TCB.

This change allows the compiler to eliminate redundant reads of
the variable, reducing the number of reads from 98 to 89 and
decreasing the text size of the library by 512 bytes.

While at it, fix a few trivial whitespace issues as well.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-12 17:47:55 +02:00
Sergey Kolosov 8ca2fe7e96 resolv: Add tests for getaddrinfo returning EAI_AGAIN [BZ #16849]
This patch adds two tests that verify correct behavior of getaddrinfo
when DNS resolution fails with a temporary error. Both tests ensure
that getaddrinfo returns EAI_AGAIN in cases where no valid address can
be resolved due to network or resolver failure.

* tst-getaddrinfo-eai-again.c
  Runs inside the glibc test-container without any DNS server
  configured. The test performs queries using AF_INET, AF_INET6,
  and AF_UNSPEC and verifies that getaddrinfo returns EAI_AGAIN
  when resolution fails.

* tst-getaddrinfo-eai-again-timeout.c
  Runs outside of the container but uses the resolv_test framework
  to simulate network failures. The test covers two failure modes:
  - No response from the server (resolv_response_drop)
  - Zero-length reply from the server
  In both cases, getaddrinfo is expected to return EAI_AGAIN.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-10-10 17:15:27 +02:00
Yury Khrustalev 7a47a51e8d misc: Fix several typos 2025-10-10 14:52:40 +01:00
Collin Funk 33eff78c8b libio: Add terminating NUL when the first character is EOF in getdelim [BZ #28038]
POSIX requires that the buffer used by getdelim/getline add a
terminating NUL whenever an EOF is read.

* libio/iogetdelim.c (__getdelim): Add a NUL byte when the first
__underflow is called.
* libio/tst-getdelim.c (do_test): Add a test case for the bug.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-10-09 17:38:01 -07:00
Andreas Schwab 5a83a403d1 Alphabetize nss/Makefile 2025-10-09 09:50:27 +02:00
Ben Boeckel eda354cfd8 elf: Report when found libraries are rejected [BZ #25669]
When debugging library loading issues with `LD_DEBUG`, it can be
frustrating to see logs for files in a directory are searched, but the
target library is skipped over without any indication of why. Add
reporting to all paths which reject a library as `ENOENT`.

Originally created for minimum-OS version detection, but that has since
been removed in b46d250656 (Remove kernel version check, 2022-02-21).
The remaining codepaths are still useful.

Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-08 10:43:18 -03:00
Adhemerval Zanella 1b8eb82845 benchtests: Improve fmod benchmark
The gcc implements fmod as a built-in for x86, so disable it to
benchmark the C implementation.

Also, make fmod and fmodf use the workload directive to measure
the reciprocal throughput.
2025-10-08 10:42:22 -03:00
Adhemerval Zanella e66fc31b7c benchtests: Add lgammaf_r benchmark
Random inputs in the range [-20.0,20.0].
2025-10-08 10:42:10 -03:00
Dev Jain fa5d1b5419 malloc: Do not call madvise if oldsize >= THP size
Linux handles virtual memory in Virtual Memory Areas (VMAs). The
madvise(MADV_HUGEPAGE) call works on a VMA granularity, which sets the
VM_HUGEPAGE flag on the VMA. If this VMA or a portion of it is mremapped
to a different location, Linux will create a new VMA, which will have
the same flags as the old one. This implies that the VM_HUGEPAGE flag
will be retained. Therefore, if we can guarantee that the old VMA was
marked with VM_HUGEPAGE, then there is no need to call madvise_thp() in
mremap_chunk().

The old chunk comes from a heap or non-heap allocation, both of which
have already been enlightened for THP. This implies that, if THP is on,
and the size of the old chunk is greater than or equal to thp_pagesize,
the VMA to which this chunk belongs to, has the VM_HUGEPAGE flag set.
Hence in this case we can avoid invoking the madvise() syscall.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-08 12:59:30 +00:00
Wilco Dijkstra 88de32a070 malloc: Improve mmap interface
Add mmap_set_chunk() to create a new chunk from an mmap block.
Remove set_mmap_is_hp() since it is done inside mmap_set_chunk().
Rename prev_size_mmap() to mmap_base_offset().  Cleanup comments.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-08 12:59:30 +00:00
Wilco Dijkstra adbd3ba137 atomic: Remove atomic_forced_read
Remove the odd atomic_forced_read which is neither atomic nor forced.
Some uses are completely redundant, so simply remove them.  In other cases
the intended use is to force a memory ordering, so use acquire load for those.
In yet other cases their purpose is unclear, for example __nscd_cache_search
appears to allow concurrent accesses to the cache while it is being garbage
collected by another thread!  Use relaxed atomic loads here to block spills
from accidentally reloading memory that is being changed.

Passes regress on AArch64, OK for commit?
2025-10-08 12:59:30 +00:00
Andreas Schwab 9da624a183 nss: use C locale for parsing nsswitch.conf (bug 33519)
The keywords in nsswitch.conf are ASCII-only, but some locales map ASCII
characters to non-ASCII characters in case conversion.
2025-10-08 14:34:24 +02:00
Uros Bizjak 3ee23564ce x86: Use typeof_member style in RSEQ area access expressions
Update RSEQ access macros to use `(struct rseq_area) {}.member`
in _Static_assert and __typeof expressions, instead of
RSEQ_SELF()->member.  This adopts the typeof_member style, avoiding
reliance on RSEQ_SELF for compile-time expressions.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-08 09:35:15 +02:00
Uros Bizjak 99518a3a35 x86: Simplify RSEQ area access expressions
Replace manual cast with a direct
`(struct rseq_area __seg_gs *)__rseq_offset` dereference to access
`member`.  This avoids redundant `offsetof(struct rseq_area, member)`
and improves readability while preserving semantics.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-08 09:35:15 +02:00
Uros Bizjak e47728a77c x86: Simplify stack and pointer guard macros
Replace manual casts with a direct `(__tcbhead_t __seg_gs *)0`
dereferences for `stack_guard` and `pointer_guard`.  This makes
the macros more straightforward and removes the dependency on
<stdint.h>.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-08 09:35:15 +02:00
Uros Bizjak f48b12aab6 x86: Simplify TCB access expressions
Replace manual cast with a direct `(__typeof(*descr) __seg_gs *)0`
dereference to access `member`.  This avoids redundant
`offsetof(struct pthread, member)` and improves readability while
preserving semantics.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-08 09:35:15 +02:00
Sunil K Pandey a114e29ddd x86: Detect Intel Nova Lake Processor
Detect Intel Nova Lake Processor and tune it similar to Intel Panther
Lake.  https://cdrdv2.intel.com/v1/dl/getContent/671368 Section 1.2.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-07 20:50:24 -07:00
Sunil K Pandey f8dd52901b x86: Detect Intel Wildcat Lake Processor
Detect Intel Wildcat Lake Processor and tune it similar to Intel Panther
Lake.  https://cdrdv2.intel.com/v1/dl/getContent/671368 Section 1.2.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-07 16:41:06 -07:00
Sachin MongaandPaul Murphy 2ea943f7d4 ppc64le: Restore optimized strncmp for power10
This patch addresses the actual cause of CVE-2025-5745

The vector non-volatile registers are not used anymore for
32 byte load and comparison operation

Additionally, the assembler workaround used earlier for the
instruction lxvp is replaced with actual instruction.

Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
Co-authored-by: Paul Murphy <paumurph@redhat.com>
2025-10-07 03:25:42 -05:00
Sachin MongaandPaul Murphy 9a40b1cda5 ppc64le: Restore optimized strcmp for power10
This patch addresses the actual cause of CVE-2025-5702

The vector non-volatile registers are not used anymore for
32 byte load and comparison operation

Additionally, the assembler workaround used earlier for the
instruction lxvp is replaced with actual instruction.

Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
Co-authored-by: Paul Murphy <paumurph@redhat.com>
2025-10-07 03:20:44 -05:00
Collin Funk fcfbc3ee31 manual: check the correct variable in SIOCATMARK example [BZ #33093]
* manual/socket.texi (Out-of-Band Data): Check the atmark variable which
is set by the ioctl instead of the undefined result variable.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-06 19:14:59 -07:00
Yury Khrustalev b96031cb56 manual: describe syscall numbers not supported via syscall()
The syscall() function allows to make system calls directly, however,
in the case of system calls that affect internal state of process or
thread, the caller would have to take care of extensive setup necessary
for the internals of Glibc to work correctly in the child threads. This
may make using syscall() with these syscall numbers impractical and
prone to undefined behaviour.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-06 16:48:07 +01:00
Bruno Haible ed5b1fad62 manual: fix some mistakes in the indices [BZ #24657]
* manual/errno.texi (Error Messages): Add error_print_progname to the
variable index.
* manual/sysinfo.texi (Host Identification): Fix typo of the
getdomainname function.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-05 21:05:26 -07:00
Collin Funk e6cbc38bfb manual: Fix missing reference to the mmap function [BZ #20473]
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-03 14:42:41 -07:00
Adhemerval Zanella 0c8cdb10a1 arm: Add ARM VFPv4 VFMA instruction support in fma/fmaf (BZ 15503)
It is enabled through math-use-builtins-fma.h if  glibc is built
for VPFv4 (__ARM_FEATURE_FMA predefined by GCC), or through IFUNC
(testing HWCAP_ARM_VFPv4) otherwise.

Checked on arm-linux-gnueabihf.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-03 15:19:54 -03:00
Adhemerval Zanella 61ac7c6a75 math: Optimize flt-32 remainder implementation
With same micro-optimization done for the double variant:

  * Combine the |y| zero check.
  * Rework the check to adjust result and call fmod.
  * Remove one check after fmod.
  * Remove float-int-float roundtrip on return.

Also use math_config.h macros and indent the code.  The resulting
strategy is different in many places that I think requires a
different Copyright.

I see the following performance improvements using remainder benchtests
(using reciprocal-throughput metric):

Architecture     | Input           |   master |   patch  | Improvemnt
-----------------|-----------------|----------|-----------------------
x86_64           | subnormals      |  20.4176 |  19.6144 |      3.93%
x86_64           | normal          |  54.0939 |  52.2343 |      3.44%
x86_64           | close-exponent  |  23.9120 |  22.3768 |      6.42%
aarch64          | subnormals      |   9.2423 |   8.3825 |      9.30%
aarch64          | normal          |  30.5393 |   29.244 |      4.24%
aarch64          | close-exponent  |  15.5405 |  13.9256 |     10.39%

The aarch64 used as Neoverse-N1, gcc 15.1.1; while the x86_64 was
a AMD Ryzen 9 5900X, gcc 15.2.1.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-03 15:19:44 -03:00
Adhemerval Zanella f0facb2d27 math: Optimize dbl-64 remainder implementation
The commit 34b9f8bc17 provides an optimized fmod implementation; use
the same strategy used for remainderf and implement the double variant
on top of fmod.

I see the following performance improvements using remainder benchtests
(using reciprocal-throughput metric):

Architecture     | Input           |   master |   patch  | Improvemnt
-----------------|-----------------|----------|-----------------------
x86_64           | subnormals      |  76.1345 |  21.5334 |     71.72%
x86_64           | normal          | 553.2670 | 426.5670 |     22.90%
x86_64           | close-exponent  |  30.5111 |  22.6893 |     25.64%
aarch64          | subnormals      |  26.0734 |   8.4876 |     67.45%
aarch64          | normal          | 205.2590 |  200.082 |      2.52%
aarch64          | close-exponent  |  13.8481 |  13.6663 |      1.31%

The aarch64 used as Neoverse-N1, gcc 15.1.1; while the x86_64 was
a AMD Ryzen 9 5900X, gcc 15.2.1.

This implementation also fixes the math/test-double-remainder issues
on alpha.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-03 15:19:31 -03:00
William Hunt 849a274531 malloc: Cleanup macros, asserts and sysmalloc_mmap_fallback
Refactor malloc.c to remove dead code, create macros to abstract duplicated
code, and cleanup sysmalloc_mmap_fallback to remove logic not related to the
mmap call.

Change the return type of mmap_base to uintptr_t since this allows using
operations on the return value, and avoids casting in both calls in
mremap_chunk and munmap_chunk.

Cleanup sysmalloc_mmap_fallback. Remove unused parameters nb, oldsize
and av. Remove redundant overflow check and instead use size_t for all
parameters except extra_flags to prevent overflows. Move logic not concerned
with the mmap call itself outside the function after both calls to
sysmalloc_mmap_fallback are made; this means move code for naming the VMA
and marking the arena being extended as non-contiguous to the calling code to
be handled in the case that the mmap is successful. Calculate the fallback
size from nb to avoid modifying size after it has been set for MORECORE.

Remove unused noncontiguous macro.

Remove redundant assert for checking unreachable option for global_max_fast.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-03 16:34:10 +00:00
Collin Funk 6d9e110577 math: fix Wshift-overflow warning.
When compiling on x86_64 with -Wshift-overflow=2 you can see the
following warning:

../sysdeps/ieee754/flt-32/math_config.h: In function ‘is_inf’:
../sysdeps/ieee754/flt-32/math_config.h:184:37: warning: result of ‘2139095040 << 1’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=]
  184 |   return (x << 1) == (EXPONENT_MASK << 1);
      |                                     ^~

This patch adjusts the definitions to use UINT32_C. This matches the
definitions in sysdeps/ieee754/dbl-64/math_config.h which use UINT64_C
for these definitions.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-02 18:01:23 -07:00
Alejandro Colomar 3746668bcf tests-mbwc/tst_funcs.h: Fix typo
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-01 14:49:10 -03:00
Prasanna Paithankar 4ae9b66048 shm-directory: Truncated struct member name length
The struct shmdir_name in include/shm-directory.h has name field to
contains the full path of the POSIX IPC object (shm and sem).
The size was previously set to sizeof (SHMDIR) + 4 + NAME_MAX, where 4
bytes were reserved for the optional "sem." prefix.

This led to incorrect execution of the __shm_get_name function
in posix/shm-directory.c which is used accross in shm_[open/unlink] and
sem_[open/unlink] functions.

For shm_[open/unlink]:
This is because the name field was large enough to hold 268 characters
(255 + 4 + 9) instead of the maximum allowed 263 characters (255 + 9).
This caused the __shm_get_name to not throw ENAMETOOLONG error when the
name length exceeded NAME_MAX (255) upto 259 characters.

For sem_[open/unlink]:
Similarly, the __shm_get_name incorrectly returned success for names of
length 255 instead of 251 (255 - 4).

This was overlooked as finally these functions throw the correct
ENAMETOOLONG error; which was thrown by the openat syscall, which is
called later in the shm_* and sem_* functions.

This patch corrects the size of name field in struct shmdir_name to
sizeof (SHMDIR) + NAME_MAX. The __shm_get_name function return
ENAMETOOLONG if alloc_buffer_has_failed returns true (which only happens
when copy length > alloc_buffer_size (buffer)).

Relevant runtime monitoring were done in gdb to confirm the same.

Signed-off-by: Prasanna Paithankar <paithankarprasanna@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-10-01 14:49:10 -03:00
Adhemerval Zanella 4324a1490e benchtests: Add remainderf benchtest
The inputs are based on fmodf-inputs.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-01 14:49:10 -03:00
Adhemerval Zanella 989b47acf0 benchtests: Add remainder benchtest
The inputs are based on fmod-inputs.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-01 14:49:10 -03:00
Joseph Myers 48c053fd62 Use Linux 6.17 in build-many-glibcs.py
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2025-10-01 15:15:43 +00:00
Joseph Myers a7ddbf456d Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23
C23 adds once_flag, ONCE_FLAG_INIT and call_once to stdlib.h (in C11
they were only in threads.h, in C23 they are in both headers; this
change came from N2840).  Implement this change, with a
bits/types/once_flag.h header for the common type and initializer
definitions.

Note that there's an omnibus bug (bug 33001) that covers more than
just these missing definitions.

This doesn't seem a significant enough feature to be worth mentioning
in NEWS.

ISO C is not concerned with whether functions are in libc or
libpthread, but POSIX links this to what header they are declared in,
so functions declared in stdlib.h are supposed to be in libc.
However, the current edition of POSIX is based on C17; hopefully Hurd
glibc will have completed the merge of libpthread into libc (in
particular, moving call_once) well before a future edition of POSIX
based on C23 (or a later version of ISO C) is released.

Tested for x86_64 and x86.
2025-10-01 15:15:15 +00:00
Joseph Myers 0f201f4a81 Implement C23 memset_explicit (bug 32378)
Add the C23 memset_explicit function to glibc.  Everything here is
closely based on the approach taken for explicit_bzero.  This includes
the bits that relate to internal uses of explicit_bzero within glibc
(although we don't currently have any such internal uses of
memset_explicit), and also includes the nonnull attribute (when we
move to nonnull_if_nonzero for various functions following C2y, this
function should be included in that change).

The function is declared both for __USE_MISC and for __GLIBC_USE (ISOC23)
(so by default not just for compilers defaulting to C23 mode).

Tested for x86_64 and x86.
2025-10-01 15:14:09 +00:00
Collin Funk a8ad2e9e43 manual: Fix missing declaration in inetcli example.
Previously this file failed to compile with the following errors:

    $ gcc manual/examples/inetcli.c
    manual/examples/inetcli.c: In function ‘write_to_server’:
    manual/examples/inetcli.c:36:37: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
       36 |   nbytes = write (filedes, MESSAGE, strlen (MESSAGE) + 1);
          |                                     ^~~~~~
    manual/examples/inetcli.c:26:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
       25 | #include <netdb.h>
      +++ |+#include <string.h>
       26 |
    manual/examples/inetcli.c:36:37: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
       36 |   nbytes = write (filedes, MESSAGE, strlen (MESSAGE) + 1);
          |                                     ^~~~~~
    manual/examples/inetcli.c:36:37: note: include ‘<string.h>’ or provide a declaration of ‘strlen’

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk 1c539d79f6 manual: Fix compiler errors in inetsrv example.
Previously this file failed to compile with the following errors:

    $ gcc manual/examples/inetsrv.c
    manual/examples/inetsrv.c: In function ‘main’:
    manual/examples/inetsrv.c:97:31: error: passing argument 3 of ‘accept’ from incompatible pointer type [-Wincompatible-pointer-types]
       97 |                               &size);
          |                               ^~~~~
          |                               |
          |                               size_t * {aka long unsigned int *}
    In file included from manual/examples/inetsrv.c:23:
    /usr/include/sys/socket.h:307:42: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘size_t *’ {aka ‘long unsigned int *’}
      307 |                    socklen_t *__restrict __addr_len);
          |                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
    manual/examples/inetsrv.c:105:26: error: implicit declaration of function ‘inet_ntoa’ [-Wimplicit-function-declaration]
      105 |                          inet_ntoa (clientname.sin_addr),

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk e465aeed59 manual: Fix compiler errors in filesrv example.
Previously this file failed to compile with the following errors:

    $ gcc manual/examples/filesrv.c
    manual/examples/filesrv.c: In function ‘main’:
    manual/examples/filesrv.c:37:3: error: implicit declaration of function ‘unlink’ [-Wimplicit-function-declaration]
       37 |   unlink (SERVER);
          |   ^~~~~~
    manual/examples/filesrv.c:40:10: error: implicit declaration of function ‘make_named_socket’ [-Wimplicit-function-declaration]
       40 |   sock = make_named_socket (SERVER);
          |          ^~~~~~~~~~~~~~~~~
    manual/examples/filesrv.c:46:54: error: passing argument 6 of ‘recvfrom’ from incompatible pointer type [-Wincompatible-pointer-types]
       46 |                          (struct sockaddr *) & name, &size);
          |                                                      ^~~~~
          |                                                      |
          |                                                      size_t * {aka long unsigned int *}
    In file included from manual/examples/filesrv.c:21:
    /usr/include/sys/socket.h:165:48: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘size_t *’ {aka ‘long unsigned int *’}
      165 |                          socklen_t *__restrict __addr_len);
          |                          ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

This patch fixes the missing declaration for unlink and uses
'socklen_t *' for the fourth argument of recv from. The
make_named_socket function is defined in the manual.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk ae77ce91c8 manual: Fix missing declaration in select example.
Without _GNU_SOURCE defined this file fails to compile with the
following error:

    $ gcc manual/examples/select.c
    manual/examples/select.c: In function ‘input_timeout’:
    manual/examples/select.c:44:10: error: implicit declaration of function ‘TEMP_FAILURE_RETRY’ [-Wimplicit-function-declaration]
       44 |   return TEMP_FAILURE_RETRY (select (FD_SETSIZE,
          |          ^~~~~~~~~~~~~~~~~~

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk 8df2a7811e manual: Fix missing declaration in setjmp example.
Previously this file would fail to compile with the following error:

    $ gcc manual/examples/setjmp.c
    manual/examples/setjmp.c: In function ‘main’:
    manual/examples/setjmp.c:37:7: error: implicit declaration of function ‘do_command’ [-Wimplicit-function-declaration]
       37 |       do_command ();
          |       ^~~~~~~~~~
    manual/examples/setjmp.c: At top level:
    manual/examples/setjmp.c:42:1: warning: conflicting types for ‘do_command’; have ‘void(void)’
       42 | do_command (void)
          | ^~~~~~~~~~
    manual/examples/setjmp.c:37:7: note: previous implicit declaration of ‘do_command’ with type ‘void(void)’
       37 |       do_command ();
          |       ^~~~~~~~~~

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk dd4e8ae64e manual: fix missing include in sigh1 example.
Previously this file would fail to compile with the following error:

    $ gcc manual/examples/sigh1.c
    manual/examples/sigh1.c: In function ‘main’:
    manual/examples/sigh1.c:46:3: error: implicit declaration of function ‘alarm’ [-Wimplicit-function-declaration]
       46 |   alarm (2);
          |   ^~~~~

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk 8a80c7f9d7 manual: Fix missing declaration in strdupa example.
Without _GNU_SOURCE defined this file fails to compile with the
following error:

    $ gcc manual/examples/strdupa.c
    manual/examples/strdupa.c: In function ‘main’:
    manual/examples/strdupa.c:27:19: error: implicit declaration of function ‘strdupa’; did you mean ‘strdup’? [-Wimplicit-function-declaration]
       27 |   char *wr_path = strdupa (path);
          |                   ^~~~~~~
          |                   strdup
    manual/examples/strdupa.c:27:19: error: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk 0d98af2e1d manual: Allow getsubopt example to compile with GCC 15.
GCC 15 turned -Wincompatible-pointer-types into a compiler error instead
of a warning by default. This patch prevents the following error:

    $ gcc manual/examples/subopt.c
    manual/examples/subopt.c: In function ‘main’:
    manual/examples/subopt.c:64:40: error: passing argument 2 of ‘getsubopt’ from incompatible pointer type [-Wincompatible-pointer-types]
       64 |           switch (getsubopt (&subopts, mount_opts, &value))
          |                                        ^~~~~~~~~~
          |                                        |
          |                                        const char **
    In file included from manual/examples/subopt.c:19:
    /usr/include/stdlib.h:1100:47: note: expected ‘char * const* restrict’ but argument is of type ‘const char **’
     1100 |                       char *const *__restrict __tokens,
          |                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk 85a31b7764 manual: Fix missing include in memopen example.
Previously this file would fail to compile with the following error:

    $ gcc manual/examples/memopen.c
    manual/examples/memopen.c: In function ‘main’:
    manual/examples/memopen.c:28:30: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
       28 |   stream = fmemopen (buffer, strlen (buffer), "r");
          |                              ^~~~~~
    manual/examples/memopen.c:19:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
       18 | #include <stdio.h>
      +++ |+#include <string.h>
       19 |
    manual/examples/memopen.c:28:30: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
       28 |   stream = fmemopen (buffer, strlen (buffer), "r");
          |                              ^~~~~~
    manual/examples/memopen.c:28:30: note: include ‘<string.h>’ or provide a declaration of ‘strlen’

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk a2a773992d manual: Fix missing declaration in twalk example.
Without _GNU_SOURCE defined this file fails to compile with the
following error:

    $ gcc manual/examples/twalk.c
    manual/examples/twalk.c: In function ‘twalk’:
    manual/examples/twalk.c:55:3: error: implicit declaration of function ‘twalk_r’; did you mean ‘twalk’? [-Wimplicit-function-declaration]
       55 |   twalk_r (root, twalk_with_twalk_r_action, &closure);
          |   ^~~~~~~
          |   twalk

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk 5af86c5eb0 manual: Fix missing include in sigusr example.
Previously this file would fail to compile with the following error:

    $ gcc manual/examples/sigusr.c
    manual/examples/sigusr.c: In function ‘child_function’:
    manual/examples/sigusr.c:46:3: error: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
       46 |   exit (0);
          |   ^~~~
    manual/examples/sigusr.c:23:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
       22 | #include <unistd.h>
      +++ |+#include <stdlib.h>
       23 | /*@end group*/
    manual/examples/sigusr.c:46:3: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
       46 |   exit (0);
          |   ^~~~
    manual/examples/sigusr.c:46:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk 1912550f62 manual: Fix missing includes in the mbstouwcs example.
Previously this file would fail to compile with the following error:

    $ gcc manual/examples/mbstouwcs.c
    manual/examples/mbstouwcs.c: In function ‘mbstouwcs’:
    manual/examples/mbstouwcs.c:34:11: error: ‘errno’ undeclared (first use in this function)
       34 |           errno = EILSEQ;
          |           ^~~~~
    manual/examples/mbstouwcs.c:5:1: note: ‘errno’ is defined in header ‘<errno.h>’; this is probably fixable by adding ‘#include <errno.h>’
        4 | #include <wchar.h>
      +++ |+#include <errno.h>
        5 |
    manual/examples/mbstouwcs.c:34:11: note: each undeclared identifier is reported only once for each function it appears in
       34 |           errno = EILSEQ;
          |           ^~~~~
    manual/examples/mbstouwcs.c:34:19: error: ‘EILSEQ’ undeclared (first use in this function)
       34 |           errno = EILSEQ;
          |                   ^~~~~~
    manual/examples/mbstouwcs.c:47:20: error: implicit declaration of function ‘towupper’ [-Wimplicit-function-declaration]
       47 |           *wcp++ = towupper (wc);
          |                    ^~~~~~~~
    manual/examples/mbstouwcs.c:5:1: note: include ‘<wctype.h>’ or provide a declaration of ‘towupper’
        4 | #include <wchar.h>
      +++ |+#include <wctype.h>
        5 |
    manual/examples/mbstouwcs.c:47:20: warning: incompatible implicit declaration of built-in function ‘towupper’ [-Wbuiltin-declaration-mismatch]
       47 |           *wcp++ = towupper (wc);
          |                    ^~~~~~~~
    manual/examples/mbstouwcs.c:47:20: note: include ‘<wctype.h>’ or provide a declaration of ‘towupper’

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk a86118d661 manual: Fix missing include in group and user database example.
Previously this file would fail to compile with the following error:

    $ gcc manual/examples/db.c
    db.c: In function ‘main’:
    db.c:37:7: error: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
       37 |       printf ("Couldn't find out about user %d.\n", (int) me);
          |       ^~~~~~
    db.c:23:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
       22 | #include <stdlib.h>
      +++ |+#include <stdio.h>
       23 |
    db.c:37:7: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
       37 |       printf ("Couldn't find out about user %d.\n", (int) me);
          |       ^~~~~~
    db.c:37:7: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
    db.c:42:3: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
       42 |   printf ("I am %s.\n", my_passwd->pw_gecos);
          |   ^~~~~~
    db.c:42:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-29 17:01:54 -07:00
Collin Funk e7eadbb29f Linux: Fix tst-copy_file_range-large test on recent kernels [BZ #33498]
Instead of a negative return value the fixed FUSE copy_file_range will
silently truncate the size to UINT_MAX & PAGE_MASK [1]. Allow that value
to be returned as well.

[1] https://github.com/torvalds/linux/commit/1e08938c3694f707bb165535df352ac97a8c75c9

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-27 18:18:04 -07:00
Luna Lamb 653e6c4fff AArch64: Implement AdvSIMD and SVE log10p1(f) routines
Vector variants of the new C23 log10p1 routines.

Note: Benchmark inputs for log10p1(f) are identical to log1p(f)

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-09-27 12:45:59 +00:00
Luna Lamb db42732474 AArch64: Implement AdvSIMD and SVE log2p1(f) routines
Vector variants of the new C23 log2p1 routines.

Note: Benchmark inputs for log2p1(f) are identical to log1p(f).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-09-27 12:44:09 +00:00
Florian Weimer afce5fccdf manual: Improve documentation of the shutdown function
Document the SHUT_* constants and attempt to explain the
implications for Linux TCP and UNIX domain sockets.

The Linux TCP behavior was discovered when writing the
socket/tst-shutdown test.

Suggested by Sergey Organov in
<https://inbox.sourceware.org/libc-help/qblfrh$4m4i$1@blaine.gmane.org/>.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-25 08:37:13 +02:00
Uros Bizjak a9a8b106bb x86: Restore "*&" GCC asm memory operand workaround to installed fpu-control.h
fpu_control.h is an installed header so a wider range of compiler versions
(including ones older than GCC 9) are relevant with it than are relevant
for building glibc.

Fixes commit 3014dec3ad
('x86: Remove obsolete "*&" GCC asm memory operand workaround')

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
2025-09-24 08:04:41 +02:00
Samuel Thibault 7ebac6bf94 hurd: Fix building on i686-gnu
vm_size_t and rlim_t may not be the same type.

Fixes commit 802b0eba51
("hurd: implement RLIMIT_AS against Mach RPCs")
2025-09-23 21:43:59 +02:00
Adhemerval Zanella c40832acff math: Remove unused files
The multiprecision slow paths were removed in glibc 2.28.
2025-09-23 10:29:24 -03:00
Adhemerval Zanella 490cacb099 benchtests: Add workload for tgammaf-inputs 2025-09-23 10:29:24 -03:00
Jovan Dmitrovic 70d45632ad mips: Fix delay slot filling in bsd-setjmp.S
In the !defined __PIC__ case, we cannot guarantee that the delay slot
is properly filled at the final `j` instuction without reordering
active.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2025-09-23 10:29:24 -03:00
Jovan Dmitrovic 3ac2833ec7 mips: Remove strcmp.S
Testing strcmp on MIPS hardware shows that strcmp.S performs worse
than the combination of using the generic strcmp.c implementation
alongside -funroll-loops.

Suggested-by:  Joseph Myers <josmyers@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2025-09-23 10:29:24 -03:00
Adhemerval Zanella c1016b727a assert: Refactor assert/assert_perror
It now calls __libc_assert, which contains similar logic. The assert
call only requires memory allocation for the message translation, so
test-assert2.c is adapted to handle it.

It also removes the fxprintf from assert/assert_perror; although it
is not 100% backwards-compatible (write message only if there is a
file descriptor associated with the stderr). It now writes bytes
directly without going through the wide stream state.

Checked on aarch64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-23 10:29:24 -03:00
Adhemerval Zanella 855bfa2566 nptl: Fix MADV_GUARD_INSTALL logic for thread without guard page (BZ 33356)
The main issue is that setup_stack_prot fails to account for cases where
the cached thread stack lacks a guard page, which can cause madvise to
fail. Update the logic to also handle whether MADV_GUARD_INSTALL is
supported when resizing the guard page.

Checked on x86_64-linux-gnu with 6.8.0 and 6.15 kernels.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-23 10:29:24 -03:00
Uros Bizjak b8254a047f x86_64: Fix number of operands mismatch for `vdivss'
Fixes commit ff8be6152b
('x86: Use "%v" to emit VEX encoded instructions for AVX targets')

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
2025-09-23 08:13:13 +02:00
Uros Bizjak ff8be6152b x86: Use "%v" to emit VEX encoded instructions for AVX targets
Legacy encodings of SSE instructions incur AVX-SSE domain transition
penalties on some Intel microarchitectures (e.g. Haswell, Broadwell).
Using the VEX forms avoids these penatlies and keeps all instructions
in the VEX decode domain.  Use "%v" sequence to emit the "v" prefix
for opcodes when compiling with -mavx.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-22 17:33:25 +02:00
Uros Bizjak 3014dec3ad x86: Remove obsolete "*&" GCC asm memory operand workaround
GCC now accept plain variable names as valid lvalues for "m"
constraints, automatically spilling locals to memory if necessary.
The long-standing "*&" pattern was originally used as a defensive
workaround for older compiler versions that rejected operands
such as:

     asm ("incl %0" : "+m"(x));

with errors like "memory input is not directly addressable".

Modern compilers (GCC >= 9) reliably generate correct code
without the workaround, and the resulting assembly is identical.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-22 17:33:25 +02:00
Wilco Dijkstra eba46f7077 benchtests: Fix warning in bench-strchr.c
Ensure benchtests compile with trunk GCC.
2025-09-22 12:42:57 +00:00
Wilco Dijkstra 9825f9b823 NEWS: Update with removal of dumped heaps
Support for dumped heaps has been removed - malloc_set_state() now always
returns the error code -1.
2025-09-22 12:42:43 +00:00
Samuel Thibault b7e0ec907b hurd: Fix RLIM_INFINITY on 64b
rlim_t is 64b on 64b systems, so we should extend RLIM_INFINITY to that,
not only RLIM64_INFINITY or requiring 64b offsets.

This is similar to Linux headers.
2025-09-22 02:30:14 +02:00
Samuel Thibault 81a6e97791 hurd: Note BZ #30166 as fixed
802b0eba51 ("hurd: implement RLIMIT_AS against Mach RPCs") brought the
needed RLIMIT_AS support for memory-crunchy tests.
2025-09-22 02:17:50 +02:00
Diego Nieto Cid 802b0eba51 hurd: implement RLIMIT_AS against Mach RPCs
Check for VM limit RPCs

  * config.h.in: add #undef for HAVE_MACH_VM_GET_SIZE_LIMIT and
    HAVE_MACH_VM_SET_SIZE_LIMIT.
  * sysdeps/mach/configure.ac: use mach_RPC_CHECK to check for
    vm_set_size_limit and vm_get_size_limit RPCs in gnumach.defs.
  * sysdeps/mach/configure: regenerate file.

Use vm_get_size_limit to initialize RLIMIT_AS

  * hurd/hurdrlimit.c(init_rlimit): use vm_get_size_limit to initialize
    RLIMIT_AS entry of the _hurd_rlimits array.

Notify the kernel of the new VM size limits

  * sysdeps/mach/hurd/setrlimit.c: use the vm_set_size_limit RPC,
    if available, to notify the kernel of the new limits. Retry RPC
    calls if they were interrupted by a signal.
Message-ID: <03fb90a795b354a366ee73f56f73e6ad22a86cda.1755220108.git.dnietoc@gmail.com>
2025-09-22 00:52:37 +02:00
Samuel Thibault c9cc047e9f hurd: catch SIGSEGV on returning from signal handler
On stack overflow typically, we may not actually have room on the stack to
trampoline back from the signal handler.  We have to detect this before
locking the ss, otherwise the signal thread will be stuck on taking the
ss lock while trying to post SIGSEGV.
2025-09-21 23:45:40 +02:00
DJ Delorie 8aa99c592b manual: Explain our implementation-defined memstream semantics
Posix Issue 8 adds an implementation-defined item we don't already
cover, about seeking backwards.  This defines our implentation.

https://issues.redhat.com/browse/RHEL-3008
https://pubs.opengroup.org/onlinepubs/9799919799/functions/open_memstream.html

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by Collin Funk <collin.funk1@gmail.com>
2025-09-19 14:51:05 -04:00
Wilco Dijkstra 85c5b504aa malloc: Remove dumped heap support
Remove support for obsolete dumped heaps.  Dumping heaps was discontinued
8 years ago, however loading a dumped heap is still supported. This blocks
changes and improvements of the malloc data structures - hence it is time
to remove this.  Ancient binaries that still call malloc_set_state will now
get the -1 error code.  Update tst-mallocstate.c to just check for this.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-19 13:11:56 +00:00
Wilco Dijkstra aebaeb2c33 AArch64: Update math-vector-fortran.h
Update math-vector-fortran.h with the latest set of math functions
and sort by name.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2025-09-19 12:57:47 +00:00
Yury Khrustalev 20446e3502 manual: fix typo in tunables.texi 2025-09-19 12:03:38 +01:00
Dev Jain f807e85c31 malloc: Hoist common unlock out of if-else control block
We currently unlock the arena mutex in arena_get_retry() unconditionally.
Therefore, hoist out the unlock from the if-else control block.

Signed-off-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-18 15:50:15 -04:00
Florian Weimer 855a67c3cc stdlib: Use support_accept_oom in test-bz22786
The realpath call may trigger OOM termination of the test process
under difficult-to-predict circumstances.  (It depends on available
RAM and swap.)  Therefore, instruct the test driver to ignore
an OOM process termination during the realpath call.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-09-18 19:11:38 +02:00
Florian Weimer 480660e270 support: Add support_accept_oom to heuristically support OOM errors
Some tests may trigger the kernel OOM handler under conditions
which are difficult to predict (depending on available RAM and
swap space).  If we can determine specific regions which might
do this and this does not contradict the test object, the
functions support_accept_oom (true) and support_accept_oom (false)
can be called at the start and end, and the test driver will
ignore SIGKILL signals.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-09-18 19:11:38 +02:00
Yury Khrustalev 3fd794264e support: fix build failure due to lack of stdbool.h
On some targets using bool in support/check_mem_access.h resulted
in build error due to stdbool.h not being included, fix this.

See 9be489d778 for details.

Reported-by: Joseph Myers <josmyers@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-17 13:02:01 +01:00
H.J. Lu 1fa5773eb1 x86: Don't use asm statement for trunc/truncf
Compiler inlines trunc and truncf with SSE4.1.  But older versions of GCC
doesn't inline them with -Os:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121861

Don't use asm statement for trunc and truncf if compiler can inline them
with -Os.  It removes one register move with GCC 16:

__modff_sse41:                        __modff_sse41:
.LFB23:                               .LFB23:
   .cfi_startproc                        .cfi_startproc
   endbr64                               endbr64
   subq  $24, %rsp                       subq  $24, %rsp
   .cfi_def_cfa_offset 32                .cfi_def_cfa_offset 32
   movq  %fs:40, %rax                    movq  %fs:40, %rax
   movq  %rax, 8(%rsp)                   movq  %rax, 8(%rsp)
   xorl  %eax, %eax                      xorl  %eax, %eax
   movd  %xmm0, %eax                     movd  %xmm0, %eax
   addl  %eax, %eax                      addl  %eax, %eax
   cmpl  $-16777216, %eax                cmpl  $-16777216, %eax
   je .L7                                je .L7
                                   >     movaps   %xmm0, %xmm3
   movaps   %xmm0, %xmm4                 movaps   %xmm0, %xmm4
   movss .LC0(%rip), %xmm2         |     movss .LC0(%rip), %xmm1
   movaps   %xmm2, %xmm3           |     movaps   %xmm1, %xmm2
   andps %xmm0, %xmm2              |     roundss  $11, %xmm3, %xmm3
   roundss $11, %xmm0, %xmm1       |     subss %xmm3, %xmm4
   subss %xmm1, %xmm4              |     andps %xmm0, %xmm1
   andnps   %xmm4, %xmm3           |     andnps   %xmm4, %xmm2
   orps  %xmm3, %xmm2              |     orps  %xmm2, %xmm1
.L3:                                  .L3:
   movss %xmm1, (%rdi)             |     movss %xmm3, (%rdi)
   movq  8(%rsp), %rax                   movq  8(%rsp), %rax
   subq  %fs:40, %rax                    subq  %fs:40, %rax
   jne   .L8                             jne   .L8
   movaps   %xmm2, %xmm0           |     movaps   %xmm1, %xmm0
   addq  $24, %rsp                       addq  $24, %rsp
   .cfi_remember_state                   .cfi_remember_state
   .cfi_def_cfa_offset 8                 .cfi_def_cfa_offset 8
   ret                                   ret

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
2025-09-17 04:30:11 -07:00
Aurelien Jarno 13d67746cb ldd: define the "unused" variable
The "unused" variable could be use unitialized, which is an issue if ldd
is ran with "-u". Fix that by defining the variable to an empty value,
just like it is already done for the bind_now, warn and verbose
variables.

Reported-by: Johan Palmqvist <johan.palmqvist@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-09-15 20:52:23 +02:00
H.J. Lu d6666eea3e i686: Compile .op files and gmon tests with -mfentry
On i686, after GCC 16 commit:

commit 07d8de9174c421d719649639a1452b8b9f2eee32
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jul 2 08:58:23 2025 +0800

    x86-64: Add --enable-x86-64-mfentry

which warns ‘-pg’ without ‘-mfentry’, when glibc is configured with
--disable-default-pie, GCC 16 fails to compile .op files and gmon tests
with error:

cc1: error: ‘-pg’ without ‘-mfentry’ may be unreliable with shrink wrapping [-Werror]

Compile .op files and gmon tests with -mfentry if it is supported by
CC/TEST_CC and glibc is configured with --disable-default-pie.  This
fixes BZ #33376.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-09-15 11:14:03 -07:00
Yury KhrustalevandAdhemerval Zanella Netto 9be489d778 support: add check_mem_access function
Add check_mem_access(addr) function to check if memory at addr can
be written or read returning false if memory is not accessible.

This function changes signal handler for SIGSEGV and SIGBUS signals
when it is called first, and it is not thread-safe.

Co-authored-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-15 09:47:41 +01:00
Uros Bizjak 041151f439 i386: Use __seg_gs qualifier to cast access to TCB in THREAD_GSCOPE_RESET_FLAG()
Use the __seg_gs named address space qualifier to cast access to the
gscope_flag in the TCB as a %gs: prefixed address.  This enables the
use of the "m" operand constraint, which informs the compiler about
memory access in the inline assembly.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
2025-09-14 21:50:50 +02:00
Uros Bizjak 3628351bcd x86_64: Use __seg_fs qualifier to cast access to TCB in THREAD_GSCOPE_RESET_FLAG()
Use the __seg_fs named address space qualifier to cast access to the
gscope_flag in the TCB as a %fs: prefixed address.  This enables the
use of the "m" operand constraint, which informs the compiler about
memory access in the inline assembly.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
2025-09-14 21:50:50 +02:00
Joseph Myers 273f80374a Fix RISC-V soft-float _FPU_SETCW for GCC 16 set-but-not-used warnings
The soft-float RISC-V definition of _FPU_SETCW results in a
-Werror=unused-but-set-variable= build failure with GCC mainline (in
math/setfpucw.c) because it does not use the dummy cw variable.
Change it to (void) (cw) as on other architectures to avoid this build
failure.

Tested with build-many-glibcs.py (compilers) for
riscv64-linux-gnu-rv64imac-lp64, which previously failed.
Reviewed-by: Sam James <sam@gentoo.org>
2025-09-13 07:11:44 -07:00
Florian Weimer 0fceed2545 nss: Group merge does not react to ERANGE during merge (bug 33361)
The break statement in CHECK_MERGE is expected to exit the surrounding
while loop, not the do-while loop with in the macro.  Remove the
do-while loop from the macro.  It is not needed to turn the macro
expansion into a single statement due to the way CHECK_MERGE is used
(and the statement expression would cover this anyway).

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-12 21:33:34 +02:00
caiyinyu cae3c9e3a1 LoongArch: Use the generic shmlab.h.
The shmlba.h file related to the LoongArch architecture was introduced
in commit 3eed5f3a1e to address the mismatch in the SHMLBA definition
between glibc and the kernel. See [1].  The SHMLBA definition was later
updated in commit d23b77953f5a. See [2].  Now, we adopt the definition
from the common layer.

[1]:
commit 3eed5f3a1e
Author: caiyinyu <caiyinyu@loongson.cn>
Date:   Thu May 25 17:01:11 2023 +0800

    LoongArch: Fix inconsistency in SHMLBA macro values between glibc and kernel

    The LoongArch glibc was using the value of the SHMLBA macro from common code,
    which is __getpagesize() (16k), but this was inconsistent with the value of
    the SHMLBA macro in the kernel, which is SZ_64K (64k). This caused several
    shmat-related tests in LTP (Linux Test Project) to fail. This commit fixes
    the issue by ensuring that the glibc's SHMLBA macro value matches the value
    used in the kernel like other architectures.

[2]:
commit d23b77953f5a4fbf94c05157b186aac2a247ae32
Author: Huacai Chen <chenhuacai@kernel.org>
Date:   Wed Jan 17 12:43:08 2024 +0800

    LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE

    LoongArch has hardware page coloring for L1 Cache, so we don't have
    cache aliases. But SFB (Store Fill Buffer) still has aliases. So we
    define SHMLBA to SZ_64K previously. But there are losts of applications
    use PAGE_SIZE rather than SHMLBA to mmap() file pages and shared pages.
    Of course we can fix them one by one, but not easy.

    On the other hand, we can simply disable SFB for 4KB page size to fix
    cache alias (there will be performance decrease, but acceptable), and
    in future we will fix SFB in hardware. So we can safely define SHMLBA to
    PAGE_SIZE (use the generic shmparam.h) to make life easier.

Signed-off-by: caiyinyu <caiyinyu@loongson.cn>
Reported-by: lixing <lixing@loongson.cn>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-12 09:42:19 +08:00
Adhemerval Zanella dbebe0c418 alpha: Fix missing inexact-flag raising for lround/lrint
The l*[rint|round]f implements uses alpha 'cvtst/s', 'addt/suc',
adn 'cvttq/svd' which are not not fully IEEE compliant w.r.t
inexact-flag raising..  Use the software fallback implementation
instead.

Checked on alpha-linux-gnu.

Tested-by: Michael Cree <mcree@orcon.net.nz>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-09-11 14:48:00 -03:00
Adhemerval Zanella cde86de627 math: Remove clz_uint64/ctz_uint64 and use stdbit.h
Checked on aarch64-linux-gnu and x86_64-linux-gnu
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-11 14:47:25 -03:00
Adhemerval Zanella bd7b04ec7c math: Split erf and erfc
Checked on x86_64-linux-gnu, aarch64-linux-gnu, and
powerpc64le-linux-gnu.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:59 -03:00
Adhemerval Zanella f40cdb65f5 math: Use internal fesetround alias on fma
To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella adecb3bec1 math: Use internal fetestexcept alias on fma
To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella 63ba1a1509 math: Add fetestexcept internal alias
To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella 41c2f1d9a3 math: Use internal feholdexcept alias on fma
To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella 08c68809d0 math: Use internal feupdateenv alias on fma
To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella 5624ee0482 math: Use internal feholdexcept alias on fma
To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella 2eb8836de7 math: Add feclearexcept internal alias
To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella 1fdb73fb3c benchtests: Add workload directive for tgamma 2025-09-11 14:46:07 -03:00
Adhemerval Zanella 5abfa1365b benchtests: Add workload directive for erf and erfc 2025-09-11 14:46:07 -03:00
Adhemerval Zanella 56e4da7ca5 benchtests: Add workload for lgamma
Random inputs in range [-20.00,20.00].
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella 2c25058aa5 benchtests: Add workload for asinh
Random input in range [-10,10].
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella ddd8c33f87 benchtests: Add workload for acosh
Random inputs in range [1.00,21.00]
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella 10ca44f1cc SHARED-FILES: Adjust core-math entries
And remove duplicate info on each file wrt glibc changes.  Also
add the core-math git repository link.
Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11 14:46:07 -03:00
Adhemerval Zanella b5d88fa6c3 math: Fix x86_64 build for -Os (BZ 33367)
The compiler might not inline the trunc function call for
USE_TRUNC_BUILTIN [1].

This patch adds an optimized __trunc/__truncf for x86 used
on modf ifunc variant to avoid the trunc libcall.

Checked on x86_64, x86_64-v2, x86_64-v3, and x86_64-v4. Used -O2 and
-Os options. Performed a full make check on x86_64 with both
 optimizations.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121861
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-11 06:23:33 -07:00
Yury Khrustalev f0b88eb784 manual: fix typo 2025-09-11 10:50:43 +01:00
Mike FABIAN 88dc93cb40 Update to Unicode 17.0.0 [BZ #33289]
Unicode 17.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 17.0.0, using
the generator scripts contributed by Mike FABIAN (Red Hat).

Changes in CHARMAP and WIDTH:

    Total added characters in newly generated CHARMAP: 4803
    Total removed characters in newly generated WIDTH: 0
    Total changed characters in newly generated WIDTH: 0
    Total added characters in newly generated WIDTH: 4512

Some combining characters and other non-spacing marks have been added
with WIDTH 0. Lots of characters have been added with WIDTH 2, most of
them are CJK Ideographs plus a few Tangut characters and 7 emoji.

Changes in ctype:

    alpha: Added 4672 characters in new ctype which were not in old ctype
    combining: Added 42 characters in new ctype which were not in old ctype
    combining_level3: Added 8 characters in new ctype which were not in old ctype
    graph: Added 4803 characters in new ctype which were not in old ctype
    lower: Missing: ʕ 0x295 LATIN LETTER PHARYNGEAL VOICED FRICATIVE
    lower: Added 27 characters in new ctype which were not in old ctype
    print: Added 4803 characters in new ctype which were not in old ctype
    punct: Added 131 characters in new ctype which were not in old ctype
    tolower: Added 28 characters in new ctype which were not in old ctype
    totitle: Added 28 characters in new ctype which were not in old ctype
    toupper: Added 28 characters in new ctype which were not in old ctype
    upper: Added 28 characters in new ctype which were not in old ctype

Nothing suspicious in the additions.

About the character removed from lower:

ʕ 0x295 LATIN LETTER PHARYNGEAL VOICED FRICATIVE

In UnicodeData.txt it changed from 'Ll' (Letter Lowercase) to 'Lo' (Letter Other):

-0295;LATIN LETTER PHARYNGEAL VOICED FRICATIVE;Ll;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP;;;;
+0295;LATIN LETTER PHARYNGEAL VOICED FRICATIVE;Lo;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP;;;;

Resolves: BZ #33289

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-11 09:42:18 +02:00
remph e20ca759af AArch64: add optimised strspn/strcspn
Requires Neon (aka. Advanced SIMD).  Looks up 16 characters at a time,
for a 2-3x perfomance improvement, and a ~30% speedup on the strtok &
strsep benchtests, as tested on Cortex A-{53,72}.

Signed-off-by: remph <lhr@disroot.org>

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-09-10 16:12:23 +00:00
Uros Bizjak 1a076b5c21 i386: Use __seg_gs qualifiers in {STACK, POINTER}_CHK_GUARD macros
Use the __seg_gs named address space qualifiers to cast reads of
the guard values in the TCB as %gs: prefixed addresses.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-10 05:32:40 -07:00
Uros Bizjak f402c54483 x86_64: Use __seg_fs qualifiers in {STACK, POINTER}_CHK_GUARD macros
Use the __seg_fs named address space qualifiers to cast reads of
the guard values in the TCB as %fs: prefixed addresses.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-10 05:32:17 -07:00
Uros Bizjak 4be94f6a9c x86: Remove x86 version of thread_pointer.h
The x86 version of thread_pointer.h is the same as the generic one.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-10 05:30:07 -07:00
Uros Bizjak e5222ceb73 x86: Remove stale __GNUC_PREREQ (11, 1) test from __thread_pointer()
GCC 12 is currently the minimum supported compiler version.
Remove no longer needed __GNUC_PREREQ (11, 1) test from
__thread_pointer().

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-10 05:30:07 -07:00
Wilco Dijkstra 19442c052c malloc: Cleanup libc_realloc
Minor cleanup of libc_realloc: remove unnecessary special cases for mmap, move
ar_ptr initialization, first check for oldmem == NULL.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-10 09:18:06 +00:00
Wilco Dijkstra 210ee29503 atomics: Remove unused atomics
Remove all unused atomics.  Replace uses of catomic_increment and
catomic_decrement with atomic_fetch_add_relaxed which maps to a standard
compiler builtin. Relaxed memory ordering is correct for simple counters
since they only need atomicity.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-10 09:18:06 +00:00
Samuel Thibault 245ea60b0e malloc: check "negative" tcache_key values by hand
instead of undefined cases from casting uintptr_t into intptr_t.
2025-09-09 23:05:00 +02:00
Uros Bizjak b8253693b7 x86: Define atomic_compare_and_exchange_{val, bool}_acq using __atomic_compare_exchange_n
No functional changes.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 07:58:52 -07:00
Uros Bizjak 935ee691bc x86: Define atomic_exchange_acq using __atomic_exchange_n
The resulting libc.so is identical on both x86_64 and
i386 targets compared to unpatched builds:

$ sha1sum libc-x86_64-old.so libc-x86_64-new.so
74eca1b87f2ecc9757a984c089a582b7615d93e7  libc-x86_64-old.so
74eca1b87f2ecc9757a984c089a582b7615d93e7  libc-x86_64-new.so
$ sha1sum libc-i386-old.so libc-i386-new.so
882bbab8324f79f4fbc85224c4c914fc6822ece7  libc-i386-old.so
882bbab8324f79f4fbc85224c4c914fc6822ece7  libc-i386-new.so

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 07:51:41 -07:00
Uros Bizjak e6b5ad1b1d x86: Define atomic_full_barrier using __sync_synchronize
For x86_64 targets, __sync_synchronize emits a full 64-bit
'LOCK ORQ $0x0,(%rsp)' instead of 'LOCK ORL $0x0,(%rsp)'.

No functional changes.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 07:44:41 -07:00
Uros Bizjak 4eef002328 x86: Remove catomic_* locking primitives
Remove obsolete catomic_* locking primitives which don't map
to standard compiler builtins.

There are still a couple of places in the tree that uses them
(malloc/arena.c and malloc/malloc.c).

x86 didn't define __arch_c_compare_and_exchange_bool_* primitives
so fallback code used __arch_c_compare_and_exchange_val_* primitives
instead.  This resulted in unoptimal code for
catomic_compare_and_exchange_bool_acq where superfluous
CMP was emitted after CMPXCHG, e.g. in arena_get2:

   775b8:	48 8d 4a 01          	lea    0x1(%rdx),%rcx
   775bc:	48 89 d0             	mov    %rdx,%rax
   775bf:	64 83 3c 25 18 00 00 	cmpl   $0x0,%fs:0x18
   775c6:	00 00
   775c8:	74 01                	je     775cb <arena_get2+0x35b>
   775ca:	f0 48 0f b1 0d 75 3d 	lock cmpxchg %rcx,0x163d75(%rip)        # 1db348 <narenas>
   775d1:	16 00
   775d3:	48 39 c2             	cmp    %rax,%rdx
   775d6:	74 7f                	je     77657 <arena_get2+0x3e7>

that now becomes:

   775b8:	48 8d 4a 01          	lea    0x1(%rdx),%rcx
   775bc:	48 89 d0             	mov    %rdx,%rax
   775bf:	f0 48 0f b1 0d 80 3d 	lock cmpxchg %rcx,0x163d80(%rip)        # 1db348 <narenas>
   775c6:	16 00
   775c8:	74 7f                	je     77649 <arena_get2+0x3d9>

OTOH, catomic_decrement does not fallback to atomic_fetch_add (, -1)
builtin but to the cmpxchg loop, so the generated code in arena_get2
regresses a bit, from using LOCK DECQ insn:

   77829:	64 83 3c 25 18 00 00 	cmpl   $0x0,%fs:0x18
   77830:	00 00
   77832:	74 01                	je     77835 <arena_get2+0x5c5>
   77834:	f0 48 ff 0d 0c 3b 16 	lock decq 0x163b0c(%rip)        # 1db348 <narenas>
   7783b:	00

to a cmpxchg loop:

   7783d:	48 8b 0d 04 3b 16 00 	mov    0x163b04(%rip),%rcx        # 1db348 <narenas>
   77844:	48 8d 71 ff          	lea    -0x1(%rcx),%rsi
   77848:	48 89 c8             	mov    %rcx,%rax
   7784b:	f0 48 0f b1 35 f4 3a 	lock cmpxchg %rsi,0x163af4(%rip)        # 1db348 <narenas>
   77852:	16 00
   77854:	0f 84 c9 fa ff ff    	je     77323 <arena_get2+0xb3>
   7785a:	eb e1                	jmp    7783d <arena_get2+0x5cd>

Defining catomic_exchange_and_add using __atomic_fetch_add solves the
above issue and generates optimal:

   77809:	f0 48 83 2d 36 3b 16 	lock subq $0x1,0x163b36(%rip)        # 1db348 <narenas>
   77810:	00 01

Depending on the target processor, the compiler may emit either
'LOCK ADD/SUB $1, m' or 'INC/DEC $1, m' instruction, due to partial
flag register stall issue.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 07:36:02 -07:00
Uros Bizjak af5b01dc26 x86: Remove unused atomics
Remove unused atomics from <sysdeps/x86/atomic-machine.h>.

The resulting libc.so is identical on both x86_64 and
i386 targets compared to unpatched builds:

$ sha1sum libc-x86_64-old.so libc-x86_64-new.so
b89aaa2b71efd435104ebe6f4cd0f2ef89fcac90  libc-x86_64-old.so
b89aaa2b71efd435104ebe6f4cd0f2ef89fcac90  libc-x86_64-new.so
$ sha1sum libc-i386-old.so libc-i386-new.so
aa70f2d64da2f0f516634b116014cfe7af3e5b1a  libc-i386-old.so
aa70f2d64da2f0f516634b116014cfe7af3e5b1a  libc-i386-new.so

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 07:29:57 -07:00
Wilco Dijkstra c7b7c80b39 atomic: Switch atomic.h to builtin atomics
Switch to standard builtin atomics by removing the defines for
!USE_ATOMIC_COMPILER_BUILTINS.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 13:57:59 +00:00
Wilco Dijkstra b568af853b atomic: Switch power to builtin atomics
Switch power to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 13:57:59 +00:00
Wilco Dijkstra 9c72e0193d atomic: Switch hppa to builtin atomics
Switch hppa to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 13:53:54 +00:00
Wilco Dijkstra 6916b7faf8 atomic: Switch sh to builtin atomics
Switch sh to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 13:53:54 +00:00
Wilco Dijkstra 666c26c243 atomic: Switch microblaze to builtin atomics
Switch microblaze to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 13:53:54 +00:00
Wilco Dijkstra 30108f8b6c atomic: Switch alpha to builtin atomics
Switch alpha to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 13:53:54 +00:00
Wilco Dijkstra 1c48da52bc atomic: Switch m68k to builtin atomics
Switch m68k to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 13:53:54 +00:00
Wilco Dijkstra 2a035debbb atomic: Use builtin atomics with USE_ATOMIC_COMPILER_BUILTINS
Use builtin atomics for atomic_compare_and_exchange_* and
atomic_exchange_and_add if USE_ATOMIC_COMPILER_BUILTINS is enabled.
This allows removing target atomic-machine.h headers.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09 13:53:54 +00:00
H.J. Lu 5c522d7a58 x86: Include <bits/stdlib-bsearch.h> in dl-cacheinfo.h
On x86-64, when glibc is configured with --enable-stack-protector=all
and compiled with -Os, ld.so crashes very early:

(gdb) r --direct
Starting program: /export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/string/test-memswap --direct

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f41b0a in bsearch (__key=__key@entry=0x7fffffffda28,
    __base=__base@entry=0x7ffff7fca140 <intel_02_known>,
    __nmemb=__nmemb@entry=68, __size=__size@entry=8,
    __compar=__compar@entry=0x7ffff7f3b691 <intel_02_known_compare>)
    at ../bits/stdlib-bsearch.h:22
22	{
(gdb) disass
Dump of assembler code for function bsearch:
   0x00007ffff7f41af0 <+0>:	push   %r15
   0x00007ffff7f41af2 <+2>:	mov    %rcx,%r15
   0x00007ffff7f41af5 <+5>:	push   %r14
   0x00007ffff7f41af7 <+7>:	push   %r13
   0x00007ffff7f41af9 <+9>:	mov    %rsi,%r13
   0x00007ffff7f41afc <+12>:	push   %r12
   0x00007ffff7f41afe <+14>:	mov    %rdi,%r12
   0x00007ffff7f41b01 <+17>:	push   %rbp
   0x00007ffff7f41b02 <+18>:	mov    %rdx,%rbp
   0x00007ffff7f41b05 <+21>:	push   %rbx
   0x00007ffff7f41b06 <+22>:	sub    $0x18,%rsp
=> 0x00007ffff7f41b0a <+26>:	mov    %fs:0x28,%r14
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We can't use stack protector at this point.
   0x00007ffff7f41b13 <+35>:	mov    %r14,0x8(%rsp)
   0x00007ffff7f41b18 <+40>:	mov    %r8,%r14
   0x00007ffff7f41b1b <+43>:	test   %rbp,%rbp
   0x00007ffff7f41b1e <+46>:	je     0x7ffff7f41b48 <bsearch+88>
   0x00007ffff7f41b20 <+48>:	mov    %rbp,%rbx
   0x00007ffff7f41b23 <+51>:	mov    %r12,%rdi
   0x00007ffff7f41b26 <+54>:	shr    $1,%rbx
   0x00007ffff7f41b29 <+57>:	imul   %r15,%rbx
   0x00007ffff7f41b2d <+61>:	add    %r13,%rbx
   0x00007ffff7f41b30 <+64>:	mov    %rbx,%rsi
(gdb) bt
 #0  0x00007ffff7f41b0a in bsearch (__key=__key@entry=0x7fffffffda28,
    __base=__base@entry=0x7ffff7fca140 <intel_02_known>,
    __nmemb=__nmemb@entry=68, __size=__size@entry=8,
    __compar=__compar@entry=0x7ffff7f3b691 <intel_02_known_compare>)
    at ../bits/stdlib-bsearch.h:22
 #1  0x00007ffff7f3c1be in intel_check_word (name=188, value=1979933440,
    has_level_2=has_level_2@entry=0x7fffffffda7f,
    no_level_2_or_3=no_level_2_or_3@entry=0x7fffffffda7e,
    cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:217
 #2  0x00007ffff7f3c29f in handle_intel (name=name@entry=188,
    cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:279
 #3  0x00007ffff7f3ccf9 in dl_init_cacheinfo (cpu_features=<optimized out>)
    at ../sysdeps/x86/dl-cacheinfo.h:852
 #4  init_cpu_features (cpu_features=<optimized out>)
    at ../sysdeps/x86/cpu-features.c:1153
 #5  0x00007ffff7f3d6f9 in __libc_start_main_impl (main=0x7ffff7f396dc <main>,
    argc=2, argv=0x7fffffffdbe8, init=<optimized out>, fini=<optimized out>,
    rtld_fini=0x0, stack_end=0x7fffffffdbd8) at ../csu/libc-start.c:269
 #6  0x00007ffff7f39901 in _start () at ../sysdeps/x86_64/start.S:115
(gdb)

The problem is that since __USE_EXTERN_INLINES isn't defined with -Os,
the inline bsearch in <bits/stdlib-bsearch.h> isn't available and the
external bsearch is compiled with stack protector.  Include
<bits/stdlib-bsearch.h> in dl-cacheinfo.h fixed BZ #33374.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-09-08 20:31:36 -07:00
Thiago Jung Bauermann 6f120faf64 Linux: Add missing si_code constants from Linux kernel
This brings the si_codes listed in siginfo-consts.h up-to-date with
Linux v6.16's include/uapi/asm-generic/siginfo.h.

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

Suggested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2025-09-08 14:12:47 -04:00
Andreas Schwab ed5da9d659 Remove futex_supports_pshared
Both NPTL and HTL support PTHREAD_PROCESS_SHARED, and since the removal of
the NaCL port there are no other pthread implementations.
2025-09-08 15:01:18 +02:00
Xi Ruoyao 3b39822a82 misc: Add support for Linux uio.h RWF_DONTCACHE flag
Linux 6.14 adds the new flag for uncached buffered IO on a filesystem
supporting it.

This caused two test failures as these tests expected the flag
0x00000080 is unused.  Add the flag definition to fix these tests on
Linux >= 6.14:

    FAIL: misc/tst-preadvwritev2
    FAIL: misc/tst-preadvwritev64v2

The test failures were not detected in routine test suite runs because
normally we create the test file in /tmp, where a tmpfs is usually
mounted, and tmpfs does not support this flag.  But it can be reproduced
with TMPDIR set to some directory in an ext4 file system.

Link: https://git.kernel.org/torvalds/c/af6505e5745b
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-08 08:22:20 -03:00
Adhemerval Zanella 3795f22d42 alpha: Align stack for alpha
As done already for x86_64 [1] and aarch64 [2].  It fixes
misc/tst-misalign-clone on alpha.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=27902
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=27939
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-08 08:21:56 -03:00
Adhemerval Zanella b9fe06a8a8 malloc: Fix Os build on some ABIs
I have not checked with all versions for all ABIs, but I saw failures
with gcc-14 on arm, alpha, hppa, i686, sparc, sh4, and microblaze.
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-08 08:21:48 -03:00
Florian Weimer b173557da9 libio: Define AT_RENAME_* with the same tokens as Linux
Linux uses different expressions for the RENAME_* and AT_RENAME_*
constants.  Mirror that in <stdio.h>, so that the macro redefinitions
do not result in preprocessor warnings.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-05 19:02:59 +02:00
Maciej W. Rozycki 5d45da09e6 testsuite: Update tests for 'xfclose' use
Convert (some) tests to use 'xfclose' rather than using plain 'fclose'
call with no error checking or plain missing such a call.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-05 11:53:31 +01:00
Maciej W. Rozycki 2d47b01de0 testsuite: Update tests for 'xfmemopen' use
Convert tests to use 'xfmemopen' rather than open-coding error checks
with 'fmemopen' or plain missing them, where 'fmemopen' itself is not
the scope of testing.  Leave 'fmemopen' tests alone.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-05 11:53:31 +01:00
Maciej W. Rozycki fe709cc245 support: Implement 'xfmemopen' for seamless 'fmemopen' use
Add 'xfmemopen' wrapper for seamless 'fmemopen' use in tests, following
'xfopen', 'xfclose', etc., and providing a standardized error reporting
facility.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-05 11:53:31 +01:00
Arjun Shankar a0dc87da2a x86_64: Unconditionally run test elf/check-dt-x86-64-plt
The intention of GLIBC_ABI_DT_X86_64_PLT is simply to mark the existence
of the fix in f8587a6189
("x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT").

Testing for GLIBC_ABI_DT_X86_64_PLT does not depend on the linker
supporting -z mark-plt.  Therefore remove this dependency on linker
support and test unconditionally.

Fixes commit 399384e0c8
("x86-64: Add GLIBC_ABI_DT_X86_64_PLT [BZ #33212]")

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-04 23:05:56 +02:00
Joseph Myers b7f904012a Fix sysdeps/mips/dl-machine-reject-phdr.h build with GCC 16
Building for MIPS has been broken with GCC mainline since mid-July,
probably GCC commit 0eac9cfee8cb0b21de866a04d5d59685ab35208f "c, c++:
Extend -Wunused-but-set-* warnings [PR44677]", because the variable
perfect_match in elf_machine_reject_phdr_p is set unconditionally, but
only used if _MIPS_SIM == _ABIO32.  Mark it with __attribute__ ((unused)),
which seems cleaner in such a conditionally-used case than making all
other logic relating to this variable conditional.

Tested with build-many-glibcs.py (compilers build, which previously
failed) for mips64-linux-gnu.
2025-09-03 16:04:49 +00:00
Hasaan Khan 8ced7815fb AArch64: Implement exp2m1 and exp10m1 routines
Vector variants of the new C23 exp2m1 & exp10m1 routines.

Note: Benchmark inputs for exp2m1 & exp10m1 are identical to exp2 & exp10
respectively, this also includes the floating point variations.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-09-02 16:50:24 +00:00
Florian Weimer 54bd776f99 Tests: Create files with mode 0666, not 0777 (bug 33171)
Mode 0777 should be used for directories only because it results
in executable entries (after typical umasks are applied).

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-09-01 15:12:28 +02:00
Jonathan Wakely 576976eacc nptl: Fix "Arch-sepecific" typo in comment 2025-09-01 13:10:48 +01:00
Xi Ruoyao 0c6cb5285b nptl: Provide __pthread_rwlock_unlock compat symbol for versions before 2.43
The symbol was unintentionally leaked on ports introduced after
GLIBC_2.34, provide the compat symbol to avoid breaking ABI on them.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-01 09:07:35 +08:00
Xi Ruoyao 4a32b39bb1 nptl: Drop IS_IN (libpthread) around hidden_proto (__pthread_rwlock_unlock)
Now libpthread is a dummy library and it no longer contains
__pthread_rwlock_unlock at all, thus IS_IN (libpthread) does not make
sense here.

It seems an left over from commit eb29dcde31 ("nptl: Move rwlock
functions with forwarders into libc") and it caused libc.so to export an
unversioned __pthread_rwlock_unlock on Linux ports introduced after the
2.34 release (loongarch and or1k) but the symbol is not ever supposed to
be exported on those new ports.  Only since the commit 3b2b88ccee
("elf: early conversion of elf p_flags to mprotect flags") the header
dependency change happened to pull in libc-lockP.h which sets
hidden_proto (__pthread_rwlock_unlock) correctly, the symbol is no
longer exported, breaking the ABI on those ports.

Remove this #if as a clean up and to prevent such a mess from happening
again.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-01 09:07:35 +08:00
DJ Delorie 6dbaed693a login: fix ut_line comparison logic
ut_line[] is not a string, it's a fixed-width character field,
and may not be NUL terminated.  Thus, the use of strcmp is incorrect.
strncmp is more appropriate as it stops at the field size.

Note that differences beyond the field size do not count here,
as (1) this test doesn't do that, and (2) such differences are
traditionally ignored (i.e. logins that are silently truncated to
8 characters, etc)

While this is "only a test", we should still demonstrate the
correct way of doing things.  Also, using strncmp avoids a
"not a string" warning from gcc if you use -O1 or lower,
where it can't deduce that overflow won't happen.

Reviewed-by: Sam James <sam@gentoo.org>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-29 14:49:19 -04:00
DJ Delorie 320cf1e1b5 malloc: add tst-mxfast to hugetlb exclusion list
tst-mxfast needs GLIBC_TUNABLES to be set to its own value.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-08-29 13:22:19 -04:00
Uros Bizjak 119d658ac2 x86: Use flag output operands for inline asm in atomic-machine.h
Use the flag output constraints feature available in gcc 6+
("=@cc<cond>") instead of explicitly setting a boolean variable
with SETcc instruction.  This approach decouples the instruction
that sets the flags from the code that consumes them, allowing
the compiler to create better code when working with flags users.
Instead of e.g.:

   lock add %esi,(%rdi)
   sets   %sil
   test   %sil,%sil
   jne    <...>

the compiler now generates:

   lock add %esi,(%rdi)
   js     <...>

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-08-29 09:05:23 +02:00
Uros BizjakandH.J. Lu 9a1cb8f783 x32: Fix, optimize and cleanup RSEQ_* accessors
Add missing "memory" clobber to accessors.  The "memory" clobber
tells the compiler that the assembly code performs memory reads
or writes to items other than those listed in the input and output
operands (for example, accessing the memory pointed to by one of
the input parameters).

Use MOVZBL instead of MOVB when reading 1-byte memory location
into a register.  MOVB to a register actually inserts into the LSB
of the word-sized register, making the result dependent on
the previous register value.  MOVZBL avoids this issue.

Change %P asm operand modifiers to %c.  The ‘c’ modifier is a
generic asm operand modifier that requires a constant operand and
prints the constant expression without punctuation.

Replace %b asm operand modifiers with explicit casts.  Explicit
casts inform the compiler which part of the register value is used,
allowing it to perform additional optimizations (e.g. narrowing the
preceding operation).

Remove %q asm operand modifiers.  Since the value is already cast
to 'long long int', the compiler will emit a 64-bit register name
in the assembly without needing %q.

No functional changes intended.

Tested-by: H.J. Lu <hjl.tools@gmail.com>
Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-28 04:57:24 -07:00
Henrik Lindström c49a32d7eb x86/configure: Improve portability of isa level check
wc -l pads the output with leading spaces on some systems, e.g. FreeBSD.
This results in the check `test "$count" = 1` failing. Use -eq for integer
comparison instead.

Signed-off-by: Henrik Lindström <henrik@lxm.se>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-08-27 17:14:15 +02:00
Cupertino Miranda 3b2b88ccee elf: early conversion of elf p_flags to mprotect flags
This patch replaces _dl_stack_flags global variable by
_dl_stack_prot_flags.
The advantage is that any convertion from p_flags to final used mprotect
flags occurs at loading of p_flags. It avoids repeated spurious
convertions of _dl_stack_flags, for example in allocate_thread_stack.

This modification was suggested in:
  https://sourceware.org/pipermail/libc-alpha/2025-March/165537.html

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-27 10:45:45 -03:00
Wilco Dijkstra 921e251e8f malloc: Support hugepages in mremap_chunk
Add mremap_chunk support for mmap()ed chunks using hugepages by accounting for
their alignment, to prevent the mremap call failing in most cases where the
size passed is not a hugepage size multiple. It also improves robustness for
reallocating hugepages since mremap is much less likely to fail, so running
out of memory when reallocating a larger size and having to copy the old
contents after mremap fails is also less likely.

To track whether an mmap()ed chunk uses hugepages, have a flag in the lowest
bit of the mchunk_prev_size field which is set after a call to sysmalloc_mmap,
and accessed later in mremap_chunk. Create macros for getting and setting this
bit, and for mapping the bit off when accessing the field for mmap()ed chunks.
Since the alignment cannot be lower than 8 bytes, this flag cannot affect the
alignment data.

Add malloc/tst-tcfree4-malloc-check to the tests-exclude-malloc-check list as
malloc-check prevents the tcache from being used to store chunks. This test
caused failures due to a bug in mem2chunk_check to be fixed in a later patch.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-27 13:07:09 +00:00
Wilco Dijkstra 614cfd0f8a malloc: Change mmap chunk layout
Change the mmap chunk layout to be identical to a normal chunk.  This makes it
safe for tcache to hold mmap chunks and simplifies size calculations in
memsize and musable.  Add mmap_base() and mmap_size() macros to simplify code.

Reviewed-by: Cupertino Miranda <cupertino.miranda@oracle.com>
2025-08-27 11:41:58 +00:00
Paul Zimmermann 0a96e56017 added benchmark inputs for rsqrtf and rsqrt
Changes with respect to v1:
- added missing rsqrt and rsqrtf in bench-math
2025-08-27 08:28:28 +02:00
Paul Zimmermann 170606d82c add missing benchmark files for several C23 binary64 functions
These files were prepared together with Saban Houssein.
2025-08-26 17:08:43 +02:00
Collin Funk 596dc7b676 manual: Refer to libc-alpha instead of a dead mailing list.
* manual/message.texi (Advanced gettext functions): Refer to
libc-alpha@sourceware.org instead of bug-glibc-manual@gnu.org which no
longer exists.
* NEWS: Likewise.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-08-25 16:45:42 -07:00
H.J. Lu 027505a07b Don't pass -c to LIBC_TRY_TEST_CC_OPTION
LIBC_TRY_TEST_CC_OPTION is defined with LIBC_TRY_CC_OPTION:

dnl Test a compiler option or options with an empty input file.
dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false])
AC_DEFUN([LIBC_TRY_CC_OPTION],
[AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])],
        [$2], [$3])])

which passes -S to compiler.  Unlike gcc, when -c is also passed to clang
20, we get

configure:7838: clang -c -Werror -fsemantic-interposition -xc /dev/null -S -o /dev/null
clang: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]

Don't pass -c to LIBC_TRY_TEST_CC_OPTION since -c isn't needed.

This fixes BZ #33318.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-23 15:59:42 -07:00
H.J. Lu 7851260bf5 Remove test-have-mamx-tile from Makefile.in
Since have-mamx-tile is for TEST_CC only as shown in
sysdeps/x86_64/configure.ac:

LIBC_CONFIG_VAR([have-mamx-tile], [$libc_cv_test_x86_have_amx_tile])

remove test-have-mamx-tile from Makefile.in.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-23 15:58:00 -07:00
H.J. Lu 861d04967d Don't use -Wfree-labels/-Wmissing-parameter-name if unsupported
Don't use -Wfree-labels/-Wmissing-parameter-name for "make check" if
they are unsupported by TEST_CC.

This fixes BZ #33310.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-22 19:07:33 -07:00
H.J. Lu dd7122c057 Undef __INT64_C/__UINT64_C for glibc build and test
Since clang 20 defines __INT64_C and __UINT64_C as built-in macros, undef
them for glibc build and test.  This fixes BZ #33311.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-22 18:18:38 -07:00
H.J. Lu d142b7d205 Revert "Don't use -Wfree-labels/-Wmissing-parameter-name if unsupported"
This reverts commit ee06d98c5b.
2025-08-22 18:03:46 -07:00
H.J. Lu ee06d98c5b Don't use -Wfree-labels/-Wmissing-parameter-name if unsupported
Don't use -Wfree-labels/-Wmissing-parameter-name for "make check" if
they are unsupported by TEST_CC.

This fixes BZ #33310.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-22 17:56:09 -07:00
H.J. Lu dd4394b249 x86: Set have-protected-data to no if unsupported
If the building compiler enables no direct external data access by
default, access to protected data in shared libraries from executables
must be compiled with no direct external data access.  If the testing
compiler doesn't support it, set have-protected-data to no to disable
the tests which requires no direct external data access.

Add LIBC_TRY_CC_COMMAND to test a building compiler option or options
with an input file.

This fixes BZ #33286.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-22 17:55:32 -07:00
Maciej W. Rozycki aa4dbb2eeb stdio-common: Convert macros across scanf input specifier tests
Convert 'compare_real', 'read_real', and 'verify_input' macros to
functions so as to improve readability and avoid pitfalls.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23 01:02:46 +01:00
Maciej W. Rozycki a1e5ee13ab stdio-common: Adjust header inclusion in scanf input specifier tests
Move the inclusion of the data class header from the individual tests to
the data-type-specific skeleton, providing for the use of the data type
under test in the data class header and reducing duplication.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23 01:02:46 +01:00
Maciej W. Rozycki 2419637eb0 stdio-common: Include correct skeleton in scanf input specifier tests
Follow 'scanf' itself and use the system header inclusion variant for
the data-type-specific skeleton consistently across the remaining scanf
family functions so that any sysdeps/ variant takes precedence even in
the presence of a corresponding skeleton in stdio-common/ (though we
have no such arrangement at the moment).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23 01:02:46 +01:00
Maciej W. Rozycki ca0f999a93 stdio-common: Fix NaN input data for scanf input specifier tests [BZ #32857]
Update NaN input data with 'n-char-sequence' in reference data matching
data under test, removing test failures with the M68K host.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23 01:02:46 +01:00
Maciej W. Rozycki 27aa1fb735 stdio-common: Fix bad NaN crash in scanf input specifier tests [BZ #32857]
Fix a null pointer dereference causing a crash in 'read_real' when the
terminating null character is written for use with the subsequent call
to 'nan' for invalid NaN reference input, such as:

%a:nan:1:3:nanny:

by moving all the 'n-char-sequence' handling under the check for the
opening parenthesis.

No test case added as it's a test case issue in the first place.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23 01:02:46 +01:00
Maciej W. Rozycki 67d2c9e3b7 stdio-common: Fix a crash in scanf input specifier tests [BZ #32857]
Fix a null pointer dereference causing a crash in 'read_real' when the
terminating null character is written for use with the subsequent call
to 'nan' for NaN reference input using null 'n-char-sequence', such as:

%a:nan():1:5:nan():

by moving the memory allocation call ahead of the check for the closing
parenthesis.

No test case added as it's a test case issue in the first place.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23 01:02:46 +01:00
Maciej W. Rozycki da2a2581c4 stdio-common: Fix error reporting in scanf input specifier tests
Remove buffer contents reporting from the real variant of 'verify_input'
where there has been an input data format error making the contents of
data buffers irrelevant.

For example given invalid float input data:

%a:nan:1:3:nan(:

these messages are produced:

error: ./tst-scanf-format-skeleton.c:240: input buffer: `0000c07f'
error: ./tst-scanf-format-skeleton.c:240: value buffer: `0000c07f'
error: ./tst-scanf-format-skeleton.c:242: input line 1: input data format error

with the two former lines irrelevant.  Remove them from output then,
only leaving:

error: ./tst-scanf-format-skeleton.c:242: input line 1: input data format error

No test case added as it's a test case issue in the first place.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23 01:02:46 +01:00
Maciej W. Rozycki 2b16c76609 stdio-common: Reject insufficient character data in scanf [BZ #12701]
Reject invalid formatted scanf character data with the 'c' conversion
where there is not enough input available to satisfy the field width
requested.  It is required by ISO C that this conversion matches a
sequence of characters of exactly the number specified by the field
width and it is also already documented as such in our own manual:

"It reads precisely the next N characters, and fails if it cannot get
that many."

Currently a matching success is instead incorrectly produced where the
EOF condition is encountered before the required number of characters
has been retrieved, and the characters actually obtained are stored in
the buffer provided.

Add test cases accordingly and remove placeholders from 'c' conversion
input data for the existing scanf tests.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-23 01:02:46 +01:00
H.J. Lu e377a7a8ec Disable -Wimplicit-fallthrough when clang is in use
Clang's -Wimplicit-fallthrough warning, which flags unannotated
fall-through in switch statements, does not recognize specific comments
like /* FALLTHROUGH */ for suppressing the warning, unlike GCC.  Since
fall through comments are used extensively in glibc, disable
-Wimplicit-fallthrough when clang is in use.

This fixes BZ #33312.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-22 16:32:02 -07:00
H.J. Lu b4ab549ae5 libio: Properly link in libio functions in static binaries
commit 3020f72618
Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Date:   Tue Dec 27 18:11:43 2022 -0300

    libio: Remove the usage of __libc_IO_vtables

added

 #define libio_static_fn_required(name) __asm (".globl " #name);

to link in libio functions in static binaries.  But there is no relocation
in
	.globl	_IO_file_open

and "strip --strip-unneeded" will remove such unreferenced symbols which
breaks static binaries.  Redefine libio_static_fn_required to create a
reference to the required function with

static __typeof (name) *const name##_p __attribute__((used)) = name;

This fixes BZ #33300.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Tested-by: Xi Ruoyao <xry111@xry111.site>
2025-08-22 12:03:00 -07:00
Uros BizjakandH.J. Lu 3997c50f0b x86_64: Use __seg_fs qualifiers in NPTL accessors
Use __seg_fs named address space qualifiers to cast NPTL accessors
to %fs: prefixed addresses.  Use volatile access only where
strictly necessary.

Use existing assembly RSEQ_* accessors for x32 to
work around the GCC bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121613

because negative value in __rseq_offset is used
as an offset from %fs.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
2025-08-22 06:36:14 -07:00
H.J. Lu bb7fb0f1a7 x86: Remove an extra space before THREAD_SELF
After

f6dd43d5f7 i386: Remove stalled __GNUC_PREREQ (6, 0) test in THREAD_SELF()
b0f0c41a5f x86_64: Remove stalled __GNUC_PREREQ (6, 0) test in THREAD_SELF()

removed the unnecessary __GNUC_PREREQ (6, 0) test, remove the extra space
before THREAD_SELF macro name.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-21 19:32:30 -07:00
Uros Bizjak b0f0c41a5f x86_64: Remove stalled __GNUC_PREREQ (6, 0) test in THREAD_SELF()
Currenty GCC-12 is required as the minimum supported compiler
version.  Remove stalled __GNUC_PREREQ (6, 0) test for
GCC compiler version in THREAD_SELF() macro definition.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-20 11:48:27 -07:00
Uros Bizjak 0e49fc68aa i386: Use __seg_gs qualifiers in NPTL accessors
Use __seg_gs named address space qualifiers to cast NPTL accessors
to %gs: prefixed addresses.  Use volatile access only where
strictly necessary.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-20 11:48:23 -07:00
Uros Bizjak f6dd43d5f7 i386: Remove stalled __GNUC_PREREQ (6, 0) test in THREAD_SELF()
Currenty GCC-12 is required as the minimum supported compiler
version.  Remove stalled __GNUC_PREREQ (6, 0) test for
GCC compiler version in THREAD_SELF() macro definition.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-20 11:48:20 -07:00
Uros Bizjak f80dddbe29 i386: Use TESTB instead of TESTL in ____longjmp_chk()
There is no need to use TESTL when checking the least-significant bit
with a TEST instruction. Use TESTB, which is three bytes shorter:

   f6 44 24 04 01          testb  $0x1,0x4(%esp)

vs:

   f7 44 24 04 01 00 00    testl  $0x1,0x4(%esp)
   00

for the same effect.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-20 11:48:17 -07:00
Uros Bizjak dd38f49cdc x86_64: Use TESTB instead of TESTL in CHECK_INVALID_LONGJMP
There is no need to use TESTL when checking the least-significant bit
with a TEST instruction. Use TESTB, which is three bytes shorter:

   f6 44 24 f0 01      	   testb  $0x1,-0x10(%rsp)

vs:

   f7 44 24 f0 01 00 00    testl  $0x1,-0x10(%rsp)
   00

for the same effect.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-20 11:47:53 -07:00
Pierre Blanchard aac077645a AArch64: Fix SVE powf routine [BZ #33299]
Fix a bug in predicate logic introduced in last change.
A slight performance improvement from relying on all true
predicates during conversion from single to double.
This fixes BZ #33299.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-08-20 17:45:21 +00:00
Arjun Shankar 6f999af332 support: Handle FUSE_GETXATTR during FUSE FS mount
When testing with some kernel versions, support FUSE infrastructure
encounters a FUSE_GETXATTR request, leading to FUSE tests hanging until
timed out.  Therefore, pass FUSE_GETXATTR requests from
support_fuse_handle_mountpoint to support_fuse_handle_directory, and
adjust support_fuse_handle_directory to return ENOSYS so that tests can
proceed.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-08-19 09:54:38 +02:00
caiyinyu d4ccda8e69 malloc: Fix tst bug in malloc/tst-free-errno-malloc-hugetlb1.
When transparent hugepages (THP) are configured to 32MB on x86/loongarch
systems, the current big_size value may not be sufficiently large to
guarantee that free(ptr) [1] will call munmap(ptr_aligned, big_size).

Tested on x86_64 and loongarch64.

PS: Without this patch and using 32M THP, there is a about 50% chance
that malloc/tst-free-errno-malloc-hugetlb1 will fail on both x86_64 and
loongarch64.

[1] malloc/tst-free-errno.c:
...
       errno = 1789;
       /* This call to free() is supposed to call
            munmap (ptr_aligned, big_size);
          which increases the number of VMAs by 1, which is supposed
          to fail.  */
->     free (ptr);
       TEST_VERIFY (get_errno () == 1789);
     }
...

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-08-19 09:05:32 +08:00
H.J. Lu bd4628f3f1 i386: Also add GLIBC_ABI_GNU2_TLS version [BZ #33129]
Since the GNU2 TLS run-time bug:

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

affects both i386 and x86-64, also add GLIBC_ABI_GNU2_TLS version to i386
to indicate the working GNU2 TLS run-time.  For x86-64, the additional
GNU2 TLS run-time bug fix is needed for

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

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-18 11:58:01 -07:00
gfleury 098e449df0 htl: move sem_unlink into libc.
Message-ID: <20250817104023.91919-8-gfleury@disroot.org>
2025-08-18 01:06:41 +02:00
gfleury f5a43420e2 htl: move sem_{clockwait, timedwait, wait, trywait} into libc.
Message-ID: <20250817104023.91919-7-gfleury@disroot.org>
2025-08-18 01:06:38 +02:00
gfleury 795f5f2a8b htl: move sem_post into libc.
Message-ID: <20250817104023.91919-6-gfleury@disroot.org>
2025-08-18 00:55:33 +02:00
gfleury 50f5ddc20a htl: move sem_open, sem_close into libc.
Message-ID: <20250817104023.91919-5-gfleury@disroot.org>
2025-08-18 00:55:18 +02:00
gfleury b2b6d32f11 htl: move sem_init into libc.
Message-ID: <20250817104023.91919-4-gfleury@disroot.org>
2025-08-18 00:23:11 +02:00
gfleury 11c07af422 htl: move sem_getvalue into libc.
Message-ID: <20250817104023.91919-3-gfleury@disroot.org>
2025-08-18 00:22:53 +02:00
gfleury c2560a0c56 htl: move sem_destroy into libc.
Message-ID: <20250817104023.91919-2-gfleury@disroot.org>
2025-08-18 00:22:43 +02:00
gfleury 35296a6e73 htl: move __pthread_startup into libc.
Message-ID: <20250815181500.107433-20-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury 80412aee3e htl: move __pthread_setup into libc.
Message-ID: <20250815181500.107433-19-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury b6616efe8c htl: move pthread_{join, clockjoin_np, timedjoin_np, tryjoin_np} into libc.
Message-ID: <20250815181500.107433-18-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury 36982b0fdb htl: move pthread_exit into libc.
Message-ID: <20250815181500.107433-17-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury a901f2599e htl: move pthread_detach into libc.
Message-ID: <20250815181500.107433-16-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury d0667a77de htl: move __pthread_sigstate_init into libc.
Message-ID: <20250815181500.107433-15-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury f6a47e2d61 htl: move pthread_mutex_transfer_np into libc.
Message-ID: <20250815181500.107433-14-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury 1e6588e777 htl: move pthread_getattr_np into libc.
Message-ID: <20250815181500.107433-13-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury 6541288cb5 htl: move pthread_testcancel into libc.
Message-ID: <20250815181500.107433-12-gfleury@disroot.org>
2025-08-16 01:44:50 +02:00
gfleury edcc9ca48c htl: move pthread_kill into libc.
Message-ID: <20250815181500.107433-11-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury de8351f4de htl: move pthread_cancel, __pthread_do_cancel into libc.
Message-ID: <20250815181500.107433-10-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury e0b765d9ba htl: move __thread_set_pcsptp into libc.
Message-ID: <20250815181500.107433-9-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury 2dcb8fb8e7 htl: move pthread_yield into libc.
Message-ID: <20250815181500.107433-8-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury fa35ccbba8 htl: move pthread_getcpuclockid into libc.
Message-ID: <20250815181500.107433-7-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury c3abc99cb0 htl: move __pthread_thread_{alloc, start, terminate} into libc.
Message-ID: <20250815181500.107433-6-gfleury@disroot.org>
2025-08-16 01:44:26 +02:00
gfleury 450912d5db htl: move __pthread_stack_alloc into libc.
Message-ID: <20250815181500.107433-5-gfleury@disroot.org>
2025-08-16 01:15:37 +02:00
gfleury 2522a3f3ae htl: move __pthread_init_{specific, static_tls}, __pthread_{alloc}, dealloc} into libc.
Message-ID: <20250815181500.107433-4-gfleury@disroot.org>
2025-08-16 01:13:22 +02:00
gfleury b586357e2a htl: move pthread_get/setconcurrency into libc.
Message-ID: <20250815181500.107433-3-gfleury@disroot.org>
2025-08-16 01:12:21 +02:00
gfleury d479e71498 htl: move pthread_setschedprio into libc.
Message-ID: <20250815181500.107433-2-gfleury@disroot.org>
2025-08-16 01:11:21 +02:00
H.J. Lu 399384e0c8 x86-64: Add GLIBC_ABI_DT_X86_64_PLT [BZ #33212]
When the linker -z mark-plt option is used to add DT_X86_64_PLT,
DT_X86_64_PLTSZ and DT_X86_64_PLTENT, the r_addend field of the
R_X86_64_JUMP_SLOT relocation stores the offset of the indirect
branch instruction.  However, glibc versions without the commit:

commit f8587a6189
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri May 20 19:21:48 2022 -0700

    x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT

    According to x86-64 psABI, r_addend should be ignored for R_X86_64_GLOB_DAT
    and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to 0, we
    can ignore their r_addends.

    Reviewed-by: Fangrui Song <maskray@google.com>

won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.
Such programs and shared libraries will fail at run-time randomly.

Add GLIBC_ABI_DT_X86_64_PLT version to indicate that glibc is compatible
with DT_X86_64_PLT.

The linker can add the glibc GLIBC_ABI_DT_X86_64_PLT version dependency
whenever -z mark-plt is passed to the linker.  The resulting programs and
shared libraries will fail to load at run-time against libc.so without the
GLIBC_ABI_DT_X86_64_PLT version, instead of fail randomly.

This fixes BZ #33212.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-14 07:05:37 -07:00
H.J. Lu ed1b7a5a48 i386: Add GLIBC_ABI_GNU_TLS version [BZ #33221]
On i386, programs and shared libraries with __thread usage may fail
silently at run-time against glibc without the TLS run-time fix for:

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

Add GLIBC_ABI_GNU_TLS version to indicate that glibc has the working
GNU TLS run-time.  Linker can add the GLIBC_ABI_GNU_TLS version to
binaries which depend on the working TLS run-time so that such programs
and shared libraries will fail to load and run at run-time against
libc.so without the GLIBC_ABI_GNU_TLS version, instead of fail silently
at random.

This fixes BZ #33221.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-14 05:43:32 -07:00
H.J. Lu 9df8fa397d x86-64: Add GLIBC_ABI_GNU2_TLS version [BZ #33129]
Programs and shared libraries compiled with -mtls-dialect=gnu2 may fail
silently at run-time against glibc without the GNU2 TLS run-time fix
for:

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

Add GLIBC_ABI_GNU2_TLS version to indicate that glibc has the working
GNU2 TLS run-time.  Linker can add the GLIBC_ABI_GNU2_TLS version to
binaries which depend on the working GNU2 TLS run-time:

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

so that such programs and shared libraries will fail to load and run at
run-time against libc.so without the GLIBC_ABI_GNU2_TLS version, instead
of fail silently at random.

This fixes BZ #33129.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-14 05:42:54 -07:00
caiyinyu 9dccb0e1c5 LoongArch: Fix build failure for loongarch64-linux-gnusf toolchain. [BZ #32776]
GCC parts:

A GCC bug caused the loss of the search path: /usr/lib64/sf, and this
bug has now been fixed in GCC.

See:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=9467435253948b83fcb5f7430f6cd571236960d8
2025-08-13 15:29:16 +08:00
Wilco Dijkstra 122847e4a2 benchtests: Avoid truncation in random memcpy/memset benchmarks
Use uint16_t rather than uint8_t for the size arrays.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-08-12 11:15:58 +00:00
Maciej W. Rozycki bc5cf78543 stdio-common: Fix macro parameter shadowing in scanf input specifier tests
The use of the same name for a local variable combined with passing a
pointer to it to a nested macro call causes the wrong 'err' variable to
be updated in 'read_real', because '&err' is only expanded at '*errp'
evaluation.  Consequently the variable defined in 'read_real' is set
rather than one in its 'verify_input' caller as it would be the case
should 'read_real' be a function, leading to invalid input such as:

%a:nan:1:3:nan(:

to be accepted.

Address the issue by renaming the 'err' variable in 'verify_input' to
'errx', causing such input to be correctly rejected:

error: ./tst-scanf-format-skeleton.c:242: input line 1: input data format error

No test case added as it's a test case issue in the first place.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-11 17:42:12 +01:00
Maciej W. Rozycki 1c1f5e8f6d stdio-common: Add 'f' conversion tests for . scanf input [BZ #12701]
Verify that . input is rejected by 'f' conversion (and its uppercase
counterpart).  Replace 0 input with .0 rather than adding new one,
because the integral part of 0 is already covered by 0.0 data, so
there's no need to keep this duplication.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-11 17:42:12 +01:00
Maciej W. Rozycki 291f4d4fe5 stdio-common: Add 'e' conversion tests for . scanf input [BZ #12701]
Verify that . input is rejected by 'e' conversion (and its uppercase
counterpart).  Replace 0e0 input with .0e0 rather than adding new one,
because 0 significand is already covered by 0e+0 data, so there's no
need to keep this duplication.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-11 17:42:12 +01:00
Maciej W. Rozycki 14957cb1c4 stdio-common: Add 'a', 'g' conversion tests for 0x. scanf input [BZ #12701]
Verify that 0x. input is rejected by 'a' and 'g' conversions (and their
uppercase counterparts).  Replace 0x0p0 input with 0x.0p0 rather than
adding new one, because 0x0 significand is already covered by 0x0p+0
data, so there's no need to keep this duplication.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-11 17:42:12 +01:00
Maciej W. Rozycki b52ecff316 stdio-common: Reject significands w/o digits in scanf [BZ #12701]
Reject invalid formatted scanf real input data the significand part of
which is comprised of a hexadecimal prefix followed by a decimal point
only, optionally preceded by a sign.  Such data is a prefix of, but not
a matching input sequence and it is required by ISO C to cause a
matching failure.

Currently a matching success is instead incorrectly produced along with
the conversion result of zero, with data up to and including the decimal
point consumed from input.

Technically this change also causes lone . to be rejected early, though
it doesn't change semantics, because unlike 0x. it's not valid input to
'strtod', etc. so it gets rejected at actual conversion time later on
anyway.

Test cases follow as separate changes.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-11 17:42:12 +01:00
Maciej W. Rozycki b692181703 stdio-common: Don't read real input beyond the field width in scanf
Fix a code pattern that repeats across '__vfscanf_internal' where the
remaining field width of 0 is incorrectly interpreted as no width limit,
which in turn results in reading input beyond the limit requested.  The
lack of width limit is indicated by the field width of -1 rather than 0,
set earlier on in the function.

The problematic code pattern is used for both integer and floating-point
conversions, but in the former case a corresponding conditional earlier
on prevents the field width from being 0 when executing the pattern.  It
does trigger in the latter case, where the decimal point is a multibyte
character or for multibyte digit characters.

Fix the code pattern by using 'width > 0' comparison, and apply the fix
throughout even to code handling integer conversions so as to interpret
the field width consistently and avoid people's confusion even if width
cannot be 0 at those places.

For multibyte digit characters there is an additional issue that causes
code to push back a partially fetched multibyte character multiple times
as execution proceeds through matching data retrieved against individual
digits that have to be rejected due to the field width limit preventing
the rest of the multibyte character from being retrieved.  It is because
code relies on 'ungetc' ignoring a request to push back EOF, however in
the out-of-limit field width condition the data held is not EOF but the
previously retrieved character byte instead.

Fix this issue by artificially assigning EOF to the character byte
storage variable where the out-of-limit field width condition prevents
further processing, and also apply the fix throughout except for the
decimal point/thousands separator case, which uses different code.

Add test cases accordingly.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-11 17:42:12 +01:00
Samuel Thibault 8543577b04 malloc: Fix checking for small negative values of tcache_key
tcache_key is unsigned so we should turn it explicitly to signed before
taking its absolute value.
2025-08-10 23:45:35 +02:00
Samuel Thibault 2536c4f858 malloc: Make sure tcache_key is odd enough
We want tcache_key not to be a commonly-occurring value in memory, so ensure
a minimum amount of one and zero bits.

And we need it non-zero, otherwise even if tcache_double_free_verify sets
e->key to 0 before calling __libc_free, it gets called again by __libc_free,
thus looping indefinitely.

Fixes: c968fe5062 ("malloc: Use tailcalls in __libc_free")
2025-08-10 09:44:08 +02:00
Andreas Schneider a6eb8285d9 localedata: Add en_SE for ISO8601 dates
On a Linux system you have two sources for locales: glibc and ICU.

ICU offeres a lot more languages than glibc. Especially when it comes to
en_*.

If you have an English system and want to use ISO8601 for date and time
format there is only one locale which can be used for that: en_SE

However ICU offers en_SE and glibc doesn't. If you set LC_TIME=en_SE a
lot of application wont start, because the locale is not known to glibc.

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>

Reviewed-by: Mike FABIAN <mfabian@redhat.com>
2025-08-08 17:53:13 +02:00
Wilco Dijkstra a5e9269f51 malloc: Fix MALLOC_DEBUG
MALLOC_DEBUG only works on locked arenas, so move the call to
check_inuse_chunk from __libc_free() to _int_free_chunk().
Regress now passes if MALLOC_DEBUG is enabled.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-08 14:00:43 +00:00
Wilco Dijkstra 05a14648e9 malloc: Support THP in arenas
Arenas support huge pages but not transparent huge pages.  Add this by
also checking mp_.thp_pagesize when creating a new arena, and use madvise.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-08 14:00:11 +00:00
Wilco Dijkstra 94ebcfc4f2 malloc: Remove use of __curbrk
Remove an odd use of __curbrk and use MORECORE (0) instead.
This fixes Hurd build since it doesn't define this symbol.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-08 13:59:31 +00:00
Sachin Monga fd9ffafc0e Filter machine compiler flags into Assembler Flags
Assembler files may want or need to test for predefined macros which are
set via -m* compiler options, so ensure all -m* options in CFLAGS are passed
to ASFLAGS.

Reviewed-by:  Florian Weimer <fweimer@redhat.com>
2025-08-07 02:02:17 -05:00
H.J. Lu 9d054eca1a tst-freopen4: Remove temporary directory from warning message
tst-freopen4-main.c issues a warning message:

warning: could not remove temporary file: /tmp/tst-freopen4potgti: No such file or directory

since chroot makes generated temporary directories inaccessible.  Add
special rules for tst-freopen4.out and tst-freopen64-4.out to remove
the temporary directory in warning message from tst-freopen4 and
tst-freopen64-4.

This partially fixes BZ #33182.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-05 17:58:55 -07:00
H.J. Lu adec0bf05b Revert "tst-freopen4-main.c: Call support_capture_subprocess with chroot"
Revert commit 6463d4a7b2 to fix

FAIL: stdio-common/tst-freopen4-mem
FAIL: stdio-common/tst-freopen64-4-mem

This fixes BZ #33254.

Reviewed-by: Sam James <sam@gentoo.org>
2025-08-05 12:14:54 -07:00
Avinal KumarandAdhemerval Zanella Netto 25258aef78 iconv: Fix iconv functions not following symlinks [BZ #32339]
On some file systems iconv do not follow symlinks.  This happens because
read_conf_file() function's directory traversal loop reject symbolic
links and then lstat64() call do not follow symlinks.

This commit fixes the directory traversal loop to accept symbolic links
and then follow the link using stat64().

The test works by creating a temporary directory and placing a symbolic
link inside it that points to a configuration file.  It then runs
iconvconfig on this directory.

The test passes if iconvconfig successfully follows the symlink and
generates the cache correctly, confirming that the directory traversal
logic now properly handles symbolic links.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Co-authored-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
2025-08-05 14:15:33 -03:00
Florian Weimer 9a2aceb076 Linux: Add test case for bug 33245
The copy_file_range system call seems to be the only one that can
return an off64_t value.  Use FUSE to exercise this, without actually
creating such large files or copying any data.  Due to FUSE protocol
limitations, only sizes up to UINT_MAX can be tested, but this is
sufficient to check for the presence of bug 33245.

The FUSE protocol limitations are raised here:

  copy_file_range return value on FUSE
  <https://lore.kernel.org/all/lhuh5ynl8z5.fsf@oldenburg.str.redhat.com/>

Reviewed-by: Sam James <sam@gentoo.org>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-08-05 15:25:18 +02:00
Jens Remus e5363e6f46 Use TLS initial-exec model for __libc_tsd_CTYPE_* thread variables [BZ #33234]
Commit 10a66a8e42 ("Remove <libc-tsd.h>") removed the TLS initial-exec
(IE) model attribute from the __libc_tsd_CTYPE_* thread variable declarations
and definitions.  Commit a894f04d87 ("Optimize __libc_tsd_* thread
variable access") restored it on declarations.

Restore the TLS initial-exec model attribute on __libc_tsd_CTYPE_* thread
variable definitions.

This resolves test tst-locale1 failure on s390 32-bit, when using a
GNU linker without the fix from GNU binutils commit aefebe82dc89
("IBM zSystems: Fix offset relative to static TLS").

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-08-05 13:06:12 +02:00
Collin Funk 1eec8431a5 iconv: use bswap_32 instead of __builtin_bswap32
This file uses a mix of both functions, prefer the non-builtin version.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-08-05 10:07:18 +02:00
H.J. Lu 5d23dfb289 tst-env-setuid: Delete LD_DEBUG_OUTPUT output
Update tst-env-setuid.c to delete LD_DEBUG_OUTPUT output, instead of
leaving it behind.

This partially fixes BZ #33182.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-04 14:41:29 -07:00
H.J. Lu 6463d4a7b2 tst-freopen4-main.c: Call support_capture_subprocess with chroot
Update tst-freopen4-main.c to call support_capture_subprocess with chroot,
which makes temporary files inaccessible, so that temporary files can be
deleted.

This partially fixes BZ #33182.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-04 14:41:29 -07:00
H.J. Lu e7db515060 tst-fopen-threaded.c: Delete temporary file
Update tst-fopen-threaded.c to call support_create_temp_directory to
create a temporary directory and open "file" in the temporary directory,
instead of using /tmp/openclosetest and leaving it behind.

This partially fixes BZ #33182.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-04 14:41:29 -07:00
H.J. Lu d27b1a71cd Delete temporary files in support_subprocess
Call support_delete_temp_files to delete temporary files before exit in
support_subprocess.

This partially fixes BZ #33182.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-04 14:41:29 -07:00
Wilco Dijkstra 7ab623afb9 Revert "Remove use of __curbrk."
This reverts commit 1ee0b771a9.
2025-08-04 17:31:56 +00:00
Wilco Dijkstra 91a7726374 Revert "Improve MALLOC_DEBUG"
This reverts commit 4b3e65682d.
2025-08-04 17:31:54 +00:00
Wilco Dijkstra b6f8c0031c Revert "Enable THP on arenas"
This reverts commit 77d3e73936.
2025-08-04 17:31:52 +00:00
Wilco Dijkstra 011ef5b18c Revert "benchtests: Avoid overflow in random memcpy/memset benchmarks"
This reverts commit 09604542d3.
2025-08-04 17:31:51 +00:00
Wilco Dijkstra 3191dda282 Revert "Use _int_free_chunk in tcache_thread_shutdown"
This reverts commit 05ef6a4974.
2025-08-04 17:31:49 +00:00
Wilco Dijkstra f4e402b370 Revert "Remove dumped heap support"
This reverts commit 8f57caa7fd.
2025-08-04 17:31:47 +00:00
Wilco Dijkstra 1bf4a379e8 Revert "malloc: Cleanup libc_realloc"
This reverts commit dea1e52af3.
2025-08-04 17:31:45 +00:00
Wilco Dijkstra 8c2b6e528d Revert "Change mmap representation"
This reverts commit 4b74591022.
2025-08-04 17:31:40 +00:00
Wilco Dijkstra 1ee0b771a9 Remove use of __curbrk. 2025-08-04 17:13:55 +00:00
Wilco Dijkstra 4b3e65682d Improve MALLOC_DEBUG 2025-08-04 17:13:55 +00:00
Wilco Dijkstra 77d3e73936 Enable THP on arenas 2025-08-04 17:13:55 +00:00
Wilco Dijkstra 09604542d3 benchtests: Avoid overflow in random memcpy/memset benchmarks
Use uint16_t rather than uint8_t for the size arrays.
2025-08-04 17:13:55 +00:00
Wilco Dijkstra 05ef6a4974 Use _int_free_chunk in tcache_thread_shutdown 2025-08-04 17:13:55 +00:00
Wilco Dijkstra 8f57caa7fd Remove dumped heap support 2025-08-04 17:13:55 +00:00
Wilco Dijkstra dea1e52af3 malloc: Cleanup libc_realloc
Minor cleanup of libc_realloc: remove unnecessary special cases for mmap, move
ar_ptr initialization, first check for oldmem == NULL.
2025-08-04 17:13:55 +00:00
Wilco Dijkstra 4b74591022 Change mmap representation 2025-08-04 17:13:55 +00:00
Collin Funk 4d059af105 manual: Adjust documentation to standardization of select
The select function, fd_set, and FD_* macros were standardized by POSIX
in the sys/select.h header. They are still defined in sys/types.h if
__USE_MISC is defined, but we should recommend the more portable and
standardized sys/select.h.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-04 11:18:02 -03:00
Collin Funk 6e3e14fd4c manual: Use sys/select.h instead of sys/time.h for select example.
The original example works on glibc since sys/time.h includes
sys/select.h. However, since POSIX requires that select is defined in
sys/select.h this change makes the example more portable.

Reported by Gavin Smith <gavinsmith0123@gmail.com> in:
<https://lists.gnu.org/archive/html/bug-texinfo/2025-07/msg00091.html>.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-04 11:16:23 -03:00
Collin Funk 0f8c3c4329 manual: document getsubopt standardization.
The getsubopt function was an XSI extension since POSIX issue 4 until it
was added to Base in POSIX Issue 7.  This also adds the 'restrict'
qualifier to the arguments as done in POSIX.1-2024, and has been the
case in glibc.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-04 11:15:08 -03:00
Luca Boccassi d7da87980c errlist: add missing entries for MIPS/SPARC
These are defined in the kernel headers but missing from the list
of names, so strerrorname_np() returns NULL.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/mips/include/uapi/asm/errno.h#n95
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/sparc/include/uapi/asm/errno.h#n55

Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-04 11:13:48 -03:00
Samuel Thibault ad4589e2d8 hurd: support: Fix running SGID tests
Secure mode is enabled only if SGID actually provides a new privilege,
so we have to drop it before gaining it again.

Fixes commit 3a3fb2ed83
("Fix error reporting (false negatives) in SGID tests")
2025-08-03 23:59:55 +02:00
Florian Weimer e1f03adef9 support: Handle COPY_FILE_RANGE events with FUSE 2025-08-03 11:22:44 +02:00
Wilco Dijkstra 35a7a7ab99 malloc: Cleanup sysmalloc_mmap
Cleanup sysmalloc_mmap - simplify padding since it is always a constant.
Remove av parameter which is only used in do_check_chunk, but since it may be
NULL for mmap, it will cause a crash in checking mode.  Remove the odd check
on mmap in do_check_chunk.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-08-02 15:21:16 +00:00
Wilco Dijkstra b68b125ad1 malloc: Improve checked_request2size
Change checked_request2size to return SIZE_MAX for huge inputs.  This
ensures large allocation requests stay large and can't be confused with a
small allocation.  As a result several existing checks against PTRDIFF_MAX
become redundant.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-08-02 14:38:35 +00:00
Wilco Dijkstra 21fda179c2 malloc: Cleanup madvise defines
Remove redundant ifdefs for madvise/THP.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-08-02 14:19:50 +00:00
Wilco Dijkstra 2df57ad95c benchtests: Cleanup bench-malloc-thread
Change duration to 3 seconds.  Add spaces before '('.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-08-02 14:18:23 +00:00
Wilco Dijkstra ad4caba414 malloc: Fix MAX_TCACHE_SMALL_SIZE
MAX_TCACHE_SMALL_SIZE should use chunk size since it is used after
checked_request2size.  Increase limit of tcache_max_bytes by 1 since all
comparisons use '<'.  As a result, the last tcache entry is now used as
expected.

Reviewed-by: DJ Delorie <dj@redhat.com>
2025-08-02 14:16:24 +00:00
Adhemerval Zanella 7107bebf19 nptl: Fix SYSCALL_CANCEL for return values larger than INT_MAX (BZ 33245)
The SYSCALL_CANCEL calls __syscall_cancel, which in turn
calls __internal_syscall_cancel with an 'int' return instead of the
expected 'long int'.  This causes issues with syscalls that return
values larger than INT_MAX, such as copy_file_range [1].

Checked on x86_64-linux-gnu.

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79139

Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-08-01 16:57:41 -03:00
H.J. Lu cf91048748 i386: Consolidate subdirectory check on elf and csu
Consolidate subdirectory check on elf and csu to avoid checking them
more than once.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-01 05:51:28 -07:00
H.J. Lu 69451ca6ec x86-64: Consolidate subdirectory check on elf and csu
Consolidate subdirectory check on elf and csu to avoid checking them
more than once.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-08-01 05:50:53 -07:00
Florian Weimer 20681be149 elf: Handle ld.so with LOAD segment gaps in _dl_find_object (bug 31943)
Detect if ld.so not contiguous and handle that case in _dl_find_object.
Set l_find_object_processed even for initially loaded link maps,
otherwise dlopen of an initially loaded object adds it to
_dlfo_loaded_mappings (where maps are expected to be contiguous),
in addition to _dlfo_nodelete_mappings.

Test elf/tst-link-map-contiguous-ldso iterates over the loader
image, reading every word to make sure memory is actually mapped.
It only does that if the l_contiguous flag is set for the link map.
Otherwise, it finds gaps with mmap and checks that _dl_find_object
does not return the ld.so mapping for them.

The test elf/tst-link-map-contiguous-main does the same thing for
the libc.so shared object.  This only works if the kernel loaded
the main program because the glibc dynamic loader may fill
the gaps with PROT_NONE mappings in some cases, making it contiguous,
but accesses to individual words may still fault.

Test elf/tst-link-map-contiguous-libc is again slightly different
because the dynamic loader always fills the gaps with PROT_NONE
mappings, so a different form of probing has to be used.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-01 10:21:39 +02:00
Florian Weimer 2cac9559e0 elf: Extract rtld_setup_phdr function from dl_main
Remove historic binutils reference from comment and update
how this data is used by applications.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-01 10:21:27 +02:00
Davide Cavalca d9a348d092 stdlib: resolve a double lock init issue after fork [BZ #32994]
The __abort_fork_reset_child (introduced in
d40ac01cbb) call resets the lock after the
fork. This causes a DRD regression in valgrind
(https://bugs.kde.org/show_bug.cgi?id=503668), as it's effectively a
double initialization, despite it being actually ok in this case. As
suggested in https://sourceware.org/bugzilla/show_bug.cgi?id=32994#c2
we replace it here with a memcpy of another initialized lock instead,
which makes valgrind happy.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-07-31 19:11:08 +02:00
Joseph Myers 258126bc0b Use Linux 6.16, GCC 15, binutils 2.45 in build-many-glibcs.py
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2025-07-29 15:08:43 +00:00
William Hunt 9097cbf5d8 malloc: Enable THP always support on hugetlb tunable
Enable support for THP always when glibc.malloc.hugetlb=1, as the tunable
currently only gives explicit support in malloc for the THP madvise mode
by aligning to a huge page size. Add a thp_mode parameter to mp_ and check
in madvise_thp whether the system is using madvise mode, otherwise the
`__madvise` call is useless. Set the thp_mode to be unsupported by default,
but if the hugetlb tunable is set this updates thp_mode. Performance of
xalancbmk improves by 4.9% on Neoverse V2 when THP always mode is set on the
system and glibc.malloc.hugetlb=1.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-07-29 15:05:51 +00:00
Wilco Dijkstra 089b4fb90f malloc: Remove redundant NULL check
Remove a redundant NULL check from tcache_get_n.

Reviewed-by: Cupertino Miranda <cupertino.miranda@oracle.com>
2025-07-29 14:11:58 +00:00
Paul Zimmermann 9716ee567a replace atan2-inputs with more meaningful inputs
Commit 934d88d used inputs with exponent generated at random in the
whole binary64 exponent range, which yields essentially very large
or very small values of |y/x|. Instead, this commit generates x, y at
random in [-10,10], which should better corresponds to real applications.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-07-29 13:25:59 +02:00
Sam James 87afbd7a1a inet-fortified: fix namespace violation (bug 33227)
We need to use __sz, not sz, as we do elsewhere.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-07-29 11:50:29 +01:00
Samuel Thibault d25fcb681f tst-cond23: return EXIT_UNSUPPORTED on missing clock selection 2025-07-29 11:56:17 +02:00
Andreas K. Hüttel 03b2515065 NEWS: Add 2.43 section
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-28 20:33:18 +02:00
Andreas K. Hüttel 170550da27 Bump version to 2.42.9000
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-28 20:31:31 +02:00
Andreas K. Hüttel d2097651cc Create ChangeLog.old/ChangeLog.31
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-28 20:22:55 +02:00
Andreas K. Hüttel 2dc0412498 Bump version number to 2.42
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-28 20:19:17 +02:00
Andreas K. Hüttel c113fdc40b NEWS: update with last-minute fix bug 33224
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-28 20:12:05 +02:00
Adhemerval Zanella 6ab36c4e6d math: Update auto-libm-tests-in with ldbl-128ibm compoundn/pown failures
It fixes ce488f7c16 which updated
the out files without using gen-auto-libm-tests.c instructions.

Checked on powerpc64le-linux-gnu.

Tested-by: Andreas K. Huettel <dilfridge@gentoo.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-07-28 13:58:54 -03:00
Andreas K. Hüttel 54851e392d INSTALL: Update newest tested binutils version
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-28 16:49:01 +02:00
Florian Weimer 620f0730f3 elf: Compile _dl_debug_state separately (bug 33224)
This ensures that the compiler will not inline it, so that
debuggers which do not use the Systemtap probes can reliably
set a breakpoint on it.

Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
Tested-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-07-28 16:06:54 +02:00
Sam James c4ff6e666b configure.ac: fix bashisms in SFrame checks
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-07-28 15:52:11 +02:00
Andreas K. Hüttel 0def172386 INSTALL: regenerate
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26 17:07:14 +02:00
Andreas K. Hüttel 4e42971a03 install.texi: Update tested build tool versions
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26 17:05:21 +02:00
Andreas K. Hüttel 015483f8a1 contrib.texi: Update
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26 16:53:43 +02:00
Andreas K. Hüttel a92914de93 NEWS: insert list of CVEs
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26 15:23:49 +02:00
Andreas K. Hüttel 4d585d0afb advisories: s/CVE-id/CVE-Id/ (the lowercase i breaks our tooling)
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-26 15:21:27 +02:00
Carlos O'Donell 2a796b7981 NEWS: Generalize testing section and mention the manual. 2025-07-25 18:41:05 -04:00
Andreas K. Hüttel 712623fb07 NEWS: Insert list of bugs fixed in 2.42
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-25 23:52:41 +02:00
Andreas K. Hüttel 12c9494310 NEWS: Collect some more newsworthy items
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-25 23:36:56 +02:00
Andreas K. Hüttel 30a5fd9b11 NEWS: editorial changes
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-25 21:18:13 +02:00
Andreas K. Hüttel b149c8e1f7 po: Update swedish translations
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-25 19:31:37 +02:00
Adhemerval Zanella 9e1951ae88 debug: Only run sframe tests if run-built-tests is enabled 2025-07-25 14:03:23 -03:00
Adhemerval Zanella 8698af6dcf aarch64: Fix aarch64_be build with --enable-sframe 2025-07-25 13:57:44 -03:00
Adhemerval Zanella 158e939aef elf: Check SFrame on tst-dl_find_object.c
If SFrame is enable check if DLFO_FLAG_SFRAME is set (since sframe
support is added by default) and if dlfo_sframe has the expected
value.

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

Reviewed-by: Sam James <sam@gentoo.org>
2025-07-24 15:51:58 -03:00
Claudiu Zissulescu 072b5a9922 sframe: Add support for SFRAME_F_FDE_FUNC_START_PCREL flag
The Sframe V2 has a new errata which introduces the
SFRAME_F_FDE_FUNC_START_PCREL flag. This flag indicates the encoding
of the SFrame FDE function start address field like this:

- if set, sfde_func_start_address field contains the offset in bytes
to the start PC of the associated function from the field itself.

- if unset, sfde_func_start_address field contains the offset in bytes
to the start PC of the associated function from the start of the
SFrame section.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-07-24 15:51:58 -03:00
Adhemerval Zanella 20528165bd Disable SFrame support by default
And add extra checks to enable for binutils 2.45 and if the architecture
explicitly enables it.  When SFrame is disabled, all the related code
is also not enabled for backtrace() and _dl_find_object(), so SFrame
backtracking is not used even if the binary has the SFrame segment.

This patch also adds some other related fixes:

  * Fixed an issue with AC_CHECK_PROG_VER, where the READELF_SFRAME
    usage prevented specifying a different readelf through READELF
    environment variable at configure time.

  * Add an extra arch-specific internal definition,
    libc_cv_support_sframe, to disable --enable-sframe on architectures
    that have binutils but not glibc support (s390x).

  * Renamed the tests without the .sframe segment and move the
    tst-backtrace1 from pthread to debug.

  * Use the built compiler strip to remove the .sframe segment,
    instead of the system one (which might not support SFrame).

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

Reviewed-by: Sam James <sam@gentoo.org>
2025-07-24 15:51:58 -03:00
14742 changed files with 309356 additions and 115641 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
# clang-format file for GLIBC
# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# Copyright (C) 2022-2026 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
#
# The GNU C Library is free software; you can redistribute it and/or
+24 -150
View File
@@ -8489,70 +8489,37 @@ sysdeps/s390/memchr-z900.S:
sysdeps/s390/memset-z900.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/__longjmp.c:
sysdeps/s390/__longjmp.c:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/add_n.S:
sysdeps/s390/add_n.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/addmul_1.S:
sysdeps/s390/crti.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/dl-machine.h:
Contributed by Carl Pederson & Martin Schwidefsky.
sysdeps/s390/s390-32/mul_1.S:
sysdeps/s390/crtn.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/s390-mcount.S:
sysdeps/s390/dl-machine.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390x-mcount.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com)
sysdeps/s390/s390-32/setjmp.S:
sysdeps/s390/setjmp.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/start.S:
sysdeps/s390/start.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/strncpy-z900.S:
sysdeps/s390/strncpy-z900.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/sub_n.S:
sysdeps/s390/sub_n.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-32/sysdep.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/__longjmp.c:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/add_n.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/crti.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/crtn.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/dl-machine.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/s390x-mcount.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com)
sysdeps/s390/s390-64/setjmp.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/start.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/strncpy-z900.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/sub_n.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/s390-64/sysdep.h:
sysdeps/s390/sysdep.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/s390/strcmp-z900.S:
@@ -9613,130 +9580,37 @@ sysdeps/unix/sysv/linux/s390/bits/elfclass.h:
sysdeps/unix/sysv/linux/s390/dl-procinfo.h:
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2006.
sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c:
sysdeps/unix/sysv/linux/s390/____longjmp_chk.c:
Contributed by Jakub Jelinek <jakub@redhat.com>.
sysdeps/unix/sysv/linux/s390/s390-32/clone.S:
sysdeps/unix/sysv/linux/s390/clone.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S:
sysdeps/unix/sysv/linux/s390/getcontext.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/getutent.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutid.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutline.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/login.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/login32.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c:
sysdeps/unix/sysv/linux/s390/makecontext.c:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h:
sysdeps/unix/sysv/linux/s390/register-dump.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S:
sysdeps/unix/sysv/linux/s390/setcontext.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S:
sysdeps/unix/sysv/linux/s390/swapcontext.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/syscall.S:
sysdeps/unix/sysv/linux/s390/syscall.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S:
sysdeps/unix/sysv/linux/s390/sysdep.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h:
sysdeps/unix/sysv/linux/s390/sysdep.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c:
Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
sysdeps/unix/sysv/linux/s390/s390-32/vfork.S:
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c:
Contributed by Jakub Jelinek <jakub@redhat.com>.
sysdeps/unix/sysv/linux/s390/s390-64/clone.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h:
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
sysdeps/unix/sysv/linux/s390/s390-64/vfork.S:
sysdeps/unix/sysv/linux/s390/vfork.S:
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
sysdeps/unix/sysv/linux/s390/sigcontextinfo.h:
+501
View File
@@ -0,0 +1,501 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Moe Ghoul>, 1 April 1990
Moe Ghoul, President of Vice
That's all there is to it!
-502
View File
@@ -1,502 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
+1
View File
@@ -0,0 +1 @@
COPYING.LESSERv2
+4 -5
View File
@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -304,8 +304,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
with this program; if not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@@ -329,8 +328,8 @@ necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
<signature of Moe Ghoul>, 1 April 1989
Moe Ghoul, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+14 -31
View File
@@ -154,30 +154,10 @@ passed to 'configure'. For example:
NOTE: '--enable-cet' is only supported on x86_64 and x32.
'--enable-memory-tagging'
Enable memory tagging support if the architecture supports it.
When the GNU C Library is built with this option then the resulting
library will be able to control the use of tagged memory when
hardware support is present by use of the tunable
'glibc.mem.tagging'. This includes the generation of tagged memory
when using the 'malloc' APIs.
At present only AArch64 platforms with MTE provide this
functionality, although the library will still operate (without
memory tagging) on older versions of the architecture.
The default is to disable support for memory tagging.
'--disable-profile'
Don't build libraries with profiling information. You may want to
use this option if you don't plan to do profiling.
'--enable-static-nss'
Compile static versions of the NSS (Name Service Switch) libraries.
This is not recommended because it defeats the purpose of NSS; a
program linked statically with the NSS libraries cannot be
dynamically reconfigured to use a different name database.
'--enable-hardcoded-path-in-tests'
By default, dynamic tests are linked to run with the installed C
library. This option hardcodes the newly built C library path in
@@ -291,10 +271,13 @@ passed to 'configure'. For example:
Default is to disable fortification.
'--disable-sframe'
By default, the GNU C Library is built with '-Wa,--gsframe' if the
current GNU 'binutils' supports it. You may want to use this
option if you don't plan to use SFrame stack tracer.
'--enable-sframe'
Experimental option supported by some architectures, where the GNU
C Library is built with '-Wa,--gsframe' if 'binutils' supports it.
Currently this is only supported on x86_64 and aarch64. The option
enables SFrame support on 'backtrace'.
Default is to disable SFrame support.
To build the library and related programs, type 'make'. This will
produce a lot of output, some of which may look like errors from 'make'
@@ -497,7 +480,7 @@ build the GNU C Library:
GCC 12.1 or higher is required. In general it is recommended to
use the newest version of the compiler that is known to work for
building the GNU C Library, as newer compilers usually produce
better code. As of release time, GCC 14.2.1 is the newest compiler
better code. As of release time, GCC 15.2.1 is the newest compiler
verified to work to build the GNU C Library.
For multi-arch support it is recommended to use a GCC which has
@@ -519,7 +502,7 @@ build the GNU C Library:
You must use GNU 'binutils' (as and ld) to build the GNU C Library.
No other assembler or linker has the necessary functionality at the
moment. As of release time, GNU 'binutils' 2.43.1 is the newest
moment. As of release time, GNU 'binutils' 2.45.1 is the newest
verified to work to build the GNU C Library.
* GNU 'texinfo' 4.7 or later
@@ -536,7 +519,7 @@ build the GNU C Library:
'awk' is used in several places to generate files. Some 'gawk'
extensions are used, including the 'asorti' function, which was
introduced in version 3.1.2 of 'gawk'. As of release time, 'gawk'
version 5.3.1 is the newest verified to work to build the GNU C
version 5.3.2 is the newest verified to work to build the GNU C
Library.
Testing the GNU C Library requires 'gawk' to be compiled with
@@ -553,7 +536,7 @@ build the GNU C Library:
Perl is not required, but if present it is used in some tests and
the 'mtrace' program, to build the GNU C Library manual. As of
release time 'perl' version 5.40.0 is the newest verified to work
release time 'perl' version 5.42.0 is the newest verified to work
to build the GNU C Library.
* GNU 'sed' 3.02 or newer
@@ -565,7 +548,7 @@ build the GNU C Library:
* Python 3.4 or later
Python is required to build the GNU C Library. As of release time,
Python 3.12.8 is the newest verified to work for building and
Python 3.14.0 is the newest verified to work for building and
testing the GNU C Library.
* PExpect 4.0
@@ -583,7 +566,7 @@ build the GNU C Library:
A missing 'abnf' module does not reduce the test coverage of the
library itself.
* GDB 7.8 or later with support for Python 2.7/3.4 or later
* GDB 7.8 or later with support for Python 3.4 or later
GDB itself needs to be configured with Python support in order to
use the pretty printers. Notice that your system having Python
@@ -605,7 +588,7 @@ and if you change any of the message translation files you will need
* GNU 'gettext' 0.10.36 or later
As of release time, GNU 'gettext' version 0.23 is the newest
As of release time, GNU 'gettext' version 0.23.2 is the newest
version verified to work to build the GNU C Library.
You may also need these packages if you upgrade your source tree using
+17 -23
View File
@@ -1,4 +1,4 @@
# Copyright (C) 1991-2025 Free Software Foundation, Inc.
# Copyright (C) 1991-2026 Free Software Foundation, Inc.
# Copyright The GNU Toolchain Authors.
# This file is part of the GNU C Library.
@@ -711,25 +711,29 @@ link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnuli
ifndef gnulib
ifneq ($(have-cc-with-libunwind),yes)
libunwind =
ifeq ($(have-libgcc_s),yes)
libgcc_s = -lgcc_s
endif
else
libunwind = -lunwind
libunwind = -lunwind $(libgcc-name)
libgcc_s = $(libunwind)
endif
libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
libgcc_eh := -Wl,--as-needed $(libgcc_s) -Wl,--no-as-needed
gnulib-arch =
gnulib = -lgcc $(gnulib-arch)
gnulib-tests := -lgcc $(libgcc_eh)
gnulib = $(libgcc-name) $(gnulib-arch)
gnulib-tests := $(libgcc-name) $(libgcc_eh)
gnulib-extralibdir = $(dir $(shell $(CC) -print-file-name=libgcc_s.so$(libgcc_s.so-version)))
static-gnulib-arch =
# By default, elf/static-stubs.o, instead of -lgcc_eh, is used to
# statically link programs. When --disable-shared is used, we use
# -lgcc_eh since elf/static-stubs.o isn't sufficient.
ifeq (yes,$(build-shared))
static-gnulib = -lgcc $(static-gnulib-arch)
static-gnulib = $(libgcc-name) $(static-gnulib-arch)
else
static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch)
static-gnulib = $(libgcc-name) $(libgcc_eh-name) $(static-gnulib-arch)
endif
static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)
libc.so-gnulib := -lgcc
static-gnulib-tests := $(libgcc-name) $(libgcc_eh-name) $(libunwind)
libc.so-gnulib := $(libgcc-name)
endif
+preinit = $(addprefix $(csu-objpfx),crti.o)
+postinit = $(addprefix $(csu-objpfx),crtn.o)
@@ -916,6 +920,9 @@ endif
# disable any optimization that assume default rounding mode.
+math-flags = -frounding-math
# We have to assume that glibc functions might generate user-visible traps.
+math-flags += -ftrapping-math
# Logically only "libnldbl", "nonlib" and "testsuite" should be using
# -fno-math-errno. However due to GCC bug #88576, only "libm" and
# "libmvec" can use -fno-math-errno.
@@ -1182,7 +1189,7 @@ endif
# The assembler can generate debug information too.
ifndef ASFLAGS
ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
ASFLAGS := $(filter -g% -fdebug-prefix-map=% -m%,$(CFLAGS))
endif
override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu) $(as-sframe)
@@ -1449,19 +1456,6 @@ endif
sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
$(firstword $(subst :, ,$p))))
# $(libpthread-routines-var) and $(librt-routines-var) are the make
# variable to which pthread routines need to be added to land in the
# right library.
ifeq ($(pthread-in-libc),yes)
libpthread-routines-var = routines
librt-routines-var = routines
libanl-routines-var = routines
else
libpthread-routines-var = libpthread-routines
librt-routines-var = librt-routines
libanl-routines-var = libanl-routines
endif
# A sysdeps Makeconfig fragment may set libc-reentrant to yes.
ifeq (yes,$(libc-reentrant))
defines += -D_LIBC_REENTRANT
+30 -2
View File
@@ -1,4 +1,4 @@
# Copyright (C) 1991-2025 Free Software Foundation, Inc.
# Copyright (C) 1991-2026 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -594,7 +594,35 @@ define summarize-tests
@grep -E '^[A-Z]+:' $(objpfx)$1 | grep -E -v '^(PASS|XFAIL):' || true
@echo " === Summary of results$2 ==="
@sed -e '/:.*/!d' -e 's/:.*//' < $(objpfx)$1 | sort | uniq -c
@! grep -E '^[A-Z]+:' $(objpfx)$1 | grep -E -q -v '^(X?PASS|XFAIL|UNSUPPORTED):'
@{ \
grep -E '^[A-Z]+:' $(objpfx)$1 | \
grep -E -v '^(X?PASS|XFAIL|UNSUPPORTED):' | \
( \
if ! test -f $(..)allowed-failures.txt; then \
read -r _; exit $$(( $$? == 0 )); \
fi; \
status=0; \
while IFS= read -r line; do \
case "$$line" in \
FAIL:*) \
name=$${line#FAIL: }; \
escaped_name=`printf '%s' "$$name" | sed 's/[.+]/\\&/g'`; \
if grep -Eq -- "^$${escaped_name}[[:space:]]*#" \
$(..)allowed-failures.txt; then \
echo "Ignoring allowed FAIL: $${name}"; \
continue; \
fi; \
echo "Unallowed FAIL: $${name}"; \
status=1; \
;; \
*) \
status=1; \
;; \
esac; \
done; \
exit $$status; \
); \
}
endef
# The intention here is to do ONE install of our build into the
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# Copyright (C) 2019-2026 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
+4 -4
View File
@@ -5,9 +5,9 @@ TEST_CXX = @TEST_CXX@
test-cc-option-wimplicit-fallthrough = @libc_cv_test_cc_wimplicit_fallthrough@
test-config-cflags-mprefer-vector-width = @libc_cv_test_cc_mprefer_vector_width@
test-config-cflags-signaling-nans = @libc_cv_test_cc_signaling_nans@
test-config-cflags-wno-ignored-attributes = @libc_cv_test_wno_ignored_attributes@
test-cc-option-wfree-labels = @libc_cv_test_cc_wfree_labels@
test-cc-option-wmissing-parameter-name = @libc_cv_test_cc_wmissing_parameter_name@
test-enable-cet = @test_enable_cet@
test-have-mamx-tile = @libc_cv_test_x86_have_amx_tile@
test-have-static-pie = @libc_cv_test_static_pie@
test-supported-fortify = @libc_cv_test_supported_fortify_source@
@@ -25,9 +25,9 @@ check xcheck test:
cc-option-wimplicit-fallthrough="$(test-cc-option-wimplicit-fallthrough)" \
config-cflags-mprefer-vector-width="$(test-config-cflags-mprefer-vector-width)" \
config-cflags-signaling-nans="$(test-config-cflags-signaling-nans)" \
config-cflags-wno-ignored-attributes="$(test-config-cflags-wno-ignored-attributes)" \
cc-option-wfree-labels="$(test-cc-option-wfree-labels)" \
cc-option-wmissing-parameter-name="$(test-cc-option-wmissing-parameter-name)" \
enable-cet="$(test-enable-cet)" \
have-mamx-tile="$(test-have-mamx-tile)" \
have-static-pie="$(test-have-static-pie)" \
supported-fortify="$(test-supported-fortify)" \
objdir=`pwd` $@
+6 -3
View File
@@ -1,4 +1,4 @@
# Copyright (C) 1991-2025 Free Software Foundation, Inc.
# Copyright (C) 1991-2026 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -508,7 +508,9 @@ ifeq ($(build-shared),yes)
map-file = $(firstword $($(@F:.so=-map)) \
$(addprefix $(common-objpfx), \
$(filter $(@F:.so=.map),$(version-maps))))
load-map-file = $(map-file:%=-Wl,--version-script=%)
# The map version is created with multiple symbols that might not be
# exported depending of the ABI.
load-map-file = $(map-file:%=-Wl,--version-script=%) $(have-undefined-version)
endif
# Compiler arguments to use to link a shared object with libc and
@@ -563,7 +565,8 @@ $(LINK.o) -shared -static-libgcc $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
-B$(csu-objpfx) $(load-map-file) \
$(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
$(link-test-modules-rpath-link) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
$(libgcc_eh)
endef
# This macro is similar to build-shlib but it does not define a soname
+449 -22
View File
@@ -1,10 +1,311 @@
GNU C Library NEWS -- history of user-visible changes.
Copyright (C) 1992-2025 Free Software Foundation, Inc.
Copyright (C) 1992-2026 Free Software Foundation, Inc.
See the end for copying conditions.
Please send GNU C library bug reports via <https://sourceware.org/bugzilla/>
using `glibc' in the "product" field.
Version 2.44
Major new features:
* A new tunable, glibc.elf.thp, is added to map read-only segments with
Transparent Huge Pages (THP) if THP isn't disable in kernel. When
glibc.elf.thp is set to 1, malloc uses the actual kernel THP mode
instead of defaulting to madvise mode and madvise_thp will stop issuing
MADV_HUGEPAGE if kernel THP mode is always.
* THP page size in malloc is capped to MAX_THP_PAGESIZE. If THP page
size is above MAX_THP_PAGESIZE, THP in malloc is disabled.
* Additional optimized and correctly rounded mathematical functions have
been imported from the CORE-MATH project, in particular cosh, sinh, and
tanh.
* The SVID handling for cosh and sinh were moved to compat symbols, allowing
improvements in performance.
* New locale added: hrx_BR (Hunsrik language spoken in Brazil).
* Static PIE is now supported for arm-*-linux-gnueabi. It requires toolchain
support to correctly set the expected linker options.
* On AArch64 targets that support Guarded Control Stack extension all GCS
operations (including status, write on shadow stack, and push to shadow
stack) are locked after enabling GCS with ENFORCED or OVERRIDE GCS policy.
When a GCS operation is locked, a program cannot change this operation
status via prctl syscall. This prevents disabling or corrupting GCS
shadow stack during runtime.
Deprecated and removed features, and other changes affecting compatibility:
* Although malloc and related functions currently return pointers
aligned to alignof (max_align_t), the documentation now says future
versions of glibc may relax alignment requirements for small allocations.
For example, a future malloc (1) might return a pointer with odd
alignment, because no object of size 1 can have a fundamental
alignment greater than 1.
* The s390-linux-gnu (31bit) configuration is no longer supported.
* The --enable-memory-tagging configure option has been removed.
The corresponding AArch64-specific functionality that was previously
activated by this flag has been removed as well.
* The --enable-static-nss configure option has been removed. It had no
effect on the build since the NSS reorganization in glibc 2.33; its only
remaining behavior was to suppress the link-time warnings on the NSS
interface functions in libc.a, which are now emitted unconditionally.
Changes to build and runtime requirements:
[Add changes to build and runtime requirements here]
Security related changes:
The following CVEs were fixed in this release, details of which can be
found in the advisories directory of the release tarball:
GLIBC-SA-2026-0005:
gethostbyaddr and gethostbyaddr_r may incorrectly handle DNS
response (CVE-2026-4437)
GLIBC-SA-2026-0006:
gethostbyaddr and gethostbyaddr_r return invalid DNS hostnames
(CVE-2026-4438)
GLIBC-SA-2026-0007:
iconv crash due to assertion failure with untrusted input
(CVE-2026-4046)
The following bugs were resolved with this release:
[The release manager will add the list generated by
scripts/list-fixed-bugs.py just before the release.]
Version 2.43
Major new features:
* The ISO C23 free_sized, free_aligned_sized, memset_explicit, and
memalignment functions have been added.
* As specified in ISO C23, the assert macro is defined to take variable
arguments to support expressions with a comma inside a compound
literal initializer not surrounded by parentheses.
* For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
pointers into their input arrays now have definitions as macros that
return a pointer to a const-qualified type when the input argument is
a pointer to a const-qualified type.
* The ISO C23 typedef names long_double_t, _Float32_t, _Float64_t, and
(on platforms supporting _Float128) _Float128_t, introduced in TS
18661-3:2015, have been added to <math.h>.
* The ISO C23 optional time bases TIME_MONOTONIC, TIME_ACTIVE, and
TIME_THREAD_ACTIVE have been added.
* On Linux, the mseal function has been added. It allows for sealing
memory mappings to prevent further changes during process execution,
such as changes to protection permissions, unmapping, relocation to
another location, or shrinking the size.
* Additional optimized and correctly rounded mathematical functions have
been imported from the CORE-MATH project, in particular acosh, asinh,
atanh, erf, erfc, lgamma, and tgamma.
* Optimized implementations for fma, fmaf, remainder, remaindef, frexpf,
frexp, frexpl (binary128), and frexpl (intel96) have been added.
* The SVID handling for acosf, acoshf, asinhf, atan2f, atanhf, coshf, fmodf,
lgammaf/lgammaf_r, log10f, remainderf, sinhf, sqrtf, tgammaf, y0/j0,
y1/j1, and yn/jn was moved to compat symbols, allowing improvements in
performance.
* Experimental support for building with clang has been added. It requires
at least clang version 18, aarch64-linux-gnu or x86_64-linux-gnu
targets, and a libgcc compatible runtime (including libgcc_s.so for
pthread cancellation and backtrace runtime support).
* On Linux, the openat2 function has been added. It is an extension of
openat and provides a superset of its functionality. It is supported only
in LFS mode and is a cancellable entrypoint.
* On AArch64, support for 2MB transparent huge pages has been enabled by
default in malloc (similar to setting glibc.malloc.hugetlb=1 tunable).
* On AArch64 Linux targets supporting the Scalable Matrix Extension
(SME), the clone() system call wrapper will disable the ZA state of the
SME.
* On AArch64 targets supporting the Branch Target Identification (BTI)
extension, it is possible to enforce that all binaries in the process
support BTI using the glibc.cpu.aarch64_bti tunable.
* On AArch64 Linux targets supporting at least one of the branch protection
extensions (e.g. Branch Target Identification or Guarded Control Stack), it
is possible to use LD_DEBUG=security to make the dynamic linker show
warning messages about loaded binaries that do not support the
corresponding security feature.
* On AArch64, vector variants of the new C23 exp2m1, exp10m1, log10p1,
log2p1, and rsqrt routines have been added.
* On RISC-V, an RVV-optimized implementation of memset has been added.
* On x86, support for the Intel Nova Lake and Wildcat Lake processors
has been added.
* The test suite has seen significant improvements in particular around
the scanf, strerror, strsignal functions and multithreaded testing.
* Unicode support has been updated to Unicode 17.0.0.
* The manual has been updated and modernized, in particular also regarding
many of its code examples.
Deprecated and removed features, and other changes affecting compatibility:
* Support for dumped heaps has been removed. malloc_set_state() now always
returns the error code -1.
* The aforementioned change in ISO C23 of the declaration of bsearch,
memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr,
wcsstr, and wmemchr as const-preserving macros can lead to compilation
issues in code not set up for it. In particular, gnulib snapshots may need
to be updated.
* The uimaxabs function has been renamed to umaxabs, following a change
to the name of that function in ISO C2Y. The old function continues
to exist as a compatibility symbol for old binaries.
* The fromfp, fromfpx, ufromfp and ufromfpx functions, and the
corresponding functions for other floating-point types, now return
their result in the same type as their floating-point argument, rather
than intmax_t or uintmax_t, in accordance with a change to the
definition of these functions in ISO C23. Existing binaries that use
the versions returning intmax_t or uintmax_t will continue to work.
* The support for TX lock elision of pthread mutexes has been removed on all
architectures (powerpc, s390x, x86_64).
* The next linux 6.19 release will remove support for compat syscalls on s390x.
Therefore the s390-linux-gnu (31bit) configuration is deprecated in the
glibc 2.43 release and will then be removed with glibc 2.44 release.
Note that s390x-linux-gnu (64bit) remains supported.
Changes to build and runtime requirements:
* The LD_PROFILE functionality no longer has a default directory for the
profile data it writes. Instead, developers are required to set a
directory explicitly using the LD_PROFILE_OUTPUT environment variable.
To restore the previous, insecure behavior, processes can be run with
LD_PROFILE_OUTPUT=/var/tmp.
Security related changes:
The following CVEs were fixed in this release, details of which can be
found in the advisories directory of the release tarball:
GLIBC-SA-2026-0001:
Integer overflow in memalign leads to heap corruption
(CVE-2026-0861)
GLIBC-SA-2026-0002:
getnetbyaddr and getnetbyaddr_r leak stack contents to DNS resovler
(CVE-2026-0915)
GLIBC-SA-2026-0003:
wordexp with WRDE_REUSE and WRDE_APPEND may return uninitialized
memory (CVE-2025-15281)
The following bugs were resolved with this release:
[15503] math: [arm] Support ARM VFPv4 VFMA instruction in fma
[20473] manual: Missing word in stack allocation documentation.
[24657] manual: Two mistakes in manual index
[25669] dynamic-link: Provide extra information when a found library
file is not suitable
[28038] stdio: getdelim()/getline() does not add NUL terminator if
first character is EOF.
[28267] nptl: nptl: pthread_exit should set cancellation type and
state
[28327] math: Wrong return type for {,u}fromfp{,x} functions
[28376] libc: [meta] Build glibc with Clang
[29326] math: Usage of double in sqrtf
[30635] glob: stack-overflow /build/glibc-
SzIz7B/glibc-2.31/posix/../posix/glob.c:546:9 in glob64
[31470] libc: inttypes.h provides incorrect macro definitions
[31664] libc: rfe: please provide openat2()
[31943] dynamic-link: _dl_find_object can fail if ld.so contains gaps
between load segments
[32339] build: iconv functions do not follow symlinks
[32378] libc: Implement memset_explicit
[32583] libc: setup_vdso doesn't support two PT_LOAD segments if one
of them has zero-vaddr
[32994] libc: pthread_rwlock_init reinitialisation during calls to
fork()
[33093] manual: Typo in section 16.9.8 Out-of-Band Data of the manual
[33129] dynamic-link: Need a version tag to indicate that glibc has
working GNU2 TLS support
[33182] build: Some tests leave random directories under /tmp
[33190] localedata: localedata: Add en_SE for ISO8601 date and time
[33212] dynamic-link: Add GLIBC_ABI_DT_X86_64_PLT version to indicate
x86_64 psABI compliance for DT_X86_64_PLT* support
[33221] dynamic-link: Add GLIBC_ABI_GNU_TLS version to indicate the
working GNU TLS run-time
[33227] network: namespace violation in inet-fortified.h
[33234] libc: s390: Test tst-locale1 fails on s390 32-bit
[33245] nptl: nptl: error in internal cancellation syscall handling,
corrupting copy_file_range syscall return value
[33254] libc: tst-freopen4-mem and tst-freopen64-4-mem FAIL
[33286] build: Test failure with glibc built with -mno-direct-extern-
access
[33289] localedata: Update locale data to Unicode 17.0.0
[33300] stdio: strip --strip-unneeded "breaks" libc.a (causing
segfault in Rust programs linked libc statically)
[33311] build: Testing failure with clang
[33312] build: Disable -Wimplicit-fallthrough for clang
[33318] build: -c shouldn't be passed to LIBC_TRY_TEST_CC_OPTION
[33325] libc: ISO C2y renamed s/uimaxabs/umaxabs/
[33340] libc: Possible regression in 2.42 termios refactoring re non-
standard baud rate
[33356] nptl: creating thread stack with guardsize 0 can erroneously
conclude MADV_GUARD_INSTALL is available
[33361] nss: Group merge does not handle ERANGE during merge
[33376] build: GCC 16 fails to build glibc when configured with
--disable-default-pie --enable-profile
[33404] dynamic-link: ld.so crashes when compiled with -Os and
configured with --enable-stack-protector=all
[33405] math: Optimize modf/modff for x86_64-v2 aren't compiled with
-fsignaling-nans
[33411] math: powl() raises spurious overflow
[33425] build: setfpucw.c:25:17: error: variable cw set but not used
[-Werror=unused-but-set-variable=]
[33519] nss: getXXX API fails for turkish locale if nsswitch.conf
contains "i"
[33542] libc: x86: wmemset ifunc: stray '!' causing SSE2
[33547] libc: microblaze: wrong __syscall_cancel_arch after
89b53077d2a58f00e7debdfe58afabe953dac60d
[33563] math: powf() fails for 0x1p+8192 ^ 1.0
[33586] math: [2.43 Regression] FAIL: math/test-float64x-pow
[33619] math: [2.43 Regression] Many math test failures on x86-64
[33627] libc: execvp reads uninitialized memory
[33632] nptl: Incorrect USE_64B_ATOMICS usage on struct new_sem
[33653] time: __fts64_children_time64 Does Not Support 2038 Problem
[33677] math: [2.43 Regression] Many math test failures
[33715] nptl: nptl: pthread_create might act as a cancellation
entrypoint
[33717] nptl: nptl:
pthread_join/pthread_timedjoin_np/pthread_clockjoin_np might not act
as cancellation entrypoint
[33752] manual: Doc incorrectly says double and long double may not be
distinct
[33814] glob: wordexp with WRDE_REUSE and WRDE_APPEND may return
uninitialized memory
Version 2.42
Major new features:
@@ -19,38 +320,58 @@ Major new features:
* On Linux, the pthread_gettid_np function has been added.
* The ISO C2Y family of unsigned abs functions, i.e.
uabs, ulabs, ullabs and uimaxabs, are now supported.
* The ISO C2Y family of unsigned abs functions, i.e. uabs, ulabs,
ullabs, and uimaxabs, is now supported.
* On Linux, the <termios.h> interface now supports arbitrary baud rates;
speed_t is redefined to simply be the baud rate specified as an
unsigned int, which matches the kernel interface.
* The thread-local cache in malloc (tcache) now supports caching of large
blocks. This feature can be enabled by setting the tunable
glibc.malloc.tcache_max to a larger value (max 4194304).
Tcache is also significantly faster for small sizes.
* The thread-local cache in malloc (tcache) now supports caching of
large blocks. This feature can be enabled by setting the tunable
glibc.malloc.tcache_max to a larger value (max 4194304). Tcache is
also significantly faster for small sizes.
* New stack tracer using SFrame. Introducing --disable-sframe a new
configuration flag. Building glibc using sframe is automatically
enabled when the build system supports it.
* A new configure option, "--enable-sframe", can be used to enable
SFrame support of the GNU C Libraries. SFrame is a new stack trace
information format which can be used by backtrace. It requires
binutils with a minimum version of 2.45.
* Support for lightweight stack guard pages via madvise and the
MADV_GUARD_INSTALL flag has been added to pthread_create.
* Additional optimized and correctly rounded mathematical functions have
been imported from the CORE-MATH project, in particular acospif,
asinpif, atanpif, atan2pif, cospif, sinpif, tanpif.
* The testsuite has been significantly extended, including coverage of
the functionality of the printf and scanf function families in many
variants.
* The manual has been significantly extended and updated, particularly
the threads, terminal, filesystem, resource, and math chapters.
* Code has been added to detect the x86-64 Intel Arrow Lake, Panther
Lake, Clearwater Forest, and Diamond Rapids microarchitectures.
* Regarding S390, support for the new z17 platform has been added.
Deprecated and removed features, and other changes affecting compatibility:
* The glibc.rtld.execstack now supports a compatibility mode to allow
programs that require an executable stack through dynamic loaded
shared libraries.
* The glibc.rtld.execstack tunable now supports a compatibility mode to
allow programs that require an executable stack through dynamically
loaded shared libraries.
* On Linux, the <termio.h> header and the definition of struct termio
in <sys/ioctl.h> have been removed. The termio interface has been
obsolete since the very first version of POSIX.1 in 1988, replaced
with <termios.h>.
* The support for TX lock elision of pthread mutexes is deprecated on
all architectures and will be removed in the next release.
* The support for TX lock elision of pthread mutexes has been deprecated
on all architectures and will be removed in the next release.
* On AArch64 Linux targets supporting SME, setjmp and sigsetjmp will
disable ZA state of SME.
* On AArch64 Linux targets supporting the Scalable Matrix Extension
(SME), setjmp and sigsetjmp will disable the ZA state of SME.
Changes to build and runtime requirements:
@@ -63,13 +384,119 @@ Security related changes:
The following CVEs were fixed in this release, details of which can be
found in the advisories directory of the release tarball:
[The release manager will add the list generated by
scripts/process-advisories.sh just before the release.]
GLIBC-SA-2025-0001:
assert: Buffer overflow when printing assertion failure message
(CVE-2025-0395)
GLIBC-SA-2025-0003:
power10: strcmp fails to save and restore nonvolatile vector
registers (CVE-2025-5702)
GLIBC-SA-2025-0004:
power10: strncmp fails to save and restore nonvolatile vector
registers (CVE-2025-5745)
GLIBC-SA-2025-0005:
posix: Fix double-free after allocation failure in regcomp
(CVE-2025-8058)
The following bugs were resolved with this release:
[The release manager will add the list generated by
scripts/list-fixed-bugs.py just before the release.]
[5994] stdio: fflush after ungetc on seekable input stream
[12724] stdio: fclose violates POSIX 2008 on seekable input streams
[25263] dynamic-link: ldd and ld.so fail to resolve $ORIGIN with cross
dir symlink
[27880] nptl: Please provide a pthread pid accessor
[29190] dynamic-link: Symbols with version hash zero lead to crashes,
not matched correctly
[29459] stdio: fwrite does not return EPIPE when underlying write
fails with EPIPE.
[31791] nss: [Regression] nss: memory for >8 elements in nsswitch.conf
is not freed
[32058] libc: qsort leaks memory if C++ exception is thrown from
comparison function
[32269] dynamic-link: RISC-V IFUNC resolver cannot access gp pointer
[32369] stdio: fflush(NULL) doesn't properly flush files opened in
read mode
[32411] math: THREEp96 seems wrong
[32412] dynamic-link: Initial DTV is reallocated using main realloc in
auditing mode
[32483] locale: ctype.h macros segfault in multithreaded programs with
multiple libc.so
[32529] stdio: fseek failure on file opened with "rm" mode after
ungetc
[32535] stdio: fflush failure on file opened with "rm" mode after
ungetc
[32541] libc: getenv cannot be overridden in static builds
[32574] libc: pthread_attr_getstacksize/pthread_attr_getstack return
incorrect main stack size
[32612] dynamic-link: [aarch64 PAC] _dl_tlsdesc_dynamic can't be
unwound through with _Unwind_Backtrace
[32626] math: math: log10p1f is not correctly rounded
[32627] math: math: sinhf is not correctly rounded
[32630] math: math: tanf is not correctly rounded for all rounding
modes
[32653] dynamic-link: Review options for improving both security and
backwards compatibility of glibc 2.41 dlopen / execstack handling
[32694] math: wrong clang version 3.4 prereq checks in bits/floatn.h
for __float128 support, should be 3.9
[32708] libc: Inclusion of sys/mount.h triggers many gcc warnings
using -Wshift-overflow=2 -Wsystem-headers
[32711] math: math: remainder incorrect sign of zero result
[32717] libc: glibc tests fail when bfd is built with --enable-error-
execstack=yes
[32723] math: [2.41 Regression] /usr/include/bits/floatn.h doesn't
work with Intel SYCL compiler
[32763] dynamic-link: Static PIE with more than one PT_LOAD segments
at offset 0 segfault
[32777] crypt: The performance of the rand() function degradation
[32781] libc: Inccorect attribute access for sched_getattr
[32782] nptl: Race conditions in pthread cancellation causing crash
[32786] nptl: pthread_cond_* symbols should probably have had a
version bump in 2.41
[32795] nptl: aio_suspend_time64 confuses CLOCK_MONOTONIC and
CLOCK_REALTIME
[32810] dynamic-link: Immediate crash on x86-64 when running with
GLIBC_TUNABLES=glibc.cpu.hwcaps=-XSAVEC
[32823] libc: make[2]: *** [../Rules:248:
/home/dave/gnu/glibc/objdir/elf/tst-origin] Error 1
[32897] dynamic-link: pthread_getattr_np fails when executable stack
tunable is set
[32918] math: math: atanhf triggers UB
[32919] math: math: coshf triggers UB
[32920] math: math: logf triggers UB
[32921] math: math: sinhf triggers UB
[32922] math: math: cbrtf triggers UB
[32923] math: math: cospif triggers UB
[32924] math: math: erfcf triggers UB
[32925] math: math: sinpif triggers UB
[32932] libc: riscv: __riscv_hwprobe function attributes are incorrect
[32947] libc: stdlib: wrong iovec array size on __libc_message_impl
[32980] manual: getopt_long_only does not check long options first, as
the manual claims
[32981] ports: elf/tst-execstack-prog-static-tunable fails on
sparc64-linux-gnu
[32987] libc: New tst-dlopen-sgid test FAILs
[32996] malloc: i386 TLS helper functions don't preserve XMM registers
[33035] libc: [2.27 regression] Linux: __close_nocancel_nostatus
clobbers errno
[33056] string: Power 10 strcmp clobbers nonvolatile vector registers
(CVE-2025-5702)
[33059] string: Power 10 memchr clobbers v20
[33060] string: Power 10 strncmp clobbers nonvolatile vector registers
(CVE-2025-5745)
[33088] dynamic-link: __ehdr_start may need run-time relocation
[33089] build: [2.42 Regression] GCC 14.2.1 failed to build glibc
[33134] libc: mcount_internal shouldn't use vector/r16-r31 registers
nor call memcpy/memset
[33139] stdio: %n after static dlopen is unreliable if file
descriptors are exhausted
[33165] build: [2.42 Regression] FAIL: elf/check-localplt
[33173] math: Wrong IFUNC selector is used for modf/modff
[33185] regex: Double-free after memory allocation failure in regcomp
bracket expression parsing (CVE-2025-8058)
[33224] dynamic-link: _dl_debug_state hook no longer works (since
8329939a37f483a16013dd8af8303cbcb86d92cb)
Version 2.41
@@ -8173,7 +8600,7 @@ Version 1.06
`make dvi' will produce a DVI file of the printed manual.
`make info' will produce Info files that you can read on line using C-h i
in Emacs or the `info' program.
Please send comments on the manual to bug-glibc-manual@gnu.org.
Please send comments on the manual to libc-alpha@sourceware.org.
* The library now supports SVR4 on i386s (i386-unknown-sysv4).
+4 -4
View File
@@ -38,7 +38,6 @@ The GNU C Library supports these configurations for using Linux kernels:
or1k-*-linux-gnu
powerpc-*-linux-gnu Hardware or software floating point, BE only.
powerpc64*-*-linux-gnu Big-endian and little-endian.
s390-*-linux-gnu
s390x-*-linux-gnu
riscv32-*-linux-gnu
riscv64-*-linux-gnu
@@ -63,9 +62,10 @@ following the bug-reporting instructions below. Please be sure to check
the manual in the current development sources to see if your problem has
already been corrected.
Please see https://www.gnu.org/software/libc/bugs.html for bug reporting
information. We are now using the Bugzilla system to track all bug reports.
This web page gives detailed information on how to report bugs properly.
Please see https://sourceware.org/glibc/wiki/Bugzilla%20Procedures for bug
reporting information. We are now using the Bugzilla system to track all
bug reports. This web page gives detailed information on how to report
bugs properly.
The GNU C Library is free software. See the file COPYING.LIB for copying
conditions, and LICENSES for notices about a few contributions that require
+42 -14
View File
@@ -1,4 +1,4 @@
# Copyright (C) 1991-2025 Free Software Foundation, Inc.
# Copyright (C) 1991-2026 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -195,9 +195,17 @@ xtests:
> $(objpfx)subdir-xtests.sum
ifeq ($(build-programs),yes)
binaries-all-notests = $(others) $(sysdep-others)
ifeq (yes,$(have-libgcc_s))
# NB: Build programs in $(others-noinstall) like tests only if libgcc_s is
# available. Otherwise, "build-many-glibcs.py compilers" will fail to
# build the initial glibc with the initial limited gcc due to the missing
# libgcc_s.
all-notests = $(others-noinstall)
endif
binaries-all-notests = $(filter-out $(all-notests), \
$(others) $(sysdep-others))
binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) \
$(tests-container)
$(tests-container) $(all-notests)
binaries-all = $(binaries-all-notests) $(binaries-all-tests)
binaries-static-notests = $(others-static)
binaries-static-tests = $(tests-static) $(xtests-static)
@@ -280,7 +288,8 @@ $(addprefix $(objpfx),$(binaries-malloc-check-tests)): %-malloc-check: %.o \
endif
ifneq "$(strip $(binaries-malloc-hugetlb1-tests))" ""
$(addprefix $(objpfx),$(binaries-malloc-hugetlb1-tests)): %-malloc-hugetlb1: %.o \
$(addprefix $(objpfx),$(binaries-malloc-hugetlb1-tests)): \
%-malloc-hugetlb1: %-malloc-hugetlb1.o \
$(link-extra-libs-tests) \
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
@@ -288,7 +297,8 @@ $(addprefix $(objpfx),$(binaries-malloc-hugetlb1-tests)): %-malloc-hugetlb1: %.o
endif
ifneq "$(strip $(binaries-malloc-hugetlb2-tests))" ""
$(addprefix $(objpfx),$(binaries-malloc-hugetlb2-tests)): %-malloc-hugetlb2: %.o \
$(addprefix $(objpfx),$(binaries-malloc-hugetlb2-tests)): \
%-malloc-hugetlb2: %-malloc-hugetlb2.o \
$(link-extra-libs-tests) \
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
@@ -340,21 +350,39 @@ $(1)-malloc-check-ENV = MALLOC_CHECK_=3 \
endef
$(foreach t,$(tests-malloc-check),$(eval $(call malloc-check-ENVS,$(t))))
# Generate environment variable GLIBC_TUNABLES to be appended to
# the test environment, appending tunables specifically added for
# each test to the ambient GLIBC_TUNABLES environment variable.
# The *-TUNABLES-only can be used by a test to override any ambient
# tunables.
define test-tun-joined
$(subst $(empty) ,:,$(strip $($*-TUNABLES)))
endef
define test-tunables-all
$(if $($*-TUNABLES),$(if $(GLIBC_TUNABLES),GLIBC_TUNABLES=$(GLIBC_TUNABLES):$(test-tun-joined),GLIBC_TUNABLES=$(test-tun-joined)),)
endef
define test-tunables-only
GLIBC_TUNABLES=$(subst $(empty) ,:,$(strip $($*-TUNABLES-only)))
endef
define test-tunables
$(if $($*-TUNABLES-only),$(test-tunables-only),$(test-tunables-all))
endef
# All malloc-hugetlb1 tests will be run with GLIBC_TUNABLES=glibc.malloc.hugetlb=1
define malloc-hugetlb1-ENVS
$(1)-malloc-hugetlb1-ENV += GLIBC_TUNABLES=glibc.malloc.hugetlb=1
$(1)-malloc-hugetlb1-TUNABLES += glibc.malloc.hugetlb=1
endef
$(foreach t,$(tests-malloc-hugetlb1),$(eval $(call malloc-hugetlb1-ENVS,$(t))))
# All malloc-hugetlb2 tests will be run with GLIBC_TUNABLE=glibc.malloc.hugetlb=2
define malloc-hugetlb2-ENVS
$(1)-malloc-hugetlb2-ENV += GLIBC_TUNABLES=glibc.malloc.hugetlb=2
$(1)-malloc-hugetlb2-TUNABLES += glibc.malloc.hugetlb=2
endef
$(foreach t,$(tests-malloc-hugetlb2),$(eval $(call malloc-hugetlb2-ENVS,$(t))))
# All malloc-largetcache tests will be run with GLIBC_TUNABLE=glibc.malloc.tcache_max=1048576
define malloc-largetcache-ENVS
$(1)-malloc-largetcache-ENV += GLIBC_TUNABLES=glibc.malloc.tcache_max=1048576
$(1)-malloc-largetcache-TUNABLES += glibc.malloc.tcache_max=1048576
endef
$(foreach t,$(tests-malloc-largetcache),$(eval $(call malloc-largetcache-ENVS,$(t))))
@@ -364,13 +392,13 @@ $(1)-mcheck-ENV = LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
endef
$(foreach t,$(tests-mcheck),$(eval $(call mcheck-ENVS,$(t))))
ifneq "$(strip $(tests) $(tests-internal) $(xtests) $(test-srcs))" ""
ifneq "$(strip $(tests) $(tests-container) $(tests-internal) $(xtests) $(test-srcs))" ""
# These are the implicit rules for making test outputs
# from the test programs and whatever input files are present.
define make-test-out
$(if $($*-ENV-only),$(test-wrapper-env-only) $($*-ENV-only),\
$(test-wrapper-env) $(run-program-env) $($*-ENV)) \
$(if $($*-ENV-only),$(test-wrapper-env-only) $($*-ENV-only) $(test-tunables),\
$(test-wrapper-env) $(run-program-env) $($*-ENV) $(test-tunables)) \
$(host-test-program-cmd) $($*-ARGS)
endef
$(objpfx)%.out: %.input $(objpfx)%
@@ -385,8 +413,8 @@ $(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence.
# and pid namespaces) in which to run, should be added to
# tests-container.
$(tests-container:%=$(objpfx)%.out): $(objpfx)%.out : $(if $(wildcard $(objpfx)%.files),$(objpfx)%.files,/dev/null) $(objpfx)%
$(test-wrapper-env) $(run-program-env) $(run-via-rtld-prefix) \
$(common-objpfx)support/test-container env $(run-program-env) $($*-ENV) \
$(test-wrapper-env) $(run-program-env) $(test-via-rtld-prefix) \
$(common-objpfx)support/test-container env $(run-program-env) $($*-ENV) $(test-tunables) \
$(host-test-program-cmd) $($*-ARGS) > $@; \
$(evaluate-test)
+1 -1
View File
@@ -170,7 +170,7 @@ the bug, the fix, or the mailing list discussions.
## CVE assignment
Security bugs flagged with `security+` should have [CVE
identifiers](http://cve.mitre.org/about/). Please reach out to the glibc
identifiers](https://www.cve.org/About/Overview). Please reach out to the glibc
security team using the documented [security
process](https://sourceware.org/glibc/security.html) and they work on getting a
CVE number.
+631 -140
View File
@@ -14,6 +14,10 @@
# has to be compared manually so this list is likely incomplete or may contain
# errors.
gnulib:
COPYINGv2
COPYINGv3
COPYING.LESSERv2
doc/fdl-1.3.texi
argp/argp-ba.c
argp/argp-ba.c
argp/argp-eexst.c
@@ -29,10 +33,25 @@ gnulib:
argp/argp.h
dirent/alphasort.c
dirent/scandir.c
# Merged from gnulib 2021-09-21
# Merged from gnulib 2025-10-29 (gnulib commit 1790ef25d8)
include/intprops.h
include/intprops-internal.h
# Merged from gnulib 2026-02-16
include/assure.h
include/flexmember.h
include/hash.h
include/next-prime.h
include/xalloc-oversized.h
# Merged from gnulib 2021-09-21
include/regex.h
# Merged from gnulib 2026-02-16
io/cycle-check.c
io/cycle-check.h
io/dev-ino.h
io/fts-cycle.c
io/fts-common.c
io/i-ring.c
io/same-inode.h
locale/programs/3level.h
# Merged from gnulib 2014-6-23
malloc/obstack.c
@@ -42,7 +61,9 @@ gnulib:
misc/error.c
misc/error.h
misc/getpass.c
misc/hash.c
misc/mkdtemp.c
misc/next-prime.c
# Merged from gnulib 2021-09-21
misc/sys/cdefs.h
posix/fnmatch_loop.c
@@ -92,6 +113,8 @@ gnulib:
stdlib/setenv.c
stdlib/strtoll.c
stdlib/strtoul.c
stdlib/tst-stdc_rotate_left.c
stdlib/tst-stdc_rotate_right.c
# Merged from gnulib 2014-6-26, needs merge back
string/memchr.c
string/memcmp.c
@@ -129,9 +152,7 @@ gnulib:
time/strptime.c
time/timegm.c
# The last merge was 2014-12-11 and merged gettext 0.19.3 into glibc with a
# patch submitted to the gettext mailing list for changes that could be merged
# back.
# Synced with GNU gettext 1.0 (2026-05-18), through gettext commit 2ebbdd0e2.
#
# This commit was omitted from the merge as it does not appear to be compatible
# with how glibc expects things to work:
@@ -148,6 +169,7 @@ gettext:
intl/dcngettext.c
intl/dgettext.c
intl/dngettext.c
intl/eval-plural.h
intl/explodename.c
intl/finddomain.c
intl/gettext.c
@@ -178,7 +200,7 @@ linux:
# The following files are shared with the upstream Unicode project and must be
# updated regularly to stay in sync with the upstream unicode releases.
#
# Merged from Unicode 16.0.0 release.
# Merged from Unicode 17.0.0 release (2025 September 9)
unicode:
localedata/unicode-gen/UnicodeData.txt
localedata/unicode-gen/unicode-license.txt
@@ -189,8 +211,9 @@ unicode:
# The following files are shared with the upstream tzcode project and must be
# updated regularly to stay in sync with the upstream releases.
#
# Currently synced to TZDB 2024b, announced and distributed here:
# https://github.com/eggert/tz/releases/tag/2024b
# Currently synced to TZDB 2026b, distributed at:
# https://github.com/eggert/tz/releases/tag/2026b
# https://data.iana.org/time-zones/releases/tzdb-2026b.tar.lz
tzcode:
timezone/private.h
timezone/tzfile.h
@@ -229,136 +252,604 @@ tzdata:
# This is yearistype.sh in the parent project
timezone/yearistype
# The following files are shared with the CORE-MATH project
sysdeps/ieee754/flt-32/e_gammaf_r.c
(file src/binary32/tgamma/tgammaf.c in CORE-MATH)
Instructions to merge new versions:
- change the function name from cr_tgammaf to __ieee754_gammaf_r
- add "int *signgamp" as 2nd argument and add at the beginning:
if (signgamp != NULL) *signgamp = 1;
- remove the errno stuff (this is done by the wrapper)
- replace 0x1p127f * 0x1p127f by math_narrow_eval (x * 0x1p127f)
- replace 0x1p-127f * sgn[k&1] by math_narrow_eval (0x1p-127f * sgn[k&1])
- add libm_alias_finite (__ieee754_gammaf_r, __gammaf_r) at the end
sysdeps/ieee754/flt-32/s_exp10m1f.c
(file src/binary32/exp10m1/exp10m1f.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_exp2m1f.c
(file src/binary32/exp2m1/exp2m1f.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_expm1f.c
(file src/binary32/expm1/expm1f.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/e_log10f.c
(file src/binary32/log10/log10f.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_log2p1f.c
(file src/binary32/log2p1/log2p1f.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_log1pf.c
(file src/binary32/log1p/log1pf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_log10p1f.c
(file src/binary32/log10p1/log10p1f.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_cbrtf.c
(file src/binary32/cbrt/cbrtf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_erff.c
(file src/binary32/erf/erff.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_erfcf.c
(file src/binary32/erfc/erfcf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/e_lgammaf_r.c:
(file src/binary32/lgamma/lgammaf.c in CORE-MATH)
- change the function name from cr_lgammaf to __ieee754_lgammaf_r
- add "int *signgamp" as 2nd argument and add at the beginning:
if (signgamp != NULL) *signgamp = 1;
- remove the errno stuff (this is done by the wrapper)
- replace 0x1p127f * 0x1p127f by math_narrow_eval (x * 0x1p127f)
- add libm_alias_finite (__ieee754_lgammaf_r, __lgammaf_r) at the end
sysdeps/ieee754/flt-32/s_tanf.c:
(src/binary32/tan/tanf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow. It was changed
to use an internal wrapper for 128 bit unsigned integer operations
for ABIs that do not support the type natively.
sysdeps/ieee754/flt-32/e_acosf.c:
(src/binary32/acos/acosf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/e_acoshf.c:
(src/binary32/acosh/acoshf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/e_asinf.c:
(src/binary32/asin/asinf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_asinhf.c:
(src/binary32/asinh/asinhf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_atanf.c:
(src/binary32/atan/atanf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/e_atan2f.c:
(src/binary32/atan2/atan2f.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/e_atanhf.c:
(src/binary32/atanh/atanhf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/e_coshf.c:
(src/binary32/cosh/coshf.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/e_sinhf.c:
(src/binary32/sinh/sinhf.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_tanhf.c:
(src/binary32/tanh/tanhf.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_acospif.c:
(src/binary32/acospi/acospif.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_asinpif.c:
(src/binary32/asinpi/asinpif.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_atan2pif.c:
(src/binary32/atan2pi/atan2pif.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_atanpif.c:
(src/binary32/atanpi/atanpif.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_cospif.c:
(src/binary32/cospi/cospif.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_sinpif.c:
(src/binary32/sinpi/sinpif.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
sysdeps/ieee754/flt-32/s_tanpif.c:
(src/binary32/tanpi/tanpif.c in CORE-MATH)
- the code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
# The following files are imported from the CORE-MATH project, with
# adjustments made to follow glibc code style, to utilize internal error
# handling functions, and to implement minor fixes for ABIs with
# FLT_EVAL_METHOD equal to 2 (i386). Additionally, extra optimizations
# are applied to share the internal data table across different
# implementations.
#
# The project is distribute here:
# https://gitlab.inria.fr/core-math/core-math/
core-math:
# src/binary64/acosh/acosh.c, revision 887cab6f
sysdeps/ieee754/dbl-64/e_acosh.c
# src/binary64/atanh/atanh.c, revision 532e37dc
sysdeps/ieee754/dbl-64/e_atanh.c
# src/binary64/cosh/cosh.c, revision 5d0c89d5
sysdeps/ieee754/dbl-64/e_cosh.c
# src/binary64/tgamma/tgamma.c, revision 0f185e23
sysdeps/ieee754/dbl-64/e_gamma_r.c
# src/binary64/lgamma/lgamma.c, revision 0413bb7e
sysdeps/ieee754/dbl-64/e_lgamma_r.c
# src/binary64/sinh/sinh.c, revision 8127b7ac
sysdeps/ieee754/dbl-64/e_sinh.c
# src/binary64/asinh/asinh.c, revision cd653cf7
sysdeps/ieee754/dbl-64/s_asinh.c
# src/binary64/erf/erf.c, revision 384ed01d
sysdeps/ieee754/dbl-64/s_erf.c
# src/binary64/erfc/erfc.c, revision 55e9869e
sysdeps/ieee754/dbl-64/s_erfc.c
# src/binary64/tanh/tanh.c, revision 8ea8ea35
sysdeps/ieee754/dbl-64/s_tanh.c
# src/binary32/acos/acosf.c, revision 56dd347
sysdeps/ieee754/flt-32/e_acosf.c
# src/binary32/acosh/acoshf.c, revision d0b9ddd
sysdeps/ieee754/flt-32/e_acoshf.c
# file src/binary32/cosh/coshf.c, revision de59ecfb
sysdeps/ieee754/flt-32/e_coshf.c
# src/binary32/tgamma/tgammaf.c, revision 8ea8ea35
sysdeps/ieee754/flt-32/e_gammaf_r.c
# src/binary32/lgamma/lgammaf.c, revision 8ea8ea35
sysdeps/ieee754/flt-32/e_lgammaf_r.c
# src/binary32/log10/log10f.c, revision ebff4c43
sysdeps/ieee754/flt-32/e_log10f.c
# src/binary32/sinh/sinhf.c, revision bbfabd99
sysdeps/ieee754/flt-32/e_sinhf.c
# src/binary32/acospi/acospif.c, revision 1a6a9ab
sysdeps/ieee754/flt-32/s_acospif.c
# src/binary32/asinpi/asinpif.c, revision 6ee58266
sysdeps/ieee754/flt-32/s_asinpif.c
# src/binary32/atan2pi/atan2pif.c, revision dbebee1
sysdeps/ieee754/flt-32/s_atan2pif.c
# src/binary32/atanpi/atanpif.c, revision e02000e
sysdeps/ieee754/flt-32/s_atanpif.c
# src/binary32/cbrt/cbrtf.c, revision f7c7408d
sysdeps/ieee754/flt-32/s_cbrtf.c
# src/binary32/cospi/cospif.c, revision bbfabd99
sysdeps/ieee754/flt-32/s_cospif.c
# src/binary32/erfc/erfcf.c revision d0a2be20
sysdeps/ieee754/flt-32/s_erfcf.c
# src/binary32/erf/erff.c revision bc385c2
sysdeps/ieee754/flt-32/s_erff.c
# src/binary32/exp10m1/exp10m1f.c, revision c46b85b
sysdeps/ieee754/flt-32/s_exp10m1f.c
# src/binary32/exp2m1/exp2m1f.c, revision baf5f6b
sysdeps/ieee754/flt-32/s_exp2m1f.c
# src/binary32/expm1/expm1f.c, revision bc385c2
sysdeps/ieee754/flt-32/s_expm1f.c
# src/binary32/log10p1/log10p1f.c revision eb28456b
sysdeps/ieee754/flt-32/s_log10p1f.c
# src/binary32/log1p/log1pf.c revision 24ef43a1
sysdeps/ieee754/flt-32/s_log1pf.c
# src/binary32/log2p1/log2p1f.c revision 3fbe16be
sysdeps/ieee754/flt-32/s_log2p1f.c
# src/binary32/sinpi/sinpif.c, revision bbfabd99d
sysdeps/ieee754/flt-32/s_sinpif.c
# src/binary32/tan/tanf.c, revision 59d21d7
sysdeps/ieee754/flt-32/s_tanf.c
# src/binary32/tanh/tanhf.c, revision b1ecd83
sysdeps/ieee754/flt-32/s_tanhf.c
# src/binary32/tanpi/tanpif.c, revision 3bbf907
sysdeps/ieee754/flt-32/s_tanpif.c
# The following files are imported from the Arm Optimized-Routines project,
# with adjustments made to follow glibc code style and integrate with
# glibc-specific infrastructure where needed.
#
# The project is distributed here:
# https://github.com/ARM-software/optimized-routines/
arm-optimized-routines:
# Math routines
# math/math_config.h, revision 712aa21
sysdeps/ieee754/flt-32/math_config.h
# math/math_config.h, revision 712aa21
sysdeps/ieee754/dbl-64/math_config.h
# math/math_err.c, revision 189dfef
sysdeps/ieee754/dbl-64/math_err.c
# math/math_errf.c, revision 189dfef
sysdeps/ieee754/flt-32/math_errf.c
# math/cosf.c, revision aec783d
sysdeps/ieee754/flt-32/s_cosf.c
# math/exp2f.c, revision 712aa21
sysdeps/ieee754/flt-32/e_exp2f.c
# math/exp2f_data.c, revision 189dfef
sysdeps/ieee754/flt-32/e_exp2f_data.c
# math/expf.c, revision 712aa21
sysdeps/ieee754/flt-32/e_expf.c
# math/log2f.c, revision 712aa21
sysdeps/ieee754/flt-32/e_log2f.c
# math/log2f_data.c, revision 189dfef
sysdeps/ieee754/flt-32/e_log2f_data.c
# math/logf.c, revision 712aa21
sysdeps/ieee754/flt-32/e_logf.c
# math/logf_data.c, revision c0136f1
sysdeps/ieee754/flt-32/e_logf_data.c
# math/powf.c, revision 712aa21
sysdeps/ieee754/flt-32/e_powf.c
# math/powf_log2_data.c, revision 189dfef
sysdeps/ieee754/flt-32/e_powf_log2_data.c
# math/sincosf.c, revision af29d39
sysdeps/ieee754/flt-32/s_sincosf.c
# math/sincosf.h, revision aed553c
sysdeps/ieee754/flt-32/s_sincosf.h
# math/sincosf_data.c, revision 189dfef
sysdeps/ieee754/flt-32/s_sincosf_data.c
# math/sinf.c, revision aec783d
sysdeps/ieee754/flt-32/s_sinf.c
# math/exp.c, revision 712aa21
sysdeps/ieee754/dbl-64/e_exp.c
# math/exp10.c, revision 712aa21
sysdeps/ieee754/dbl-64/e_exp10.c
# math/exp2.c, revision 712aa21
sysdeps/ieee754/dbl-64/e_exp2.c
# math/exp_data.c, revision c013701
sysdeps/ieee754/dbl-64/e_exp_data.c
# math/log.c, revision 712aa21
sysdeps/ieee754/dbl-64/e_log.c
# math/log2.c, revision 712aa21
sysdeps/ieee754/dbl-64/e_log2.c
# math/log2_data.c, revision 189dfef
sysdeps/ieee754/dbl-64/e_log2_data.c
# math/log_data.c, revision 189dfef
sysdeps/ieee754/dbl-64/e_log_data.c
# math/pow.c, revision 712aa21
sysdeps/ieee754/dbl-64/e_pow.c
# math/pow_log_data.c, revision 189dfef
sysdeps/ieee754/dbl-64/e_pow_log_data.c
# Mathvec routines
# math/math_config.h, revision 712aa21
sysdeps/aarch64/fpu/vecmath_config.h
# math/aarch64/v_erf_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/erf_data.c
# math/aarch64/v_erfc_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/erfc_data.c
# math/aarch64/v_erfcf_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/erfcf_data.c
# math/aarch64/v_erff_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/erff_data.c
# math/aarch64/v_exp_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/v_exp_data.c
# math/aarch64/v_exp_tail_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/v_exp_tail_data.c
# math/aarch64/v_log10_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/v_log10_data.c
# math/aarch64/v_log2_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/v_log2_data.c
# math/aarch64/v_log_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/v_log_data.c
# math/aarch64/v_pow_exp_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/v_pow_exp_data.c
# math/aarch64/v_pow_log_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/v_pow_log_data.c
# math/aarch64/v_powf_data.c, revision 0a6ab6d
sysdeps/aarch64/fpu/v_powf_data.c
# math/aarch64/sve/acos.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/acos.c
# math/aarch64/sve/acosf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/acosf.c
# math/aarch64/sve/acosh.c, revision 8b665af
sysdeps/aarch64/fpu/sve/acosh.c
# math/aarch64/sve/acoshf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/acoshf.c
# math/aarch64/sve/acospi.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/acospi.c
# math/aarch64/sve/acospif.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/acospif.c
# math/aarch64/sve/asin.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/asin.c
# math/aarch64/sve/asinf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/asinf.c
# math/aarch64/sve/asinh.c, revision 9bf4cfc
sysdeps/aarch64/fpu/sve/asinh.c
# math/aarch64/sve/asinhf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/asinhf.c
# math/aarch64/sve/asinpi.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/asinpi.c
# math/aarch64/sve/asinpif.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/asinpif.c
# math/aarch64/sve/atan.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atan.c
# math/aarch64/sve/atan2.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atan2.c
# math/aarch64/sve/atan2f.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atan2f.c
# math/aarch64/sve/atan2pi.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atan2pi.c
# math/aarch64/sve/atan2pif.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atan2pif.c
# math/aarch64/sve/atanf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atanf.c
# math/aarch64/sve/atanh.c, revision 29c7342
sysdeps/aarch64/fpu/sve/atanh.c
# math/aarch64/sve/atanhf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atanhf.c
# math/aarch64/sve/atanpi.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atanpi.c
# math/aarch64/sve/atanpif.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/atanpif.c
# math/aarch64/sve/cbrt.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/cbrt.c
# math/aarch64/sve/cbrtf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/cbrtf.c
# math/aarch64/sve/cos.c, revision 99cbbad
sysdeps/aarch64/fpu/sve/cos.c
# math/aarch64/sve/cosf.c, revision 25aa012
sysdeps/aarch64/fpu/sve/cosf.c
# math/aarch64/sve/cosh.c, revision 242a017
sysdeps/aarch64/fpu/sve/cosh.c
# math/aarch64/sve/coshf.c, revision 2fff60c
sysdeps/aarch64/fpu/sve/coshf.c
# math/aarch64/sve/cospi.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/cospi.c
# math/aarch64/sve/cospif.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/cospif.c
# math/aarch64/sve/erf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/erf.c
# math/aarch64/sve/erfc.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/erfc.c
# math/aarch64/sve/erfcf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/erfcf.c
# math/aarch64/sve/erff.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/erff.c
# math/aarch64/sve/exp.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp.c
# math/aarch64/sve/exp10.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp10.c
# math/aarch64/sve/exp10f.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp10f.c
# math/aarch64/sve/exp10m1.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp10m1.c
# math/aarch64/sve/exp10m1f.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp10m1f.c
# math/aarch64/sve/exp2.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp2.c
# math/aarch64/sve/exp2f.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp2f.c
# math/aarch64/sve/exp2m1.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp2m1.c
# math/aarch64/sve/exp2m1f.c, revision d664b69
sysdeps/aarch64/fpu/sve/exp2m1f.c
# math/aarch64/sve/expf.c, revision 47044a5
sysdeps/aarch64/fpu/sve/expf.c
# math/aarch64/sve/expm1.c, revision d664b69
sysdeps/aarch64/fpu/sve/expm1.c
# math/aarch64/sve/expm1f.c, revision d664b69
sysdeps/aarch64/fpu/sve/expm1f.c
# math/aarch64/sve/hypot.c, revision 74d699d
sysdeps/aarch64/fpu/sve/hypot.c
# math/aarch64/sve/hypotf.c, revision 74d699d
sysdeps/aarch64/fpu/sve/hypotf.c
# math/aarch64/sve/log.c, revision 91b052e
sysdeps/aarch64/fpu/sve/log.c
# math/aarch64/sve/log10.c, revision 91b052e
sysdeps/aarch64/fpu/sve/log10.c
# math/aarch64/sve/log10f.c, revision 8ca4cc0
sysdeps/aarch64/fpu/sve/log10f.c
# math/aarch64/sve/log10p1.c, revision 166744d
sysdeps/aarch64/fpu/sve/log10p1.c
# math/aarch64/sve/log10p1f.c, revision 8124d30
sysdeps/aarch64/fpu/sve/log10p1f.c
# math/aarch64/sve/log1p.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/log1p.c
# math/aarch64/sve/log1pf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/log1pf.c
# math/aarch64/sve/log2.c, revision 91b052e
sysdeps/aarch64/fpu/sve/log2.c
# math/aarch64/sve/log2f.c, revision 8ca4cc0
sysdeps/aarch64/fpu/sve/log2f.c
# math/aarch64/sve/log2p1.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/log2p1.c
# math/aarch64/sve/log2p1f.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/log2p1f.c
# math/aarch64/sve/logf.c, revision 8ca4cc0
sysdeps/aarch64/fpu/sve/logf.c
# math/aarch64/sve/pow.c, revision 2c38e83
sysdeps/aarch64/fpu/sve/pow.c
# math/aarch64/sve/powf.c, revision 2c38e83
sysdeps/aarch64/fpu/sve/powf.c
# math/aarch64/sve/powr.c, revision 30da949
sysdeps/aarch64/fpu/sve/powr.c
# math/aarch64/sve/powrf.c, revision e2bca42
sysdeps/aarch64/fpu/sve/powrf.c
# math/aarch64/sve/rsqrt.c, revision 4fc7374
sysdeps/aarch64/fpu/sve/rsqrt.c
# math/aarch64/sve/rsqrtf.c, revision b1bc8ba
sysdeps/aarch64/fpu/sve/rsqrtf.c
# math/aarch64/sve/sin.c, revision 99cbbad
sysdeps/aarch64/fpu/sve/sin.c
# math/aarch64/sve/sinf.c, revision 25aa012
sysdeps/aarch64/fpu/sve/sinf.c
# math/aarch64/sve/sinh.c, revision 242a017
sysdeps/aarch64/fpu/sve/sinh.c
# math/aarch64/sve/sinhf.c, revision 2fff60c
sysdeps/aarch64/fpu/sve/sinhf.c
# math/aarch64/sve/sinpi.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/sinpi.c
# math/aarch64/sve/sinpif.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/sinpif.c
# math/aarch64/sve/tan.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/tan.c
# math/aarch64/sve/tanf.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/tanf.c
# math/aarch64/sve/tanh.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/tanh.c
# math/aarch64/sve/tanhf.c, revision 2fff60c
sysdeps/aarch64/fpu/sve/tanhf.c
# math/aarch64/sve/tanpi.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/tanpi.c
# math/aarch64/sve/tanpif.c, revision 1aad38d
sysdeps/aarch64/fpu/sve/tanpif.c
# math/aarch64/sve/sv_exp_special_inline.h, revision d664b69
sysdeps/aarch64/fpu/sve/sv_exp_special_inline.h
# math/aarch64/sve/sv_expf_inline.h, revision ba35b32
sysdeps/aarch64/fpu/sve/sv_expf_inline.h
# math/aarch64/sve/sv_expf_special_inline.h, revision d664b69
sysdeps/aarch64/fpu/sve/sv_expf_special_inline.h
# math/aarch64/sve/sv_expm1f_inline.h, revision 78cd003
sysdeps/aarch64/fpu/sve/sv_expm1f_inline.h
# math/aarch64/sve/sv_log1p_inline.h, revision 7d08237
sysdeps/aarch64/fpu/sve/sv_log1p_inline.h
# math/aarch64/sve/sv_log1pf_inline.h, revision a386525
sysdeps/aarch64/fpu/sve/sv_log1pf_inline.h
# math/aarch64/sve/sv_pow_inline.h, revision 30da949
sysdeps/aarch64/fpu/sve/sv_pow_inline.h
# math/aarch64/sve/sv_powf_inline.h, revision 30da949
sysdeps/aarch64/fpu/sve/sv_powf_inline.h
# math/aarch64/sve/sv_poly_f32.h, revision 5d5e6e6
sysdeps/aarch64/fpu/sve/poly_sve_f32.h
# math/aarch64/sve/sv_poly_f64.h, revision 5d5e6e6
sysdeps/aarch64/fpu/sve/poly_sve_f64.h
# math/aarch64/sve/sv_poly_generic.h, revision 5d5e6e6
sysdeps/aarch64/fpu/sve/poly_sve_generic.h
# math/aarch64/sve/sv_math.h, revision 7361ef6
sysdeps/aarch64/fpu/sve/sv_math.h
# math/aarch64/sve/sv_trig_fallback.h, revision 99cbbad
sysdeps/aarch64/fpu/sve/sv_trig_fallback.h
# math/aarch64/sve/sv_trigf_fallback.h, revision 25aa012
sysdeps/aarch64/fpu/sve/sv_trigf_fallback.h
# math/aarch64/advsimd/acos.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/acos.c
# math/aarch64/advsimd/acosf.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/acosf.c
# math/aarch64/advsimd/acosh.c, revision 188e75a
sysdeps/aarch64/fpu/advsimd/acosh.c
# math/aarch64/advsimd/acoshf.c, revision af3851e
sysdeps/aarch64/fpu/advsimd/acoshf.c
# math/aarch64/advsimd/acospi.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/acospi.c
# math/aarch64/advsimd/acospif.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/acospif.c
# math/aarch64/advsimd/asin.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/asin.c
# math/aarch64/advsimd/asinf.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/asinf.c
# math/aarch64/advsimd/asinh.c, revision bac1b4f
sysdeps/aarch64/fpu/advsimd/asinh.c
# math/aarch64/advsimd/asinhf.c, revision af3851e
sysdeps/aarch64/fpu/advsimd/asinhf.c
# math/aarch64/advsimd/asinpi.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/asinpi.c
# math/aarch64/advsimd/asinpif.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/asinpif.c
# math/aarch64/advsimd/atan.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/atan.c
# math/aarch64/advsimd/atan2.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/atan2.c
# math/aarch64/advsimd/atan2f.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/atan2f.c
# math/aarch64/advsimd/atan2pi.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/atan2pi.c
# math/aarch64/advsimd/atan2pif.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/atan2pif.c
# math/aarch64/advsimd/atanf.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/atanf.c
# math/aarch64/advsimd/atanh.c, revision 281cb3a
sysdeps/aarch64/fpu/advsimd/atanh.c
# math/aarch64/advsimd/atanhf.c, revision d852158
sysdeps/aarch64/fpu/advsimd/atanhf.c
# math/aarch64/advsimd/atanpi.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/atanpi.c
# math/aarch64/advsimd/atanpif.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/atanpif.c
# math/aarch64/advsimd/cbrt.c, revision 0a6ab6d
sysdeps/aarch64/fpu/advsimd/cbrt.c
# math/aarch64/advsimd/cbrtf.c, revision 6c74650
sysdeps/aarch64/fpu/advsimd/cbrtf.c
# math/aarch64/advsimd/cos.c, revision 677a12b
sysdeps/aarch64/fpu/advsimd/cos.c
# math/aarch64/advsimd/cosf.c, revision 15c35d9
sysdeps/aarch64/fpu/advsimd/cosf.c
# math/aarch64/advsimd/cosh.c, revision 447bbaa
sysdeps/aarch64/fpu/advsimd/cosh.c
# math/aarch64/advsimd/coshf.c, revision 45237ba
sysdeps/aarch64/fpu/advsimd/coshf.c
# math/aarch64/advsimd/cospi.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/cospi.c
# math/aarch64/advsimd/cospif.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/cospif.c
# math/aarch64/advsimd/erf.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/erf.c
# math/aarch64/advsimd/erfc.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/erfc.c
# math/aarch64/advsimd/erfcf.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/erfcf.c
# math/aarch64/advsimd/erff.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/erff.c
# math/aarch64/advsimd/exp.c, revision dce5dab
sysdeps/aarch64/fpu/advsimd/exp.c
# math/aarch64/advsimd/exp10.c, revision dce5dab
sysdeps/aarch64/fpu/advsimd/exp10.c
# math/aarch64/advsimd/exp10f.c, revision 69d38dd
sysdeps/aarch64/fpu/advsimd/exp10f.c
# math/aarch64/advsimd/exp10m1.c, revision dce5dab
sysdeps/aarch64/fpu/advsimd/exp10m1.c
# math/aarch64/advsimd/exp10m1f.c, revision a5092e8
sysdeps/aarch64/fpu/advsimd/exp10m1f.c
# math/aarch64/advsimd/exp2.c, revision dce5dab
sysdeps/aarch64/fpu/advsimd/exp2.c
# math/aarch64/advsimd/exp2f.c, revision 69d38dd
sysdeps/aarch64/fpu/advsimd/exp2f.c
# math/aarch64/advsimd/exp2m1.c, revision dce5dab
sysdeps/aarch64/fpu/advsimd/exp2m1.c
# math/aarch64/advsimd/exp2m1f.c, revision a5092e8
sysdeps/aarch64/fpu/advsimd/exp2m1f.c
# math/aarch64/advsimd/expf.c, revision 69d38dd
sysdeps/aarch64/fpu/advsimd/expf.c
# math/aarch64/advsimd/expm1.c, revision dce5dab
sysdeps/aarch64/fpu/advsimd/expm1.c
# math/aarch64/advsimd/expm1f.c, revision a5092e8
sysdeps/aarch64/fpu/advsimd/expm1f.c
# math/aarch64/advsimd/hypot.c, revision 09f8d05
sysdeps/aarch64/fpu/advsimd/hypot.c
# math/aarch64/advsimd/hypotf.c, revision 99dff4f
sysdeps/aarch64/fpu/advsimd/hypotf.c
# math/aarch64/advsimd/log.c, revision 0345857
sysdeps/aarch64/fpu/advsimd/log.c
# math/aarch64/advsimd/log10.c, revision 77aff35
sysdeps/aarch64/fpu/advsimd/log10.c
# math/aarch64/advsimd/log10f.c, revision ff1596f
sysdeps/aarch64/fpu/advsimd/log10f.c
# math/aarch64/advsimd/log10p1.c, revision 7fc8510
sysdeps/aarch64/fpu/advsimd/log10p1.c
# math/aarch64/advsimd/log10p1f.c, revision 58cd796
sysdeps/aarch64/fpu/advsimd/log10p1f.c
# math/aarch64/advsimd/log1p.c, revision 355a985
sysdeps/aarch64/fpu/advsimd/log1p.c
# math/aarch64/advsimd/log1pf.c, revision 5cf8408
sysdeps/aarch64/fpu/advsimd/log1pf.c
# math/aarch64/advsimd/log2.c, revision b8deb33
sysdeps/aarch64/fpu/advsimd/log2.c
# math/aarch64/advsimd/log2f.c, revision b98f80d
sysdeps/aarch64/fpu/advsimd/log2f.c
# math/aarch64/advsimd/log2p1.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/log2p1.c
# math/aarch64/advsimd/log2p1f.c, revision 58cd796
sysdeps/aarch64/fpu/advsimd/log2p1f.c
# math/aarch64/advsimd/logf.c, revision 1b15b12
sysdeps/aarch64/fpu/advsimd/logf.c
# math/aarch64/advsimd/finite_pow.h, revision 30da949
sysdeps/aarch64/fpu/advsimd/finite_pow.h
# math/pow_common.h, revision 30da949
sysdeps/aarch64/fpu/pow_common.h
# math/powf_common.h, revision 30da949
sysdeps/aarch64/fpu/powf_common.h
# math/aarch64/advsimd/pow.c, revision 30da949
sysdeps/aarch64/fpu/advsimd/pow.c
# math/aarch64/advsimd/powf.c, revision 30da949
sysdeps/aarch64/fpu/advsimd/powf.c
# math/aarch64/advsimd/powr.c, revision 30da949
sysdeps/aarch64/fpu/advsimd/powr.c
# math/aarch64/advsimd/powrf.c, revision e2bca42
sysdeps/aarch64/fpu/advsimd/powrf.c
# math/aarch64/advsimd/rsqrt.c, revision 0945eab
sysdeps/aarch64/fpu/advsimd/rsqrt.c
# math/aarch64/advsimd/rsqrtf.c, revision 88e9cc9
sysdeps/aarch64/fpu/advsimd/rsqrtf.c
# math/aarch64/advsimd/sin.c, revision 677a12b
sysdeps/aarch64/fpu/advsimd/sin.c
# math/aarch64/advsimd/sinf.c, revision 15c35d9
sysdeps/aarch64/fpu/advsimd/sinf.c
# math/aarch64/advsimd/sinh.c, revision 447bbaa
sysdeps/aarch64/fpu/advsimd/sinh.c
# math/aarch64/advsimd/sinhf.c, revision 45237ba
sysdeps/aarch64/fpu/advsimd/sinhf.c
# math/aarch64/advsimd/sinpi.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/sinpi.c
# math/aarch64/advsimd/sinpif.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/sinpif.c
# math/aarch64/advsimd/tan.c, revision a8bbb87
sysdeps/aarch64/fpu/advsimd/tan.c
# math/aarch64/advsimd/tanf.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/tanf.c
# math/aarch64/advsimd/tanh.c, revision 447bbaa
sysdeps/aarch64/fpu/advsimd/tanh.c
# math/aarch64/advsimd/tanhf.c, revision 45237ba
sysdeps/aarch64/fpu/advsimd/tanhf.c
# math/aarch64/advsimd/tanpi.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/tanpi.c
# math/aarch64/advsimd/tanpif.c, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/tanpif.c
# math/aarch64/advsimd/v_exp_special_case_inline.h, revision dce5dab
sysdeps/aarch64/fpu/advsimd/v_exp_special_case_inline.h
# math/aarch64/advsimd/v_expf_inline.h, revision 747e0e1
sysdeps/aarch64/fpu/advsimd/v_expf_inline.h
# math/aarch64/advsimd/v_expf_special_inline.h, revision a5092e8
sysdeps/aarch64/fpu/advsimd/v_expf_special_inline.h
# math/aarch64/advsimd/v_expm1_inline.h, revision 0a6ab6d
sysdeps/aarch64/fpu/advsimd/v_expm1_inline.h
# math/aarch64/advsimd/v_expm1f_inline.h, revision 0a6ab6d
sysdeps/aarch64/fpu/advsimd/v_expm1f_inline.h
# math/aarch64/advsimd/v_log1p_inline.h, revision 1aad38d
sysdeps/aarch64/fpu/advsimd/v_log1p_inline.h
# math/aarch64/advsimd/v_log1pf_inline.h, revision 0a6ab6d
sysdeps/aarch64/fpu/advsimd/v_log1pf_inline.h
# math/aarch64/advsimd/v_pow_inline.h, revision efde0c7
sysdeps/aarch64/fpu/advsimd/v_pow_inline.h
# math/aarch64/advsimd/v_powf_inline.h, revision 5b06a16
sysdeps/aarch64/fpu/advsimd/v_powf_inline.h
# math/aarch64/advsimd/v_powrf_inline.h, revision 30da949
sysdeps/aarch64/fpu/advsimd/v_powrf_inline.h
# math/aarch64/advsimd/v_poly_f32.h, revision 0a6ab6d
sysdeps/aarch64/fpu/advsimd/poly_advsimd_f32.h
# math/aarch64/advsimd/v_poly_f64.h, revision 0a6ab6d
sysdeps/aarch64/fpu/advsimd/poly_advsimd_f64.h
# math/poly_generic.h, revision 0a6ab6d
sysdeps/aarch64/fpu/advsimd/poly_generic.h
# math/aarch64/advsimd/v_math.h, revision 1829557
sysdeps/aarch64/fpu/advsimd/v_math.h
# math/aarch64/advsimd/v_trig_fallback.h, revision 677a12b
sysdeps/aarch64/fpu/advsimd/v_trig_fallback.h
# math/aarch64/advsimd/v_trigf_fallback.h, revision 15c35d9
sysdeps/aarch64/fpu/advsimd/v_trigf_fallback.h
# String routines
# string/aarch64/__mtag_tag_region.S, revision 41e5ae5
sysdeps/aarch64/__mtag_tag_region.S
# string/aarch64/__mtag_tag_zero_region.S, revision 41e5ae5
sysdeps/aarch64/__mtag_tag_zero_region.S
# string/aarch64/memchr-mte.S, revision 41e5ae5
sysdeps/aarch64/memchr.S
# string/aarch64/memcmp.S, revision 41e5ae5
sysdeps/aarch64/memcmp.S
# string/aarch64/memcpy-advsimd.S, revision 41e5ae5
sysdeps/aarch64/memcpy.S
# string/aarch64/memcpy-mops.S, revision 41e5ae5
sysdeps/aarch64/multiarch/memcpy_mops.S
# string/aarch64/memcpy-sve.S, revision 71e3640
sysdeps/aarch64/multiarch/memcpy_sve.S
# string/aarch64/memmove-mops.S, revision 41e5ae5
sysdeps/aarch64/multiarch/memmove_mops.S
# string/aarch64/memrchr.S, revision 41e5ae5
sysdeps/aarch64/memrchr.S
# string/aarch64/memset-mops.S, revision 41e5ae5
sysdeps/aarch64/multiarch/memset_mops.S
# string/aarch64/memset-sve.S, revision 0f71101
sysdeps/aarch64/multiarch/memset_sve_zva64.S
# string/aarch64/memset.S, revision 098df8c
sysdeps/aarch64/memset.S
# string/aarch64/stpcpy.S, revision 189dfef
sysdeps/aarch64/stpcpy.S
# string/aarch64/strchr-mte.S, revision 41e5ae5
sysdeps/aarch64/strchr.S
# string/aarch64/strchrnul-mte.S, revision 41e5ae5
sysdeps/aarch64/strchrnul.S
# string/aarch64/strcmp.S, revision 41e5ae5
sysdeps/aarch64/strcmp.S
# string/aarch64/strcpy.S, revision 41e5ae5
sysdeps/aarch64/strcpy.S
# string/aarch64/strlen-mte.S, revision 41e5ae5
sysdeps/aarch64/strlen.S
# string/aarch64/strncmp.S, revision 41e5ae5
sysdeps/aarch64/strncmp.S
# string/aarch64/strnlen.S, revision 41e5ae5
sysdeps/aarch64/strnlen.S
# string/aarch64/strrchr-mte.S, revision 41e5ae5
sysdeps/aarch64/strrchr.S
# string/arm/memchr.S, revision 1eb5d7c
sysdeps/arm/armv6t2/memchr.S
# string/arm/memcpy.S, revision 1eb5d7c
sysdeps/arm/armv7/multiarch/memcpy_impl.S
# string/arm/strcmp.S, revision 1eb5d7c
sysdeps/arm/armv7/strcmp.S
# string/arm/strlen-armv6t2.S, revision 1eb5d7c
sysdeps/arm/armv6t2/strlen.S
Vendored
+81
View File
@@ -145,6 +145,10 @@ if test -z "$NM"; then
NM=`$CC -print-prog-name=nm`
fi
AC_SUBST(NM)
if test -z "$STRIP"; then
STRIP=`$CC -print-prog-name=strip`
fi
AC_SUBST(STRIP)
])
dnl Run a static link test with -nostdlib -nostartfiles.
@@ -264,6 +268,38 @@ else
fi
AC_MSG_RESULT($libc_linker_feature)])
dnl Check linker option support.
dnl LIBC_TEST_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false])
AC_DEFUN([LIBC_TEST_LINKER_FEATURE],
[AC_MSG_CHECKING([for linker that supports $1])
libc_linker_feature=no
cat > conftest.c <<EOF
int _start (void) { return 42; }
EOF
saved_CC="$CC"
CC="$TEST_CC"
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
$2 -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c
1>&AS_MESSAGE_LOG_FD])
then
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
| grep "warning: $1 ignored" > /dev/null 2>&1; then
true
else
libc_linker_feature=yes
fi
fi
rm -f conftest*
if test $libc_linker_feature = yes; then
$3
else
$4
fi
CC="$saved_CC"
AC_MSG_RESULT($libc_linker_feature)])
dnl Add a makefile variable, with value set from a shell string
dnl (expanded by the shell inside double quotes), to config.make.
dnl LIBC_CONFIG_VAR(make-variable, shell-value)
@@ -322,6 +358,23 @@ case "$prefix" in
;;
esac])
dnl Test a CC compiler option or options with an input file.
dnl LIBC_TRY_CC_COMMAND([message], [code], [options],
dnl [CC-cache-id], [CC-action-if-true], [CC-action-if-false])
AC_DEFUN([LIBC_TRY_CC_COMMAND],
[
cat > conftest.c <<EOF
$2
EOF
AC_CACHE_CHECK([$1], $4, [dnl
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $3 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
then
[$5]
else
[$6]
fi])
rm -f conftest*])
dnl Run a test with TEST_CC.
dnl LIBC_CHECK_TEST_CC([commands])
AC_DEFUN([LIBC_CHECK_TEST_CC],
@@ -476,3 +529,31 @@ LIBC_CHECK_TEST_CXX(
[LIBC_TRY_CXX_OPTION([$2], [$4], [$5])])
)
])
dnl Check if toolchain supports generating binaries with the required
dnl ELF marking as checked by readelf.
dnl LIBC_CHECK_ELF_PROPERTY([message], [pattern], [action-if-true], [action-if-false])
AC_DEFUN([LIBC_CHECK_ELF_PROPERTY],
[AC_MSG_CHECKING([$1])
libc_elf_property=no
cat > conftest.c <<EOF
int foo (void) { return 42; }
EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-fPIC -shared -o conftest.so conftest.c
1>&AS_MESSAGE_LOG_FD])
then
if AC_TRY_COMMAND([LC_ALL=C $READELF -n --wide conftest.so | grep "$2" 1>&AS_MESSAGE_LOG_FD])
then
libc_elf_property=yes
else
libc_elf_property=no
fi
fi
rm -f conftest*
if test $libc_elf_property = yes; then
$3
else
$4
fi
AC_MSG_RESULT($libc_elf_property)])
+1 -1
View File
@@ -12,7 +12,7 @@ discovered at the time of publishing this advisory, but the presence of
custom setuid programs, although strongly discouraged as a security
practice, cannot be discounted.
CVE-id: CVE-2025-4802
CVE-Id: CVE-2025-4802
Public-Date: 2025-05-16
Vulnerable-Commit: 10e93d968716ab82931d593bada121c17c0a4b93 (2.27)
Fix-Commit: 5451fa962cd0a90a0e2ec1d8910a559ace02bba0 (2.39)
+1 -1
View File
@@ -21,7 +21,7 @@ so:
export GLIBC_TUNABLES=glibc.cpu.hwcaps=-arch_3_1
CVE-id: CVE-2025-5702
CVE-Id: CVE-2025-5702
Public-Date: 2025-06-04
Vulnerable-Commit: 3367d8e180848030d1646f088759f02b8dfe0d6f (2.39)
Fix-Commit: 15808c77b35319e67ee0dc8f984a9a1a434701bc (2.42)
+1 -1
View File
@@ -21,7 +21,7 @@ so:
export GLIBC_TUNABLES=glibc.cpu.hwcaps=-arch_3_1
CVE-id: CVE-2025-5745
CVE-Id: CVE-2025-5745
Public-Date: 2025-06-05
Vulnerable-Commit: 23f0d81608d0ca6379894ef81670cf30af7fd081 (2.40)
Fix-Commit: 63c60101ce7c5eac42be90f698ba02099b41b965 (2.42)
+41
View File
@@ -0,0 +1,41 @@
Integer overflow in memalign leads to heap corruption
Passing too large an alignment to the memalign suite of functions
(memalign, posix_memalign, aligned_alloc) in the GNU C Library version
2.30 to 2.42 may result in an integer overflow, which could consequently
result in a heap corruption.
Note that the attacker must have control over both, the size as well as
the alignment arguments of the memalign function to be able to exploit
this. The size parameter must be close enough to PTRDIFF_MAX so as to
overflow size_t along with the large alignment argument. This limits
the malicious inputs for the alignment for memalign to the range [1<<62
+ 1, 1<<63] and exactly 1<<63 for posix_memalign and aligned_alloc.
Typically the alignment argument passed to such functions is a known
constrained quantity (e.g. page size, block size, struct sizes) and is
not attacker controlled, because of which this may not be easily
exploitable in practice. An application bug could potentially result in
the input alignment being too large, e.g. due to a different buffer
overflow or integer overflow in the application or its dependent
libraries, but that is again an uncommon usage pattern given typical
sources of alignments.
CVE-Id: CVE-2026-0861
Public-Date: 2026-01-14
Vulnerable-Commit: 9bf8e29ca136094f73f69f725f15c51facc97206 (2.30)
Fix-Commit: c9188d333717d3ceb7e3020011651f424f749f93 (2.43)
Fix-Commit: 7f19ef14fbce095d4c77395e258320cad2ea2b28 (2.30-153)
Fix-Commit: f18446d7b4a423090ee5e328c36b3c2a0f26041c (2.31-166)
Fix-Commit: 8aef9e7a7af9565c0324b4ecb38b30dfa3782fd8 (2.32-151)
Fix-Commit: 011293b4fd748cdd6f95874ba2b6aba9a3df8bff (2.33-275)
Fix-Commit: 2c77e52108a58956c9f674b36e1f59a4e3fdcf4d (2.34-525)
Fix-Commit: 499d1ccafccfe64df1b88deea2fa84d8180e8e8f (2.35-399)
Fix-Commit: fb6b8822175769b5794fb6ea04f2895483a29b61 (2.36-244)
Fix-Commit: 7b913d41a07836def826f2164c52541a9835f324 (2.37-172)
Fix-Commit: 744b63026a29f7eedbbc8e3a01a7f48a6eb0a085 (2.38-212)
Fix-Commit: fb22fd3f5b415dd4cd6f7b5741c2f0412374e242 (2.39-286)
Fix-Commit: bfc4dd9e526eacf3017dd8864ba0848e9d045dd4 (2.40-216)
Fix-Commit: 1e2c1ea4307197ccece0cda574bcfebf9080894c (2.41-121)
Fix-Commit: b0ec8fb689df862171f0f78994a3bdeb51313545 (2.42-49)
Reported-by: Igor Morgenstern, Aisle Research
+36
View File
@@ -0,0 +1,36 @@
getnetbyaddr and getnetbyaddr_r leak stack contents to DNS resovler
Calling getnetbyaddr or getnetbyaddr_r with a configured nsswitch.conf
that specifies the library's DNS backend for networks and queries for a
zero-valued network in the GNU C Library version 2.0 to version 2.42
can leak stack contents to the configured DNS resolver.
A defect in the _nss_dns_getnetbyaddr_r function which implements
getnetbyaddr and getnetbyaddr_r in the dns-based network database can
pass stack contents unmodified to the configured DNS resolver as part of
the network DNS query when the network queried is the default network
i.e. net == 0x0. This stack contents leaking in the query is considered
a loss of confidentiality for the host making the query. Typically it
is rare to call these APIs with a net value of zero, and if an attacker
can control the net value it can only leak adjacent stack, and so loss
of confidentiality is spatially limited. The leak might be used to
accelerate an ASLR bypass by knowing pointer values, but also requires
network adjacent access to snoop between the application and the
DNS server; making the attack complexity higher.
CVE-Id: CVE-2026-0915
Public-Date: 2026-01-15
Vulnerable-Commit: 5f0e6fc702296840d2daa39f83f6cb1e40073d58 (1.92-1)
Fix-Commit: e56ff82d5034ec66c6a78f517af6faa427f65b0b (2.43)
Fix-Commit: 453e6b8dbab935257eb0802b0c97bca6b67ba30e (2.42-50)
Fix-Commit: 15c9839a0b853f552b4ed9047841b6223f3c104d (2.41-122)
Fix-Commit: 329c775788b2c9ff3da774ccf59fba7b6b8ff08e (2.40-217)
Fix-Commit: 831f63b94ceb92fb14c0d1a7ddad35a0d1404c71 (2.39-287)
Fix-Commit: 49125ffc8e1674dc2a100dfdc5b78796f22e16f2 (2.38-213)
Fix-Commit: ddcaed5dfb05b2c1a6ea842fd6b643501365450a (2.37-173)
Fix-Commit: a6bf47887f24b2b394acb301a3189fda04bd4d4d (2.36-245)
Fix-Commit: 66f0cb057c9b4fb1249a5fec6ef4a63511a37899 (2.35-400)
Fix-Commit: 96863dee262225cfb79f9fe45e06fd188319c7b8 (2.34-526)
Fix-Commit: d210011f1536c8322157cbb4fe4229b35c834c08 (2.33-276)
Fix-Commit: 1bc1832cfc74c2a601220969f36e789a5e9f0ebe (2.32-152)
Reported-by: Igor Morgenstern, Aisle Research
+36
View File
@@ -0,0 +1,36 @@
wordexp with WRDE_REUSE and WRDE_APPEND may return uninitialized memory
Calling wordexp with WRDE_REUSE in conjunction with WRDE_APPEND in the
GNU C Library version 2.0 to version 2.42 may cause the interface to
return uninitialized memory in the we_wordv member, which on subsequent
calls to wordfree may abort the process.
The implementation of WRDE_REUSE in conjunction with WRDE_APPEND fails
to clear the we_wordc member of the structure, and as such, when new
words are added internally, a leading we_wordc count number of entries
are skipped since they are assumed initialized. These skipped entries
are not initialized, but are the contents of a realloc-expanded array of
pointers. If the caller inspects the we_wordv array, it will
dereference invalid pointers and crash. If the caller calls wordfree,
the malloc implementation may detect the invalid pointers and abort the
process. Calls to wordexp using WRDE_REUSE and WRDE_APPEND have never
worked correctly and thus the existence of applications that make use of
this feature is unlikely.
CVE-Id: CVE-2025-15281
Public-Date: 2026-01-20
Vulnerable-Commit: 8f2ece695d8822e9ecc63ecd157e90bf17a6fe65 (1.93-260)
Fix-Commit: 80cc58ea2de214f85b0a1d902a3b668ad2ecb302 (2.43)
Fix-Commit: cbf39c26b25801e9bc88499b4fd361ac172d4125 (2.42-51)
Fix-Commit: fb4db64a04ad6c96cd1fbb7e02eb59323b1f2ac2 (2.41-123)
Fix-Commit: 9fe8576664d43b87ca19401fb6a975e217e47623 (2.40-218)
Fix-Commit: ce65d944e38a20cb70af2a48a4b8aa5d8fabe1cc (2.39-288)
Fix-Commit: d5409a1be010699794264162c551ba60f05ee6c3 (2.38-214)
Fix-Commit: ff2b172803f6bbd897755d2ce83ec4323a1a15b3 (2.37-174)
Fix-Commit: e97cfe2293ed097eb3d0b4c18274d22855e65130 (2.36-246)
Fix-Commit: bb59339d02faebac534a87eea50c83c948f35b77 (2.35-401)
Fix-Commit: 2b656ff94d72f93c84d8da2e7c76456c1994f02e (2.34-527)
Fix-Commit: 1d8ed2067a8a5d162a07670d0d063429679f17a0 (2.33-277)
Fix-Commit: 3a56c4ee4ea49b8f2391a2d8d6220013c4160a79 (2.32-153)
Fix-Commit: 28eb5caf895ced5d895cb02757e109004a2d33e5 (2.31-167)
Reported-by: Vitaly Simonovich
+30
View File
@@ -0,0 +1,30 @@
nscd client crash on x86_64 under high nscd load
Calling NSS-backed functions that support caching via nscd may call the
nscd client side code and in the GNU C Library version 2.36 under high
load on x86_64 systems, the client may call memcmp on inputs that are
concurrently modified by other processes or threads and crash.
The nscd client in the GNU C Library uses the memcmp function with
inputs that may be concurrently modified by another thread, potentially
resulting in spurious cache misses, which in itself is not a security
issue. However in the GNU C Library version 2.36 an optimized
implementation of memcmp was introduced for x86_64 which could crash
when invoked with such undefined behaviour, turning this into a
potential crash of the nscd client and the application that uses it.
This implementation was backported to the 2.35 branch, making the nscd
client in that branch vulnerable as well. Subsequently, the fix for
this issue was backported to all vulnerable branches in the GNU C
Library repository.
It is advised that distributions that may have cherry-picked the memcpy
SSE2 optimization in their copy of the GNU C Library, also apply the fix
to avoid the potential crash in the nscd client.
CVE-Id: CVE-2026-3904
Public-Date: 2026-03-11
Vulnerable-Commit: 8804157ad9da39631703b92315460808eac86b0c (2.36)
Vulnerable-Commit: 5a8df6485c584e2b0e957ec6b9070437a724911a (2.35-89)
Fix-Commit: b712be52645282c706a5faa038242504feb06db5 (2.37)
Fix-Commit: 93967a2a7bbdcedb73e0b246713580c7c84d001e (2.36-84)
Fix-Commit: 6bcd5d8e3668d52388a6e0580611749f93e6871f (2.35-230)
+37
View File
@@ -0,0 +1,37 @@
gethostbyaddr and gethostbyaddr_r may incorrectly handle DNS response
Calling gethostbyaddr or gethostbyaddr_r with a configured nsswitch.conf
that specifies the library's DNS backend in the GNU C Library version
2.34 to version 2.43 could, with a crafted response from the configured
DNS server, result in a violation of the DNS specification that causes
the application to treat a non-answer section of the DNS response as a
valid answer.
A defect in the getanswer_ptr function, which implements the iteration
and extraction of the answer from the DNS response, can cause it to
incorrectly transition from the answer section to the next section while
still treating it as an answer to the question. This can happen when
the answer contains only skipped records, and the subsequent section
contains a semantically invalid T_PTR record. This is considered a
security issue because it is a violation of the DNS specification that
leads to incorrect behaviour that could result in the wrong hostname
being returned to the caller. At the time of publication, no known
affected DNS server returns results that would be incorrectly
interpreted by the library. An attacker would either need to be network
adjacent or have compromised the DNS server to use this defect to hide
returned reverse DNS results from intrusion detection systems. Even
then, the inbound connection from the attacker, or the outbound
connection from the application, would be visible to the intrusion
detection system. At best, the defect can be used to obfuscate and
delay analysis of the evolving threat.
CVE-Id: CVE-2026-4437
Public-Date: 2026-03-20
Vulnerable-Commit: 32e5db37684ffcbc6ae34fcc6cdcf28670506baa (2.34-323)
Vulnerable-Commit: def97e7f71a07517810f7263213d607e08ad21f1 (2.35-188)
Vulnerable-Commit: 77f523c473878ec0051582ef15161c6982879095 (2.36-30)
Vulnerable-Commit: e32547d661a43da63368e488b6cfa9c53b4dcf92 (2.37)
Fix-Commit: 5c6fca0c62ce5bd6e68e259f138097756cbafd4d (2.43-16)
Fix-Commit: 9f5f18aab40ec6b61fa49a007615e6077e9a979b (2.44)
Reported-by: Antonio Maini (0rbitingZer0) - 0rbitingZer0@proton.me
Reported-by: Kevin Farrell
+27
View File
@@ -0,0 +1,27 @@
gethostbyaddr and gethostbyaddr_r return invalid DNS hostnames
Calling gethostbyaddr or gethostbyaddr_r with a configured nsswitch.conf
that specifies the library's DNS backend in the GNU C library version
2.34 to version 2.43 could result in an invalid DNS hostname being
returned to the caller in violation of the DNS specification.
A defect in the getanswer_ptr function, which implements the iteration
and extraction of the answer from a DNS response, can cause it to accept
an invalid DNS hostname that can contain shell metacharacters. An
application that uses the returned hostname in a shell, without guarding
for shell expansion, may be subject to shell injection attacks. At the
time of publication, no known affected DNS server returns results with
shell metacharacters in the results. An attacker would either need to
be network adjacent or have compromised the DNS server to use this
defect for shell injection. No known vulnerable application has been
identified.
CVE-Id: CVE-2026-4438
Public-Date: 2026-03-20
Vulnerable-Commit: 32e5db37684ffcbc6ae34fcc6cdcf28670506baa (2.34-323)
Vulnerable-Commit: def97e7f71a07517810f7263213d607e08ad21f1 (2.35-188)
Vulnerable-Commit: 77f523c473878ec0051582ef15161c6982879095 (2.36-30)
Vulnerable-Commit: e32547d661a43da63368e488b6cfa9c53b4dcf92 (2.37)
Fix-Commit: dd9945c0ba40d2dbc9eb7c99291ba6b69bd66718 (2.43-17)
Fix-Commit: e10977481f4db4b2a3ce34fa4c3a1e26651ae312 (2.44)
Reported-by: Antonio Maini (0rbitingZer0) - 0rbitingZer0@proton.me
+15
View File
@@ -0,0 +1,15 @@
iconv crash due to assertion failure with untrusted input
The iconv() function in the GNU C Library versions 2.43 and earlier may
crash due to an assertion failure when converting inputs from the
IBM1390 or IBM1399 character sets, which may be used to remotely crash
an application.
This vulnerability can be trivially mitigated by removing the IBM1390
and IBM1399 character sets from systems that do not need them.
CVE-Id: CVE-2026-4046
Public-Date: 2026-03-12
Vulnerable-Commit: 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (2.3.3-1501)
Fix-Commit: d6f08d1cf027f4eb2ba289a6cc66853722d4badc (2.44)
Reported-by: Rocket Ma
+22
View File
@@ -0,0 +1,22 @@
REJECTED: Static buffer overflow in deprecated nis_local_principal
REJECTED: CVE-2026-5358 is rejected for two reasons. Firstly it has been
discovered that no NIS+ client or server was ever released for any
Linux-based OS distributions and as such this makes the API provisional
and unused. Secondly it has been discovered that the NIS+ cold start
cache (/var/nis/NIS_COLD_START) cannot be bypassed and as such the API
can only be called with a trusted server from the pre-populated cache.
The use of a trusted server means no trust boundary is crossed and this
is therefore considered a normal bug.
NIS+ support in the GNU C Library was never officially supported even
though an incomplete implementation of the APIs was made pulibc. To the
best knowledge of the glibc security team no open-source NIS+ server
implementations were ever released for use with this API. Applications
should not use any of the NIS+ APIs and should move to modern identity
and access management services.
CVE-Id: CVE-2026-5358
Public-Date: 2026-04-10
Rejected-Date: 2026-04-33
Reported-by: Rahul Hoysala
+23
View File
@@ -0,0 +1,23 @@
scanf %mc off-by-one heap buffer overflow
Calling the scanf family of functions with a %mc (malloc'd character
match) in the GNU C Library version 2.7 to version 2.43 with a format
width specifier with an explicit width greater than 1024 could result in
a one byte heap buffer overflow.
The bug is in the buffer growth formula in __vfscanf_internal, which
under-allocates by one byte during realloc expansion, allowing a
controlled single-byte overwrite past the end of the heap buffer.
The impact is limited by the fact that to execute the overwrite you need
both user controlled input data and a specific choice of maximum width
that yields a smaller than needed allocation. The latter point has to
take into account malloc's particular chunk size rounding process. The
"%[width]mc" format specifier does not appear to have notable use in
major Linux-based OS distributions, due to which the real world impact
may be limited to bespoke use cases.
CVE-Id: CVE-2026-5450
Public-Date: 2026-03-19
Vulnerable-Commit: 874aa52349cc111d1f6ea5dff24bb14c306714e0 (2.7)
Reported-by: Rocket Ma
+24
View File
@@ -0,0 +1,24 @@
Potential buffer under-read in ungetwc
Calling the ungetwc function on a FILE stream with wide characters
encoded in a character set that has overlaps between its single byte and
multi-byte character encodings, in the GNU C Library version 2.43 or
earlier, may result in an attempt to read bytes before an allocated
buffer, potentially resulting in unintentional disclosure of neighboring
data in the heap, or a program crash.
A bug in the wide character pushback implementation
(_IO_wdefault_pbackfail in libio/wgenops.c) causes ungetwc() to operate
on the regular character buffer (fp->_IO_read_ptr) instead of the actual
wide-stream read pointer (fp->_wide_data->_IO_read_ptr). The program
crash may happen in cases where fp->_IO_read_ptr is not initialized and
hence points to NULL. The buffer under-read requires a special situation
where the input character encoding is such that there are overlaps
between single byte representations and multibyte representations in
that encoding, resulting in spurious matches. The spurious match case
is not possible in the standard Unicode character sets.
CVE-Id: CVE-2026-5928
Public-Date: 2026-03-17
Reported-by: Rocket Ma
Vulnerable-Commit: d64b6ad07585b8a37e5fecc9a47fcee766d52ede (2.1.1-89)
+24
View File
@@ -0,0 +1,24 @@
Potential buffer overflow in ns_sprintrrf TSIG handling path
The deprecated functions ns_printrrf, ns_printrr and fp_nquery in the
GNU C Library version 2.2 and newer fail to enforce the caller-supplied
buffer length, and can result in an out-of-bounds write when printing
TSIG records.
A defect in the TSIG case handling within ns_sprintrrf performs a
formatted write using sprintf without checking the remaining buffer
length, and may write up to 6 bytes past the end of the buffer. If the
library is compiled with assertions, and the out-of-bounds write doesn't
terminate the process, then a subsequent check for "len <= *buflen" will
trigger an assertion failure.
These functions are for application debugging only and hence not in the
path of code executed by the DNS resolver. Further, they have been
deprecated since version 2.34 (2021-08-02) and should not be used by any
new applications. Applications should consider porting away from these
interfaces since they may be removed in future versions.
CVE-Id: CVE-2026-5435
Public-Date: 2026-04-02
Vulnerable-Commit: b43b13ac2544b11f35be301d1589b51a8473e32b (2.2)
Reported-by: shinobu
+18
View File
@@ -0,0 +1,18 @@
Buffer overread in ns_printrrf with corrupted RDATA field
The deprecated functions ns_printrrf, ns_printrr and fp_nquery in the
GNU C Library version 2.0.1 to version 2.43 fail to validate the RDATA
content against the RDATA length in a DNS response when processing A6,
CERT, LOC, TKEY or TSIG records, which may allow an attacker to craft a
DNS response, causing a target application to crash or read
uninitialized memory.
These functions are for application debugging only and hence not in the
path of code executed by the DNS resolver. Further, they have been
deprecated since version 2.34 and should not be used by any new
applications. Applications should consider porting away from these
interfaces since they may be removed in future versions.
CVE-Id: CVE-2026-6238
Public-Date: 2026-04-11
Vulnerable-Commit: ee188d555b8c32ad9704a7440cab400af967292f (1.90)
+20
View File
@@ -0,0 +1,20 @@
Potential stack-based buffer clash during tilde expansion in wordexp
Calling wordexp with a tilde (~) followed by an overly long username
in the GNU C Library version 2.2.3 to 2.43 may lead to a stack buffer
clash.
When expanding paths that begin with a tilde (~) followed by a username, the
internal parse_tilde function extracts the username to determine the user's
home directory. The implementation allocates memory for this username directly
on the stack using the strndupa macro. Because the size of this allocation
was determined by the length of the user-supplied input without any bounds
checks, passing an excessively long username e.g. thousands of characters,
forces the thread to exhaust its stack space. Thus if an application passes
untrusted, attacker-controlled input to the wordexp function, an attacker
can trigger a stack clash.
CVE-Id: CVE-2026-6791
Public-Date: 2026-06-22
Vulnerable-Commit: 344af000e1d6e9c7882b9bc48e71cb3f1b5fc03c (2.2.3-114)
Reported-by: storm
+15
View File
@@ -25,6 +25,10 @@ This is the CVE-Id assigned under the CVE Program
Public-Date:
The date this issue became publicly known.
Rejected-Date:
The most recent date the assigned advisory was rejected. If the advisory
is ever published again the Rejected-Date tag should be removed.
Vulnerable-Commit:
The commit that introduced this vulnerability. There could be multiple
entries, one for each release branch in the glibc repository; the
@@ -67,6 +71,17 @@ An advisory for a CVE needs to be added on the master branch in two steps:
4. Verify the updated advisory and push the result.
Rejecting an Advisory
---------------------
Rejecting an advisory on the master branch can be done in one step:
1. Mark the advisory as rejected. Add the text "REJECTED: " as a prefix
to any short-form description. Add a new paragraph that starts with
"REJECTED: " and explains the reason for the rejection including
justification for why it no longer has security impact. Lastly add
a Rejected-Date tag to the advisory.
Getting a NEWS snippet from advisories
--------------------------------------
+4 -5
View File
@@ -1,4 +1,4 @@
# Copyright (C) 1997-2025 Free Software Foundation, Inc.
# Copyright (C) 1997-2026 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -47,10 +47,9 @@ tests = \
tst-ldbl-argp \
# tests
CFLAGS-argp-help.c += $(uses-callbacks) -fexceptions $(config-cflags-wno-ignored-attributes)
CFLAGS-argp-parse.c += $(uses-callbacks) $(config-cflags-wno-ignored-attributes)
CFLAGS-argp-fmtstream.c += -fexceptions $(config-cflags-wno-ignored-attributes)
CFLAGS-argp-fs-xinl.c += $(config-cflags-wno-ignored-attributes)
CFLAGS-argp-help.c += $(uses-callbacks) -fexceptions
CFLAGS-argp-parse.c += $(uses-callbacks)
CFLAGS-argp-fmtstream.c += -fexceptions
bug-argp1-ARGS = -- --help
bug-argp2-ARGS = -- -d 111 --dstaddr 222 -p 333 --peer 444
+1 -1
View File
@@ -1,5 +1,5 @@
/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
Copyright (C) 1996-2025 Free Software Foundation, Inc.
Copyright (C) 1996-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Default definition for ARGP_ERR_EXIT_STATUS
Copyright (C) 1997-2025 Free Software Foundation, Inc.
Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Word-wrapping and line-truncating streams
Copyright (C) 1997-2025 Free Software Foundation, Inc.
Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+13 -7
View File
@@ -1,5 +1,5 @@
/* Word-wrapping and line-truncating streams.
Copyright (C) 1997-2025 Free Software Foundation, Inc.
Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -107,19 +107,22 @@ __BEGIN_DECLS
extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream,
size_t __lmargin,
size_t __rmargin,
ssize_t __wmargin);
ssize_t __wmargin)
attribute_hidden;
extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream,
size_t __lmargin,
size_t __rmargin,
ssize_t __wmargin);
/* Flush __FS to its stream, and free it (but don't close the stream). */
extern void __argp_fmtstream_free (argp_fmtstream_t __fs);
extern void __argp_fmtstream_free (argp_fmtstream_t __fs)
attribute_hidden;
extern void argp_fmtstream_free (argp_fmtstream_t __fs);
extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
const char *__fmt, ...)
__attribute__ ((__format__ (printf, 2, 3)));
__attribute__ ((__format__ (printf, 2, 3)))
attribute_hidden;
extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
const char *__fmt, ...)
__attribute__ ((__format__ (printf, 2, 3)));
@@ -131,7 +134,8 @@ extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str);
extern int argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str);
extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len);
const char *__str, size_t __len)
attribute_hidden;
extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len);
@@ -167,9 +171,11 @@ extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
/* Internal routines. */
extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
extern void __argp_fmtstream_update (argp_fmtstream_t __fs);
extern void __argp_fmtstream_update (argp_fmtstream_t __fs)
attribute_hidden;
extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount)
attribute_hidden;
#ifdef __OPTIMIZE__
/* Inline versions of above routines. */
+1 -1
View File
@@ -1,5 +1,5 @@
/* Real definitions for extern inline functions in argp-fmtstream.h
Copyright (C) 1997-2025 Free Software Foundation, Inc.
Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing help output
Copyright (C) 1995-2025 Free Software Foundation, Inc.
Copyright (C) 1995-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Name frobnication for compiling argp outside of glibc
Copyright (C) 1997-2025 Free Software Foundation, Inc.
Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing, layered over getopt
Copyright (C) 1995-2025 Free Software Foundation, Inc.
Copyright (C) 1995-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Default definition for ARGP_PROGRAM_VERSION.
Copyright (C) 1996-2025 Free Software Foundation, Inc.
Copyright (C) 1996-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
Copyright (C) 1996-2025 Free Software Foundation, Inc.
Copyright (C) 1996-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Test program for argp argument parser
Copyright (C) 1997-2025 Free Software Foundation, Inc.
Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+25 -9
View File
@@ -1,5 +1,5 @@
/* Real definitions for extern inline functions in argp.h
Copyright (C) 1997-2025 Free Software Foundation, Inc.
Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -25,19 +25,35 @@
# include <features.h>
#endif
#ifndef __USE_EXTERN_INLINES
# define __USE_EXTERN_INLINES 1
#endif
#define ARGP_EI
#undef __OPTIMIZE__
#define __OPTIMIZE__ 1
#include <argp.h>
/* Add weak aliases. */
#if _LIBC - 0 && defined (weak_alias)
#ifdef _LIBC
void
__argp_usage (const struct argp_state *__state)
{
__argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
}
weak_alias (__argp_usage, argp_usage)
int
__option_is_short (const struct argp_option *__opt)
{
if (__opt->flags & OPTION_DOC)
return 0;
else
{
int __key = __opt->key;
return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
}
}
weak_alias (__option_is_short, _option_is_short)
int
__option_is_end (const struct argp_option *__opt)
{
return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
}
weak_alias (__option_is_end, _option_is_end)
#endif
+4 -8
View File
@@ -1,5 +1,5 @@
/* Hierarchical argument parsing, layered over getopt.
Copyright (C) 1995-2025 Free Software Foundation, Inc.
Copyright (C) 1995-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -518,17 +518,13 @@ extern void *__argp_input (const struct argp *__restrict __argp,
# define __option_is_end _option_is_end
# endif
# ifndef ARGP_EI
# define ARGP_EI __extern_inline
# endif
ARGP_EI void
__extern_inline void
__argp_usage (const struct argp_state *__state)
{
__argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
}
ARGP_EI int
__extern_inline int
__NTH (__option_is_short (const struct argp_option *__opt))
{
if (__opt->flags & OPTION_DOC)
@@ -540,7 +536,7 @@ __NTH (__option_is_short (const struct argp_option *__opt))
}
}
ARGP_EI int
__extern_inline int
__NTH (__option_is_end (const struct argp_option *__opt))
{
return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+1 -1
View File
@@ -1,5 +1,5 @@
/* Redirections for argp functions for -mlong-double-64.
Copyright (C) 2019-2025 Free Software Foundation, Inc.
Copyright (C) 2019-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2002-2025 Free Software Foundation, Inc.
/* Copyright (C) 2002-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2007-2025 Free Software Foundation, Inc.
/* Copyright (C) 2007-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Testing of long double conversions in argp.h functions.
Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copyright (C) 2018-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+11 -1
View File
@@ -1,4 +1,4 @@
# Copyright (C) 1991-2025 Free Software Foundation, Inc.
# Copyright (C) 1991-2026 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -36,19 +36,29 @@ routines := \
tests := \
test-assert \
test-assert-2 \
test-assert-c++-variadic \
test-assert-c99 \
test-assert-gnu99 \
test-assert-perr \
test-assert-variadic \
tst-assert-c++ \
tst-assert-g++ \
tst-assert-sa-2025-0001 \
# tests
CFLAGS-test-assert-c99.c += -std=c99
CFLAGS-test-assert-gnu99.c += -std=gnu99
ifeq ($(have-cxx-thread_local),yes)
CFLAGS-test-assert-c++-variadic.o = $(test-config-cxxflags-stdcxx26)
LDLIBS-test-assert-c++-variadic = -lstdc++
CFLAGS-tst-assert-c++.o = -std=c++11
LDLIBS-tst-assert-c++ = -lstdc++
CFLAGS-tst-assert-g++.o = -std=gnu++11
LDLIBS-tst-assert-g++ = -lstdc++
else
tests-unsupported += \
test-assert-c++-variadic \
tst-assert-c++ \
tst-assert-g++ \
# tests-unsupported
+1 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
/* Copyright (C) 2000-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+4 -3
View File
@@ -1,5 +1,5 @@
/* libc-internal assert that calls __libc_message.
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,6 +28,7 @@ __libc_assert_fail (const char *assertion, const char *file, unsigned int line,
char linebuf[INT_BUFSIZE_BOUND (unsigned int)];
array_end (linebuf)[-1] = '\0';
char *linestr = _itoa_word (line, array_end (linebuf) - 1, 10, 0);
__libc_message ("Fatal glibc error: %s:%s (%s): assertion failed: %s\n",
file, linestr, function, assertion);
__libc_assert (
"Fatal glibc error: %s:%s (%s): assertion failed: %s\n", file, linestr,
function, assertion);
}
+20 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1994-2025 Free Software Foundation, Inc.
/* Copyright (C) 1994-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,10 +15,15 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <_itoa.h>
#include <array_length.h>
#include <assert.h>
#include <intprops.h>
#include <libintl.h>
#include <string.h>
#include <stdio.h>
extern const char *__progname;
/* This function, when passed an error number, a filename, and a line
number, prints a message on the standard error stream of the form:
@@ -31,8 +36,19 @@ __assert_perror_fail (int errnum,
{
char errbuf[1024];
char *e = __strerror_r (errnum, errbuf, sizeof errbuf);
__assert_fail_base (_("%s%s%s:%u: %s%sUnexpected error: %s.\n"),
e, file, line, function);
const char *e = __strerror_r (errnum, errbuf, sizeof errbuf);
char linebuf[INT_BUFSIZE_BOUND (unsigned int)];
array_end (linebuf)[-1] = '\0';
char *linestr = _itoa_word (line, array_end (linebuf) - 1, 10, 0);
__libc_message (_("%s%s%s:%s: %s%sUnexpected error: %s.\n"),
__progname,
__progname[0] ? ": " : "",
file,
linestr,
function ? function : "",
function ? ": " : "",
e);
}
libc_hidden_def (__assert_perror_fail)
+15 -99
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1991-2025 Free Software Foundation, Inc.
/* Copyright (C) 1991-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,115 +15,31 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <array_length.h>
#include <intprops.h>
#include <ldsodefs.h>
#include <libc-pointer-arith.h>
#include <libintl.h>
#include <libio/iolibio.h>
#include <setvmaname.h>
#include <sys/uio.h>
#include <unistd.h>
#include <stdio.h>
extern const char *__progname;
#define fflush(s) _IO_fflush (s)
/* This function, when passed a string containing an asserted
expression, a filename, and a line number, prints a message
on the standard error stream of the form:
a.c:10: foobar: Assertion `a == b' failed.
It then aborts program execution via a call to `abort'. */
#ifdef FATAL_PREPARE_INCLUDE
# include FATAL_PREPARE_INCLUDE
#endif
void
__assert_fail_base (const char *fmt, const char *assertion, const char *file,
unsigned int line, const char *function)
{
char *str;
#ifdef FATAL_PREPARE
FATAL_PREPARE;
#endif
int total = __asprintf (&str, fmt,
__progname, __progname[0] ? ": " : "",
file, line,
function ? function : "", function ? ": " : "",
assertion);
if (total >= 0)
{
/* Print the message. */
(void) __fxprintf (NULL, "%s", str);
(void) fflush (stderr);
total = ALIGN_UP (total + sizeof (struct abort_msg_s) + 1,
GLRO(dl_pagesize));
struct abort_msg_s *buf = __mmap (NULL, total, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (__glibc_likely (buf != MAP_FAILED))
{
buf->size = total;
strcpy (buf->msg, str);
__set_vma_name (buf, total, " glibc: assert");
/* We have to free the old buffer since the application might
catch the SIGABRT signal. */
struct abort_msg_s *old = atomic_exchange_acquire (&__abort_msg, buf);
if (old != NULL)
__munmap (old, old->size);
}
free (str);
}
else
{
/* At least print a minimal message. */
char linebuf[INT_STRLEN_BOUND (int) + sizeof ":: "];
struct iovec v[9];
int i = 0;
#define WS(s) (v[i].iov_len = strlen (v[i].iov_base = (void *) (s)), i++)
if (__progname)
{
WS (__progname);
WS (": ");
}
WS (file);
v[i++] = (struct iovec) {.iov_base = linebuf,
.iov_len = sprintf (linebuf, ":%d: ", line)};
if (function)
{
WS (function);
WS (": ");
}
WS ("Assertion `");
WS (assertion);
/* We omit the '.' here so that the assert tests can tell when
this code path is taken. */
WS ("' failed\n");
(void) __writev (STDERR_FILENO, v, i);
}
abort ();
}
#undef __assert_fail
void
__assert_fail (const char *assertion, const char *file, unsigned int line,
const char *function)
{
__assert_fail_base (_("%s%s%s:%u: %s%sAssertion `%s' failed.\n"),
assertion, file, line, function);
char linebuf[INT_BUFSIZE_BOUND (unsigned int)];
array_end (linebuf)[-1] = '\0';
char *linestr = _itoa_word (line, array_end (linebuf) - 1, 10, 0);
__libc_assert (_("%s%s%s:%s: %s%sAssertion `%s' failed.\n"),
__progname,
__progname[0] ? ": " : "",
file,
linestr,
function ? function : "",
function ? ": " : "",
assertion);
}
+67 -5
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1991-2025 Free Software Foundation, Inc.
/* Copyright (C) 1991-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -34,12 +34,35 @@
#define _ASSERT_H 1
#include <features.h>
#if __GLIBC_USE (ISOC23)
# ifndef __STDC_VERSION_ASSERT_H__
# define __STDC_VERSION_ASSERT_H__ 202311L
# endif
#endif
#if defined __cplusplus && __GNUC_PREREQ (2,95)
# define __ASSERT_VOID_CAST static_cast<void>
#else
# define __ASSERT_VOID_CAST (void)
#endif
/* C23 makes assert a variadic macro so that expressions with a comma
not between parentheses, but that would still be valid as a single
function argument, such as those involving compound literals with a
comma in the initializer list, can be passed to assert. This
depends on support for variadic macros (added in C99 and GCC 2.95),
and on support for _Bool (added in C99 and GCC 3.0) in order to
validate that only a single expression is passed as an argument. */
#if ((__GLIBC_USE (ISOC23) \
&& (defined __GNUC__ \
? __GNUC_PREREQ (3, 0) \
: defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) \
|| (defined __cplusplus && __cplusplus > 202302L))
# define __ASSERT_VARIADIC 1
#else
# define __ASSERT_VARIADIC 0
#endif
/* void assert (int expression);
If NDEBUG is defined, do nothing.
@@ -47,7 +70,11 @@
#ifdef NDEBUG
# define assert(expr) (__ASSERT_VOID_CAST (0))
# if __ASSERT_VARIADIC
# define assert(...) (__ASSERT_VOID_CAST (0))
# else
# define assert(expr) (__ASSERT_VOID_CAST (0))
# endif
/* void assert_perror (int errnum);
@@ -80,6 +107,13 @@ extern void __assert (const char *__assertion, const char *__file, int __line)
__THROW __attribute__ ((__noreturn__)) __COLD;
# if __ASSERT_VARIADIC && !defined __cplusplus
/* This function is not defined and is not called outside of an
unevaluated sizeof, but serves to verify that the argument to
assert is a single expression. */
extern _Bool __assert_single_arg (_Bool);
# endif
__END_DECLS
/* When possible, define assert so that it does not add extra
@@ -96,29 +130,57 @@ __END_DECLS
# define __ASSERT_FILE __FILE__
# define __ASSERT_LINE __LINE__
# endif
# define assert(expr) \
# if __ASSERT_VARIADIC
/* The first test of __VA_ARGS__ evaluates it without converting scoped
enumeration values to bool, and the second test checks that it is a
single expression without evaluating it. */
# define assert(...) \
((__VA_ARGS__) \
? void (1 ? 1 : bool (__VA_ARGS__)) \
: __assert_fail (#__VA_ARGS__, __ASSERT_FILE, __ASSERT_LINE, \
__ASSERT_FUNCTION))
# else
# define assert(expr) \
(static_cast <bool> (expr) \
? void (0) \
: __assert_fail (#expr, __ASSERT_FILE, __ASSERT_LINE, \
__ASSERT_FUNCTION))
# endif
# elif !defined __GNUC__ || defined __STRICT_ANSI__
# define assert(expr) \
# if __ASSERT_VARIADIC
# define assert(...) \
(((void) sizeof (__assert_single_arg (__VA_ARGS__)), __VA_ARGS__) \
? __ASSERT_VOID_CAST (0) \
: __assert_fail (#__VA_ARGS__, __FILE__, __LINE__, __ASSERT_FUNCTION))
# else
# define assert(expr) \
((expr) \
? __ASSERT_VOID_CAST (0) \
: __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
# endif
# else
# if __ASSERT_VARIADIC
# define assert(...) \
((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
if (__VA_ARGS__) \
; /* empty */ \
else \
__assert_fail (#__VA_ARGS__, __FILE__, __LINE__, __ASSERT_FUNCTION); \
}))
# else
/* The first occurrence of EXPR is not evaluated due to the sizeof,
but will trigger any pedantic warnings masked by the __extension__
for the second occurrence. The ternary operator is required to
support function pointers and bit fields in this context, and to
suppress the evaluation of variable length arrays. */
# define assert(expr) \
# define assert(expr) \
((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \
if (expr) \
; /* empty */ \
else \
__assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
}))
# endif
# endif
# ifdef __USE_GNU
+5 -15
View File
@@ -1,5 +1,5 @@
/* Test assert's compliance with POSIX requirements.
Copyright (C) 2024-2025 Free Software Foundation, Inc.
Copyright (C) 2024-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -127,7 +127,7 @@ check_posix (const char *buf, int rv, int line,
}
static void
one_test (void (*func)(void *), int which_path)
one_test (void (*func)(void *))
{
struct support_capture_subprocess sp;
int rv;
@@ -140,17 +140,7 @@ one_test (void (*func)(void *), int which_path)
check_posix (sp.err.buffer, rv, do_lineno, do_funcname, "1 == 2");
/* Look for intentional subtle differences in messages to verify
that the intended code path was taken. */
switch (which_path)
{
case 0:
TEST_VERIFY (strstr (sp.err.buffer, "failed.\n") != NULL);
break;
case 1:
TEST_VERIFY (strstr (sp.err.buffer, "failed\n") != NULL);
break;
}
TEST_VERIFY (strstr (sp.err.buffer, "failed.\n") != NULL);
support_capture_subprocess_free (&sp);
}
@@ -158,8 +148,8 @@ one_test (void (*func)(void *), int which_path)
static int
do_test(void)
{
one_test (test_assert_normal, 0);
one_test (test_assert_nomalloc, 1);
one_test (test_assert_normal);
one_test (test_assert_nomalloc);
return 0;
}
+120
View File
@@ -0,0 +1,120 @@
/* Test assert as a variadic macro for C++ code snippets.
Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
/* This test requires C++26, and is compiled with -std=c++26
if GCC version supports that, and no additional options
otherwise. */
#if defined __cplusplus && __cplusplus > 202302L
#undef NDEBUG
#include <assert.h>
template <typename T1, typename T2>
bool
foo ()
{ return true; }
struct C
{
C (int p, int r) : x (p + r) {}
int x;
};
int
func ()
{
return 1;
}
static void
test_enabled ()
{
{
assert (foo <int, float> ());
}
{
assert (C {1, 2}.x > 0);
}
{
int x = 10, y = 20;
assert ([x, y] { return x < y; } ());
}
{
/* Ill-formed, not an assigment expression. */
// assert (func (), func ());
assert ((func (), func ()));
}
}
/* GCC PR118629 fixed the handling of assert inside requires clause. */
#if __GNUC_PREREQ (14, 3) || defined __clang__
template <typename Ts>
constexpr bool
assert_works ()
{
return requires (Ts ts) {
assert (ts);
};
}
enum OE { oe };
enum TE : int { te };
enum class SE : int { se };
static_assert ( assert_works <OE> ());
static_assert ( assert_works <TE> ());
static_assert (!assert_works <SE> ());
#endif /* __GNUC_PREREQ (14, 3) || defined __clang__ */
#define NDEBUG
#include <assert.h>
static void
test_disabled ()
{
/* Assert is variadic, but ignores arguments */
assert(1, 2);
assert(+, 1, -, 2, *, 30);
}
static int
do_test ()
{
test_enabled ();
test_disabled ();
return 0;
}
#else
#include <support/test-driver.h>
static int
do_test ()
{
return EXIT_UNSUPPORTED;
}
#endif
#include <support/test-driver.c>
+3
View File
@@ -0,0 +1,3 @@
#undef _GNU_SOURCE
#include <test-assert.c>
+3
View File
@@ -0,0 +1,3 @@
#undef _GNU_SOURCE
#include <test-assert.c>
+50
View File
@@ -0,0 +1,50 @@
/* Test assert as a variadic macro.
Copyright (C) 2025-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#undef NDEBUG
#include <assert.h>
static void
test1 (void)
{
/* This is two macro arguments, but one function argument, so must
be accepted for C23. */
assert ((int [2]) { 0, 1 }[1]);
}
#define NDEBUG
#include <assert.h>
static void
test2 (void)
{
/* With NDEBUG, arbitrary sequences of tokens are valid as assert
arguments; they do not need to form a single expression. */
assert (1, 2, 3, *);
assert ();
}
static int
do_test (void)
{
test1 ();
test2 ();
return 0;
}
#include <support/test-driver.c>
+37 -1
View File
@@ -1,5 +1,5 @@
/* Tests for interactions between C++ and assert.
Copyright (C) 2017-2025 Free Software Foundation, Inc.
Copyright (C) 2017-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,11 @@
#include <assert.h>
#if __GNUC_PREREQ (5, 0)
template <typename> struct is_void { static const bool value = false; };
template <> struct is_void <void> { static const bool value = true; };
static_assert(is_void <decltype (assert (""))>::value, "type is void");
/* The C++ standard requires that if the assert argument is a constant
subexpression, then the assert itself is one, too. */
constexpr int
@@ -63,6 +68,15 @@ struct bool_and_int
template <class T> bool operator!= (T) const; /* No definition. */
};
/* Scoped enumerations are not contextually convertible to bool. */
enum class E { e1 = 1 };
int&
preincrement (int& i)
{
return ++i;
}
static int
do_test ()
{
@@ -76,8 +90,30 @@ do_test ()
assert (value);
}
{
assert ([] { return true; } ());
}
{
assert (bool (E::e1));
/* Ill-formed, E::e1 is not contextually convertible to bool. */
// assert (E::e1);
}
{
int i = 0;
assert (preincrement (i) > 0);
if (i != 1)
return 1;
}
return 0;
}
#define NDEBUG
#include <assert.h>
static_assert(is_void <decltype (assert (""))>::value, "type is void with NDEBUG");
#else
#include <support/test-driver.h>
+1 -1
View File
@@ -1,5 +1,5 @@
/* Tests for interactions between C++ and assert. GNU C++11 version.
Copyright (C) 2017-2025 Free Software Foundation, Inc.
Copyright (C) 2017-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+38 -2
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# Copyright (C) 2013-2026 Free Software Foundation, Inc.
# Copyright The GNU Toolchain Authors.
# This file is part of the GNU C Library.
@@ -28,19 +28,23 @@ bench-math := \
acosf \
acosh \
acoshf \
acospi \
acospif \
asin \
asinf \
asinh \
asinhf \
asinpi \
asinpif \
atan \
atan2 \
atan2f \
atan2pi \
atan2pif \
atanf \
atanh \
atanhf \
atanpi \
atanpif \
cbrt \
cbrtf \
@@ -50,6 +54,7 @@ bench-math := \
cosf \
cosh \
coshf \
cospi \
cospif \
erf \
erfc \
@@ -58,9 +63,11 @@ bench-math := \
exp \
exp10 \
exp10f \
exp10m1 \
exp10m1f \
exp2 \
exp2f \
exp2m1 \
exp2m1f \
expf \
expl \
@@ -68,6 +75,8 @@ bench-math := \
expm1f \
floor \
floorf \
fma \
fmaf \
fmal \
fmax \
fmaxf \
@@ -75,6 +84,9 @@ bench-math := \
fminf \
fmod \
fmodf \
frexp \
frexpf \
frexpl \
hypot \
hypotf \
ilogb \
@@ -86,17 +98,20 @@ bench-math := \
j1 \
lgamma \
lgammaf \
lgammaf_r \
llrint \
llrintf \
log \
log10 \
log10f \
log10p1 \
log10p1f \
log1p \
log1pf \
log2 \
log2f \
log2l \
log2p1 \
log2p1f \
logb \
logbf \
@@ -110,22 +125,28 @@ bench-math := \
pow \
powf \
powl \
remainder \
remainderf \
rint \
rintf \
roundeven \
roundevenf \
rsqrt \
rsqrtf \
sin \
sincos \
sincosf \
sinf \
sinh \
sinhf \
sinpi \
sinpif \
sqrt \
tan \
tanf \
tanh \
tanhf \
tanpi \
tanpif \
tgamma \
tgammaf \
@@ -154,6 +175,8 @@ bench-pthread := \
pthread-locks \
pthread-mutex-lock \
pthread-mutex-trylock \
pthread-mutex-trylock-recursive-throughput \
pthread-mutex-trylock-throughput \
pthread-spin-lock \
pthread-spin-trylock \
pthread_once \
@@ -167,6 +190,8 @@ bench-resolv := \
LDLIBS-bench-pthread-mutex-lock += -lm
LDLIBS-bench-pthread-mutex-trylock += -lm
LDLIBS-bench-pthread-mutex-trylock-recursive-throughput += -lm
LDLIBS-bench-pthread-mutex-trylock-throughput += -lm
LDLIBS-bench-pthread-spin-lock += -lm
LDLIBS-bench-pthread-spin-trylock += -lm
@@ -325,10 +350,19 @@ CFLAGS-bench-ffsll.c += -fno-builtin
CFLAGS-bench-sqrt.c += -fno-builtin
CFLAGS-bench-fmin.c += -fno-builtin
CFLAGS-bench-fminf.c += -fno-builtin
CFLAGS-bench-fma.c += -fno-builtin
CFLAGS-bench-fmaf.c += -fno-builtin
CFLAGS-bench-fmax.c += -fno-builtin
CFLAGS-bench-fmaxf.c += -fno-builtin
CFLAGS-bench-trunc.c += -fno-builtin
CFLAGS-bench-truncf.c += -fno-builtin
CFLAGS-bench-fmod.c += -fno-builtin
CFLAGS-bench-fmodf.c += -fno-builtin
CFLAGS-bench-frexp.c += -fno-builtin
CFLAGS-bench-frexpf.c += -fno-builtin
CFLAGS-bench-frexpl.c += -fno-builtin
CFLAGS-bench-remainder.c += -fno-builtin
CFLAGS-bench-remainderf.c += -fno-builtin
CFLAGS-bench-roundeven.c += -fno-builtin
CFLAGS-bench-roundevenf.c += -fno-builtin
CFLAGS-bench-isnan.c += $(config-cflags-signaling-nans)
@@ -367,6 +401,8 @@ $(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests)
$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
$(addprefix $(objpfx)bench-,pthread-mutex-locks): $(libm-benchtests)
$(addprefix $(objpfx)bench-,malloc-thread): $(libm-benchtests)
$(addprefix $(objpfx)bench-,calloc-thread): $(libm-benchtests)
@@ -411,7 +447,7 @@ bench-deps := bench-skeleton.c bench-timing.h Makefile
run-bench = $(test-wrapper-env) \
$(run-program-env) \
$($*-ENV) $(test-via-rtld-prefix) $${run}
$($*-ENV) $(test-tunables) $(test-via-rtld-prefix) $${run}
timing-type := $(objpfx)bench-timing-type
extra-objs += bench-timing-type.o
+1002 -300
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1002 -300
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1001 -1002
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,5 +1,5 @@
/* arc4random benchmarks.
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure bsearch functions.
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure bzero functions with large data sizes.
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure bzero functions.
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Benchmark calloc and free functions.
Copyright (C) 2024-2025 Free Software Foundation, Inc.
Copyright (C) 2024-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Benchmark calloc and free functions.
Copyright (C) 2025 Free Software Foundation, Inc.
Copyright (C) 2025-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Benchmark calloc and free functions.
Copyright (C) 2024-2025 Free Software Foundation, Inc.
Copyright (C) 2024-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure __dl_new_hash runtime
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure __dl_new_hash runtime
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Benchmark fclose.
Copyright (C) 2024-2025 Free Software Foundation, Inc.
Copyright (C) 2024-2026 Free Software Foundation, Inc.
Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Actual benchmark kernels used by bench-hash-funcs.h
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure hash functions runtime.
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copyright (C) 2022-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Skeleton for libmvec benchmark programs.
Copyright (C) 2021-2025 Free Software Foundation, Inc.
Copyright (C) 2021-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+2 -2
View File
@@ -1,5 +1,5 @@
/* Benchmark malloc and free functions.
Copyright (C) 2019-2025 Free Software Foundation, Inc.
Copyright (C) 2019-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@
#include "json-lib.h"
/* Benchmark the malloc/free performance of a varying number of blocks of a
given size. This enables performance tracking of the t-cache and fastbins.
given size. This enables performance tracking of the t-cache.
It tests 3 different scenarios: single-threaded using main arena,
multi-threaded using thread-arena, and main arena with SINGLE_THREAD_P
false. */
+1 -1
View File
@@ -1,5 +1,5 @@
/* Benchmark tcache hotpath allocations.
Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copyright (C) 2013-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+11 -11
View File
@@ -1,5 +1,5 @@
/* Benchmark malloc and free functions.
Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copyright (C) 2013-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@
<https://www.gnu.org/licenses/>. */
#ifndef TEST_FUNC
# define TEST_FUNC(size) malloc(size)
# define TEST_FUNC(size) malloc (size)
# define TEST_NAME "malloc"
#endif
@@ -36,7 +36,7 @@
#include "json-lib.h"
/* Benchmark duration in seconds. */
#define BENCHMARK_DURATION 10
#define BENCHMARK_DURATION 3
#define RAND_SEED 88
#ifndef NUM_THREADS
@@ -68,7 +68,7 @@ get_block_size (unsigned int rand_data)
float min_pow = powf (dist_min, exponent + 1);
float max_pow = powf (dist_max, exponent + 1);
float r = (float) rand_data / RAND_MAX;
float r = (float) rand_data / (float) RAND_MAX;
return (unsigned int) powf ((max_pow - min_pow) * r + min_pow,
1 / (exponent + 1));
@@ -206,12 +206,12 @@ do_benchmark (size_t num_threads, size_t *iters)
for (size_t i = 0; i < num_threads; i++)
{
args[i].working_set = working_set[i];
pthread_create(&threads[i], NULL, benchmark_thread, &args[i]);
pthread_create (&threads[i], NULL, benchmark_thread, &args[i]);
}
for (size_t i = 0; i < num_threads; i++)
{
pthread_join(threads[i], NULL);
pthread_join (threads[i], NULL);
TIMING_ACCUM (elapsed, args[i].elapsed);
*iters += args[i].iters;
}
@@ -219,7 +219,7 @@ do_benchmark (size_t num_threads, size_t *iters)
return elapsed;
}
static void usage(const char *name)
static void usage (const char *name)
{
fprintf (stderr, "%s: <num_threads>\n", name);
exit (1);
@@ -241,15 +241,15 @@ main (int argc, char **argv)
long ret;
errno = 0;
ret = strtol(argv[1], NULL, 10);
ret = strtol (argv[1], NULL, 10);
if (errno || ret == 0)
usage(argv[0]);
usage (argv[0]);
num_threads = ret;
}
else
usage(argv[0]);
usage (argv[0]);
init_random_values ();
@@ -275,7 +275,7 @@ main (int argc, char **argv)
cur = do_benchmark (num_threads, &iters);
struct rusage usage;
getrusage(RUSAGE_SELF, &usage);
getrusage (RUSAGE_SELF, &usage);
d_total_s = cur;
d_total_i = iters;
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure math inline functions.
Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copyright (C) 2015-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+2 -2
View File
@@ -1,5 +1,5 @@
/* Measure memccpy functions.
Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copyright (C) 2013-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@
void *
generic_memccpy (void *dst, const void *src, int c, size_t n)
{
void *p = memchr (src, c, n);
const void *p = memchr (src, c, n);
if (p != NULL)
return mempcpy (dst, src, p - src + 1);
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure memchr functions.
Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copyright (C) 2013-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure memcmp functions.
Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copyright (C) 2013-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure __memcmpeq functions.
Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copyright (C) 2015-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+1 -1
View File
@@ -1,5 +1,5 @@
/* Measure memcpy functions with large data sizes.
Copyright (C) 2016-2025 Free Software Foundation, Inc.
Copyright (C) 2016-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
+2 -2
View File
@@ -1,5 +1,5 @@
/* Measure memcpy performance.
Copyright (C) 2016-2025 Free Software Foundation, Inc.
Copyright (C) 2016-2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -34,7 +34,7 @@ typedef struct { uint8_t align; uint16_t freq; } align_data_t;
#define SIZE_NUM 65536
#define SIZE_MASK (SIZE_NUM-1)
static uint8_t size_arr[SIZE_NUM];
static uint16_t size_arr[SIZE_NUM];
/* Frequency data for memcpy of less than 4096 bytes based on SPEC2017. */
static freq_data_t size_freq[] =

Some files were not shown because too many files have changed in this diff Show More