]> sourceware.org Git - glibc.git/log
glibc.git
3 months agohurd: Fix lsetxattr return value
Samuel Thibault [Mon, 10 Jun 2024 19:56:13 +0000 (21:56 +0200)]
hurd: Fix lsetxattr return value

The manpage says that lsetxattr returns 0 on success, like setxattr.

3 months agolocaledata: add new locales scn_IT
David Paleino [Wed, 15 May 2024 18:39:46 +0000 (20:39 +0200)]
localedata: add new locales scn_IT

Signed-off-by: David Paleino <dapal@debian.org>
3 months agosupport: Fix typo in xgetsockname error message
Avinal Kumar [Fri, 17 May 2024 15:28:04 +0000 (20:58 +0530)]
support: Fix typo in xgetsockname error message

The error message in xgetsockname was incorrectly referring to a
different function.  This commit fixes that.

Suggested-by: Arjun Shankar <arjun@redhat.com>
Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 months agogetconf: Add NPROCESSORS_{CONF,ONLN} [BZ #31661]
Mohamed Akram [Thu, 30 May 2024 14:05:50 +0000 (18:05 +0400)]
getconf: Add NPROCESSORS_{CONF,ONLN} [BZ #31661]

These are required by the upcoming POSIX standard and are available on
other platforms.

Link: https://austingroupbugs.net/view.php?id=339
Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
3 months agoLinux: Add epoll ioctls
Joe Damato [Tue, 28 May 2024 17:37:06 +0000 (17:37 +0000)]
Linux: Add epoll ioctls

As of Linux kernel 6.9, some ioctls and a parameters structure have been
introduced which allow user programs to control whether a particular
epoll context will busy poll.

Update the headers to include these for the convenience of user apps.

The ioctls were added in Linux kernel 6.9 commit 18e2bf0edf4dd
("eventpoll: Add epoll ioctl for epoll_params") [1] to
include/uapi/linux/eventpoll.h.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/?h=v6.9&id=18e2bf0edf4dd

Signed-off-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 months agoImprove doc for time_t range (BZ 31808)
Paul Eggert [Tue, 28 May 2024 17:07:47 +0000 (10:07 -0700)]
Improve doc for time_t range (BZ 31808)

3 months agodifftime can throw exceptions
Paul Eggert [Tue, 28 May 2024 17:07:47 +0000 (10:07 -0700)]
difftime can throw exceptions

difftime can signal an inexact conversion when converting to double,
so it should not be marked as pure or nothrow (BZ 31808).

Although we could do something more complicated, in which difftime is
plain on modern platforms but const and nothrow on obsolescent
platforms with 32-bit time_t, it hardly seems worth the trouble.
difftime is used so rarely that it's not worth taking pains to
optimize calls to it on obsolescent platforms.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 months agomalloc: New test to check malloc alternate path using memory obstruction
sayan paul [Wed, 29 May 2024 10:01:04 +0000 (15:31 +0530)]
malloc: New test to check malloc alternate path using memory obstruction

The test aims to ensure that malloc uses the alternate path to
allocate memory when sbrk() or brk() fails.To achieve this,
the test first creates an obstruction at current program break,
tests that obstruction with a failing sbrk(), then checks if malloc
is still returning a valid ptr thus inferring that malloc() used
mmap() instead of brk() or sbrk() to allocate the memory.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
Reviewed-by: Zack Weinberg <zack@owlfolio.org>
3 months agomath: Fix exp10 undefined left shift
Szabolcs Nagy [Wed, 22 May 2024 15:33:43 +0000 (16:33 +0100)]
math: Fix exp10 undefined left shift

Left shift of ki is undefined when ki<0, copy the logic from exp,
which uses unsigned arithmetics, to fix it.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 months agolibio: Test for fdopen memory leak without SEEK_END support (bug 31840)
Florian Weimer [Tue, 4 Jun 2024 12:37:35 +0000 (14:37 +0200)]
libio: Test for fdopen memory leak without SEEK_END support (bug 31840)

The bug report used /dev/mem, but /proc/self/mem works as well
(if available).

3 months agoRemove memory leak in fdopen (bug 31840)
Andreas Schwab [Tue, 4 Jun 2024 09:01:11 +0000 (11:01 +0200)]
Remove memory leak in fdopen (bug 31840)

Deallocate the memory for the FILE structure when seeking to the end fails
in append mode.

Fixes: ea33158c96 ("Fix offset caching for streams and use it for ftell (BZ #16680)")
3 months agoAdd new AArch64 HWCAP2 definitions from Linux 6.9 to bits/hwcap.h
Joseph Myers [Tue, 4 Jun 2024 12:25:05 +0000 (12:25 +0000)]
Add new AArch64 HWCAP2 definitions from Linux 6.9 to bits/hwcap.h

Linux 6.9 adds 15 new HWCAP2_* values for AArch64; add them to
bits/hwcap.h in glibc.

Tested with build-many-glibcs.py for aarch64-linux-gnu.

3 months agoAdd more NT_ARM_* constants from Linux kernel to elf.h
Joseph Myers [Tue, 4 Jun 2024 12:24:37 +0000 (12:24 +0000)]
Add more NT_ARM_* constants from Linux kernel to elf.h

Linux 6.9 adds the ELF note type NT_ARM_FPMR.  Add this to glibc's
elf.h, along with the previously missed NT_ARM_SSVE, NT_ARM_ZA and
NT_ARM_ZT (added in older kernel versions).

Tested for x86_64.

3 months agostdlib: Describe __cxa_finalize usage in function comment
Florian Weimer [Mon, 3 Jun 2024 17:04:58 +0000 (19:04 +0200)]
stdlib: Describe __cxa_finalize usage in function comment

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
3 months agoelf: Avoid some free (NULL) calls in _dl_update_slotinfo
Florian Weimer [Mon, 3 Jun 2024 08:49:40 +0000 (10:49 +0200)]
elf: Avoid some free (NULL) calls in _dl_update_slotinfo

This has been confirmed to work around some interposed mallocs.  Here
is a discussion of the impact test ust/libc-wrapper/test_libc-wrapper
in lttng-tools:

  New TLS usage in libgcc_s.so.1, compatibility impact
  <https://inbox.sourceware.org/libc-alpha/8734v1ieke.fsf@oldenburg.str.redhat.com/>

Reportedly, this patch also papers over a similar issue when tcmalloc
2.9.1 is not compiled with -ftls-model=initial-exec.  Of course the
goal really should be to compile mallocs with the initial-exec TLS
model, but this commit appears to be a useful interim workaround.

Fixes commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow
tls access after dlopen [BZ #19924]").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 months agox86: Add seperate non-temporal tunable for memset
Noah Goldstein [Fri, 24 May 2024 17:38:51 +0000 (12:38 -0500)]
x86: Add seperate non-temporal tunable for memset

The tuning for non-temporal stores for memset vs memcpy is not always
the same. This includes both the exact value and whether non-temporal
stores are profitable at all for a given arch.

This patch add `x86_memset_non_temporal_threshold`. Currently we
disable non-temporal stores for non Intel vendors as the only
benchmarks showing its benefit have been on Intel hardware.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 months agox86: Improve large memset perf with non-temporal stores [RHEL-29312]
Noah Goldstein [Fri, 24 May 2024 17:38:50 +0000 (12:38 -0500)]
x86: Improve large memset perf with non-temporal stores [RHEL-29312]

Previously we use `rep stosb` for all medium/large memsets. This is
notably worse than non-temporal stores for large (above a
few MBs) memsets.
See:
https://docs.google.com/spreadsheets/d/1opzukzvum4n6-RUVHTGddV6RjAEil4P2uMjjQGLbLcU/edit?usp=sharing
For data using different stategies for large memset on ICX and SKX.

Using non-temporal stores can be up to 3x faster on ICX and 2x faster
on SKX. Historically, these numbers would not have been so good
because of the zero-over-zero writeback optimization that `rep stosb`
is able to do. But, the zero-over-zero writeback optimization has been
removed as a potential side-channel attack, so there is no longer any
good reason to only rely on `rep stosb` for large memsets. On the flip
size, non-temporal writes can avoid data in their RFO requests saving
memory bandwidth.

All of the other changes to the file are to re-organize the
code-blocks to maintain "good" alignment given the new code added in
the `L(stosb_local)` case.

The results from running the GLIBC memset benchmarks on TGL-client for
N=20 runs:

Geometric Mean across the suite New / Old EXEX256: 0.979
Geometric Mean across the suite New / Old EXEX512: 0.979
Geometric Mean across the suite New / Old AVX2   : 0.986
Geometric Mean across the suite New / Old SSE2   : 0.979

Most of the cases are essentially unchanged, this is mostly to show
that adding the non-temporal case didn't add any regressions to the
other cases.

The results on the memset-large benchmark suite on TGL-client for N=20
runs:

Geometric Mean across the suite New / Old EXEX256: 0.926
Geometric Mean across the suite New / Old EXEX512: 0.925
Geometric Mean across the suite New / Old AVX2   : 0.928
Geometric Mean across the suite New / Old SSE2   : 0.924

So roughly a 7.5% speedup. This is lower than what we see on servers
(likely because clients typically have faster single-core bandwidth so
saving bandwidth on RFOs is less impactful), but still advantageous.

Full test-suite passes on x86_64 w/ and w/o multiarch.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 months agoelf: add note identifier for dlopen metadata
Luca Boccassi [Wed, 15 May 2024 00:10:35 +0000 (01:10 +0100)]
elf: add note identifier for dlopen metadata

This new note type is defined at https://systemd.io/ELF_DLOPEN_METADATA/
and is used to list shared library dependencies loaded via dlopen().
Distro packagers can use this, via tools like those available at
https://github.com/systemd/package-notes to automatically generate
dependencies when building projects that make use of this
specification.

By defining the note id here we can use it in other projects as a
stable identifier, for example in 'readelf' to pretty-print its
content.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
3 months agoelf: update NT_FDO_PACKAGING_METADATA spec URL
Luca Boccassi [Wed, 15 May 2024 00:10:34 +0000 (01:10 +0100)]
elf: update NT_FDO_PACKAGING_METADATA spec URL

Page was renamed some time ago, there's a redirect but better
to point to the right one

Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
4 months agoLoongArch: Use "$fcsr0" instead of "$r0" in _FPU_{GET,SET}CW
Xi Ruoyao [Mon, 29 Apr 2024 07:26:24 +0000 (15:26 +0800)]
LoongArch: Use "$fcsr0" instead of "$r0" in _FPU_{GET,SET}CW

Clang inline-asm parser does not allow using "$r0" in
movfcsr2gr/movgr2fcsr, so everything using _FPU_{GET,SET}CW is now
failing to build with Clang on LoongArch.  As we now requires Binutils
>= 2.41 which supports using "$fcsr0" here, use it instead of "$r0" to
fix the issue.

Link: https://github.com/loongson-community/discussions/issues/53#issuecomment-2081507390
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4142b2368353
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
4 months agox86_64: Reformat elf_machine_rela
Xin Wang [Mon, 27 May 2024 19:06:41 +0000 (03:06 +0800)]
x86_64: Reformat elf_machine_rela

A space is added before the left bracket of the x86_64 elf_machine_rela
function, in order to harmonize with the rest of the implementation of
the function and to make it easier to retrieve the function. The lines
where the function definition is located has been re-indented, as well
as its left curly bracket placed in the correct position.

Signed-off-by: Xin Wang <yw987194828@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agoi386: Disable Intel Xeon Phi tests for GCC 15 and above (BZ 31782)
Sunil K Pandey [Mon, 27 May 2024 17:08:18 +0000 (10:08 -0700)]
i386: Disable Intel Xeon Phi tests for GCC 15 and above (BZ 31782)

This patch disables Intel Xeon Phi tests for GCC 15 and above.

GCC 15 removed Intel Xeon Phi ISA support.
commit e1a7e2c54d52d0ba374735e285b617af44841ace
Author: Haochen Jiang <haochen.jiang@intel.com>
Date:   Mon May 20 10:43:44 2024 +0800

    i386: Remove Xeon Phi ISA support

Fixes BZ 31782.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agodifftime is pure, not const
Paul Eggert [Mon, 27 May 2024 00:37:17 +0000 (17:37 -0700)]
difftime is pure, not const

Because difftime's behavior depends on the floating-point environment,
the function is pure, not const (BZ 31802).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agoparse_fdinfo: Don't advance pointer twice [BZ #31798]
H.J. Lu [Sat, 25 May 2024 12:13:41 +0000 (05:13 -0700)]
parse_fdinfo: Don't advance pointer twice [BZ #31798]

pidfd_getpid.c has

      /* Ignore invalid large values.  */
      if (INT_MULTIPLY_WRAPV (10, n, &n)
          || INT_ADD_WRAPV (n, *l++ - '0', &n))
        return -1;

For GCC older than GCC 7, INT_ADD_WRAPV(a, b, r) is defined as

   _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW)

and *l++ - '0' is evaluated twice.  Fix BZ #31798 by moving "l++" out of
the if statement.  Tested with GCC 6.4 and GCC 14.1.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agoelf/Makefile: Split and sort PIE tests
H.J. Lu [Sat, 25 May 2024 21:53:30 +0000 (14:53 -0700)]
elf/Makefile: Split and sort PIE tests

Put each item on a separate line and sort PIE tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 months agoRevert "Test fscanf of long double without <stdio.h>"
H.J. Lu [Fri, 24 May 2024 23:24:49 +0000 (16:24 -0700)]
Revert "Test fscanf of long double without <stdio.h>"

This reverts commit 30a745450e01e4c6f484dc691c16a54a6ea72288.

On ppc64le, without <stdio.h>, vfscanf is used and with <stdio.h>
__isoc23_vfscanfieee128 is used.  I am reverting this since it doesn't
work on all targets.

4 months agosysdeps/ieee754/ldbl-opt/Makefile: Split and sort libnldbl-calls
H.J. Lu [Fri, 24 May 2024 17:25:40 +0000 (10:25 -0700)]
sysdeps/ieee754/ldbl-opt/Makefile: Split and sort libnldbl-calls

Put each item on a separate line and sort libnldbl-calls.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 months agoTest fscanf of long double without <stdio.h>
H.J. Lu [Fri, 24 May 2024 15:00:34 +0000 (08:00 -0700)]
Test fscanf of long double without <stdio.h>

Add a test for fscanf of long double without including <stdio.h>.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
4 months agosysdeps/ieee754/ldbl-opt/Makefile: Remove test-nldbl-redirect-static
H.J. Lu [Fri, 24 May 2024 13:36:18 +0000 (06:36 -0700)]
sysdeps/ieee754/ldbl-opt/Makefile: Remove test-nldbl-redirect-static

Remove $(objpfx)test-nldbl-redirect-static checked in by accident.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 months agosysdeps/ieee754/ldbl-opt/Makefile: Split and sort tests
H.J. Lu [Fri, 24 May 2024 13:30:57 +0000 (06:30 -0700)]
sysdeps/ieee754/ldbl-opt/Makefile: Split and sort tests

Put each test on a separate line and sort tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 months agos390x: Regenerate ULPs.
Stefan Liebler [Fri, 24 May 2024 07:53:49 +0000 (09:53 +0200)]
s390x: Regenerate ULPs.

Needed due to:
"Implement C23 log2p1"
commit ID 79c52daf4740b00bef43e4f5a4281b3480459b38

4 months agopowerpc: Remove duplicated versionsort from libm.a (BZ 31789)
Adhemerval Zanella [Thu, 23 May 2024 16:04:43 +0000 (13:04 -0300)]
powerpc: Remove duplicated versionsort from libm.a (BZ 31789)

The powerpc32 have an extra versionsort provided by LFS
versionsort64.o.  It seems that 5226a81f5517bcbc892679cca792006a6bafc53f
used the wrong check to create the alias for the LFS to non-LFS version.
It should not matter for _DIRENT_MATCHES_DIRENT64 since both symbols
have the same implementation.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agoUpdate kernel version to 6.9 in header constant tests
Joseph Myers [Thu, 23 May 2024 14:04:48 +0000 (14:04 +0000)]
Update kernel version to 6.9 in header constant tests

This patch updates the kernel version in the tests tst-mman-consts.py
and tst-mount-consts.py to 6.9.  (There are no new constants covered
by these tests in 6.9 that need any other header changes;
tst-pidfd-consts.py was updated separately along with adding new
constants relevant to that test.)

Tested with build-many-glibcs.py.

4 months agolocaledata: cv_RU: update translation
Mike FABIAN [Wed, 22 May 2024 15:42:18 +0000 (17:42 +0200)]
localedata: cv_RU: update translation

Resolves: BZ # 21271

4 months agomath: Provide missing math symbols on libc.a (BZ 31781)
Adhemerval Zanella [Wed, 22 May 2024 18:07:12 +0000 (15:07 -0300)]
math: Provide missing math symbols on libc.a (BZ 31781)

The libc.a for alpha, s390, and sparcv9 does not provide
copysignf64x, copysignf128, frexpf64x, frexpf128, modff64x, and
modff128.

Checked with a static build for the affected ABIs.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agos390: Make utmp32, utmpx32, and login32 shared only (BZ 31790)
Adhemerval Zanella [Wed, 22 May 2024 17:29:49 +0000 (14:29 -0300)]
s390: Make utmp32, utmpx32, and login32 shared only (BZ 31790)

The function that work with 'struct utmp32' and 'struct utmpx32'
are only for compat symbols.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agomicroblaze: Remove cacheflush from libc.a (BZ 31788)
Adhemerval Zanella [Wed, 22 May 2024 16:09:36 +0000 (13:09 -0300)]
microblaze: Remove cacheflush from libc.a (BZ 31788)

microblaze does not export it in libc.so nor the kernel provides the
cacheflush syscall.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agopowerpc: Remove duplicated llrintf and llrintf32 from libm.a (BZ 31787)
Adhemerval Zanella [Wed, 22 May 2024 14:49:10 +0000 (11:49 -0300)]
powerpc: Remove duplicated llrintf and llrintf32 from libm.a (BZ 31787)

Both the generic and POWER6 versions provide definitions of the
symbol, which are already provided by the ifunc resolver.

Checked on powerpc-linux-gnu-power4.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agopowerpc: Remove duplicate strchrnul and strncasecmp_l libc.a (BZ 31786)
Adhemerval Zanella [Wed, 22 May 2024 14:32:04 +0000 (11:32 -0300)]
powerpc: Remove duplicate strchrnul and strncasecmp_l libc.a (BZ 31786)

For powerpc64 the generic version provides a weak definition of
strchrnul, which are already provided by the ifunc resolver.  The
powerpc32 version is slight different, where for static case there
is no iFUNC support.

The strncasecmp_l is provided ifunc resolver.

Checked on powerpc-linux-gnu-power4 and powerpc64-linux-gnu.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agoloongarch: Remove duplicate strnlen in libc.a (BZ 31785)
Adhemerval Zanella [Wed, 22 May 2024 13:21:10 +0000 (10:21 -0300)]
loongarch: Remove duplicate strnlen in libc.a (BZ 31785)

The generic version provides weak definitions of strnlen,
which are already provided by the ifunc resolver.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agoaarch64: Remove duplicate memchr/strlen in libc.a (BZ 31777)
Adhemerval Zanella [Wed, 22 May 2024 13:13:21 +0000 (10:13 -0300)]
aarch64: Remove duplicate memchr/strlen in libc.a (BZ 31777)

The generic version provides weak definitions of memchr/strlen,
which are already provided by the ifunc resolvers.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agoUpdate PIDFD_* constants for Linux 6.9
Joseph Myers [Thu, 23 May 2024 12:22:40 +0000 (12:22 +0000)]
Update PIDFD_* constants for Linux 6.9

Linux 6.9 adds some more PIDFD_* constants.  Add them to glibc's
sys/pidfd.h, including updating comments that said FLAGS was reserved
and must be 0, along with updating tst-pidfd-consts.py.

Tested with build-many-glibcs.py.

4 months agoDefine write_profiling functions only in profile library [BZ #31756]
H.J. Lu [Mon, 20 May 2024 01:46:53 +0000 (18:46 -0700)]
Define write_profiling functions only in profile library [BZ #31756]

libc.so doesn't use nor export write_profiling functions.  There is no
point to define them in libc.so nor in libc.a.  Fix BZ #31756 by defining
them only in profile library.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agoDon't provide XXXf128_do_not_use aliases [BZ #31757]
H.J. Lu [Mon, 20 May 2024 12:25:34 +0000 (05:25 -0700)]
Don't provide XXXf128_do_not_use aliases [BZ #31757]

Don't provide __nexttowardf128_do_not_use, nexttowardf128_do_not_use,
finitef128_do_not_use, isinff128_do_not_use and isnanf128_do_not_use.
This fixes BZ #31757.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agoDon't provide scalb/significand _FloatN aliases [BZ #31760]
H.J. Lu [Mon, 20 May 2024 16:56:36 +0000 (09:56 -0700)]
Don't provide scalb/significand _FloatN aliases [BZ #31760]

scalb is a deprecated interface which was obsolescent in POSIX.1-2001,
removed in POSIX.1-2008, never made to C standard.  significant was
originally from BSD and never made in any standard.  Fix BZ #31760 by
not providing _FloatN aliases for them.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agomath: Fix isnanf128 static build (BZ 31774)
Adhemerval Zanella [Tue, 21 May 2024 16:52:54 +0000 (13:52 -0300)]
math: Fix isnanf128 static build (BZ 31774)

Some static implementation of float128 routines might call __isnanf128,
which is not provided by the static object.

Checked on x86_64-linux-gnu.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agomath: Add support for auto static math tests
Adhemerval Zanella [Tue, 21 May 2024 16:52:53 +0000 (13:52 -0300)]
math: Add support for auto static math tests

It basically copy the already in place rules for dynamic tests for
auto-generated math functions for all support types.  To avoid the
need to duplicate .inc files, a .SECONDEXPANSION rules is adeed for
the gen-libm-test.py generation.

New tests are added on the new rules 'libm-test-funcs-auto-static',
'libm-test-funcs-noauto-static', and 'libm-test-funcs-narrow-static';
similar to the non-static counterparts.

To avoid add extra build and disk requirement, the new math static
tests are only enable with a new define 'build-math-static-tests'.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agoChange _IO_stderr_/_IO_stdin_/_IO_stdout to compat symbols [BZ #31766]
H.J. Lu [Tue, 21 May 2024 02:30:58 +0000 (19:30 -0700)]
Change _IO_stderr_/_IO_stdin_/_IO_stdout to compat symbols [BZ #31766]

Since Glibc never provides symbol binary compatibility for relocatable
files, fix BZ #31766 by changing _IO_stderr_/_IO_stdin_/_IO_stdout to
compat symbols.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
4 months agoObsolete _dl_mcount_wrapper in glibc 2.40 [BZ #31765]
H.J. Lu [Tue, 21 May 2024 02:37:20 +0000 (19:37 -0700)]
Obsolete _dl_mcount_wrapper in glibc 2.40 [BZ #31765]

There is no _dl_mcount_wrapper prototype in any installed header files.
Fix BZ #31765 by changing _dl_mcount_wrapper to a compat symbol and
obsolete it in glibc 2.40.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
4 months agomath: Fix i386 and m68k exp10 on static build (BZ 31775)
Adhemerval Zanella [Wed, 20 Mar 2024 14:31:54 +0000 (11:31 -0300)]
math: Fix i386 and m68k exp10 on static build (BZ 31775)

The commit 08ddd26814 removed the static exp10 on i386 and m68k with an
empty w_exp10.c (required for the ABIs that uses the newly
implementation).  This patch fixes by adding the required symbols on the
arch-specific w_exp{f}_compat.c implementation.

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

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
4 months agomath: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
Adhemerval Zanella [Thu, 14 Mar 2024 17:59:35 +0000 (14:59 -0300)]
math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)

The commit 16439f419b removed the static fmod/fmodf on i386 and m68k
with and empty w_fmod.c (required for the ABIs that uses the newly
implementation).  This patch fixes by adding the required symbols on
the arch-specific w_fmod{f}_compat.c implementation.

To statically build fmod fails on some ABI (alpha, s390, sparc) because
it does not export the ldexpf128, this is also fixed by this patch.

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

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
4 months agoRemove the clone3 symbol from libc.a [BZ #31770]
H.J. Lu [Tue, 21 May 2024 12:28:29 +0000 (05:28 -0700)]
Remove the clone3 symbol from libc.a [BZ #31770]

clone3 isn't exported from glibc and is hidden in libc.so.  Fix BZ #31770
by removing clone3 alias.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agoaarch64/fpu: Add vector variants of pow
Joe Ramsay [Thu, 16 May 2024 08:21:24 +0000 (09:21 +0100)]
aarch64/fpu: Add vector variants of pow

Plus a small amount of moving includes around in order to be able to
remove duplicate definition of asuint64.

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
4 months agoCompile libmvec with -fno-math-errno
Joe Ramsay [Thu, 16 May 2024 08:16:36 +0000 (09:16 +0100)]
Compile libmvec with -fno-math-errno

Rounding intrinsics may not be inlined without
-fno-math-errno. libmvec is free to do what it
likes with errno, so disable it for better
performance.

Tested with no regression on aarch64 and x86_64.

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
4 months agomanual: clarify defintions of floating point exponent bounds (bug 31518)
Andreas Schwab [Wed, 8 May 2024 14:55:40 +0000 (16:55 +0200)]
manual: clarify defintions of floating point exponent bounds (bug 31518)

For decimal exponent bounds the range is inclusive, for binary exponent
bounds the range is exclusive.

4 months agoLoongArch: Update ulps
caiyinyu [Tue, 21 May 2024 04:06:41 +0000 (12:06 +0800)]
LoongArch: Update ulps

For the log2p1 implementation.

4 months agoLoongArch: Fix tst-gnu2-tls2 compiler error
mengqinggang [Mon, 20 May 2024 09:05:12 +0000 (17:05 +0800)]
LoongArch: Fix tst-gnu2-tls2 compiler error

Add -mno-lsx to tst-gnu2-tlsmod*.c if gcc support -mno-lsx.
Add escape character '\' in vector support test function.

4 months agoresolv: Make _res_opcodes a compat symbol [BZ #31764]
H.J. Lu [Mon, 20 May 2024 20:49:10 +0000 (13:49 -0700)]
resolv: Make _res_opcodes a compat symbol [BZ #31764]

_res_opcodes was exported by accident as a variable.  Fix BZ #31764 by
making _res_opcodes a compat symbol.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
4 months agoi386: Don't define stpncpy alias when used in IFUNC [BZ #31768]
H.J. Lu [Tue, 21 May 2024 00:32:14 +0000 (17:32 -0700)]
i386: Don't define stpncpy alias when used in IFUNC [BZ #31768]

Fix BZ #31768 by not defining stpncpy alias when used in IFUNC.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
4 months agopowerpc: Update ulps
Adhemerval Zanella [Mon, 20 May 2024 15:56:49 +0000 (15:56 +0000)]
powerpc: Update ulps

For the log2p1 implementation.

4 months agoarm: Update ulps
Adhemerval Zanella [Mon, 20 May 2024 15:54:31 +0000 (15:54 +0000)]
arm: Update ulps

For the log2p1 implementation.

4 months agoaarch64: Update ulps
Adhemerval Zanella [Mon, 20 May 2024 15:52:18 +0000 (15:52 +0000)]
aarch64: Update ulps

For the log2p1 implementation.

4 months agomath: Add more details to the test driver output.
Joe Simmons-Talbott [Mon, 20 May 2024 14:09:35 +0000 (14:09 +0000)]
math: Add more details to the test driver output.

Add start and end indicators that identify the test being run in the
verbose output.  Better identify the tests for max errors in the
summary output.  Count each exception checked for each test. Remove
double counting of tests for the check_<type> functions other than
check_float_internal. Rename print_max_error and
print_complex_max_error to check_max_error and check_complex_max_error
respectively since they have side effects.

Co-Authored-By: Carlos O'Donell <carlos@redhat.com>
Reviewed-By: Joseph Myers <josmyers@redhat.com>
4 months agoImplement C23 log2p1
Joseph Myers [Mon, 20 May 2024 13:41:39 +0000 (13:41 +0000)]
Implement C23 log2p1

C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the log2p1 functions (log2(1+x): like log1p, but for
base-2 logarithms).

This illustrates the intended structure of implementations of all
these function families: define them initially with a type-generic
template implementation.  If someone wishes to add type-specific
implementations, it is likely such implementations can be both faster
and more accurate than the type-generic one and can then override it
for types for which they are implemented (adding benchmarks would be
desirable in such cases to demonstrate that a new implementation is
indeed faster).

The test inputs are copied from those for log1p.  Note that these
changes make gen-auto-libm-tests depend on MPFR 4.2 (or later).

The bulk of the changes are fairly generic for any such new function.
(sysdeps/powerpc/nofpu/Makefile only needs changing for those
type-generic templates that use fabs.)

Tested for x86_64 and x86, and with build-many-glibcs.py.

4 months agoUpdate syscall lists for Linux 6.9
Joseph Myers [Mon, 20 May 2024 13:10:31 +0000 (13:10 +0000)]
Update syscall lists for Linux 6.9

Linux 6.9 has no new syscalls.  Update the version number in
syscall-names.list to reflect that it is still current for 6.9.

Tested with build-many-glibcs.py.

4 months agoRename procutils_read_file to __libc_procutils_read_file [BZ #31755]
H.J. Lu [Mon, 20 May 2024 01:46:36 +0000 (18:46 -0700)]
Rename procutils_read_file to __libc_procutils_read_file [BZ #31755]

Fix BZ #31755 by renaming the internal function procutils_read_file to
__libc_procutils_read_file.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agonearbyint: Don't define alias when used in IFUNC [BZ #31759]
H.J. Lu [Sun, 19 May 2024 23:36:01 +0000 (16:36 -0700)]
nearbyint: Don't define alias when used in IFUNC [BZ #31759]

Fix BZ #31759 by not defining nearbyint aliases when used in IFUNC.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
4 months agoPass -nostdlib -nostartfiles together with -r [BZ #31753]
H.J. Lu [Sat, 18 May 2024 03:00:38 +0000 (20:00 -0700)]
Pass -nostdlib -nostartfiles together with -r [BZ #31753]

Since -r in GCC 6/7/8 doesn't imply -nostdlib -nostartfiles, update the
link-static-libc.out rule to also pass -nostdlib -nostartfiles.  This
fixes BZ #31753.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 months agosocket: Use may_alias on sockaddr structs (bug 19622)
Florian Weimer [Sat, 18 May 2024 07:33:19 +0000 (09:33 +0200)]
socket: Use may_alias on sockaddr structs (bug 19622)

This supports common coding patterns.  The GCC C front end before
version 7 rejects the may_alias attribute on a struct definition
if it was not present in a previous forward declaration, so this
attribute can only be conditionally applied.

This implements the spirit of the change in Austin Group issue 1641.

Suggested-by: Marek Polacek <polacek@redhat.com>
Suggested-by: Jakub Jelinek <jakub@redhat.com>
Reviewed-by: Sam James <sam@gentoo.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 months agoUse a doubly-linked list for _IO_list_all (bug 27777)
Alexandre Ferrieux [Thu, 16 May 2024 12:54:30 +0000 (05:54 -0700)]
Use a doubly-linked list for _IO_list_all (bug 27777)

This patch fixes BZ #27777 "fclose does a linear search, takes ages when
many FILE* are opened".  Simply put, the master list of opened (FILE*),
namely _IO_list_all, is a singly-linked list.  As a consequence, the
removal of a single element is in O(N), which cripples the performance
of fclose().  The patch switches to a doubly-linked list, yielding O(1)
removal.  The one padding field in struct _IO_FILE, __pad5, is renamed
to _prevchain for a doubly-linked list.  Since fields in struct _IO_FILE
after the _lock field are internal to glibc and opaque to applications.
We can change them as long as the size of struct _IO_FILE is unchanged,
which is checked as the part of glibc ABI with sizes of _IO_2_1_stdin_,
_IO_2_1_stdout_ and _IO_2_1_stderr_.

NB: When _IO_vtable_offset (fp) == 0, copy relocation will cover the
whole struct _IO_FILE.  Otherwise, only fields up to the _lock field
will be copied to applications at run-time.  It is used to check if
the _prevchain field can be safely accessed.

After opening 2 million (FILE*), the fclose() of 100 of them takes quite
a few seconds without the patch, and under 2 seconds with it on a loaded
machine.

No test is added since there are no functional changes.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Alexandre Ferrieux <alexandre.ferrieux@orange.com>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 months agopowerpc64: Fix by using the configure value $libc_cv_cc_submachine [BZ #31629]
Manjunath Matti [Thu, 16 May 2024 22:24:36 +0000 (17:24 -0500)]
powerpc64: Fix by using the configure value $libc_cv_cc_submachine [BZ #31629]

This patch ensures that $libc_cv_cc_submachine, which is set from
"--with-cpu", overrides $CFLAGS for configure time tests.

Suggested-by: Peter Bergner <bergner@linux.ibm.com>
Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
4 months agobenchtests: Add fclose benchmark
H.J. Lu [Thu, 16 May 2024 15:08:42 +0000 (08:08 -0700)]
benchtests: Add fclose benchmark

Measure duration of 100 fclose calls after opening 1 million FILEs.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 months agoaarch64/fpu: Add vector variants of cbrt
Joe Ramsay [Tue, 30 Apr 2024 12:49:59 +0000 (13:49 +0100)]
aarch64/fpu: Add vector variants of cbrt

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
4 months agoaarch64/fpu: Add vector variants of hypot
Joe Ramsay [Tue, 30 Apr 2024 12:49:58 +0000 (13:49 +0100)]
aarch64/fpu: Add vector variants of hypot

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
4 months agoUse Linux 6.9 in build-many-glibcs.py
Joseph Myers [Thu, 16 May 2024 10:49:30 +0000 (10:49 +0000)]
Use Linux 6.9 in build-many-glibcs.py

This patch makes build-many-glibcs.py use Linux 6.9.

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

4 months agolocaledata: Fix several issues with the set of characters considered 0-width [BZ...
Jules Bertholet [Fri, 23 Feb 2024 20:54:57 +0000 (20:54 +0000)]
localedata: Fix several issues with the set of characters considered 0-width [BZ #31370]

= `Default_Ignorable_Code_Point`s should have width 0 =

Unicode specifies (https://www.unicode.org/faq/unsup_char.html#3) that characters
with the `Default_Ignorable_Code_Point` property

> should be rendered as completely invisible (and non advancing, i.e. “zero width”),
if not explicitly supported in rendering.

Hence, `wcwidth()` should give them all a width of 0, with two exceptions:

- the soft hyphen (U+00AD SOFT HYPHEN) is assigned width 1 by longstanding precedent
- U+115F HANGUL CHOSEONG FILLER needs a carveout
  due to the unique behavior of the conjoining Korean jamo characters.
  One composed Hangul "syllable block" like 퓛
  is made up of two to three individual component characters, or "jamo".
  These are all assigned an `East_Asian_Width` of `Wide`
  by Unicode, which would normally mean they would all be assigned
  width 2 by glibc; a combination of (leading choseong jamo) +
  (medial jungseong jamo) + (trailing jongseong jamo) would then have width 2 + 2 + 2 = 6.
  However, glibc (and other wcwidth implementations) special-cases jungseong and jongseong,
  assigning them all width 0,
  to ensure that the complete block has width 2 + 0 + 0 = 2 as it should.
  U+115F is meant for use in syllable blocks
  that are intentionally missing a leading jamo;
  it must be assigned a width of 2 even though it has no visible display
  to ensure that the complete block has width 2.

However, `wcwidth()` currently (before this patch)
incorrectly assigns non-zero width to
U+3164 HANGUL FILLER and U+FFA0 HALFWIDTH HANGUL FILLER;
this commit fixes that.

Unicode spec references:
- Hangul:  §3.12 https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf#G24646 and
  §18.6 https://www.unicode.org/versions/Unicode15.0.0/ch18.pdf#G31028
- `Default_Ignorable_Code_Point`: §5.21 https://www.unicode.org/versions/Unicode15.0.0/ch05.pdf#G40095.

= Non-`Default_Ignorable_Code_Point` format controls should be visible =

The Unicode Standard, §5.21 - Characters Ignored for Display
(https://www.unicode.org/versions/Unicode15.0.0/ch05.pdf#G40095)
says the following:

> A small number of format characters (General_Category = Cf )
> are also not given the Default_Ignorable_Code_Point property.
> This may surprise implementers, who often assume
> that all format characters are generally ignored in fallback display.
> The exact list of these exceptional format characters
> can be found in the Unicode Character Database.
> There are, however, three important sets of such format characters to note:
>
> - prepended concatenation marks
> - interlinear annotation characters
> - Egyptian hieroglyph format controls
>
> The prepended concatenation marks always have a visible display.
> See “Prepended Concatenation Marks” in [*Section 23.2, Layout Controls*](https://www.unicode.org/versions/Unicode15.1.0/ch23.pdf#M9.35858.HeadingBreak.132.Layout.Controls)
> for more discussion of the use and display of these signs.
>
> The other two notable sets of format characters that exceptionally are not ignored
> in fallback display consist of the interlinear annotation characters,
> U+FFF9 INTERLINEAR ANNOTATION ANCHOR through
> U+FFFB INTERLINEAR ANNOTATION TERMINATOR,
> and the Egyptian hieroglyph format controls,
> U+13430 EGYPTIAN HIEROGLYPH VERTICAL JOINER through
> U+1343F EGYPTIAN HIEROGLYPH END WALLED ENCLOSURE.
> These characters should have a visible glyph display for fallback rendering,
> because if they are not displayed,
> it is too easy to misread the resulting displayed text.
> See “Annotation Characters” in [*Section 23.8, Specials*](https://www.unicode.org/versions/Unicode15.1.0/ch23.pdf#M9.21335.Heading.133.Specials),
> as well as [*Section 11.4, Egyptian Hieroglyphs*](https://www.unicode.org/versions/Unicode15.1.0/ch11.pdf#M9.73291.Heading.1418.Egyptian.Hieroglyphs)
> for more discussion of the use and display of these characters.

glibc currently correctly assigns non-zero width to the prepended concatenation marks,
but it incorrectly gives zero width to the interlinear annotation characters
(which a generic terminal cannot interpret)
and the Egyptian hieroglyph format controls
(which are not widely supported in rendering implementations at present).
This commit fixes both these issues as well.

= Derive Hangul syllable type from Unicode data =

Previosuly, the jungseong and jongseong jamo ranges
were hard-coded into the script. With this commit, they are instead parsed
from the HangulSyllableType.txt data file published by Unicode.
This does not affect the end result.

Signed-off-by: Jules Bertholet <julesbertholet@quoi.xyz>
4 months agoLoongArch: Add support for TLS Descriptors
mengqinggang [Wed, 8 May 2024 02:06:15 +0000 (10:06 +0800)]
LoongArch: Add support for TLS Descriptors

This is mostly based on AArch64 and RISC-V implementation.

Add R_LARCH_TLS_DESC32 and R_LARCH_TLS_DESC64 relocations.

For _dl_tlsdesc_dynamic function slow path, temporarily save and restore
all vector registers.

4 months agomath: Add GLIBC_TEST_LIBM_VERBOSE environment variable support.
Joe Talbott [Tue, 14 May 2024 14:39:38 +0000 (14:39 +0000)]
math: Add GLIBC_TEST_LIBM_VERBOSE environment variable support.

Allow the libm-test-driver based tests to have their verbosity set based
on the GLIBC_TEST_LIBM_VERBOSE environment variable.  This allows the entire
testsuite to be run with a non-default verbosity.

While here check the conversion for the verbose option as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 months agomalloc: Improve aligned_alloc and calloc test coverage.
Joe Simmons-Talbott [Tue, 14 May 2024 14:36:50 +0000 (14:36 +0000)]
malloc: Improve aligned_alloc and calloc test coverage.

Add a DSO (malloc/tst-aligned_alloc-lib.so) that can be used during
testing to interpose malloc with a call that randomly uses either
aligned_alloc, __libc_malloc, or __libc_calloc in the place of malloc.
Use LD_PRELOAD with the DSO to mirror malloc/tst-malloc.c testing as an
example in malloc/tst-malloc-random.c.  Add malloc/tst-aligned-alloc-random.c
as another example that does a number of malloc calls with randomly sized,
but limited to 0xffff, requests.

The intention is to be able to utilize existing malloc testing to ensure
that similar allocation APIs are also exposed to the same rigors.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 months agoaarch64: Fix AdvSIMD libmvec routines for big-endian
Joe Ramsay [Thu, 2 May 2024 15:43:13 +0000 (16:43 +0100)]
aarch64: Fix AdvSIMD libmvec routines for big-endian

Previously many routines used * to load from vector types stored
in the data table. This is emitted as ldr, which byte-swaps the
entire vector register, and causes bugs for big-endian when not
all lanes contain the same value. When a vector is to be used
this way, it has been replaced with an array and the load with an
explicit ld1 intrinsic, which byte-swaps only within lanes.

As well, many routines previously used non-standard GCC syntax
for vector operations such as indexing into vectors types with []
and assembling vectors using {}. This syntax should not be mixed
with ACLE, as the former does not respect endianness whereas the
latter does. Such examples have been replaced with, for instance,
vcombine_* and vgetq_lane* intrinsics. Helpers which only use the
GCC syntax, such as the v_call helpers, do not need changing as
they do not use intrinsics.

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
4 months agoUnify output from backtrace_symbols_fd with backtrace_symbols (bug 31730)
Andreas Schwab [Mon, 13 May 2024 10:35:48 +0000 (12:35 +0200)]
Unify output from backtrace_symbols_fd with backtrace_symbols (bug 31730)

4 months agomanual: add dup3
DJ Delorie [Fri, 10 May 2024 21:34:29 +0000 (17:34 -0400)]
manual: add dup3

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 months agolibio/bug-wsetpos: Make the error message match the causing function
Maciej W. Rozycki [Mon, 13 May 2024 11:50:48 +0000 (12:50 +0100)]
libio/bug-wsetpos: Make the error message match the causing function

This test case calls `fopen':

  FILE *fp = fopen (temp_file, "r");

however if that fails it reports `fdopen' being the origin of the error.
Adjust the message to say `fopen' then.

4 months agomalloc/Makefile: Split and sort tests
H.J. Lu [Fri, 10 May 2024 03:27:39 +0000 (20:27 -0700)]
malloc/Makefile: Split and sort tests

Put each test on a separate line and sort tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 months agoForce DT_RPATH for --enable-hardcoded-path-in-tests
H.J. Lu [Fri, 10 May 2024 03:07:01 +0000 (20:07 -0700)]
Force DT_RPATH for --enable-hardcoded-path-in-tests

On Fedora 40/x86-64, linker enables --enable-new-dtags by default which
generates DT_RUNPATH instead of DT_RPATH.  Unlike DT_RPATH, DT_RUNPATH
only applies to DT_NEEDED entries in the executable and doesn't applies
to DT_NEEDED entries in shared libraries which are loaded via DT_NEEDED
entries in the executable.  Some glibc tests have libstdc++.so.6 in
DT_NEEDED, which has libm.so.6 in DT_NEEDED.  When DT_RUNPATH is generated,
/lib64/libm.so.6 is loaded for such tests.  If the newly built glibc is
older than glibc 2.36, these tests fail with

assert/tst-assert-c++: /export/build/gnu/tools-build/glibc-gitlab-release/build-x86_64-linux/libc.so.6: version `GLIBC_2.36' not found (required by /lib64/libm.so.6)
assert/tst-assert-c++: /export/build/gnu/tools-build/glibc-gitlab-release/build-x86_64-linux/libc.so.6: version `GLIBC_ABI_DT_RELR' not found (required by /lib64/libm.so.6)

Pass -Wl,--disable-new-dtags to linker when building glibc tests with
--enable-hardcoded-path-in-tests.  This fixes BZ #31719.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 months agopowerpc: Fix __fesetround_inline_nocheck on POWER9+ (BZ 31682)
Adhemerval Zanella [Tue, 7 May 2024 12:19:48 +0000 (09:19 -0300)]
powerpc: Fix __fesetround_inline_nocheck on POWER9+ (BZ 31682)

The e68b1151f7460d5fa88c3a567c13f66052da79a7 commit changed the
__fesetround_inline_nocheck implementation to use mffscrni
(through __fe_mffscrn) instead of mtfsfi.  For generic powerpc
ceil/floor/trunc, the function is supposed to disable the
floating-point inexact exception enable bit, however mffscrni
does not change any exception enable bits.

This patch fixes by reverting the optimization for the
__fesetround_inline_nocheck.

Checked on powerpc-linux-gnu.
Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
4 months agox86_64: Fix missing wcsncat function definition without multiarch (x86-64-v4)
Gabi Falk [Tue, 7 May 2024 18:25:00 +0000 (18:25 +0000)]
x86_64: Fix missing wcsncat function definition without multiarch (x86-64-v4)

This code expects the WCSCAT preprocessor macro to be predefined in case
the evex implementation of the function should be defined with a name
different from __wcsncat_evex.  However, when glibc is built for
x86-64-v4 without multiarch support, sysdeps/x86_64/wcsncat.S defines
WCSNCAT variable instead of WCSCAT to build it as wcsncat.  Rename the
variable to WCSNCAT, as it is actually a better naming choice for the
variable in this case.

Reported-by: Kenton Groombridge
Link: https://bugs.gentoo.org/921945
Fixes: 64b8b6516b ("x86: Add evex optimized functions for the wchar_t strcpy family")
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
4 months agolocaledata: fix weekdays in mdf_RU locale
Mike FABIAN [Wed, 8 May 2024 07:43:17 +0000 (09:43 +0200)]
localedata: fix weekdays in mdf_RU locale

From Кирилл Изместьев <izmestevks@basealt.ru>,
see: https://sourceware.org/bugzilla/show_bug.cgi?id=31530#c6
and the following comments.

4 months agolocaledata: add mdf_RU locale
Mike FABIAN [Tue, 7 May 2024 09:12:38 +0000 (11:12 +0200)]
localedata: add mdf_RU locale

Resolves: BZ # 31530

4 months agoelf: Make glibc.rtld.enable_secure ignore alias environment variables
Adhemerval Zanella [Mon, 6 May 2024 16:18:48 +0000 (13:18 -0300)]
elf: Make glibc.rtld.enable_secure ignore alias environment variables

Tunable with environment variables aliases are also ignored if
glibc.rtld.enable_secure is enabled.  The tunable parsing is also
optimized a bit, where the loop that checks each environment variable
only checks for the tunables with aliases instead of all tables.

Checked on aarch64-linux-gnu and x86_64-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 months agosupport: Add envp argument to support_capture_subprogram
Adhemerval Zanella [Mon, 6 May 2024 16:18:47 +0000 (13:18 -0300)]
support: Add envp argument to support_capture_subprogram

So tests can specify a list of environment variables.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 months agoelf: Remove glibc.rtld.enable_secure check from parse_tunables_string
Adhemerval Zanella [Mon, 6 May 2024 16:18:46 +0000 (13:18 -0300)]
elf: Remove glibc.rtld.enable_secure check from parse_tunables_string

And move it to parse_tunables.  It avoids a string comparison for
each tunable.

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

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 months agoelf: Only process multiple tunable once (BZ 31686)
Adhemerval Zanella [Mon, 6 May 2024 16:18:45 +0000 (13:18 -0300)]
elf: Only process multiple tunable once (BZ 31686)

The 680c597e9c3 commit made loader reject ill-formatted strings by
first tracking all set tunables and then applying them. However, it does
not take into consideration if the same tunable is set multiple times,
where parse_tunables_string appends the found tunable without checking
if it was already in the list. It leads to a stack-based buffer overflow
if the tunable is specified more than the total number of tunables.  For
instance:

  GLIBC_TUNABLES=glibc.malloc.check=2:... (repeat over the number of
  total support for different tunable).

Instead, use the index of the tunable list to get the expected tunable
entry.  Since now the initial list is zero-initialized, the compiler
might emit an extra memset and this requires some minor adjustment
on some ports.

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

Reported-by: Yuto Maeda <maeda@cyberdefense.jp>
Reported-by: Yutaro Shimizu <shimizu@cyberdefense.jp>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 months agoNEWS: Add advisories.
Carlos O'Donell [Thu, 2 May 2024 01:54:11 +0000 (21:54 -0400)]
NEWS: Add advisories.

  GLIBC-SA-2024-0004:
    ISO-2022-CN-EXT: fix out-of-bound writes when writing escape
    sequence (CVE-2024-2961)

  GLIBC-SA-2024-0005:
    nscd: Stack-based buffer overflow in netgroup cache (CVE-2024-33599)

  GLIBC-SA-2024-0006:
    nscd: Null pointer crashes after notfound response
    (CVE-2024-33600)

  GLIBC-SA-2024-0007:
    nscd: netgroup cache may terminate daemon on memory allocation
    failure (CVE-2024-33601)

  GLIBC-SA-2024-0008:
    nscd: netgroup cache assumes NSS callback uses in-buffer strings
    (CVE-2024-33602)

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 months agoDocument CVE-2024-33599, CVE-2024-33600, CVE-2024-33601, CVE-2024-33602
Carlos O'Donell [Mon, 29 Apr 2024 12:55:42 +0000 (08:55 -0400)]
Document CVE-2024-33599, CVE-2024-33600, CVE-2024-33601, CVE-2024-33602

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

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
4 months agoAdd crt1-2.0.o for glibc 2.0 compatibility tests
H.J. Lu [Tue, 30 Apr 2024 16:57:12 +0000 (09:57 -0700)]
Add crt1-2.0.o for glibc 2.0 compatibility tests

Starting from glibc 2.1, crt1.o contains _IO_stdin_used which is checked
by _IO_check_libio to provide binary compatibility for glibc 2.0.  Add
crt1-2.0.o for tests against glibc 2.0.  Define tests-2.0 for glibc 2.0
compatibility tests.  Add and update glibc 2.0 compatibility tests for
stderr, matherr and pthread_kill.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 months agopowerpc: Optimized strncmp for power10
Amrita H S [Mon, 6 May 2024 14:01:29 +0000 (09:01 -0500)]
powerpc: Optimized strncmp for power10

This patch is based on __strcmp_power10.

Improvements from __strncmp_power9:

    1. Uses new POWER10 instructions
       - This code uses lxvp to decrease contention on load
 by loading 32 bytes per instruction.

    2. Performance implication
       - This version has around 38% better performance on average.
       - Minor performance regression is seen for few small sizes
 and specific combination of alignments.

Signed-off-by: Amrita H S <amritahs@linux.ibm.com>
Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
4 months agobuild-many-glibcs.py: Add openrisc hard float glibc variant
Stafford Horne [Sat, 8 Jan 2022 06:35:24 +0000 (15:35 +0900)]
build-many-glibcs.py: Add openrisc hard float glibc variant

This adds the OpenRISC hard float glibc variant to the build many
script.  We update the compiler for glibc to support hard-float
multilibs to allow us to use a single generic compiler for all glibc
variants, this requires updating the compiler name.

Tested and all builds are passing.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agoor1k: Add hard float support
Stafford Horne [Sat, 27 Apr 2024 05:35:09 +0000 (06:35 +0100)]
or1k: Add hard float support

This patch adds hardware floating point support to OpenRISC.  Hardware
floating point toolchain builds are enabled by passing the machine
specific argument -mhard-float to gcc via CFLAGS.  With this enabled GCC
generates floating point instructions for single-precision operations
and exports __or1k_hard_float__.

There are 2 main parts to this patch.

 - Implement fenv functions to update the FPCSR flags keeping it in sync
   with sfp (software floating point).
 - Update machine context functions to store and restore the FPCSR
   state.

*On mcontext_t ABI*

This patch adds __fpcsr to mcontext_t.  This is an ABI change, but also
an ABI fix.  The Linux kernel has always defined padding in mcontext_t
that space was missing from the glibc ABI.  In Linux this unused space
has now been re-purposed for storing the FPCSR.  This patch brings
OpenRISC glibc in line with the Linux kernel and other libc
implementation (musl).

Compatibility getcontext, setcontext, etc symbols have been added to
allow for binaries expecting the old ABI to continue to work.

*Hard float ABI*

The calling conventions and types do not change with OpenRISC hard-float
so glibc hard-float builds continue to use dynamic linker
/lib/ld-linux-or1k.so.1.

*Testing*

I have tested this patch both with hard-float and soft-float builds and
the test results look fine to me.  Results are as follows:

Hard Float

    # failures
    FAIL: elf/tst-sprof-basic (Haven't figured out yet, not related to hard-float)
    FAIL: gmon/tst-gmon-pie (PIE bug in or1k toolchain)
    FAIL: gmon/tst-gmon-pie-gprof (PIE bug in or1k toolchain)
    FAIL: iconvdata/iconv-test (timeout, passed when run manually)
    FAIL: nptl/tst-cond24 (Timeout)
    FAIL: nptl/tst-mutex10 (Timeout)

    # summary
  6 FAIL
       4289 PASS
 86 UNSUPPORTED
 16 XFAIL
  2 XPASS

    # versions
    Toolchain: or1k-smhfpu-linux-gnu
    Compiler:  gcc version 14.0.1 20240324 (experimental) [master r14-9649-gbb04a11418f] (GCC)
    Binutils:  GNU assembler version 2.42.0 (or1k-smhfpu-linux-gnu) using BFD version (GNU Binutils) 2.42.0.20240324
    Linux:     Linux buildroot 6.9.0-rc1-00008-g4dc70e1aadfa #112 SMP Sat Apr 27 06:43:11 BST 2024 openrisc GNU/Linux
    Tester:    shorne
    Glibc:     2024-04-25 b62928f907 Florian Weimer   x86: In ld.so, diagnose missing APX support in APX-only builds  (origin/master, origin/HEAD)

Soft Float

    # failures
    FAIL: elf/tst-sprof-basic
    FAIL: gmon/tst-gmon-pie
    FAIL: gmon/tst-gmon-pie-gprof
    FAIL: nptl/tst-cond24
    FAIL: nptl/tst-mutex10

    # summary
  5 FAIL
       4295 PASS
 81 UNSUPPORTED
 16 XFAIL
  2 XPASS

    # versions
    Toolchain: or1k-smh-linux-gnu
    Compiler:  gcc version 14.0.1 20240324 (experimental) [master r14-9649-gbb04a11418f] (GCC)
    Binutils:  GNU assembler version 2.42.0 (or1k-smh-linux-gnu) using BFD version (GNU Binutils) 2.42.0.20240324
    Linux:     Linux buildroot 6.9.0-rc1-00008-g4dc70e1aadfa #112 SMP Sat Apr 27 06:43:11 BST 2024 openrisc GNU/Linux
    Tester:    shorne
    Glibc:     2024-04-25 b62928f907 Florian Weimer   x86: In ld.so, diagnose missing APX support in APX-only builds  (origin/master, origin/HEAD)

Documentation: https://raw.githubusercontent.com/openrisc/doc/master/openrisc-arch-1.4-rev0.pdf
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agoor1k: Add hard float libm-test-ulps
Stafford Horne [Sat, 27 Apr 2024 05:32:59 +0000 (06:32 +0100)]
or1k: Add hard float libm-test-ulps

This patch adds the ulps test file to prepare for the upcoming
hard float patch.  This is separated out to make the hard float patch
smaller.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This page took 0.088735 seconds and 5 git commands to generate.