]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
3 days agoUse Linux 6.16, GCC 15, binutils 2.45 in build-many-glibcs.py
Joseph Myers [Tue, 29 Jul 2025 15:08:09 +0000 (15:08 +0000)] 
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).

3 days agomalloc: Enable THP always support on hugetlb tunable
William Hunt [Tue, 29 Jul 2025 15:04:58 +0000 (15:04 +0000)] 
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>
3 days agomalloc: Remove redundant NULL check
Wilco Dijkstra [Thu, 10 Jul 2025 15:49:14 +0000 (15:49 +0000)] 
malloc: Remove redundant NULL check

Remove a redundant NULL check from tcache_get_n.

Reviewed-by: Cupertino Miranda <cupertino.miranda@oracle.com>
3 days agoreplace atan2-inputs with more meaningful inputs
Paul Zimmermann [Wed, 9 Jul 2025 08:11:23 +0000 (10:11 +0200)] 
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>
3 days agoinet-fortified: fix namespace violation (bug 33227)
Sam James [Mon, 28 Jul 2025 20:55:30 +0000 (21:55 +0100)] 
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>
3 days agotst-cond23: return EXIT_UNSUPPORTED on missing clock selection
Samuel Thibault [Tue, 29 Jul 2025 09:56:06 +0000 (11:56 +0200)] 
tst-cond23: return EXIT_UNSUPPORTED on missing clock selection

4 days agoNEWS: Add 2.43 section
Andreas K. Hüttel [Mon, 28 Jul 2025 18:33:18 +0000 (20:33 +0200)] 
NEWS: Add 2.43 section

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 days agoBump version to 2.42.9000 glibc-2.42.9000
Andreas K. Hüttel [Mon, 28 Jul 2025 18:31:31 +0000 (20:31 +0200)] 
Bump version to 2.42.9000

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 days agoCreate ChangeLog.old/ChangeLog.31 glibc-2.42
Andreas K. Hüttel [Mon, 28 Jul 2025 18:22:55 +0000 (20:22 +0200)] 
Create ChangeLog.old/ChangeLog.31

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 days agoBump version number to 2.42
Andreas K. Hüttel [Mon, 28 Jul 2025 18:19:17 +0000 (20:19 +0200)] 
Bump version number to 2.42

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 days agoNEWS: update with last-minute fix bug 33224
Andreas K. Hüttel [Mon, 28 Jul 2025 18:12:05 +0000 (20:12 +0200)] 
NEWS: update with last-minute fix bug 33224

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 days agomath: Update auto-libm-tests-in with ldbl-128ibm compoundn/pown failures
Adhemerval Zanella [Mon, 28 Jul 2025 13:59:07 +0000 (10:59 -0300)] 
math: Update auto-libm-tests-in with ldbl-128ibm compoundn/pown failures

It fixes ce488f7c1615bc2f6fe96ff4d51456e470aa5805 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>
4 days agoINSTALL: Update newest tested binutils version
Andreas K. Hüttel [Mon, 28 Jul 2025 14:49:01 +0000 (16:49 +0200)] 
INSTALL: Update newest tested binutils version

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 days agoelf: Compile _dl_debug_state separately (bug 33224)
Florian Weimer [Mon, 28 Jul 2025 12:16:52 +0000 (14:16 +0200)] 
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>
4 days agoconfigure.ac: fix bashisms in SFrame checks
Sam James [Mon, 28 Jul 2025 13:00:52 +0000 (14:00 +0100)] 
configure.ac: fix bashisms in SFrame checks

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 days agoINSTALL: regenerate
Andreas K. Hüttel [Sat, 26 Jul 2025 15:07:14 +0000 (17:07 +0200)] 
INSTALL: regenerate

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 days agoinstall.texi: Update tested build tool versions
Andreas K. Hüttel [Sat, 26 Jul 2025 15:05:21 +0000 (17:05 +0200)] 
install.texi: Update tested build tool versions

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 days agocontrib.texi: Update
Andreas K. Hüttel [Sat, 26 Jul 2025 14:53:43 +0000 (16:53 +0200)] 
contrib.texi: Update

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 days agoNEWS: insert list of CVEs
Andreas K. Hüttel [Sat, 26 Jul 2025 13:23:49 +0000 (15:23 +0200)] 
NEWS: insert list of CVEs

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 days agoadvisories: s/CVE-id/CVE-Id/ (the lowercase i breaks our tooling)
Andreas K. Hüttel [Sat, 26 Jul 2025 13:21:27 +0000 (15:21 +0200)] 
advisories: s/CVE-id/CVE-Id/ (the lowercase i breaks our tooling)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 days agoNEWS: Generalize testing section and mention the manual.
Carlos O'Donell [Fri, 25 Jul 2025 22:38:59 +0000 (18:38 -0400)] 
NEWS: Generalize testing section and mention the manual.

7 days agoNEWS: Insert list of bugs fixed in 2.42
Andreas K. Hüttel [Fri, 25 Jul 2025 21:52:41 +0000 (23:52 +0200)] 
NEWS: Insert list of bugs fixed in 2.42

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
7 days agoNEWS: Collect some more newsworthy items
Andreas K. Hüttel [Fri, 25 Jul 2025 21:36:56 +0000 (23:36 +0200)] 
NEWS: Collect some more newsworthy items

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
7 days agoNEWS: editorial changes
Andreas K. Hüttel [Fri, 25 Jul 2025 19:18:13 +0000 (21:18 +0200)] 
NEWS: editorial changes

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
7 days agopo: Update swedish translations
Andreas K. Hüttel [Fri, 25 Jul 2025 17:31:37 +0000 (19:31 +0200)] 
po: Update swedish translations

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
7 days agodebug: Only run sframe tests if run-built-tests is enabled
Adhemerval Zanella [Fri, 25 Jul 2025 17:03:23 +0000 (14:03 -0300)] 
debug: Only run sframe tests if run-built-tests is enabled

7 days agoaarch64: Fix aarch64_be build with --enable-sframe
Adhemerval Zanella [Fri, 25 Jul 2025 16:57:44 +0000 (13:57 -0300)] 
aarch64: Fix aarch64_be build with --enable-sframe

8 days agoelf: Check SFrame on tst-dl_find_object.c
Adhemerval Zanella [Tue, 22 Jul 2025 15:55:52 +0000 (12:55 -0300)] 
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>
8 days agosframe: Add support for SFRAME_F_FDE_FUNC_START_PCREL flag
Claudiu Zissulescu [Tue, 22 Jul 2025 15:55:51 +0000 (12:55 -0300)] 
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>
8 days agoDisable SFrame support by default
Adhemerval Zanella [Tue, 22 Jul 2025 15:55:50 +0000 (12:55 -0300)] 
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>
8 days agomath: xfail some pown and compoundn tests for ibm128-libgcc
Sachin Monga [Wed, 23 Jul 2025 16:43:52 +0000 (11:43 -0500)] 
math: xfail some pown and compoundn tests for ibm128-libgcc

On powerpc math/test-ibm128-pown shows below failures:

testing long double (without inline functions)
infinity has wrong sign.
Failure: Test: pown_downward (-inf, 0x7fffffffffffffffLL)
Result:
 is:          inf   inf
 should be:  -inf  -inf
Failure: Test: pown_downward (-0, 9223372036854775807LL)
Result:
 is:          0.00000000000000000000000000000000e+00   0x0.000000000000000000000000000p+0
 should be:  -0.00000000000000000000000000000000e+00  -0x0.000000000000000000000000000p+0
 difference:  0.00000000000000000000000000000000e+00   0x0.000000000000000000000000000p+0
 ulp       :  0.0000
 max.ulp   :  16.0000
Failure: pown_downward (-0x1p+0, 9223372036854775807LL): Exception "Invalid operation" set
Failure: pown_downward (-0x1p+0, 9223372036854775807LL): errno set to 34, expected 0 (unchanged)
Failure: Test: pown_downward (-0x1p+0, 9223372036854775807LL)
Result:
 is:         qNaN
 should be:  -1.00000000000000000000000000000000e+00  -0x1.000000000000000000000000000p+0
infinity has wrong sign.
Failure: Test: pown_towardzero (-0, -0x7fffffffffffffffLL)
Result:
 is:          inf   inf
 should be:  -inf  -inf
infinity has wrong sign.
Failure: Test: pown_towardzero (-inf, 0x7fffffffffffffffLL)
Result:
 is:          inf   inf
 should be:  -inf  -inf
Failure: Test: pown_towardzero (-inf, -0x7fffffffffffffffLL)
Result:
 is:          0.00000000000000000000000000000000e+00   0x0.000000000000000000000000000p+0
 should be:  -0.00000000000000000000000000000000e+00  -0x0.000000000000000000000000000p+0
 difference:  0.00000000000000000000000000000000e+00   0x0.000000000000000000000000000p+0
 ulp       :  0.0000
 max.ulp   :  16.0000
Failure: Test: pown_towardzero (-0, 9223372036854775807LL)
Result:
 is:          0.00000000000000000000000000000000e+00   0x0.000000000000000000000000000p+0
 should be:  -0.00000000000000000000000000000000e+00  -0x0.000000000000000000000000000p+0
 difference:  0.00000000000000000000000000000000e+00   0x0.000000000000000000000000000p+0
 ulp       :  0.0000
 max.ulp   :  16.0000
Failure: pown_towardzero (-0x1p+0, -9223372036854775807LL): Exception "Invalid operation" set
Failure: pown_towardzero (-0x1p+0, -9223372036854775807LL): errno set to 34, expected 0 (unchanged)
Failure: Test: pown_towardzero (-0x1p+0, -9223372036854775807LL)
Result:
 is:         qNaN
 should be:  -1.00000000000000000000000000000000e+00  -0x1.000000000000000000000000000p+0
Failure: pown_towardzero (-0x1p+0, 9223372036854775807LL): Exception "Invalid operation" set
Failure: pown_towardzero (-0x1p+0, 9223372036854775807LL): errno set to 34, expected 0 (unchanged)
Failure: Test: pown_towardzero (-0x1p+0, 9223372036854775807LL)
Result:
 is:         qNaN
 should be:  -1.00000000000000000000000000000000e+00  -0x1.000000000000000000000000000p+0
infinity has wrong sign.
Failure: Test: pown_upward (-0, -0x7fffffffffffffffLL)
Result:
 is:          inf   inf
 should be:  -inf  -inf
Failure: Test: pown_upward (-inf, -0x7fffffffffffffffLL)
Result:
 is:          0.00000000000000000000000000000000e+00   0x0.000000000000000000000000000p+0
 should be:  -0.00000000000000000000000000000000e+00  -0x0.000000000000000000000000000p+0
 difference:  0.00000000000000000000000000000000e+00   0x0.000000000000000000000000000p+0
 ulp       :  0.0000
 max.ulp   :  16.0000
Failure: pown_upward (-0x1p+0, -9223372036854775807LL): Exception "Invalid operation" set
Failure: pown_upward (-0x1p+0, -9223372036854775807LL): errno set to 34, expected 0 (unchanged)
Failure: Test: pown_upward (-0x1p+0, -9223372036854775807LL)
Result:
 is:         qNaN
 should be:  -1.00000000000000000000000000000000e+00  -0x1.000000000000000000000000000p+0

Likewise, math/test-ibm128-compoundn shows below failure:

testing long double (without inline functions)
Failure: compoundn_upward (0xf.ffffffffffff8p+1020, 1LL): Exception "Overflow" set
Failure: compoundn_upward (0xf.ffffffffffff8p+1020, 1LL): errno set to 34, expected 0 (unchanged)
Failure: Test: compoundn_upward (0xf.ffffffffffff8p+1020, 1LL)
Result:
 is:          inf   inf
 should be:   1.79769313486231570814527423731707e+308   0x1.fffffffffffff00000000000008p+1023

Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
8 days agomanual: Use @Theglibc{} at sentence start in terminal documentation
Florian Weimer [Tue, 22 Jul 2025 21:28:16 +0000 (23:28 +0200)] 
manual: Use @Theglibc{} at sentence start in terminal documentation

Fixes commit 5dd2a19ad5218261cee064 ("termios: manual: improve the
explanation of various tty concepts") and commit c744519bad8106769760
("termios: manual: document the SPEED_MAX and BAUD_MAX constants").

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
8 days agoUpdate Fix-Commit list for advisory GLIBC-SA-2025-0002
Carlos O'Donell [Thu, 24 Jul 2025 15:12:02 +0000 (11:12 -0400)] 
Update Fix-Commit list for advisory GLIBC-SA-2025-0002

8 days agodebug: Link tst-sprintf-fortify-rdonly-static with -Wl,-z,relro [BZ 33183]
John David Anglin [Thu, 24 Jul 2025 14:53:35 +0000 (10:53 -0400)] 
debug: Link tst-sprintf-fortify-rdonly-static with -Wl,-z,relro [BZ 33183]

This test requires relro_format be placed in the PT_GNU_RELRO segment.
The ELF linker enables -z relro support by default on all Linux targets
except FRV, HPPA, IA64 and MIPS. On these targets, we need to explicitly
link with -z relro to place relro_format in the PT_GNU_RELRO segment.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
9 days agoAdvisory text for CVE-2025-8058
Adhemerval Zanella [Wed, 23 Jul 2025 19:09:19 +0000 (16:09 -0300)] 
Advisory text for CVE-2025-8058

The fix is already installed (7ea06e994093fa0bcca0d0ee2c1db271d8d7885d).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
10 days agoMakeconfig: The hash character # confuses old make, use $(dir instead of sed
Andreas K. Hüttel [Mon, 21 Jul 2025 21:48:43 +0000 (23:48 +0200)] 
Makeconfig: The hash character # confuses old make, use $(dir instead of sed

Up to Make 4.2, # is treated as the start of a comment even in
function invocations. This leads to a syntax error. Fixed in Make 4.3,
but we still support versions back to 4.0 at the moment.

Tested on Gentoo (x86-64) and Debian (loongarch64)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
10 days agopo: Incorporate translations
Andreas K. Hüttel [Mon, 21 Jul 2025 22:28:48 +0000 (00:28 +0200)] 
po: Incorporate translations

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
11 days agoposix: Fix double-free after allocation failure in regcomp (bug 33185)
Florian Weimer [Mon, 21 Jul 2025 19:43:49 +0000 (21:43 +0200)] 
posix: Fix double-free after allocation failure in regcomp (bug 33185)

If a memory allocation failure occurs during bracket expression
parsing in regcomp, a double-free error may result.

Reported-by: Anastasia Belova <abelova@astralinux.ru>
Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
11 days agoRevert "Linux: Keep termios ioctl constants strictly internal"
Florian Weimer [Mon, 21 Jul 2025 13:12:44 +0000 (15:12 +0200)] 
Revert "Linux: Keep termios ioctl constants strictly internal"

This reverts commit 3d3572f59059e2b19b8541ea648a6172136ec42e.

Reason for revert: TCGETS etc. work to some extent on at least
a subset of architectures, so there is no pressing need to force
applications off them.  Removal of the macros breaks building
the sanitizers, impacting both GCC and LLVM.

Reviewed-by: Sam James <sam@gentoo.org>
12 days agotermios: manual: document the SPEED_MAX and BAUD_MAX constants
H. Peter Anvin [Sun, 13 Jul 2025 05:19:44 +0000 (22:19 -0700)] 
termios: manual: document the SPEED_MAX and BAUD_MAX constants

Add the SPEED_MAX and BAUD_MAX constants to the manual.

[ v3: drop leading underscores ]

Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
12 days agotermios: SPEED_MAX and BAUD_MAX constants
H. Peter Anvin [Sun, 13 Jul 2025 05:19:43 +0000 (22:19 -0700)] 
termios: SPEED_MAX and BAUD_MAX constants

Add constants indicating the maximum values of speed_t and baud_t.
Hopefully if and when the baud_t interface is standardized then
BAUD_MAX will be included in the standardization from the start.

Historically, the __MAX_BAUD symbol has indicated the maximum speed_t
value on at least some platforms (including glibc).  However, this
name would be problematic for future standardization, because it
confusingly implies a reference to baud_t, not speed_t, and it is
inconsistent with other limit symbols, which are all of the form *_MAX
(e.g. SIZE_MAX for size_t.)

[ v3: dropped leading underscores, leave __MAX_BAUD outside
      #ifdef __USE_MISC since it is a legacy symbol, and
      namespace-protected with a double underscore.
      (Collin Funk, Adhermerval Zanella Netto) ]

[ v4: moved from __USE_MISC to __USE_GNU (Collin Funk) ]

Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
12 days agotermios: move the baud_t interface from __USE_MISC to __USE_GNU
H. Peter Anvin [Sun, 13 Jul 2025 05:19:42 +0000 (22:19 -0700)] 
termios: move the baud_t interface from __USE_MISC to __USE_GNU

__USE_MISC refers to interfaces imported from BSD or System V, but the
baud_t interface is (at least for now) a GNU extension, so move it
from __USE_MISC to __USE_GNU.

Suggested-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
12 days agotermios: manual: improve the explanation of various tty concepts
H. Peter Anvin [Sun, 13 Jul 2025 02:20:04 +0000 (19:20 -0700)] 
termios: manual: improve the explanation of various tty concepts

It is a lot easier to understand the meaning of the tty interface if
it is explained from the beginning as conceptually emulating an RS232
serial port.  This greatly simplifies the discussions of specific
items like the meaning of line speed.

Distinguish between "modem disconnect request" (deasserting DTR) and
"modem disconnect" (DCD deasserted).  Conflating the two terms is
confusing, especially for non-RS232 devices.  In particular, on most
systems, a pseudo-terminal will *not* respond to a modem disconnect
request by triggering a modem disconnect event for the purpose of the
HUPCL flag.

It is not necessarily true that the line speed has no effect on
non-serial port devices: e.g. an SPI port may interpret it as the
clock frequency to use; however, SPI does not use asynchronous framing
bits, instead synchronization is handled by the SS# wire.  Similarly,
it is common but not by any means universal for interfaces that employ
various forms of fixed data to symbol rate encodings to encode the
data link layer bit rate rather than the physical symbol rate, which
may be higher (e.g. 8B10B) or lower (e.g. QAM/Trellis), without the
encoding or framing overhead.

Finally, a handful of devices use the line rate for entirely
nonstandard purposes.  One example is Arduino USB interfaces, which
often interprets changing the baud rate to 1200 baud as a command to
reset the device.

[ v2: removed a bogus stray chunk from editing ]

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agotermios: manual: remove duplicate cfgetospeed() definition
H. Peter Anvin [Sun, 13 Jul 2025 02:20:03 +0000 (19:20 -0700)] 
termios: manual: remove duplicate cfgetospeed() definition

The function cfsetospeed() is defined twice in the manual. Remove the
one that seems out of place.

Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
12 days agotermios: manual: fix typo: tcsettattr -> tcsetattr
H. Peter Anvin [Sun, 13 Jul 2025 02:20:02 +0000 (19:20 -0700)] 
termios: manual: fix typo: tcsettattr -> tcsetattr

Fix a typo in the manual: tcsetattr misspelled as tcsettattr.

Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
13 days agolibc.pot: regenerate
Andreas K. Hüttel [Sat, 19 Jul 2025 20:23:09 +0000 (22:23 +0200)] 
libc.pot: regenerate

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
13 days agoio/tst-stat.c: Use a temporary directory for symlink test
H.J. Lu [Sat, 19 Jul 2025 00:03:04 +0000 (17:03 -0700)] 
io/tst-stat.c: Use a temporary directory for symlink test

Call support_create_temp_directory to create a temporary directory for
symlink test, instead of a fixed file in the glibc source tree, to avoid
the race condition when there are more than one glibc tests running at the
same time with the same glibc source tree.  This fixes BZ #33178.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2 weeks agoelf: Initialize GLRO (dl_read_only_area) after static dlopen (bug 33139)
Florian Weimer [Fri, 18 Jul 2025 17:58:59 +0000 (19:58 +0200)] 
elf: Initialize GLRO (dl_read_only_area) after static dlopen (bug 33139)

The _dl_read_only_area function in the uninitialized ld.so after
static dlopen is not able to find anything.  Instead, we need to
redirect to the code from the statically linked main program.

Fixes commit d60fffe28a46b2a41fc308c1804ff02375d27408 ("debug:
Improve '%n' fortify detection (BZ 30932)").

Reviewed-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
2 weeks agodebug: Do not link tst-sprintf-fortify-rdonly against the dlopen module
Florian Weimer [Fri, 18 Jul 2025 17:58:56 +0000 (19:58 +0200)] 
debug: Do not link tst-sprintf-fortify-rdonly against the dlopen module

The test intends to load tst-sprintf-fortify-rdonly-dlopen.so via
dlopen, and directly linking against it prevents that.

Reviewed-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
2 weeks agox86-64: Properly compile ISA optimized modf and modff
H.J. Lu [Thu, 17 Jul 2025 23:00:42 +0000 (16:00 -0700)] 
x86-64: Properly compile ISA optimized modf and modff

There are 3 variants of modf and modff: SSE2, SSE4.1 and AVX.  s_modf.c
and s_modff.c include the generic implementation compiled with the minimum
x86 ISA level.  The IFUNC selector is used only if the minimum ISA level
is less than AVX.  SSE4.1 variant is included only if the ISA level is
less than SSE4.1.  AVX variant is included only the ISA level is less than
AVX.

AVX variant should be compiled with -mavx, not -msse2avx -DSSE2AVX which
are used to encode SSE assembly sources with EVEX encoding.

The routines that are shared between libc and libm should use different
rules to avoid using the same MODULE_NAME, to avoid potential issues
like BZ #33165 where __stack_chk_fail not being routed to the internal
symbol.

Tested with -march=x86-64, -march=x86-64-v2, -march=x86-64-v3 and
-march=x86-64-v4.

This fixes BZ #33165 and BZ #33173.

Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agox86-64: Compile ISA versions of modf/modff with -fno-stack-protector
H.J. Lu [Thu, 17 Jul 2025 00:17:34 +0000 (17:17 -0700)] 
x86-64: Compile ISA versions of modf/modff with -fno-stack-protector

Since modf and modff are compiled into both libc and libm, when glibc is
configured with --enable-stack-protector=all, ISA versions of modf and
modff should be compiled with -fno-stack-protector to avoid calling
__stack_chk_fail via PLT in libc.so.

This fixes BZ #33165.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2 weeks agoiconv: iconv -o should not create executable files (bug 33164)
Florian Weimer [Thu, 17 Jul 2025 12:44:05 +0000 (14:44 +0200)] 
iconv: iconv -o should not create executable files (bug 33164)

The mistake is that open must use 0666 to pick up the umask,
and not 0777 (which is required by mkdir).

Fixes commit 8ef3cff9d1ceafe369f982d980678d749fb93bd2
("iconv: Support in-place conversions (bug 10460, bug 32033)").

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agomalloc: fix definition for MAX_TCACHE_SMALL_SIZE
Cupertino Miranda [Tue, 8 Jul 2025 17:54:44 +0000 (18:54 +0100)] 
malloc: fix definition for MAX_TCACHE_SMALL_SIZE

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2 weeks agoSFrame: Add tests that uses DWARF backtracer
Claudiu Zissulescu [Mon, 14 Jul 2025 09:43:31 +0000 (12:43 +0300)] 
SFrame: Add tests that uses DWARF backtracer

When SFrame is enabled, we need to tests DW backtracer as well. Do
this by executing the same backtrace tests with .sframe section
stripped.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 weeks agoconfigure: Add --enable-sframe option
Claudiu Zissulescu [Mon, 14 Jul 2025 09:43:30 +0000 (12:43 +0300)] 
configure: Add --enable-sframe option

Enable SFrame stack track information. The --enable-sframe option
allows the glibc build to compile with SFrame stack track
information. Thus, enabling glibc's backtrace to work within glibc.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoelf: Add SFrame stack tracing
Claudiu Zissulescu [Mon, 14 Jul 2025 09:43:29 +0000 (12:43 +0300)] 
elf: Add SFrame stack tracing

This patch adds the necessary bits to enable stack tracing using
SFrame.  In the case the new SFrame stack tracing procedure doesn't
find SFrame related info, the stack tracing falls back on default
Dwarf implementation.

The new SFrame stack tracing procedure is added to debug/backtrace.c
file, the support functions are added in sysdeps folder, namely
sframe.h, read-sframe.c and read-sfame.h.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 weeks agoaarch64: Add SFrame support for aarch64 architecture
Claudiu Zissulescu [Mon, 14 Jul 2025 09:43:28 +0000 (12:43 +0300)] 
aarch64: Add SFrame support for aarch64 architecture

    The SFrame is supported for AArch64 architecture.
    Enable SFrame stack tracer for AArch64 too.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 weeks agox86: Add SFrame support for x86 architecture
Claudiu Zissulescu [Mon, 14 Jul 2025 09:43:27 +0000 (12:43 +0300)] 
x86: Add SFrame support for x86 architecture

The SFrame is well supported by x86 architecture since binutils 2.41.
Enable it to be used as default frame tracer.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 weeks agoelf: Add SFrame support to _dl_find_object function
Claudiu Zissulescu [Mon, 14 Jul 2025 09:43:26 +0000 (12:43 +0300)] 
elf: Add SFrame support to _dl_find_object function

The SFrame provides information to be able to do stack trace is now
well defined and implemented in Binutils 2.41.  The format simply
contains enough information to be able to do stack trace given a
program counter (PC) value, the stack pointer, and the frame pointer.
The SFrame information is stored in a .sframe ELF section, which is
loaded into its own PT_GNU_SFRAME segment. We consider for this support
SFrame version 2.

This patch adds the bits to _dl_find_object to recognize and store in
struct dl_find_object the necessary info about SFrame section.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
3 weeks agox86_64: Optimize modf/modff for x86_64-v2
Adhemerval Zanella [Mon, 16 Jun 2025 13:17:37 +0000 (10:17 -0300)] 
x86_64: Optimize modf/modff for x86_64-v2

The SSE4.1 provides a direct instruction for trunc, which improves
modf/modff performance with a less text size.  On Ryzen 9 (zen3) with
gcc 14.2.1:

x86_64-v2
reciprocal-throughput        master        patch       difference
workload-0_1                 7.9610       7.7914            2.13%
workload-1_maxint            9.4323       7.8021           17.28%
workload-maxint_maxfloat     8.7379       7.8049           10.68%
workload-integral            7.9492       7.7991            1.89%

latency                      master        patch       difference
workload-0_1                 7.9511      10.8910          -36.97%
workload-1_maxint           15.8278      10.9048           31.10%
workload-maxint_maxfloat    11.3495      10.9139            3.84%
workload-integral           11.5938      10.9071            5.92%

x86_64-v3
reciprocal-throughput        master        patch       difference
workload-0_1                 8.7522       7.9781            8.84%
workload-1_maxint            9.6690       7.9872           17.39%
workload-maxint_maxfloat     8.7634       7.9857            8.87%
workload-integral            8.7397       7.9893            8.59%

latency                      master        patch       difference
workload-0_1                 8.7447       9.5589           -9.31%
workload-1_maxint           13.7480       9.5690           30.40%
workload-maxint_maxfloat    10.0092       9.5680            4.41%
workload-integral            9.7518       9.5743            1.82%

For x86_64-v1 the optimization is done through a new ifunc selector.
The avx is to follow other SSE4_1 optimization (like trunc) to avoid
the ifunc for x86_64-v3.

Checked on x86_64-linux-gnu.
Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agoLinux: Keep termios ioctl constants strictly internal
Florian Weimer [Fri, 11 Jul 2025 14:04:07 +0000 (16:04 +0200)] 
Linux: Keep termios ioctl constants strictly internal

Undefine TCGETS, TCGETS2, and related ioctl constants in the installed
headers.  Extract the correct constants (using the kernel type
definitions) automatically from the UAPI headers.  The kernel
constants are available under KERNEL_* names during the glibc build,
computed using assembler constant extraction mechanism.

Alpha may have to use TCGETS instead of TCGETS2 because TCTGETS2
became available in Linux 4.20 only.  Introduce ARCH_TCGETS to make
this choice explict.

To support emulation on powerpc, glibc versions of the termios
constants are added to the emulation code in internal-ioctl.h.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agotermios: Move isatty, __isatty_nostatus from io
Florian Weimer [Fri, 11 Jul 2025 14:04:07 +0000 (16:04 +0200)] 
termios: Move isatty, __isatty_nostatus from io

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
The definition may depend on termios internals.

3 weeks agotermios: Reflow and sort Makefile
Florian Weimer [Fri, 11 Jul 2025 14:04:07 +0000 (16:04 +0200)] 
termios: Reflow and sort Makefile

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoRemove termios2 ioctl defintions from public headers
Andreas Schwab [Thu, 10 Jul 2025 07:19:38 +0000 (09:19 +0200)] 
Remove termios2 ioctl defintions from public headers

The use of the termios2 ioctl interface is an implementation detail which
should not bleed into public headers.  Remove the PowerPC version of
<bits/ioctls.h> and define the termios2 ioctl numbers in <termios_arch.h>
instead.  Also remove the include check from there which is unneeded in an
internal header.

3 weeks agoelf: Remove now pointless empty ld.so.conf files in single tests
Andreas K. Hüttel [Sat, 8 Feb 2025 16:09:04 +0000 (17:09 +0100)] 
elf: Remove now pointless empty ld.so.conf files in single tests

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agosupport: Always run ldconfig in containered tests
Andreas K. Hüttel [Sat, 8 Feb 2025 16:09:03 +0000 (17:09 +0100)] 
support: Always run ldconfig in containered tests

This is required so the generated ld.so.conf files take effect.

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoMakefile: Add ld.so.conf with libgcc dir to testroot.pristine
Andreas K. Hüttel [Sat, 8 Feb 2025 16:09:02 +0000 (17:09 +0100)] 
Makefile: Add ld.so.conf with libgcc dir to testroot.pristine

This way, a nonstandard directory within the testroot containing
libgcc_s.so can actually be picked up and used during the test runs.

Also provide a subdirectory ld.so.conf.d for drop-in configuration

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoMakeconfig: Add libgcc directory to rtld-prefix search path
Andreas K. Hüttel [Sat, 8 Feb 2025 16:09:01 +0000 (17:09 +0100)] 
Makeconfig: Add libgcc directory to rtld-prefix search path

* This needs to be done twice, for test runs with and without
  --enable-hardcoded-path-in-tests
* Also, we need to query the used $(CC) for the library location.

* The container tests run ldd and dump the list of needed libraries, then
  copy these into the container.
* Without this patch, ldd may not find libgcc_s.so, resulting in"not found"
  output and no copying of the library.
* With this patch, the library is picked up independent of its location (as
  long as the proper directory is provided) and copied into the testroot.

* This does not mean yet that ld.so in the testroot actually finds it.

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoNEWS: Mention changes to setjmp on aarch64
Yury Khrustalev [Wed, 9 Jul 2025 12:13:44 +0000 (13:13 +0100)] 
NEWS: Mention changes to setjmp on aarch64

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
3 weeks agoMark support for lock elision as deprecated.
Stefan Liebler [Tue, 8 Jul 2025 13:06:45 +0000 (15:06 +0200)] 
Mark support for lock elision as deprecated.

As discussed here:
https://sourceware.org/pipermail/libc-alpha/2025-July/168492.html
The support for TX lock elision of pthread mutexes is deprecated on
all architectures and will be removed in the next release.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agox86: Avoid vector/r16-r31 registers and memcpy/memset in mcount_internal
H.J. Lu [Mon, 7 Jul 2025 22:38:38 +0000 (06:38 +0800)] 
x86: Avoid vector/r16-r31 registers and memcpy/memset in mcount_internal

Since mcount_internal is called from mcount/__fentry__ which preserve
only RAX, RCX, RDX, RSI, RDI, R8 and R9, compile mcount.c with

-fno-tree-loop-distribute-patterns -mgeneral-regs-only -mno-apxf

to void vector/r16-r31 registers and memcpy/memset in mcount_internal.
This fixes BZ #33134.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
3 weeks agoNEWS: Mention tcache improvements
Wilco Dijkstra [Tue, 8 Jul 2025 15:03:46 +0000 (15:03 +0000)] 
NEWS: Mention tcache improvements

Update NEWS with tcache improvements.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agofstat: add test and documentation for an edge case.
Matteo Croce [Tue, 24 Jun 2025 16:40:13 +0000 (18:40 +0200)] 
fstat: add test and documentation for an edge case.

The fstatat behaviour when the target is a dangling symlink is different
if flags contains AT_SYMLINK_NOFOLLOW or not.
Add a test for this and document it.

3 weeks agofstatat: extend tests and documentation
Matteo Croce [Sat, 14 Jun 2025 09:59:03 +0000 (11:59 +0200)] 
fstatat: extend tests and documentation

Document the fstatat behaviour leading to a ENOENT errno, and extend
tests to test the case where filename does not exist.

Signed-off-by: Matteo Croce <teknoraver@meta.com>
3 weeks agohtl: move __pthread_get_cleanup_stack to libc
Samuel Thibault [Sun, 6 Jul 2025 09:01:19 +0000 (11:01 +0200)] 
htl: move __pthread_get_cleanup_stack to libc

This fixes the cleanup call from __qsort_r

3 weeks agohtl: Drop ptr_pthread_once from pthread_functions
Samuel Thibault [Sun, 6 Jul 2025 10:00:22 +0000 (10:00 +0000)] 
htl: Drop ptr_pthread_once from pthread_functions

It is unused since ccdb68e829a3 ("htl: move pthread_once into libc")

3 weeks agoelf: Restore support for _r_debug interpositions and copy relocations
Florian Weimer [Fri, 4 Jul 2025 19:46:30 +0000 (21:46 +0200)] 
elf: Restore support for _r_debug interpositions and copy relocations

The changes in commit a93d9e03a31ec14405cb3a09aa95413b67067380
("Extend struct r_debug to support multiple namespaces [BZ #15971]")
break the dyninst dynamic instrumentation tool.  It brings its
own definition of _r_debug (rather than a declaration).

Furthermore, it turns out it is rather hard to use the proposed
handshake for accessing _r_debug via DT_DEBUG. If applications want
to access _r_debug, they can do so directly if the relevant code has
been built as PIC.  To protect against harm from accidental copy
relocations due to linker relaxations, this commit restores copy
relocation support by adjusting both copies if interposition or
copy relocations are in play.  Therefore, it is possible to
use a hidden reference in ld.so to access _r_debug.

Only perform the copy relocation initialization if libc has been
loaded.  Otherwise, the ld.so search scope can be empty, and the
lookup of the _r_debug symbol mail fail.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoelf: Introduce _dl_debug_change_state
Florian Weimer [Fri, 4 Jul 2025 19:46:16 +0000 (21:46 +0200)] 
elf: Introduce _dl_debug_change_state

It combines updating r_state with the debugger notification.

The second change to  _dl_open introduces an additional debugger
notification for dlmopen, but debuggers are expected to ignore it.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoelf: Introduce separate _r_debug_array variable
Florian Weimer [Fri, 4 Jul 2025 19:46:05 +0000 (21:46 +0200)] 
elf: Introduce separate _r_debug_array variable

It replaces the ns_debug member of the namespaces.  Previously,
the base namespace had an unused ns_debug member.

This change also fixes a concurrency issue: Now _dl_debug_initialize
only updates r_next of the previous namespace's r_debug after the new
r_debug is initialized, so that only the initialized version is
observed.  (Client code accessing _r_debug will benefit from load
dependency tracking in CPUs even without explicit barriers.)

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agohurd: Mark more xfails for missing RLIMIT_AS support
Samuel Thibault [Sat, 5 Jul 2025 09:13:46 +0000 (11:13 +0200)] 
hurd: Mark more xfails for missing RLIMIT_AS support

4 weeks agoLinux: Fix typo in comment in termios_internals.h
Florian Weimer [Fri, 4 Jul 2025 08:50:06 +0000 (10:50 +0200)] 
Linux: Fix typo in comment in termios_internals.h

4 weeks agomanual: Remove '.info' suffix in manual names passed to @ref [BZ #32962].
Collin Funk [Tue, 13 May 2025 02:07:15 +0000 (19:07 -0700)] 
manual: Remove '.info' suffix in manual names passed to @ref [BZ #32962].

Texinfo 7.2 began warning about the '.info' suffix in the manual names
passed to @ref and similar commands.  They eventually plan to stop
stripping the '.info' suffix internally which will lead to broken links
in the manuals without this change.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
4 weeks agostdlib/Makefile: Remove deleted test's libm dependency
Arjun Shankar [Wed, 2 Jul 2025 15:11:32 +0000 (17:11 +0200)] 
stdlib/Makefile: Remove deleted test's libm dependency

tst-qsort5 was deleted in 709fbd3ec3595f2d1076b4fec09a739327459288.
Therefore remove its redundant libm dependency.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoelf: Add DL_ADDRESS_WITHOUT_RELOC [BZ #33088]
H.J. Lu [Sun, 15 Jun 2025 03:38:54 +0000 (11:38 +0800)] 
elf: Add DL_ADDRESS_WITHOUT_RELOC [BZ #33088]

Add DL_ADDRESS_WITHOUT_RELOC to force an address into a general purpose
register to prevent loading it into a vector register directly before
run-time relocation.  This is an updated fix for BZ #33088.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agostdlib: Fix __libc_message_impl iovec size (BZ 32947)
Adhemerval Zanella [Wed, 25 Jun 2025 19:33:24 +0000 (16:33 -0300)] 
stdlib: Fix __libc_message_impl iovec size (BZ 32947)

The iovec size should account for all substrings between each conversion
specification.  For the format:

  "abc %s efg"

The list of substrings are:

  ["abc ", arg, " efg]

which is 2 times the number of maximum arguments *plus* one.

This issue triggered 'out of bounds' errors by stdlib/tst-bz20544 when
glibc is built with experimental UBSAN support [1].

Besides adjusting the iovec size, a new runtime and check is added to
avoid wrong __libc_message_impl usage.

Checked on x86_64-linux-gnu.

[1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/ubsan-undef

Co-authored-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 weeks agoAArch64: Avoid memset ifunc in cpu-features.c [BZ #33112]
Wilco Dijkstra [Fri, 27 Jun 2025 14:10:55 +0000 (14:10 +0000)] 
AArch64: Avoid memset ifunc in cpu-features.c [BZ #33112]

During early startup memcpy or memset must not be called since many targets
use ifuncs for them which won't be initialized yet.  Security hardening may
use -ftrivial-auto-var-init=zero which inserts calls to memset.  Redirect
memset to memset_generic by including dl-symbol-redir-ifunc.h in cpu-features.c.
This fixes BZ #33112.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomalloc: Cleanup tcache_init()
Wilco Dijkstra [Thu, 3 Apr 2025 18:05:24 +0000 (18:05 +0000)] 
malloc: Cleanup tcache_init()

Cleanup tcache_init() by using the new __libc_malloc2 interface.

Reviewed-by: Cupertino Miranda <cupertino.miranda@oracle.com>
5 weeks agomalloc: replace instances of __builtin_expect with __glibc_unlikely
William Hunt [Thu, 26 Jun 2025 15:07:14 +0000 (15:07 +0000)] 
malloc: replace instances of __builtin_expect with __glibc_unlikely

Replaced all instances of __builtin_expect to __glibc_unlikely
within malloc.c and malloc-debug.c.  This improves the portability
of glibc by avoiding calls to GNU C built-in functions.  Since all
the expected results from calls to __builtin_expect were 0,
__glibc_likely was never used as a replacement.  Multiple
calls to __builtin_expect within a single if statement have
been replaced with one call to __glibc_unlikely, which wraps
every condition.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomalloc: refactored aligned_OK and misaligned_chunk
William Hunt [Wed, 25 Jun 2025 11:35:05 +0000 (11:35 +0000)] 
malloc: refactored aligned_OK and misaligned_chunk

Renamed aligned_OK to misaligned_mem as to be similar
to misaligned_chunk, and reversed any assertions using
the macro.  Made misaligned_chunk call misaligned_mem after
chunk2mem rather than bitmasking with the malloc alignment
itself, since misaligned_chunk is meant to test the data
chunk itself rather than the header, and the compiler
will optimise the addition so the ternary operator is not
needed.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomanual: Clarify renameat documentation
Jitka Obselkova [Sat, 14 Jun 2025 09:19:46 +0000 (11:19 +0200)] 
manual: Clarify renameat documentation

Clarify the meaning of renameat arguments.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agoRevert "manual: Clarify renameat documentation"
Florian Weimer [Thu, 26 Jun 2025 12:22:58 +0000 (14:22 +0200)] 
Revert "manual: Clarify renameat documentation"

This reverts commit abc2e954af77f8d10f4f54754520814590e79830.
Reason for revert: Wrong version of the patch.

5 weeks agoelf: Add missing DSO dependencies for tst-rtld-no-malloc-{audit,preload}
Florian Weimer [Thu, 26 Jun 2025 09:38:00 +0000 (11:38 +0200)] 
elf: Add missing DSO dependencies for tst-rtld-no-malloc-{audit,preload}

Fixes commit c1560f3f75c0e892b5522c16f91b4e303f677094
("elf: Switch to main malloc after final ld.so self-relocation").

Reviewed-by: Frédéric Bérat <fberat@redhat.com>
5 weeks agopowerpc: Remove modf optimization
Adhemerval Zanella [Mon, 16 Jun 2025 13:17:36 +0000 (10:17 -0300)] 
powerpc: Remove modf optimization

The generic implementation is slight more optimized than the powerpc
one, where it has a more optimized inf/nan check (by not using FP
unit checks, along with branch prediction hints), and removed one
branch by issuing trunc instead of a combination of floor/ceil (which
also generated less code).

On power10 with gcc 14.2.1:

reciprocal-throughput        master         patch        difference
workload-0_1                 1.1351        0.9067            20.12%
workload-1_maxint            1.4230        0.9040            36.47%
workload-maxint_maxfloat     1.5038        0.9076            39.65%
workload-integral            1.1280        0.9111            19.23%

latency                      master         patch        difference
workload-0_1                 1.1440        2.7117          -137.03%
workload-1_maxint            4.0556        2.7070            33.25%
workload-maxint_maxfloat     3.2122        2.7164            15.43%
workload-integral            3.2381        2.7281            15.75%

Checked on powerpc64le-linux-gnu.
Reviewed-by: Sachin Monga <smonga@linux.ibm.com>
5 weeks agopowerpc: Remove modff optimization
Adhemerval Zanella [Mon, 16 Jun 2025 13:17:35 +0000 (10:17 -0300)] 
powerpc: Remove modff optimization

The generic implementation is slight more optimized than the powerpc
one, where it has a more optimized inf/nan check (by not using FP
unit checks, along with branch prediction hints), and removed one
branch by issuing trunc instead of a combination of floor/ceil (which
also generated less code).

On power10 with gcc 14.2.1:

reciprocal-throughput        master        patch        difference
workload-0_1                 1.5210       1.3942             8.34%
workload-1_maxint            2.0926       1.3940            33.38%
workload-maxint_maxfloat     1.7851       1.3940            21.91%
workload-integral            1.5216       1.3941             8.37%

latency                      master        patch        difference
workload-0_1                 1.5928       2.6337           -65.35%
workload-1_maxint            3.2929       2.6337            20.02%
workload-maxint_maxfloat     1.9697       2.6341           -33.73%
workload-integral            2.0597       2.6337           -27.87%

Checked on powerpc64le-linux-gnu.
Reviewed-by: Sachin Monga <smonga@linux.ibm.com>
5 weeks agomanual: Add missing free to open_memstream example [BZ #27866]
Ravina Jain [Tue, 24 Jun 2025 15:06:25 +0000 (20:36 +0530)] 
manual: Add missing free to open_memstream example [BZ #27866]

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agoLinux: Convert '__close_nocancel_nostatus' to a standalone handler
Maciej W. Rozycki [Tue, 24 Jun 2025 20:17:25 +0000 (21:17 +0100)] 
Linux: Convert '__close_nocancel_nostatus' to a standalone handler

Make '__close_nocancel_nostatus' standalone.  This is a generic version
analogous to '__close_nocancel'.  Platforms may choose to implement an
inline variant instead where the syscall invocation code sequence is
short enough to be beneficial over a function call.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 weeks agoLinux: Fix '__close_nocancel_nostatus' clobbering 'errno' [BZ #33035]
Maciej W. Rozycki [Tue, 24 Jun 2025 20:17:25 +0000 (21:17 +0100)] 
Linux: Fix '__close_nocancel_nostatus' clobbering 'errno' [BZ #33035]

Fix fallout from commit c181840c93d3 ("Consolidate non cancellable close
call") that caused '__close_nocancel_nostatus' to clobber 'errno' on a
close(2) failure, a 2.27 regression.

The problem came from a rewrite from 'close_not_cancel_no_status' to
'__close_nocancel_nostatus' switching from an inline implementation that
used INTERNAL_SYSCALL macro (which stays away from 'errno') to a call to
'__close_nocancel' function that uses INLINE_SYSCALL_CALL macro (which
does poke at 'errno').

Implement '__close_nocancel_nostatus' in terms of INTERNAL_SYSCALL_CALL
then, which leaves 'errno' intact.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 weeks agoinet: Implement inet_ntoa on top of inet_ntop
Adhemerval Zanella [Wed, 4 Jun 2025 20:42:44 +0000 (17:42 -0300)] 
inet: Implement inet_ntoa on top of inet_ntop

Checked on aarch64-linux-gnu and x86_64-linux-gnu.
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 weeks agoresolv: Optimize inet_ntop
Adhemerval Zanella [Wed, 4 Jun 2025 20:42:43 +0000 (17:42 -0300)] 
resolv: Optimize inet_ntop

The benchtests/inet_ntop_ipv4 and benchtests/inet_ntop_ipv6 profile
shows that most of time is spent in costly sprint operations:

$ perf record ./benchtests/bench-inet_ntop_ipv4 && perf report --stdio
[...]
    38.53%  bench-inet_ntop  libc.so               [.] __printf_buffer
    18.69%  bench-inet_ntop  libc.so               [.] __printf_buffer_write
    11.01%  bench-inet_ntop  libc.so               [.] _itoa_word
     8.02%  bench-inet_ntop  bench-inet_ntop_ipv4  [.] bench_start
     6.99%  bench-inet_ntop  libc.so               [.] __memmove_avx_unaligned_erms
     3.86%  bench-inet_ntop  libc.so               [.] __strchrnul_avx2
     2.82%  bench-inet_ntop  libc.so               [.] __strcpy_avx2
     1.90%  bench-inet_ntop  libc.so               [.] inet_ntop4
     1.78%  bench-inet_ntop  libc.so               [.] __vsprintf_internal
     1.55%  bench-inet_ntop  libc.so               [.] __sprintf_chk
     1.18%  bench-inet_ntop  libc.so               [.] __GI___inet_ntop

$ perf record ./benchtests/bench-inet_ntop_ipv6 && perf report --stdio
    35.44%  bench-inet_ntop  libc.so               [.] __printf_buffer
    14.35%  bench-inet_ntop  libc.so               [.] __printf_buffer_write
    10.27%  bench-inet_ntop  libc.so               [.] __GI___inet_ntop
     7.93%  bench-inet_ntop  libc.so               [.] _itoa_word
     7.00%  bench-inet_ntop  libc.so               [.] __sprintf_chk
     6.20%  bench-inet_ntop  libc.so               [.] __vsprintf_internal
     5.26%  bench-inet_ntop  libc.so               [.] __strchrnul_avx2
     5.05%  bench-inet_ntop  bench-inet_ntop_ipv6  [.] bench_start
     3.70%  bench-inet_ntop  libc.so               [.] __memmove_avx_unaligned_erms
     2.11%  bench-inet_ntop  libc.so               [.] __printf_buffer_done

A new implementation is used instead:

  * The printf usage is replaced with an expanded function that prints
    either an IPv4 octet or an IPv6 quartet;

  * The strcpy is replaced with a memcpy (since ABIs usually tends to
    optimize the latter);

  * For IPv6, the '::' shorthanding is done in-place instead of using
    a temporary buffer.

  * An temporary buffer is used iff the size if larger than
    INET_ADDRSTRLEN/INET6_ADDRSTRLEN.

  * Inline is used for both inet_ntop4 and inet_ntop6,

The code is significand rewrote, so I take this requires a new license.

The performance results on aarch64 Neoverse1 with gcc 14.2.1:

* master

aarch64-linux-gnu-master$ ./benchtests/bench-inet_ntop_ipv4
  "inet_ntop_ipv4": {
   "workload-ipv4-random": {
    "duration": 1.43067e+09,
    "iterations": 8e+06,
    "reciprocal-throughput": 178.572,
    "latency": 179.096,
    "max-throughput": 5.59997e+06,
    "min-throughput": 5.58359e+06
   }
aarch64-linux-gnu-master$ ./benchtests/bench-inet_ntop_ipv6
  "inet_ntop_ipv6": {
   "workload-ipv6-random": {
    "duration": 1.68539e+09,
    "iterations": 4e+06,
    "reciprocal-throughput": 421.307,
    "latency": 421.388,
    "max-throughput": 2.37357e+06,
    "min-throughput": 2.37311e+06
   }
  }

* patched

aarch64-linux-gnu$ ./benchtests/bench-inet_ntop_ipv4
  "inet_ntop_ipv4": {
   "workload-ipv4-random": {
    "duration": 1.06133e+09,
    "iterations": 5.6e+07,
    "reciprocal-throughput": 18.8482,
    "latency": 19.0565,
    "max-throughput": 5.30555e+07,
    "min-throughput": 5.24755e+07
   }
  }
aarch64-linux-gnu$ ./benchtests/bench-inet_ntop_ipv6
  "inet_ntop_ipv6": {
   "workload-ipv6-random": {
    "duration": 1.01246e+09,
    "iterations": 2.4e+07,
    "reciprocal-throughput": 42.5576,
    "latency": 41.8139,
    "max-throughput": 2.34976e+07,
    "min-throughput": 2.39155e+07
   }
  }

Checked on aarch64-linux-gnu and x86_64-linux-gnu.
Reviewed-by: DJ Delorie <dj@redhat.com>
5 weeks agoresolve: Proper indent resolv/inet_ntop.c
Adhemerval Zanella [Wed, 4 Jun 2025 20:42:42 +0000 (17:42 -0300)] 
resolve: Proper indent resolv/inet_ntop.c

Reviewed-by: DJ Delorie <dj@redhat.com>