]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
2 weeks agoelf: Remove now pointless empty ld.so.conf files in single tests akhuettel/tests-libgcc-v2
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>
2 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>
2 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>
2 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>
2 weeks agohurd: Remove a duplicate entry from 'tests-unsupported'.
Collin Funk [Tue, 17 Jun 2025 03:14:19 +0000 (20:14 -0700)] 
hurd: Remove a duplicate entry from 'tests-unsupported'.

When building on GNU/Hurd the following warnings repeat themselves:

    ../Rules:400: target '/home/collin/obj/glibc/io/test-lfs.out' given more than once in the same rule
    ../Rules:400: target '/home/collin/obj/glibc/io/test-lfs.out' given more than once in the same rule

This is because commit 73b854e955 (hurd: Mark more memory-hungry tests
as unsupported, 2025-01-12) added it to 'tests-unsupported' even though
it was already added by decf02d382 (hurd: Mark two tests as unsupported,
2023-04-13).
Message-ID: <54dc6bf7e0dbedb1b19356f41fec843c1c523b11.1750130025.git.collin.funk1@gmail.com>

2 weeks agohurd: Fix redefinition of 'P2ALIGN'.
Collin Funk [Tue, 17 Jun 2025 03:45:14 +0000 (20:45 -0700)] 
hurd: Fix redefinition of 'P2ALIGN'.

When building on GNU/Hurd warnings like the following occur:

    ../sysdeps/x86_64/multiarch/strnlen-evex-base.S:53:10: warning: "P2ALIGN" redefined
       53 | # define P2ALIGN(...)   .p2align 4,, 6
          |          ^~~~~~~
    In file included from /usr/include/x86_64-gnu/mach/x86_64/syscall_sw.h:30,
                     from ../sysdeps/mach/sysdep.h:21,
                     from ../sysdeps/mach/x86/sysdep.h:31,
                     from ../sysdeps/x86_64/multiarch/strnlen-evex-base.S:24:
    /usr/include/x86_64-gnu/mach/x86_64/asm.h:78:9: note: this is the location of the previous definition
       78 | #define P2ALIGN(p2)     .p2align p2     /* gas-specific */
          |         ^~~~~~~

The fix is to undefine the macro from system headers in sysdep.h so that
it can be properly defined in assembly files where its definition
depends on whether string functions are being compiled for
wide-characters or not.
Message-ID: <721cd3a1bae1a553857db1dd69761a175f611364.1750131904.git.collin.funk1@gmail.com>

2 weeks agoresource/Makefile: Split and sort tests
Martin Coufal [Sat, 14 Jun 2025 09:08:18 +0000 (11:08 +0200)] 
resource/Makefile: Split and sort tests

Split and sort tests in resource/Makefile.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2 weeks agomalloc: Link large tcache tests with $(shared-thread-library)
Florian Weimer [Thu, 19 Jun 2025 04:30:12 +0000 (06:30 +0200)] 
malloc: Link large tcache tests with $(shared-thread-library)

Introduce tests-link-with-libpthread to list tests that
require linking with libpthread, and use that to generate
dependencies on $(shared-thread-library) for all multi-threaded tests.

Fixes build failures of commit cde5caa4bb21d5c474b9e4762cc847bcbc70e481
("malloc: add testing for large tcache support") on Hurd.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agox86: Update tst-gnu2-tls2 tests
H.J. Lu [Mon, 9 Jun 2025 00:17:49 +0000 (08:17 +0800)] 
x86: Update tst-gnu2-tls2 tests

Update tst-gnu2-tls2 tests to set XMM0...XMM7 to all 1s in malloc to
verify that XMM registers are preserved when _dl_tlsdesc_dynamic is
called by clearing vectors with zeroed XMM registers before
_dl_tlsdesc_dynamic and using these XMM registers to clear vectors
after _dl_tlsdesc_dynamic.  This improves the BZ #31372 test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoi386: Update ___tls_get_addr to preserve vector registers
H.J. Lu [Sun, 8 Jun 2025 21:22:10 +0000 (05:22 +0800)] 
i386: Update ___tls_get_addr to preserve vector registers

Compiler generates the following instruction sequence for dynamic TLS
access:

leal tls_var@tlsgd(,%ebx,1), %eax
call ___tls_get_addr@PLT

CALL instruction is transparent to compiler which assumes all registers,
except for EFLAGS, AX, CX, and DX, are unchanged after CALL.  But
___tls_get_addr is a normal function which doesn't preserve any vector
registers.

1. Rename the generic __tls_get_addr function to ___tls_get_addr_internal.
2. Change ___tls_get_addr to a wrapper function with implementations for
FNSAVE, FXSAVE, XSAVE and XSAVEC to save and restore all vector registers.
3. dl-tlsdesc-dynamic.h has:

_dl_tlsdesc_dynamic:
/* Like all TLS resolvers, preserve call-clobbered registers.
   We need two scratch regs anyway.  */
subl $32, %esp
cfi_adjust_cfa_offset (32)

It is wrong to use

movl %ebx, -28(%esp)
movl %esp, %ebx
cfi_def_cfa_register(%ebx)
...
mov %ebx, %esp
cfi_def_cfa_register(%esp)
movl -28(%esp), %ebx

to preserve EBX on stack.  Fix it with:

movl %ebx, 28(%esp)
movl %esp, %ebx
cfi_def_cfa_register(%ebx)
...
mov %ebx, %esp
cfi_def_cfa_register(%esp)
movl 28(%esp), %ebx

4. Update _dl_tlsdesc_dynamic to call ___tls_get_addr_internal directly.
5. Add have-test-mtls-traditional to compile tst-tls23-mod.c with
traditional TLS variant to verify the fix.
6. Define DL_RUNTIME_RESOLVE_REALIGN_STACK in sysdeps/x86/sysdep.h.

This fixes BZ #32996.

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 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.

Signed-off-by: Jitka Obselkova <jobselko@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agoposix: Add nonnull attribute to glob_pattern_p.
Collin Funk [Sat, 7 Jun 2025 23:20:27 +0000 (16:20 -0700)] 
posix: Add nonnull attribute to glob_pattern_p.

* posix/glob.h (glob_pattern_p): Add __nonnull ((1)) since this function
expects a string and does not check for NULL.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agomath: Simplify and optimize modf implementation
Adhemerval Zanella [Mon, 16 Jun 2025 13:17:34 +0000 (10:17 -0300)] 
math: Simplify and optimize modf implementation

Refactor the generic implementation to use math_config.h definitions,
and add an alternative one if the ABI supports truncf instructions
(gated through math-use-builtins-trunc.h).

The generic implementation generates similar code on x86_64, while
the optimization one for aarch64 (where truncf is supported as a
builtin by through frintz), the improvements are:

reciprocal-throughput           master    patch    difference
workload-0_1                    3.0595   3.0698        -0.34%
workload-1_maxint               5.1747   3.0542        40.98%
workload-maxint_maxfloat        3.4391   3.0349        11.75%
workload-integral               3.2732   3.0293         7.45%

latency                         master    patch    difference
workload-0_1                    3.5267   4.7107       -33.57%
workload-1_maxint               6.9074   4.7282        31.55%
workload-maxint_maxfloat        3.7210   4.7506       -27.67%
workload-integral               3.8634   4.8137       -24.60%

Checked on aarch64-linux-gnu and x86_64-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 weeks agomath: Simplify and optimize modff implementation
Adhemerval Zanella [Mon, 16 Jun 2025 13:17:33 +0000 (10:17 -0300)] 
math: Simplify and optimize modff implementation

Refactor the generic implementation to use math_config.h definitions,
and add an alternative one if the ABI supports truncf instructions
(gated through math-use-builtins-trunc.h).

The generic implementation generates similar code for x86_64, while
the optimization path aarch64 (where truncf is supported as a builtin)
through frintz), the improvements are:

reciprocal-throughput           master     patch    difference
workload-0_1                    3.0740    3.0326         1.35%
workload-1_maxint               5.2231    3.0436        41.73%
workload-maxint_maxfloat        4.0962    3.0551        25.42%
workload-integral               3.7093    3.0612        17.47%

latency                         master     patch    difference
workload-0_1                    3.5521    4.7313       -33.20%
workload-1_maxint               6.7148    4.7314        29.54%
workload-maxint_maxfloat        4.0458    4.7518       -17.45%
workload-integral               3.9719    4.7427       -19.40%

Checked on aarch64-linux-gnu and x86_64-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 weeks agoAArch64: Improve codegen SVE log1p helper
Luna Lamb [Wed, 18 Jun 2025 16:12:19 +0000 (16:12 +0000)] 
AArch64: Improve codegen SVE log1p helper

Improve codegen by packing coefficients.
4% and 2% improvement in throughput microbenchmark on Neoverse V1, for acosh
and atanh respectively.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 weeks agoAArch64: Optimise SVE FP64 Hyperbolics
Dylan Fleming [Wed, 18 Jun 2025 16:19:22 +0000 (16:19 +0000)] 
AArch64: Optimise SVE FP64 Hyperbolics

Reworke SVE FP64 hyperbolics to use the SVE FEXPA
instruction.

Also update the special case handelling for large
inputs to be entirely vectorised.

Performance improvements on Neoverse V1:

cosh_sve: 19% for |x| < 709, 5x otherwise
sinh_sve: 24% for |x| < 709, 5.9x otherwise
tanh_sve: 12% for |x| < 19,  9x otherwise

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 weeks agoAArch64: Optimize SVE exp functions
Dylan Fleming [Wed, 18 Jun 2025 16:17:12 +0000 (16:17 +0000)] 
AArch64: Optimize SVE exp functions

Improve performance of SVE exps by making better use
of the SVE FEXPA instruction.

Performance improvement on Neoverse V1:
exp2_sve:   21%
exp2f_sve:  24%
exp10f_sve: 23%
expm1_sve:  25%

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 weeks agosparc: Fix sparc32 Fix argument passing to __libc_start_main (BZ 32981)
Adhemerval Zanella [Fri, 13 Jun 2025 14:23:44 +0000 (11:23 -0300)] 
sparc: Fix sparc32 Fix argument passing to __libc_start_main (BZ 32981)

Commit 404526ee2e58f3c075253943ddc9988f4bd6b80c changed _start to write
the last argument to __libc_start_main without taking into consideration
that the function did not create a full stack frame, which leads to
overwriting the argv[0].

2 weeks agoFix termios related targets
Andreas Schwab [Wed, 18 Jun 2025 11:17:29 +0000 (13:17 +0200)] 
Fix termios related targets

Move Linux-specific termios headers and tests from misc to termios subdir
and install newly added bits/termios-cbaud.h.

2 weeks agomalloc: Cleanup _mid_memalign
Wilco Dijkstra [Wed, 28 May 2025 14:44:10 +0000 (14:44 +0000)] 
malloc: Cleanup _mid_memalign

Remove unused 'address' parameter from _mid_memalign and callers.
Fix off-by-one alignment calculation in __libc_pvalloc.

Reviewed-by: DJ Delorie <dj@redhat.com>
2 weeks agoaarch64: simplify calls to __libc_arm_za_disable in assembly
Yury Khrustalev [Mon, 16 Jun 2025 09:01:22 +0000 (10:01 +0100)] 
aarch64: simplify calls to __libc_arm_za_disable in assembly

There is no functional change in this patch.

We remove stores and loads to stack, return address signing, and redundant
CFI directives before and after call to __libc_arm_za_disable().

The __libc_arm_za_disable implementation follows special calling convention
that allows to avoid most of the operations that would be necessary for a
call to a normal function (see [1] for details).

First, we rely on __libc_arm_za_disable() not clobbering certain registers,
and we put return address into one of these registers. Now we don't need
to store it on stack, so we don't need to sign return address using PAC.

Second, as a result of the above, we don't need to update the CFI offset.

This patch provides small optimisation avoiding unnecessary store and load
on stack also simplifies assembly code and CFI directives.

[1]: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoaarch64: GCS: use internal struct in __alloc_gcs
Yury Khrustalev [Wed, 16 Apr 2025 18:08:47 +0000 (19:08 +0100)] 
aarch64: GCS: use internal struct in __alloc_gcs

No functional change here, just a small refactoring to simplify
using __alloc_gcs() for allocating shadow stacks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agopowerpc: Remove assembler workarounds
Andreas Schwab [Thu, 5 Jun 2025 08:24:46 +0000 (10:24 +0200)] 
powerpc: Remove assembler workarounds

Now that we require at least binutils 2.39 the support for POWER9 and
POWER10 instructions can be assumed.

2 weeks agomalloc: Fix tests-malloc-largetcache tests
Adhemerval Zanella [Tue, 17 Jun 2025 17:22:49 +0000 (14:22 -0300)] 
malloc: Fix tests-malloc-largetcache tests

The commit cde5caa4bb21d5c474b9e4762cc847bcbc70e481 added the
tests-malloc-largetcache without adjusting the previous entry.  The
make check fails with:

  make[1]: Entering directory '/path/to/glibc'
  make  subdir=csu -C csu ..=../ tests
  make[2]: Entering directory '/path/to/glibc/csu'
  make[2]: *** No rule to make target ')', needed by 'tests'.  Stop.
  make[2]: Leaving directory '/path/to/csu'
  make[1]: *** [Makefile:484: csu/tests] Error 2

2 weeks agoAdd TCPI_OPT_USEC_TS from Linux 6.14 and TCPI_OPT_TFO_CHILD from 6.15 to netinet...
Jeremy Harris [Sat, 31 May 2025 07:57:20 +0000 (08:57 +0100)] 
Add TCPI_OPT_USEC_TS from Linux 6.14 and TCPI_OPT_TFO_CHILD from 6.15 to netinet/tcp.h.

This patch adds the TCPI_OPT_USEC_TS constant from Linux 6.14 to
sysdeps/gnu/netinet/tcp.h

This patch adds the TCPI_OPT_TFO_CHILD constant from Linux 6.15 to
sysdeps/gnu/netinet/tcp.h

Signed-off-by: Jeremy Harris <jgh@exim.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agolinux/termios: regression test for termios speed functions
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:45 +0000 (18:35 -0700)] 
linux/termios: regression test for termios speed functions

Test that runs through a fairly large combination of the various
termios speed functions, for the new speed_t interface, for the old
speed_t interface (if enabled), and for the new baud_t interface.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2 weeks agoinclude/array_length.h: add array_foreach[_const] macros
H. Peter Anvin [Thu, 12 Jun 2025 01:35:44 +0000 (18:35 -0700)] 
include/array_length.h: add array_foreach[_const] macros

Add simple-to-use iterator macros for arrays.  They are used instead
of explicit for statements, like:

      /* Test all common speeds */
      array_foreach_const (ts, test_speeds)
test (fd, *ts);

In this case, ts will be a const pointer to each of the elements of
test_speeds in turn.

Named array_foreach*() to allow for other kinds of equivalent iterator
macros in the future.

Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agotermios: unify the naming of the termios speed fields
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:43 +0000 (18:35 -0700)] 
termios: unify the naming of the termios speed fields

The generic code has __ispeed and __ospeed; Linux has c_ispeed and
c_ospeed. Use an anonymous union member to allow both set of names on
all platforms.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2 weeks agotermios: add new baud_t interface, defined to be explicitly numeric
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:42 +0000 (18:35 -0700)] 
termios: add new baud_t interface, defined to be explicitly numeric

Add an explicitly numeric interface for baudrate setting. For glibc,
this only announces what is a fair accompli, but this is a plausible
way forward for standardization, and may be possible to infill on
non-compliant systems. The POSIX committee has stated:

[https://www.austingroupbugs.net/view.php?id=1916#c7135]

A future version of this standard is expected to add at least
the following symbolic constants for use as values of objects
of type speed_t: B57600, B115200B230400B460800, and
B921600.

Implementations are encouraged to propose additional
interfaces which will make it possible to set and query a
wider range of speeds than just those enumerated by the
constants beginning with B. If a set of common interfaces
emerges between several implementations, a future version of
this standard will likely add those interfaces.

This is exactly that interface.

The use of the term "baud" is due to the need to have a term
contrasting "speed", and it is already well established as a legacy
term -- including in the names of the legacy Bxxx
constants. Futhermore, it *is* valid from the point of view that the
termios interface fundamentally emulates an RS-232 serial port as far
as the application software is concerned.

The documentation states that for the current version of glibc,
speed_t == baud_t, but explicitly declares that this may not be the
case in the future.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agomanual: document all the termios Bxxx constants in the manual
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:41 +0000 (18:35 -0700)] 
manual: document all the termios Bxxx constants in the manual

Add all the Bxxx constants defined in the now-generic
<bits/termios-baud.h> in the manual.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2 weeks agotermios: merge the termios baud definitions
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:40 +0000 (18:35 -0700)] 
termios: merge the termios baud definitions

Now all platforms unconditionally use the "sane" definitions of the
termios baud constants. Unify them into a common file.

Note: I have made them explicitly unsigned to avoid problems with
compiler warnings for comparisons of unequal signedness or
similar. These constants were historically octal on most platforms,
and so unsigned by default.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agohurd+generic/termios: make speed_t an unsigned int
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:39 +0000 (18:35 -0700)] 
hurd+generic/termios: make speed_t an unsigned int

POSIX requires that speed_t is an unsigned integer type, so change the
generic speed_t definition to be an unsigned int instead of a plain
int.

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2 weeks agotermios: change the generic cfsetspeed() to support arbitrary speeds
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:38 +0000 (18:35 -0700)] 
termios: change the generic cfsetspeed() to support arbitrary speeds

The generic implementaion of cfsetspeed() had an internal table of
permitted baud rates, which was enforced even on an implementation
supporting arbitrary baud rates. This was to be able to *also* accept
numeric constants as well as Bxxx values.

This fundamentally makes no sense; not only does it go against the
documented behavior of cfsetspeed() which is to take the same input
as cfset[io]speed(), but it means cfsetspeed() is broken with regard
to a platform supporting arbitrary speeds.

With Linux converted to arbitrary baud rates, the only remaining case
of non-arbitrary baud rates appears to be Hurd with USE_OLD_TTY, which
one can presume being a legacy case that few if any people care about,
and so simply strip out this code and make cfsetspeed() rely on
cfsetospeed() to validate acceptable speed constants.

If a new platform is introduced which does not have arbitrary baud
rate support, using non-baud rate Bxxx constants (highly not
recommended; should be abstracted at the glibc level) but such
aliasing is desired, it should be supported by cfset[io]speed() as
well, and belongs in the platform-specific code.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agohurd/termios: remove USE_OLD_TTY
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:37 +0000 (18:35 -0700)] 
hurd/termios: remove USE_OLD_TTY

Hurd with USE_OLD_TTY was the only remaining platform with speed_t not
containing a proper baud rate. From the looks of it, that code has
long since bitrotted.

Remove the vestiges of USE_OLD_TTY.

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2 weeks agolinux: implement arbitrary and split speeds in termios
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:36 +0000 (18:35 -0700)] 
linux: implement arbitrary and split speeds in termios

Linux has supported arbitrary speeds and split speeds in the kernel
since 2008 on all platforms except Alpha (fixed in 2020), but glibc
was never updated to match. This is further complicated by POSIX uses
of macros for the cf[gs]et[io]speed interfaces, rather than plain
numbers, as it really ought to have.

On most platforms, the glibc ABI includes the c_[io]speed fields in
struct termios, but they are incorrectly used. On MIPS and SPARC, they
are entirely missing.

For backwards compatibility, the kernel will still use the legacy
speed fields unless they are set to BOTHER, and will use the legacy
output speed as the input speed if the latter is 0 (== B0). However,
the specific encoding used is visible to user space applications,
including ones other than the one running.

- SPARC and MIPS get a new struct termios, and tc[gs]etattr() is
  versioned accordingly. However, the new struct termios is set to be
  a strict extension of the old one, which means that cf* interfaces
  other than the speed-related ones do not need versioning.
- The Bxxx constants are redefined as equivalent to their integer
  values and the legacy Bxxx constants are renamed __Bxxx.
- cf[gs]et[io]speed() and cfsetspeed() are versioned accordingly.
- tcgetattr() and cfset[io]speed() are adjusted to always keep the
  c_[io]speed fields correct (unlike earlier versions), but to
  canonicalize the representation to ALSO configure the legacy fields
  if a valid legacy representation exists.
- tcsetattr(), too, canonicalizes the representation in this way
  before passing it to the kernel, to maximize compatibility with
  older applications/tools.
- The old IBAUD0 hack is removed; it is no longer necessary since
  even the legacy c_cflag baud rate fields have had separate input
  values for a long time.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agolinux/termios/powerpc: deal with powerpc-unique ioctl emulation
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:35 +0000 (18:35 -0700)] 
linux/termios/powerpc: deal with powerpc-unique ioctl emulation

The powerpc architecture, only, emulates the termios ioctls using the
glibc termios structure. Export the real kernel ones as the termios2
interface; although the kernel doesn't call it termios2, it is exactly
the termios2 interface, and it avoids the namespace clash between the
emulated ioctls and the real kernel ioctls.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agolinux/ioctls: use <linux/sockios.h> for sockios ioctls
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:34 +0000 (18:35 -0700)] 
linux/ioctls: use <linux/sockios.h> for sockios ioctls

In the kernel, these are <linux/sockios.h>. The differences between
<linux/sockios.h> and the copied data in <bits/ioctls.h> are minor;
mainly some #ifdefs, so try to use <linux/sockios.h> directly; it is
hopefully clean enough these days to use directly.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoio: replace local_isatty() with a proper function __isatty_nostatus()
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:33 +0000 (18:35 -0700)] 
io: replace local_isatty() with a proper function __isatty_nostatus()

Replace local_isatty() inlined in libio with a proper function
__isatty_nostatus(). This allows simpler system-specific
implementations that don't need to touch errno at all.

Note: I left the prototype in include/unistd.h (the internal header
file.) It didn't much make sense to me to put it in a different header
(not-cancel.h), but perhaps someone can elucidate the need.

Add such an implementation for Linux, with a generic fallback.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agotermios: make __tcsetattr() the internal interface
H. Peter Anvin (Intel) [Thu, 12 Jun 2025 01:35:32 +0000 (18:35 -0700)] 
termios: make __tcsetattr() the internal interface

There is a prototype for an internal __tcsetattr() function in
include/termios.h, but tcsetattr without __ were still declared as the
actual functions.

Make this match the comment and make __tcsetattr() an internal
interface. This will be required to version struct termios for Linux on
MIPS and SPARC.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoUpdate advisory GLIBC-SA-2025-0003 and GLIBC-SA-2025-0004
Carlos O'Donell [Mon, 16 Jun 2025 22:16:18 +0000 (18:16 -0400)] 
Update advisory GLIBC-SA-2025-0003 and GLIBC-SA-2025-0004

Add Fix-Commit information for backported fixes.

3 weeks agomalloc: Sort tests-exclude-largetcache in Makefile
H.J. Lu [Mon, 16 Jun 2025 21:52:27 +0000 (05:52 +0800)] 
malloc: Sort tests-exclude-largetcache in Makefile

This fixes:

FAIL: lint-makefiles

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoppc64le: Revert "powerpc: Optimized strcmp for power10" (CVE-2025-5702)
Carlos O'Donell [Mon, 16 Jun 2025 17:09:57 +0000 (13:09 -0400)] 
ppc64le: Revert "powerpc: Optimized strcmp for power10" (CVE-2025-5702)

This reverts commit 3367d8e180848030d1646f088759f02b8dfe0d6f

Reason for revert: Power10 strcmp clobbers non-volatile vector
registers (Bug 33056)

Tested on ppc64le without regression.

3 weeks agoppc64le: Revert "powerpc : Add optimized memchr for POWER10" (Bug 33059)
Carlos O'Donell [Wed, 11 Jun 2025 13:33:45 +0000 (09:33 -0400)] 
ppc64le: Revert "powerpc : Add optimized memchr for POWER10" (Bug 33059)

This reverts commit b9182c793caa05df5d697427c0538936e6396d4b

Reason for revert: Power10 memchr clobbers v20 vector register
(Bug 33059)

This is not a security issue, unlike CVE-2025-5745 and
CVE-2025-5702.

Tested on ppc64le without regression.

3 weeks agoppc64le: Revert "powerpc: Fix performance issues of strcmp power10" (CVE-2025-5702)
Carlos O'Donell [Wed, 11 Jun 2025 13:43:50 +0000 (09:43 -0400)] 
ppc64le: Revert "powerpc: Fix performance issues of strcmp power10" (CVE-2025-5702)

This reverts commit 90bcc8721ef82b7378d2b080141228660e862d56

This change is in the chain of the final revert that fixes the CVE
i.e. 3367d8e180848030d1646f088759f02b8dfe0d6f

Reason for revert: Power10 strcmp clobbers non-volatile vector
registers (Bug 33056)

Tested on ppc64le with no regressions.

3 weeks agoppc64le: Revert "powerpc: Optimized strncmp for power10" (CVE-2025-5745)
Carlos O'Donell [Wed, 11 Jun 2025 13:19:17 +0000 (09:19 -0400)] 
ppc64le: Revert "powerpc: Optimized strncmp for power10" (CVE-2025-5745)

This reverts commit 23f0d81608d0ca6379894ef81670cf30af7fd081

Reason for revert: Power10 strncmp clobbers non-volatile vector
registers (Bug 33060)

Tested on ppc64le with no regressions.

3 weeks agomalloc: add testing for large tcache support
Cupertino Miranda [Mon, 16 Jun 2025 12:51:53 +0000 (12:51 +0000)] 
malloc: add testing for large tcache support

This patch adds large tcache support tests by re-executing malloc tests
using the tunable:  glibc.malloc.tcache_max=1048576
Test names are postfixed with "largetcache".

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agomalloc: add tcache support for large chunk caching
Cupertino Miranda [Fri, 13 Jun 2025 15:29:59 +0000 (15:29 +0000)] 
malloc: add tcache support for large chunk caching

Existing tcache implementation in glibc seems to focus in caching
smaller data size allocations, limiting the size of the allocation to
1KB.

This patch changes tcache implementation to allow to cache any chunk
size allocations.  The implementation adds extra bins (linked-lists)
which store chunks with different ranges of allocation sizes. Bin
selection is done in multiples in powers of 2 and chunks are inserted in
growing size ordering within the bin.  The last bin contains all other
sizes of allocations.

This patch although by default preserves the same implementation,
limitting caches to 1KB chunks, it now allows to increase the max size
for the cached chunks with the tunable glibc.malloc.tcache_max.

It also now verifies if chunk was mmapped, in which case __libc_free
will not add it to tcache.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agoAlways check lockf64 return value
H.J. Lu [Sun, 15 Jun 2025 03:01:30 +0000 (11:01 +0800)] 
Always check lockf64 return value

On x86-64, when GCC 14.2.1 is used to build:

commit f3c82fc1b41261f582f5f9fa12f74af9bcbc88f9
Author: Radko Krkos <krkos@mail.muni.cz>
Date:   Sat Jun 14 11:07:40 2025 +0200

    io: Mark lockf() __wur [BZ #32800]

    In commit 0476597b28 flock() was marked __wur in posix/unistd.h, but not
    in io/fcntl.h, the declarations must match.

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

programs/locarchive.c: In function ‘open_archive’:
programs/locarchive.c:641:18: error: ignoring return value of ‘lockf64’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  641 |           (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead));
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
programs/locarchive.c:653:14: error: ignoring return value of ‘lockf64’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  653 |       (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead));
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
programs/locarchive.c:660:14: error: ignoring return value of ‘lockf64’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  660 |       (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead));
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
programs/locarchive.c:679:14: error: ignoring return value of ‘lockf64’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  679 |       (void) lockf64 (fd, F_ULOCK, sizeof (struct locarhead));
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Update locarchive.c to always check lockf64 return value.  This fixes
BZ #33089.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
3 weeks agoelf: Add optimization barrier for __ehdr_start and _end
H.J. Lu [Sun, 15 Jun 2025 03:38:54 +0000 (11:38 +0800)] 
elf: Add optimization barrier for __ehdr_start and _end

rtld.c has

extern const ElfW(Ehdr) __ehdr_start attribute_hidden;
...
  _dl_rtld_map.l_map_start = (ElfW(Addr)) &__ehdr_start;
  _dl_rtld_map.l_map_end = (ElfW(Addr)) _end;

As

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120653

shows, compiler may generate run-time relocation on __ehdr_start with

movq .LC0(%rip), %xmm0
...
.section .data.rel.ro.local,"aw"
.align 8
.LC0:
.quad __ehdr_start

This won't work before run-time relocation is finished in rtld.c.  Add
optimization barrier to prevent run-time relocations against __ehdr_start
and _end.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
3 weeks agohtl: move pthread_key_*, pthread_get/setspecific
gfleury [Fri, 13 Jun 2025 18:43:48 +0000 (20:43 +0200)] 
htl: move pthread_key_*, pthread_get/setspecific

Signed-off-by: gfleury <gfleury@disroot.org>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Message-ID: <20250613184440.1660335-1-gfleury@disroot.org>

3 weeks agoelf: Remove the unused _etext declaration
H.J. Lu [Sun, 15 Jun 2025 04:37:26 +0000 (12:37 +0800)] 
elf: Remove the unused _etext declaration

Since

commit 53df2ce6885da3d0e89e87dca7b095622296014f
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Sep 8 13:02:06 2023 +0200

    elf: Remove unused l_text_end field from struct link_map

removed the only reference to _etext, also remove the unused _etext
declaration.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoio: Mark lockf() __wur [BZ #32800]
Radko Krkos [Sat, 14 Jun 2025 09:07:40 +0000 (11:07 +0200)] 
io: Mark lockf() __wur [BZ #32800]

In commit 0476597b28 flock() was marked __wur in posix/unistd.h, but not
in io/fcntl.h, the declarations must match.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
3 weeks agobenchtests: Improve modf benchtest
Adhemerval Zanella [Wed, 28 May 2025 17:59:28 +0000 (14:59 -0300)] 
benchtests: Improve modf benchtest

It adds four ranges, which is how the generic implementation handles
normal numbers:

  1. Random inputs in the range [0.0, 1.0];
  2. Random inputs in the range [1.0, (double)(UINT64_C(1) << 52))];
  3. Random inputs in the range [(double)(UINT64_C(1) << 52), DBL_MAX];
  4. Random integral inputs in the range [0.0, (double)(UINT64_C(1) << 52)].

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agobenchtests: Add modff benchtest
Adhemerval Zanella [Wed, 28 May 2025 17:59:27 +0000 (14:59 -0300)] 
benchtests: Add modff benchtest

It adds four ranges, which is how the generic implementation handles
normal numbers:

  1. Random inputs in the range [0.0, 1.0];
  2. Random inputs in the range [1.0, (float)(1U << 23)];
  3. Random inputs in the range [(float)(1U << 23), FLT_MAX];
  4. Random integral inputs in the range [0.0, (float)(1U << 23)].

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agoriscv: Correct __riscv_hwprobe function prototype [BZ #32932]
Mark Harris [Sat, 24 May 2025 22:02:38 +0000 (15:02 -0700)] 
riscv: Correct __riscv_hwprobe function prototype [BZ #32932]

The third argument to __riscv_hwprobe is the size in bytes of the
cpu bitmask pointed to by the fourth argument, however in the access
attribute (read_only, 4, 3) it is used as an element count (i.e., the
number of unsigned longs that make up the bitmask), resulting in a
false compiler warning:

$ gcc -c hwprobe1.c
hwprobe1.c: In function 'main':
hwprobe1.c:15:11: warning: '__riscv_hwprobe' reading 1024 bytes from a region of size 128 [-Wstringop-overread]
   15 |     ret = __riscv_hwprobe (pairs, 1, sizeof(cpus), cpus, 0);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hwprobe1.c:9:23: note: source object 'cpus' of size 128
    9 |     unsigned long int cpus[16];
      |                       ^~~~
In file included from hwprobe1.c:1:
/usr/include/riscv64-linux-gnu/sys/hwprobe.h:66:12: note: in a call to function '__riscv_hwprobe' declared with attribute 'access (read_only, 4, 3)'
   66 | extern int __riscv_hwprobe (struct riscv_hwprobe *__pairs, size_t __pair_count,
      |            ^~~~~~~~~~~~~~~
$

The documentation (https://docs.kernel.org/arch/riscv/hwprobe.html)
claims that the cpu bitmask has the type cpu_set_t *, which would be
consistent with other functions that take a cpu bitmask such as
sched_setaffinity and sched_getaffinity.  It also uses the name
cpusetsize for the third argument, which is much more accurate than
cpu_count since it is a size in bytes and not a cpu count.  The
(read_only, 4, 3) access attribute in the glibc prototype claims
that the cpu bitmask is only read, however when flags is
RISCV_HWPROBE_WHICH_CPUS it is both read and written.

Therefore, in the glibc prototype the type of the fourth argument is
changed to cpu_set_t * to match the documentation, the name of the
third argument is changed to cpusetsize as in the documentation, and the
incorrect access attribute that applies to these arguments is removed.
Almost all existing callers pass a null pointer for the fourth
argument, however a transparent union is introduced for compatibility
with callers that cast a pointer to the old argument type, and a
macro is introduced allowing callers the ability to distinguish
between the old and new prototype when needed.

The access attributes are being specified with __fortified_attr_access,
however this macro is for fortified functions; the regular
__attr_access macro is for non-fortified functions such as this one.
Using the incorrect macro results in no access checks at fortify level
3, because it is assumed that the fortified function will be doing the
checking.  It is changed to use the correct macro so that the access
checks will work regardless of fortify level.

Also because __riscv_hwprobe is not a cancellation point, __THROW
is added, consistent with similar functions.  (However, it is omitted
from the typedef because GCC does not accept it there.)

The __wur (warn_unused_result) attribute is helpful for functions that
cannot be used safely without checking the result, however code such
as the following does not require the result to be checked and should
not produce a warning:
    struct riscv_hwprobe pair = { RISCV_HWPROBE_KEY_IMA_EXT_0, 0 };
    __riscv_hwprobe (&pair, 1, 0, NULL, 0);
    if (pair.value & RISCV_HWPROBE_EXT_ZBB) ...
Therefore this attribute is omitted.

The comment claiming that the second argument to the ifunc selector
is a pointer to the vDSO function is corrected.  It is a pointer to
the regular glibc function (which returns errors as positive values),
not the vDSO function (which returns errors as negative values).

Fixes commit 426d0e1aa8f17426d13707594111df712d2b8911 ("riscv: Add
Linux hwprobe syscall support").

Fixes: BZ #32932
Signed-off-by: Mark Harris <mark.hsj@gmail.com>
Signed-off-by: Mark Harris <mark.hsj@gmail.com>
Reviewed-by: Palmer Dabbelt <palmer@dabbelt.com>
Acked-by: Palmer Dabbelt <palmer@dabbelt.com>
3 weeks agoresolv: Add test for getaddrinfo returning FQDN in ai_canonname
Sergey Kolosov [Tue, 3 Jun 2025 20:10:20 +0000 (22:10 +0200)] 
resolv: Add test for getaddrinfo returning FQDN in ai_canonname

Test for BZ #15218.  This test verifies that getaddrinfo returns a
fully-qualified domain name in the ai_canonname field then
AI_CANONNAME is set and search domains apply.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
3 weeks agoaarch64: fix typo in sysdeps/aarch64/Makefile
Yury Khrustalev [Tue, 10 Jun 2025 09:48:07 +0000 (10:48 +0100)] 
aarch64: fix typo in sysdeps/aarch64/Makefile

4 weeks agoAdvisory text for CVE-2025-5745
Siddhesh Poyarekar [Thu, 5 Jun 2025 19:24:49 +0000 (15:24 -0400)] 
Advisory text for CVE-2025-5745

The fix is not available yet, so this only records the first vulnerable
commit.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 weeks agoAdvisory text for CVE-2025-5702
Siddhesh Poyarekar [Thu, 5 Jun 2025 17:29:00 +0000 (13:29 -0400)] 
Advisory text for CVE-2025-5702

The fix is not available yet, so this only records the first vulnerable
commit.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 weeks agohurd: Make __getrandom_early_init call __mach_init
Samuel Thibault [Mon, 9 Jun 2025 08:29:48 +0000 (08:29 +0000)] 
hurd: Make __getrandom_early_init call __mach_init

25d37948c9f3 ("malloc: Improve malloc initialization") moved calling malloc
initialization earlier, within _dl_sysdep_start's call to dl_main, before
__mach_init is called by _dl_init_first. But malloc initialization uses
getrandom, which needs to make RPCs.

This adds __getrandom_early_init on hurd to express that getrandom needs
__mach_init too. This also adds a guard to avoid making it create several task
and host ports.

Fixes: 25d37948c9f3 ("malloc: Improve malloc initialization")
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 weeks agox86: Avoid GLRO(dl_x86_cpu_features)
H.J. Lu [Sun, 8 Jun 2025 23:45:57 +0000 (07:45 +0800)] 
x86: Avoid GLRO(dl_x86_cpu_features)

In init_cpu_features, replace GLRO(dl_x86_cpu_features) with
cpu_features to avoid an extra load.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomanual: Add a comparative example of 'clock_nanosleep' use
Maciej W. Rozycki [Fri, 6 Jun 2025 17:14:34 +0000 (18:14 +0100)] 
manual: Add a comparative example of 'clock_nanosleep' use

Add an illustrative example of how to express 'nanosleep' in terms of
'clock_nanosleep'.

4 weeks agoAArch64: Fix builderror with GCC 12.1/12.2
Wilco Dijkstra [Fri, 6 Jun 2025 13:15:30 +0000 (13:15 +0000)] 
AArch64: Fix builderror with GCC 12.1/12.2

Early versions of GCC 12 didn't support -mtune=neoverse-v2, so use
-mtune=neoverse-v1 instead.

Reported-by: Yury Khrustalev <yury.khrustalev@arm.com>
4 weeks agoLinux: Drop obsolete kernel support with `if_nameindex' and `if_nametoindex'
Maciej W. Rozycki [Thu, 5 Jun 2025 18:04:46 +0000 (19:04 +0100)] 
Linux: Drop obsolete kernel support with `if_nameindex' and `if_nametoindex'

Support for the SIOCGIFINDEX ioctl(2) Linux ABI (0x8933 command, called
SIOGIFINDEX in the API originally) was added with kernel version 2.1.14
for AF_INET6 sockets, followed by general support with version 2.1.22.
The Linux API was then updated by adding the current SIOCGIFINDEX name
with kernel version 2.1.68, back in Nov 1997.

All these kernel versions are well below our current default required
minimum of 3.2.0, let alone some platform higher version requirements.

Drop support for the absence of the SIOCGIFINDEX ioctl(2) in the API or
ABI, by removing arrangements for the ENOSYS error condition.  Discard
the indirection from '__if_nameindex' to 'if_nameindex_netlink' and
adjust the implementation of '__if_nametoindex' accordingly for a better
code flow.

4 weeks agoaarch64: add __ifunc_hwcap function to be used in ifunc resolvers
Yury Khrustalev [Thu, 24 Apr 2025 15:58:46 +0000 (16:58 +0100)] 
aarch64: add __ifunc_hwcap function to be used in ifunc resolvers

Add a new helper function __ifunc_hwcap() as a portable way to
access HWCAP elements via the parameter(s) passed to an ifunc
resolver checking the _IFUNC_ARG_HWCAP bit in the first parameter
and size of the buffer in the second parameter.

Note that 0 is returned when the requested element is not available
or does not correspond to a valid AT_HWCAP{,2,...} value.

Also add relevant tests.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoaarch64: add support for hwcap3,4
Yury Khrustalev [Wed, 12 Mar 2025 15:28:24 +0000 (15:28 +0000)] 
aarch64: add support for hwcap3,4

Add basic support for hwcap3 and hwcap4 in dynamic loader and
ifunc resolvers.

Describe new backward-compatible prototype for GNU indirect
function resolvers that use a pointer to uint64_t array in
stead of a pointer to the __ifunc_arg_t struct.

This patch also adds macro _IFUNC_HWCAP_MAX to specify current
number of hwcap elements.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agomanual: Document futimens and utimensat
Arjun Shankar [Wed, 4 Jun 2025 11:08:58 +0000 (13:08 +0200)] 
manual: Document futimens and utimensat

Document futimens and utimensat.  Also document the EINVAL error
condition for futimes.  It is inherited by futimens and utimensat as
well.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomanual: Document unlinkat
Arjun Shankar [Wed, 4 Jun 2025 11:08:57 +0000 (13:08 +0200)] 
manual: Document unlinkat

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomanual: Document renameat
Arjun Shankar [Wed, 4 Jun 2025 11:08:56 +0000 (13:08 +0200)] 
manual: Document renameat

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomanual: Document mkdirat
Arjun Shankar [Wed, 4 Jun 2025 11:08:55 +0000 (13:08 +0200)] 
manual: Document mkdirat

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomanual: Document faccessat
Arjun Shankar [Wed, 4 Jun 2025 11:08:54 +0000 (13:08 +0200)] 
manual: Document faccessat

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomanual: Expand Descriptor-Relative Access section
Arjun Shankar [Wed, 4 Jun 2025 11:08:53 +0000 (13:08 +0200)] 
manual: Expand Descriptor-Relative Access section

Improve the clarity of the paragraphs describing common flags and add a
list of common error conditions for descriptor-relative functions.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoMakefile: Avoid $(objpfx)/ in makefiles
Florian Weimer [Wed, 4 Jun 2025 15:44:19 +0000 (17:44 +0200)] 
Makefile: Avoid $(objpfx)/ in makefiles

If paths with both $(objpfx)/ and $(objpfx) (which already includes
a trailing slash) appear during the build, this can trigger unexpected
rebuilds, or incorrect concurrent rebuilds.

4 weeks agomanual: Document error codes missing for 'inet_pton'
Maciej W. Rozycki [Wed, 4 Jun 2025 15:27:20 +0000 (16:27 +0100)] 
manual: Document error codes missing for 'inet_pton'

Add documentation for EAFNOSUPPORT error code returned, and the possible
return values on non-success.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomanual: Document error codes missing for 'if_nametoindex'
Maciej W. Rozycki [Wed, 4 Jun 2025 15:27:20 +0000 (16:27 +0100)] 
manual: Document error codes missing for 'if_nametoindex'

Add documentation for ENODEV error code returned and refer to 'socket'
for further possible codes from the underlying function call.

While changing the text clarify the description by mentioning 'ifname'.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomanual: Document error codes missing for 'if_indextoname'
Maciej W. Rozycki [Wed, 4 Jun 2025 15:27:20 +0000 (16:27 +0100)] 
manual: Document error codes missing for 'if_indextoname'

Add documentation for ENXIO error code returned and refer to 'socket'
for further possible codes from the underlying function call.

While changing the text clarify the description by mentioning 'ifname'
and replace @code tags with @var ones where referring to a function
parameter.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoposix: fix building regex when _LIBC isn't defined
Cœur [Tue, 3 Jun 2025 08:27:35 +0000 (10:27 +0200)] 
posix: fix building regex when _LIBC isn't defined

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agolocaledata: Use the name North Macedonia.
Collin Funk [Tue, 3 Jun 2025 19:50:15 +0000 (12:50 -0700)] 
localedata: Use the name North Macedonia.

The name "the former Yugoslav Republic of Macedonia" is no longer in use
since the signing of the Prespa Agreement [1][2].  This resolved the
country's naming dispute with Greece and changed the name to "North
Macedonia".

The name field of this locale/iso-3166.def is not used, so this does not
affect binaries.

[1] https://en.wikipedia.org/wiki/Prespa_Agreement
[2] https://treaties.un.org/Pages/showDetails.aspx?objid=0800000280544ac1

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomalloc: Count tcache entries downwards
Wilco Dijkstra [Wed, 9 Apr 2025 17:41:22 +0000 (17:41 +0000)] 
malloc: Count tcache entries downwards

Currently tcache requires 2 global variable accesses to determine
whether a block can be added to the tcache.  Change the counts array
to 'num_slots' to indicate the number of entries that could be added.
If 'num_slots' reaches zero, no more blocks can be added.  If the entries
pointer is not NULL, at least one block is available for allocation.

Now each tcache bin can support a different maximum number of entries,
and they can be individually switched on or off (a zero initialized
num_slots+entry means the tcache bin is not available for free or malloc).

Reviewed-by: DJ Delorie <dj@redhat.com>
4 weeks agosparc: Fix argument passing to __libc_start_main (BZ 32981)
Adhemerval Zanella [Fri, 30 May 2025 15:40:04 +0000 (12:40 -0300)] 
sparc: Fix argument passing to __libc_start_main (BZ 32981)

sparc start.S does not provide the final argument for
__libc_start_main, which is the highest stack address used to
update the __libc_stack_end.A

This fixes elf/tst-execstack-prog-static-tunable on sparc64.
On sparcv9 this does not happen because the kernel puts an
auxv value, which turns to point to a value in the stack itself.

Checked on sparc64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agolocaledata: Refer to Eswatini instead of Swaziland.
Collin Funk [Tue, 3 Jun 2025 08:53:12 +0000 (10:53 +0200)] 
localedata: Refer to Eswatini instead of Swaziland.

The name was changed in 2018 [1].

The name is not used in locale/programs/ld-address.c so this does not
change any binaries or data.

[1] https://www.un.org/en/about-us/member-states/eswatini

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agosigaction: don't sign-extend sa_flags
наб [Tue, 3 Jun 2025 08:53:12 +0000 (10:53 +0200)] 
sigaction: don't sign-extend sa_flags

Before:
  rt_sigaction(SIGBUS, {sa_handler=0x55abb9960139, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND|SA_SIGINFO|0xffffffff00000000, sa_restorer=0x7fb1b2a82050}, NULL, 8) = 0

After:
  rt_sigaction(SIGBUS, {sa_handler=0x7f6a70dce139, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND|SA_SIGINFO, sa_restorer=0x7f6a70c28f60}, NULL, 8) = 0

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 weeks agostdio-common: Add nonnull attribute to stdio_ext.h functions.
Collin Funk [Mon, 19 May 2025 04:32:42 +0000 (21:32 -0700)] 
stdio-common: Add nonnull attribute to stdio_ext.h functions.

* stdio-common/stdio_ext.h (__fbufsize, __freading, __fwriting)
(__freadable, __fwritable, __flbf, __fpurge, __fpending, __fsetlocking):
Add __nonnull ((1)) to these functions since they access the FP without
checking if it is NULL.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agoelf: Fix UB on _dl_map_object_from_fd
Adhemerval Zanella [Wed, 7 May 2025 14:17:29 +0000 (11:17 -0300)] 
elf: Fix UB on _dl_map_object_from_fd

On 32-bit architecture ubsan triggers:

UBSAN: Undefined behaviour in dl-load.c:1345:54 pointer index expression with base 0x00612508 overflowed  to 0xf7c3a508

Use explicit uintptr_t operation instead.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 weeks agoargp: Fix shift bug
Adhemerval Zanella [Wed, 7 May 2025 14:17:28 +0000 (11:17 -0300)] 
argp: Fix shift bug

From gnulib commits 06094e390b0 and 88033d3779362a.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 weeks agomath: Remove i386 ilogb/ilogbf/llogb/llogbf
Adhemerval Zanella [Mon, 28 Apr 2025 19:54:49 +0000 (16:54 -0300)] 
math: Remove i386 ilogb/ilogbf/llogb/llogbf

The new float and double implementation does not required an
extra function call and error handling uses math_err function,
which results in better performance on i386 as well.

With gcc-14 on AMD AMD Ryzen 9 5900X, master shows:

$ ./benchtests/bench-ilogb
  "ilogb": {
   "subnormal": {
    "duration": 3.68863e+09,
    "iterations": 1.72228e+08,
    "max": 89.2995,
    "min": 21.016,
    "mean": 21.4171
   },
   "normal": {
    "duration": 3.68878e+09,
    "iterations": 1.72948e+08,
    "max": 78.6065,
    "min": 21.127,
    "mean": 21.3288
   }
  }
$ ./benchtests/bench-ilogbf
  "ilogbf": {
   "subnormal": {
    "duration": 3.68835e+09,
    "iterations": 1.66716e+08,
    "max": 46.953,
    "min": 21.793,
    "mean": 22.1236
   },
   "normal": {
    "duration": 3.68784e+09,
    "iterations": 1.66168e+08,
    "max": 46.9715,
    "min": 21.904,
    "mean": 22.1935
   }
  }

While with this patch:

$ ./benchtests/bench-ilogb
  "ilogb": {
   "subnormal": {
    "duration": 3.68134e+09,
    "iterations": 4.17516e+08,
    "max": 32.5045,
    "min": 8.3245,
    "mean": 8.81723
   },
   "normal": {
    "duration": 3.6677e+09,
    "iterations": 6.79468e+08,
    "max": 50.9305,
    "min": 5.3465,
    "mean": 5.3979
   }
}
$ ./benchtests/bench-ilogbf
  "ilogbf": {
   "subnormal": {
    "duration": 3.67553e+09,
    "iterations": 5.11032e+08,
    "max": 35.927,
    "min": 7.0485,
    "mean": 7.19237
   },
   "normal": {
    "duration": 3.66877e+09,
    "iterations": 6.556e+08,
    "max": 26.3625,
    "min": 5.5315,
    "mean": 5.59605
   }
 }

Checked on i686-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomath: Optimize float ilogb/llogb
Adhemerval Zanella [Mon, 21 Apr 2025 16:45:31 +0000 (13:45 -0300)] 
math: Optimize float ilogb/llogb

It removes the wrapper by moving the error/EDOM handling to an
out-of-line implementation (__math_invalidf_i/__math_invalidf_li).
Also, __glibc_unlikely is used on errors case since it helps
code generation on recent gcc.

The code now builds to with gcc-14 on aarch64:

0000000000000000 <__ilogbf>:
   0:   1e260000        fmov    w0, s0
   4:   d3577801        ubfx    x1, x0, #23, #8
   8:   340000e1        cbz     w1, 24 <__ilogbf+0x24>
   c:   5101fc20        sub     w0, w1, #0x7f
  10:   7103fc3f        cmp     w1, #0xff
  14:   54000040        b.eq    1c <__ilogbf+0x1c>  // b.none
  18:   d65f03c0        ret
  1c:   12b00000        mov     w0, #0x7fffffff                 // #2147483647
  20:   14000000        b       0 <__math_invalidf_i>
  24:   53175800        lsl     w0, w0, #9
  28:   340000a0        cbz     w0, 3c <__ilogbf+0x3c>
  2c:   5ac01000        clz     w0, w0
  30:   12800fc1        mov     w1, #0xffffff81                 // #-127
  34:   4b000020        sub     w0, w1, w0
  38:   d65f03c0        ret
  3c:   320107e0        mov     w0, #0x80000001                 // #-2147483647
  40:   14000000        b       0 <__math_invalidf_i>

Some ABI requires additional adjustments:

  * i386 and m68k requires to use the template version, since
    both provide __ieee754_ilogb implementatations.

  * loongarch uses a custom implementation as well.

  * powerpc64le also has a custom implementation for POWER9, which
    is also used for float and float128 version.  The generic
    e_ilogb.c implementation is moved on powerpc to keep the
    current code as-is.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomath: Remove UB and optimize double ilogbf
Adhemerval Zanella [Mon, 21 Apr 2025 16:18:43 +0000 (13:18 -0300)] 
math: Remove UB and optimize double ilogbf

The subnormal exponent calculation invokes UB by left shifting the
signed expoenent to find the first leading bit.

The patch reimplements ilogb using the math_config.h macros and
uses the new stdbit.h function to simplify the subnormal handling.

On aarch64 it generates better code:

* master:

0000000000000000 <__ieee754_ilogbf>:
   0:   1e260000        fmov    w0, s0
   4:   12007801        and     w1, w0, #0x7fffffff
   8:   72091c1f        tst     w0, #0x7f800000
   c:   54000141        b.ne    34 <__ieee754_ilogbf+0x34>  // b.any
  10:   34000201        cbz     w1, 50 <__ieee754_ilogbf+0x50>
  14:   53185c21        lsl     w1, w1, #8
  18:   12800fa0        mov     w0, #0xffffff82                 // #-126
  1c:   d503201f        nop
  20:   531f7821        lsl     w1, w1, #1
  24:   51000400        sub     w0, w0, #0x1
  28:   7100003f        cmp     w1, #0x0
  2c:   54ffffac        b.gt    20 <__ieee754_ilogbf+0x20>
  30:   d65f03c0        ret
  34:   13177c20        asr     w0, w1, #23
  38:   12b01002        mov     w2, #0x7f7fffff                 // #2139095039
  3c:   5101fc00        sub     w0, w0, #0x7f
  40:   6b02003f        cmp     w1, w2
  44:   12b00001        mov     w1, #0x7fffffff                 // #2147483647
  48:   1a819000        csel    w0, w0, w1, ls  // ls = plast
  4c:   d65f03c0        ret
  50:   320107e0        mov     w0, #0x80000001                 // #-2147483647
  54:   d65f03c0        ret

* patch:

0000000000000000 <__ieee754_ilogbf>:
   0:   1e260001        fmov    w1, s0
   4:   d3577820        ubfx    x0, x1, #23, #8
   8:   350000e0        cbnz    w0, 24 <__ieee754_ilogbf+0x24>
   c:   53175821        lsl     w1, w1, #9
  10:   34000141        cbz     w1, 38 <__ieee754_ilogbf+0x38>
  14:   5ac01021        clz     w1, w1
  18:   12800fc0        mov     w0, #0xffffff81                 // #-127
  1c:   4b010000        sub     w0, w0, w1
  20:   d65f03c0        ret
  24:   7103fc1f        cmp     w0, #0xff
  28:   5101fc00        sub     w0, w0, #0x7f
  2c:   12b00001        mov     w1, #0x7fffffff                 // #2147483647
  30:   1a811000        csel    w0, w0, w1, ne  // ne = any
  34:   d65f03c0        ret
  38:   320107e0        mov     w0, #0x80000001                 // #-2147483647
  3c:   d65f03c0        ret

Other architecture with support for stdc_leading_zeros and/or
__builtin_clzll should have similar improvements.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomath: Optimize double ilogb/llogb
Adhemerval Zanella [Mon, 21 Apr 2025 14:32:02 +0000 (11:32 -0300)] 
math: Optimize double ilogb/llogb

It removes the wrapper by moving the error/EDOM handling to an
out-of-line implementation (__math_invalid_i/__math_invalid_li).
Also, __glibc_unlikely is used on errors case since it helps
code generation on recent gcc.

The code now builds to with gcc-14 on aarch64:

0000000000000000 <__ilogb>:
   0:   9e660000        fmov    x0, d0
   4:   d374f801        ubfx    x1, x0, #52, #11
   8:   340000e1        cbz     w1, 24 <__ilogb+0x24>
   c:   510ffc20        sub     w0, w1, #0x3ff
  10:   711ffc3f        cmp     w1, #0x7ff
  14:   54000040        b.eq    1c <__ilogb+0x1c>  // b.none
  18:   d65f03c0        ret
  1c:   12b00000        mov     w0, #0x7fffffff                 // #2147483647
  20:   14000000        b       0 <__math_invalid_i>
  24:   d374cc00        lsl     x0, x0, #12
  28:   b40000a0        cbz     x0, 3c <__ilogb+0x3c>
  2c:   dac01000        clz     x0, x0
  30:   12807fc1        mov     w1, #0xfffffc01                 // #-1023
  34:   4b000020        sub     w0, w1, w0
  38:   d65f03c0        ret
  3c:   320107e0        mov     w0, #0x80000001                 // #-2147483647
  40:   14000000        b       0 <__math_invalid_i>

Some ABI requires additional adjustments:

  * i386 and m68k requires to use the template version, since
    both provide __ieee754_ilogb implementatations.

  * loongarch uses a custom implementation as well.

  * powerpc64le also has a custom implementation for POWER9, which
    is also used for float and float128 version.  The generic
    e_ilogb.c implementation is moved on powerpc to keep the
    current code as-is.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomath: Remove UB and optimize double ilogb
Adhemerval Zanella [Mon, 21 Apr 2025 13:26:27 +0000 (10:26 -0300)] 
math: Remove UB and optimize double ilogb

The subnormal exponent calculation invokes UB by left shifting the
signed exponent to find the first leading bit.  The implementation
also uses 32 bits operations, which generates suboptimal code in
64 bits architectures.

The patch reimplements ilogb using the math_config.h macros and
uses the new stdbit function to simplify the subnormal handling.

On aarch64 it generates better code:

* master:

0000000000000000 <__ieee754_ilogb>:
   0:   9e660000        fmov    x0, d0
   4:   d360fc02        lsr     x2, x0, #32
   8:   d360f801        ubfx    x1, x0, #32, #31
   c:   f26c285f        tst     x2, #0x7ff00000
  10:   540001a1        b.ne    44 <__ieee754_ilogb+0x44>  // b.any
  14:   2a000022        orr     w2, w1, w0
  18:   34000322        cbz     w2, 7c <__ieee754_ilogb+0x7c>
  1c:   35000221        cbnz    w1, 60 <__ieee754_ilogb+0x60>
  20:   2a0003e1        mov     w1, w0
  24:   7100001f        cmp     w0, #0x0
  28:   12808240        mov     w0, #0xfffffbed                 // #-1043
  2c:   540000ad        b.le    40 <__ieee754_ilogb+0x40>
  30:   531f7821        lsl     w1, w1, #1
  34:   51000400        sub     w0, w0, #0x1
  38:   7100003f        cmp     w1, #0x0
  3c:   54ffffac        b.gt    30 <__ieee754_ilogb+0x30>
  40:   d65f03c0        ret
  44:   13147c20        asr     w0, w1, #20
  48:   12b00202        mov     w2, #0x7fefffff                 // #2146435071
  4c:   510ffc00        sub     w0, w0, #0x3ff
  50:   6b02003f        cmp     w1, w2
  54:   12b00001        mov     w1, #0x7fffffff                 // #2147483647
  58:   1a819000        csel    w0, w0, w1, ls  // ls = plast
  5c:   d65f03c0        ret
  60:   53155021        lsl     w1, w1, #11
  64:   12807fa0        mov     w0, #0xfffffc02                 // #-1022
  68:   531f7821        lsl     w1, w1, #1
  6c:   51000400        sub     w0, w0, #0x1
  70:   7100003f        cmp     w1, #0x0
  74:   54ffffac        b.gt    68 <__ieee754_ilogb+0x68>
  78:   d65f03c0        ret
  7c:   320107e0        mov     w0, #0x80000001                 // #-2147483647
  80:   d65f03c0        ret

* patch:

0000000000000000 <__ieee754_ilogb>:
   0:   9e660001        fmov    x1, d0
   4:   d374f820        ubfx    x0, x1, #52, #11
   8:   350000e0        cbnz    w0, 24 <__ieee754_ilogb+0x24>
   c:   d374cc21        lsl     x1, x1, #12
  10:   b4000141        cbz     x1, 38 <__ieee754_ilogb+0x38>
  14:   dac01021        clz     x1, x1
  18:   12807fc0        mov     w0, #0xfffffc01                 // #-1023
  1c:   4b010000        sub     w0, w0, w1
  20:   d65f03c0        ret
  24:   711ffc1f        cmp     w0, #0x7ff
  28:   510ffc00        sub     w0, w0, #0x3ff
  2c:   12b00001        mov     w1, #0x7fffffff                 // #2147483647
  30:   1a811000        csel    w0, w0, w1, ne  // ne = any
  34:   d65f03c0        ret
  38:   320107e0        mov     w0, #0x80000001                 // #-2147483647
  3c:   d65f03c0        ret

Other architecture with support for stdc_leading_zeros and/or
__builtin_clzll should have similar improvements.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomanual: Correct return value description of 'clock_nanosleep'
Arjun Shankar [Mon, 2 Jun 2025 08:41:02 +0000 (10:41 +0200)] 
manual: Correct return value description of 'clock_nanosleep'

Commit 1a3d8f2201d4d613401ce5be9a283f4f28c43093 incorrectly described
'clock_nanosleep' as having the same return values as 'nanosleep'.  Fix
this, clarifying that 'clock_nanosleep' returns a positive error number
upon failure instead of setting 'errno'.  Also clarify that 'nanosleep'
returns '-1' upon error.

Fixes: 1a3d8f2201d4d613401ce5be9a283f4f28c43093
Reported-by: Mark Harris <mark.hsj@gmail.com>
Reviewed-by: Mark Harris <mark.hsj@gmail.com>
5 weeks agonss: free dynarray buffer after parsing nsswitch.conf
DJ Delorie [Sat, 31 May 2025 01:04:37 +0000 (21:04 -0400)] 
nss: free dynarray buffer after parsing nsswitch.conf

Resolves: swbz 31791

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agomanual: Document clock_nanosleep
Arjun Shankar [Fri, 30 May 2025 00:09:50 +0000 (02:09 +0200)] 
manual: Document clock_nanosleep

Make minor clarifications in the documentation for 'nanosleep' and add
an entry for 'clock_nanosleep' as a generalized variant of the former
function that allows clock selection.
Reviewed-by: Maciej W. Rozycki <macro@redhat.com>
5 weeks agomanual: Fix invalid 'illegal' usage with 'nanosleep'
Maciej W. Rozycki [Fri, 30 May 2025 14:01:51 +0000 (15:01 +0100)] 
manual: Fix invalid 'illegal' usage with 'nanosleep'

The GNU Coding Standards demand that 'illegal' only be used to refer to
activities prohibited by law.  Replace it with 'invalid' accordingly in
the description of the EINVAL error condition for 'nanosleep'.

5 weeks agomanual: Fix duplicate 'consult' erratum
Maciej W. Rozycki [Fri, 30 May 2025 14:01:50 +0000 (15:01 +0100)] 
manual: Fix duplicate 'consult' erratum

Remove 'consult' duplication appearing in Extensible Scheduling section.

5 weeks agolocaledata: Correct Persian collation rules description
Maciej W. Rozycki [Fri, 30 May 2025 14:01:48 +0000 (15:01 +0100)] 
localedata: Correct Persian collation rules description

Fix an erratum in the Persian locale claiming that the CLDR collation
rules referred are for Ukrainian.

5 weeks agostdio-common: Correct 'sscanf' test feature wrapper description
Maciej W. Rozycki [Fri, 30 May 2025 14:01:47 +0000 (15:01 +0100)] 
stdio-common: Correct 'sscanf' test feature wrapper description

Fix a typo in the description, making the wrapper correctly refer to
'sscanf' rather than 'scanf' being tested.

5 weeks agomanual: Document error codes missing for 'inet_ntop'
Maciej W. Rozycki [Thu, 29 May 2025 21:11:38 +0000 (22:11 +0100)] 
manual: Document error codes missing for 'inet_ntop'

Add documentation for EAFNOSUPPORT and ENOSPC error codes returned, and
the return value on failure.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 weeks agomanual: Document error codes missing for 'socket'
Maciej W. Rozycki [Thu, 29 May 2025 21:11:38 +0000 (22:11 +0100)] 
manual: Document error codes missing for 'socket'

Add missing EAFNOSUPPORT, ESOCKTNOSUPPORT, EPROTOTYPE, EINVAL, EPERM,
and ENOMEM error codes, and adjust existing descriptions accordingly.

On Linux either ENOBUFS or ENOMEM is returned in the case of a memory
allocation failure, depending on the namespace requested, e.g. AF_INET
returns ENOMEM while AF_INET6 returns ENOBUFS, so document these codes
as alternatives.

Similarly EPERM is returned rather than EACCES on Linux, so document
these codes as alternatives as well.  We might want to convert EPERM to
EACCES for POSIX compliance, but it is beyond the scope of this change,
and software has to expect either anyway, owing to the long-established
practice.

Finally ESOCKTNOSUPPORT is returned rather than EPROTONOSUPPORT for an
unsupported style except for the AF_QIPCRTR namespace where EPROTOTYPE
is used, so document these codes as alternatives too.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 weeks agostdio-common: Consistently use 'num_digits_len' in 'vfscanf'
Maciej W. Rozycki [Thu, 29 May 2025 21:11:38 +0000 (22:11 +0100)] 
stdio-common: Consistently use 'num_digits_len' in 'vfscanf'

Make the only place use 'num_digits_len' enumeration constant where 10
is referred literally for a digit index in i18n handling for decimal
integers.  No change in code produced.

Reviewed-by: Arjun Shankar <arjun@redhat.com>