]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
7 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>
7 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>
7 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

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

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

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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
2 months 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>
2 months 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>
2 months 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'.

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

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

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

2 months 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>
2 months 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>
2 months 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>
2 months agoUpdate syscall lists for Linux 6.15
Joseph Myers [Thu, 29 May 2025 19:21:46 +0000 (19:21 +0000)] 
Update syscall lists for Linux 6.15

Linux 6.15 adds the new syscall open_tree_attr.  Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agoAArch64: Improve enabling of SVE for libmvec
Wilco Dijkstra [Thu, 29 May 2025 15:08:15 +0000 (15:08 +0000)] 
AArch64: Improve enabling of SVE for libmvec

When using a -mcpu option in CFLAGS, GCC can report errors when building libmvec.
Fix this by overriding both -mcpu and -march with a generic variant with SVE added.
Also use a tune for a modern SVE core.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2 months agoAArch64: Improve codegen in SVE log1p
Luna Lamb [Thu, 29 May 2025 15:22:51 +0000 (15:22 +0000)] 
AArch64: Improve codegen in SVE log1p

Improves memory access, reformat evaluation scheme to pack coefficients.
5% improvement in throughput microbenchmark on Neoverse V1.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 months agoUse Linux 6.15 in build-many-glibcs.py
Joseph Myers [Wed, 28 May 2025 14:15:51 +0000 (14:15 +0000)] 
Use Linux 6.15 in build-many-glibcs.py

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

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agomanual: mention PKEY_UNRESTRICTED macro in the manual
Yury Khrustalev [Tue, 27 May 2025 10:10:12 +0000 (11:10 +0100)] 
manual: mention PKEY_UNRESTRICTED macro in the manual

Also use this macro in one of the examples.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agolinux: use PKEY_UNRESTRICTED macro in tst-pkey
Yury Khrustalev [Tue, 27 May 2025 10:07:10 +0000 (11:07 +0100)] 
linux: use PKEY_UNRESTRICTED macro in tst-pkey

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agomisc: add PKEY_UNRESTRICTED macro
Yury Khrustalev [Tue, 27 May 2025 10:06:43 +0000 (11:06 +0100)] 
misc: add PKEY_UNRESTRICTED macro

A corresponding macro has been added to Linux UAPI headers in 6.15.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agogeneric: Add missing parameter name to __getrandom_early_init
Florian Weimer [Wed, 28 May 2025 08:00:41 +0000 (10:00 +0200)] 
generic: Add missing parameter name to __getrandom_early_init

This is required after commit 03da41d47dc73674307e6ffc5b75e9043febc698
("Turn on -Wmissing-parameter-name by default if available").

Reviewed-by: Sam James <sam@gentoo.org>
2 months agohurd: Avoid -Wfree-labels warning in _hurd_intr_rpc_mach_msg
Florian Weimer [Wed, 28 May 2025 07:59:24 +0000 (09:59 +0200)] 
hurd: Avoid -Wfree-labels warning in _hurd_intr_rpc_mach_msg

This is required after commit 4f4c4fcde76aedc1f5362a51d98ebb57a28fbce9
("Turn on -Wfree-labels by default if available").

Reviewed-by: Sam James <sam@gentoo.org>
2 months agoUpdate RISC-V relocations
Andreas Schwab [Mon, 16 Oct 2023 11:13:17 +0000 (13:13 +0200)] 
Update RISC-V relocations

Update the list of RISC-V relocations from the ELF psABI as of June 2024.
It removes binutils-internal only relocations that were never part of
actual object files.  The GNU_VTINHERIT and GNU_VTENTRY relocations were
never used because the corresponding GCC option -fvtable-gc was never
supported on RISC-V.

2 months agoUse -std=gnu17 in build-many-glibcs.py when configuring GMP
Joseph Myers [Tue, 27 May 2025 15:56:56 +0000 (15:56 +0000)] 
Use -std=gnu17 in build-many-glibcs.py when configuring GMP

This works around incompatibility of GMP 6.3.0 with GCC 15 (defaulting
to C23) following an approach suggested by Florian.

Tested with build-many-glibcs.py (host-libraries build only).

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agomalloc: Fix malloc init order
Wilco Dijkstra [Tue, 27 May 2025 13:32:45 +0000 (13:32 +0000)] 
malloc: Fix malloc init order

__ptmalloc_init was called too early in __libc_early_init: it uses
__libc_initial which is not set yet.  Fix this by moving initialization
to the end of __libc_early_init.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agoMove C warning flags from +gccwarn to +gccwarn-c
Florian Weimer [Tue, 27 May 2025 14:09:39 +0000 (16:09 +0200)] 
Move C warning flags from +gccwarn to +gccwarn-c

This avoids warnings about these options during the C++ header
inclusion tests.

Reviewed-by: Sam James <sam@gentoo.org>
2 months agodoc: Add missing space in documentation of __TIMESIZE
Jonathan Wakely [Tue, 27 May 2025 10:42:04 +0000 (11:42 +0100)] 
doc: Add missing space in documentation of __TIMESIZE

2 months agodoc: Fix typos in documentation of _TIME_BITS
Jonathan Wakely [Tue, 27 May 2025 10:15:22 +0000 (11:15 +0100)] 
doc: Fix typos in documentation of _TIME_BITS

2 months agoFix comment typo in libc-symbols.h
Jonathan Wakely [Tue, 27 May 2025 10:07:43 +0000 (11:07 +0100)] 
Fix comment typo in libc-symbols.h

Reviewed-by: Sam James <sam@gentoo.org>
2 months agoTurn on -Wmissing-parameter-name by default if available
Florian Weimer [Tue, 27 May 2025 05:14:58 +0000 (07:14 +0200)] 
Turn on -Wmissing-parameter-name by default if available

This flags another hazard for backporting changes to earlier branches.

Reviewed-by: Sam James <sam@gentoo.org>
2 months agomanual: Document getopt_long_only with single letter options (bug 32980)
Tomas Volf [Mon, 26 May 2025 13:53:54 +0000 (15:53 +0200)] 
manual: Document getopt_long_only with single letter options (bug 32980)

Signed-off-by: Tomas Volf <~@wolfsden.cz>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agoTurn on -Wfree-labels by default if available
Florian Weimer [Mon, 26 May 2025 06:49:19 +0000 (08:49 +0200)] 
Turn on -Wfree-labels by default if available

This flags a hazard for backporting changes to earlier branches.

Reviewed-by: Sam James <sam@gentoo.org>
2 months agoS390: Use cfi_val_offset instead of cfi_escape. 31bit part
Stefan Liebler [Wed, 14 May 2025 12:26:36 +0000 (14:26 +0200)] 
S390: Use cfi_val_offset instead of cfi_escape. 31bit part

Due to raising the minimum binutils version to version >=2.28,
the used cfi_escape for cfi_val_offset can now be ommitted.

The commit 0fc76d876261ee8253fef198ffec48c832edd4ff
has already adjusted it for the 64bit part of mcount.
This patch also adjusts it for the 31bit part of mcount.

Checked with "objdump -WF" / "objdump -Wf" that the previous
cfi_escape and the new cfi_val_offset are equal.

2 months agolibmvec: Add inputs for asinpi(f), acospi(f), atanpi(f) and atan2pi(f)
Wilco Dijkstra [Tue, 20 May 2025 13:20:17 +0000 (13:20 +0000)] 
libmvec: Add inputs for asinpi(f), acospi(f), atanpi(f) and atan2pi(f)

Add initial inputs for asinpi(f), acospi(f), atanpi(f) and atan2pi(f) based
on existing asin/acos/atan inputs.

Benchtests now works on the new libmvec function.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2 months agoINSTALL: Regenerate with texinfo 7.2
Mark Wielaard [Wed, 14 May 2025 21:11:15 +0000 (23:11 +0200)] 
INSTALL: Regenerate with texinfo 7.2

This fixes make dist on systems with the latest texinfo installed.
GNU texinfo 7.2 changes @xrefs in proper plain text sentences instead
of pseudo info references.

Tested-By: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2 months agoFix error reporting (false negatives) in SGID tests
Florian Weimer [Thu, 22 May 2025 12:36:37 +0000 (14:36 +0200)] 
Fix error reporting (false negatives) in SGID tests

And simplify the interface of support_capture_subprogram_self_sgid.

Use the existing framework for temporary directories (now with
mode 0700) and directory/file deletion.  Handle all execution
errors within support_capture_subprogram_self_sgid.  In particular,
this includes test failures because the invoked program did not
exit with exit status zero.  Existing tests that expect exit
status 42 are adjusted to use zero instead.

In addition, fix callers not to call exit (0) with test failures
pending (which may mask them, especially when running with --direct).

Fixes commit 35fc356fa3b4f485bd3ba3114c9f774e5df7d3c2
("elf: Fix subprocess status handling for tst-dlopen-sgid (bug 32987)").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 months agomanual: Use more inclusive language in comments.
Carlos O'Donell [Tue, 20 May 2025 11:45:25 +0000 (07:45 -0400)] 
manual: Use more inclusive language in comments.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agoMakerules: Use 'original' instead of 'master' in source.
Carlos O'Donell [Tue, 20 May 2025 11:45:21 +0000 (07:45 -0400)] 
Makerules: Use 'original' instead of 'master' in source.

Use more inclusive language in makefile source.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agogen-libm-test: Use 'original source' instead of 'master' in code.
Carlos O'Donell [Tue, 20 May 2025 11:45:20 +0000 (07:45 -0400)] 
gen-libm-test: Use 'original source' instead of 'master' in code.

Use more inclusive language in generated sources.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agonss_test1: Use 'parametrized template' instead of 'master' in comment.
Carlos O'Donell [Tue, 20 May 2025 11:45:19 +0000 (07:45 -0400)] 
nss_test1: Use 'parametrized template' instead of 'master' in comment.

Use more inclusive language in code comments.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agolinknamespace: Use 'ALLOWLIST' instead of 'WHITELIST' in code.
Carlos O'Donell [Tue, 20 May 2025 11:45:17 +0000 (07:45 -0400)] 
linknamespace: Use 'ALLOWLIST' instead of 'WHITELIST' in code.

Use more inclusive language in code.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agoposix: Use more inclusive language in test data.
Carlos O'Donell [Tue, 20 May 2025 11:45:16 +0000 (07:45 -0400)] 
posix: Use more inclusive language in test data.

Remove Changelog entries that use 'blacklist' or 'master' in the
test data. The test data still contains enough accented characters
to serve the purposes of the posix/tst-regex.c test.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agopylintrc: Remove obsolete ignore section and comments.
Carlos O'Donell [Tue, 20 May 2025 11:45:14 +0000 (07:45 -0400)] 
pylintrc: Remove obsolete ignore section and comments.

Remove the obsolete ignore=CVS since we use git now.

We make the code more inclusive by removing obsolete comments.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 months agosupport: Pick group in support_capture_subprogram_self_sgid if UID == 0
Florian Weimer [Wed, 21 May 2025 14:47:34 +0000 (16:47 +0200)] 
support: Pick group in support_capture_subprogram_self_sgid if UID == 0

When running as root, it is likely that we can run under any group.
Pick a harmless group from /etc/group in this case.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 months agoldbl-128: also disable lgammaf128_r builtin when building lgammal_r
Andreas Schwab [Tue, 20 May 2025 10:42:19 +0000 (12:42 +0200)] 
ldbl-128: also disable lgammaf128_r builtin when building lgammal_r

2 months agoelf: Fix subprocess status handling for tst-dlopen-sgid (bug 32987)
Florian Weimer [Wed, 21 May 2025 06:43:32 +0000 (08:43 +0200)] 
elf: Fix subprocess status handling for tst-dlopen-sgid (bug 32987)

This should really move into support_capture_subprogram_self_sgid.

Reviewed-by: Sam James <sam@gentoo.org>
2 months agox86_64: Fix typo in ifunc-impl-list.c.
Sunil K Pandey [Tue, 20 May 2025 17:07:27 +0000 (10:07 -0700)] 
x86_64: Fix typo in ifunc-impl-list.c.

Fix wcsncpy and wcpncpy typo in ifunc-impl-list.c.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 months agoelf: Test case for bug 32976 (CVE-2025-4802)
Florian Weimer [Tue, 20 May 2025 17:36:02 +0000 (19:36 +0200)] 
elf: Test case for bug 32976 (CVE-2025-4802)

Check that LD_LIBRARY_PATH is ignored for AT_SECURE statically
linked binaries, using support_capture_subprogram_self_sgid.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 months agosupport: Use const char * argument in support_capture_subprogram_self_sgid
Florian Weimer [Tue, 20 May 2025 17:36:02 +0000 (19:36 +0200)] 
support: Use const char * argument in support_capture_subprogram_self_sgid

The function does not modify the passed-in string, so make this clear
via the prototype.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 months agoAArch64: Fix typo in math-vector.h
Wilco Dijkstra [Tue, 20 May 2025 13:39:02 +0000 (13:39 +0000)] 
AArch64: Fix typo in math-vector.h

Fix typo atanpi2->atan2pi in math-vector.h.

2 months agoFix typos in ldbl-opt makefile
Andreas Schwab [Tue, 20 May 2025 09:13:01 +0000 (11:13 +0200)] 
Fix typos in ldbl-opt makefile

The -fno-builtin options need to disable the long double builtins.

2 months agoAArch64: Cleanup SVE config and defines
Wilco Dijkstra [Wed, 14 May 2025 11:38:19 +0000 (11:38 +0000)] 
AArch64: Cleanup SVE config and defines

Now we finally support modern GCC and binutils, it's time for a cleanup.
Remove HAVE_AARCH64_SVE_ASM define and conditional compilation.  Remove SVE
configure checks for SVE, ACLE and variant-PCS support.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2 months agoAArch64: Cleanup PAC and BTI
Wilco Dijkstra [Wed, 14 May 2025 16:32:31 +0000 (16:32 +0000)] 
AArch64: Cleanup PAC and BTI

Now we finally support modern GCC and binutils, it's time for a cleanup.
Use PAC and BTI instructions unconditionally and use proper assembler syntax.
Remove the PR target/94791 strip_pac workarounds for buggy GCCs.  Remove the
PAC/BTI configure checks - always emit GNU property notes on assembly files.
Change cfi_window_save to the correct cfi_negate_ra_state unwind directive.

Reviewed-by: Matthieu Longo <matthieu.longo@arm.com>
2 months agoAArch64: Implement AdvSIMD and SVE atan2pi/f
Dylan Fleming [Mon, 19 May 2025 13:58:30 +0000 (13:58 +0000)] 
AArch64: Implement AdvSIMD and SVE atan2pi/f

Implement double and single precision variants of the C23 routine atan2pi
for both AdvSIMD and SVE.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 months agoAArch64: Implement AdvSIMD and SVE atanpi/f
Dylan Fleming [Mon, 19 May 2025 12:44:20 +0000 (12:44 +0000)] 
AArch64: Implement AdvSIMD and SVE atanpi/f

Implement double and single precision variants of the C23 routine atanpi
for both AdvSIMD and SVE.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 months agoAArch64: Implement AdvSIMD and SVE asinpi/f
Dylan Fleming [Mon, 19 May 2025 12:39:51 +0000 (12:39 +0000)] 
AArch64: Implement AdvSIMD and SVE asinpi/f

Implement double and single precision variants of the C23 routine asinpi
for both AdvSIMD and SVE.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 months agoAArch64: Implement AdvSIMD and SVE acospi/f
Dylan Fleming [Mon, 19 May 2025 12:26:50 +0000 (12:26 +0000)] 
AArch64: Implement AdvSIMD and SVE acospi/f

Implement double and single precision variants of the C23 routine acospi
for both AdvSIMD and SVE.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 months agoAArch64: Optimize inverse trig functions
Dylan Fleming [Mon, 19 May 2025 11:36:51 +0000 (11:36 +0000)] 
AArch64: Optimize inverse trig functions

Improve performance of Inverse trig functions by altering how coefficients are
loaded.

Performance improvement on Neoverse V1:
SVE     acos   14%
AdvSIMD acos   6%

AdvSIMD asin   6%
SVE     asin   5%
AdvSIMD asinf  2%

AdvSIMD atanf  22%
SVE     atanf  20%
SVE     atan   11%
AdvSIMD atan   5%

SVE     atan2  7%
SVE     atan2f 4%
AdvSIMD atan2f 3%
AdvSIMD atan2  2%

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 months agoDocument CVE-2025-4802.
Carlos O'Donell [Thu, 15 May 2025 21:46:36 +0000 (17:46 -0400)] 
Document CVE-2025-4802.

This commit adds advisory data for the above CVE(s).

2 months agoctype: Fallback initialization of TLS using relocations (bug 19341, bug 32483)
Florian Weimer [Fri, 16 May 2025 17:53:09 +0000 (19:53 +0200)] 
ctype: Fallback initialization of TLS using relocations (bug 19341, bug 32483)

This ensures that the ctype data pointers in TLS are valid
in secondary namespaces even without initialization via
__ctype_init.

Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2 months agoUse proper extern declaration for _nl_C_LC_CTYPE_{class,toupper,tolower}
Florian Weimer [Fri, 16 May 2025 17:53:09 +0000 (19:53 +0200)] 
Use proper extern declaration for _nl_C_LC_CTYPE_{class,toupper,tolower}

The existing initializers already contain explicit casts.  Keep them
due to int/uint32_t mismatch.

Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2 months agoOptimize __libc_tsd_* thread variable access
Florian Weimer [Fri, 16 May 2025 17:53:09 +0000 (19:53 +0200)] 
Optimize __libc_tsd_* thread variable access

These variables are not exported, and libc.so TLS is initial-exec
anyway.  Declare these variables as hidden and use the initial-exec
TLS model.

Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2 months agoRemove <libc-tsd.h>
Florian Weimer [Fri, 16 May 2025 17:53:09 +0000 (19:53 +0200)] 
Remove <libc-tsd.h>

Use __thread variables directly instead.  The macros do not save any
typing.  It seems unlikely that a future port will lack __thread
variable support.

Some of the __libc_tsd_* variables are referenced from assembler
files, so keep their names.  Previously, <libc-tls.h> included
<tls.h>, which in turn included <errno.h>, so a few direct includes
of <errno.h> are now required.

Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2 months agomanual: add sched_getcpu()
DJ Delorie [Thu, 15 May 2025 20:38:11 +0000 (16:38 -0400)] 
manual: add sched_getcpu()

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 months agomanual: Clarifications for listing directories
Florian Weimer [Fri, 16 May 2025 14:47:02 +0000 (16:47 +0200)] 
manual: Clarifications for listing directories

Support for seeking is limited.  Using the d_off and d_reclen members
of struct dirent is discouraged, especially with readdir.  Concurrent
modification of directories during iteration may result in duplicate
or missing etnries.

2 months agomanual: add remaining CPU_* macros
DJ Delorie [Thu, 24 Apr 2025 22:03:21 +0000 (18:03 -0400)] 
manual: add remaining CPU_* macros

Adds remaining CPU_* macros, including the CPU_*_S macros
for dynamic-sized cpu sets.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 months agopowerpc: Remove check for -mabi=ibmlongdouble
Andreas Schwab [Tue, 1 Apr 2025 11:19:07 +0000 (13:19 +0200)] 
powerpc: Remove check for -mabi=ibmlongdouble

The -mabi=ibmlongdouble option has been added in gcc 4.2, thus can be
assumed to always exist.