]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
7 days agoiconv: iconv -o should not create executable files (bug 33164) release/2.41/master
Florian Weimer [Thu, 17 Jul 2025 12:44:05 +0000 (14:44 +0200)] 
iconv: iconv -o should not create executable files (bug 33164)

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

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit cdcf24ee14c27b77744ff52ab3ae852821207eb0)

7 days agoposix: Fix double-free after allocation failure in regcomp (bug 33185)
Florian Weimer [Mon, 21 Jul 2025 19:43:49 +0000 (21:43 +0200)] 
posix: Fix double-free after allocation failure in regcomp (bug 33185)

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

Reported-by: Anastasia Belova <abelova@astralinux.ru>
Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
(cherry picked from commit 7ea06e994093fa0bcca0d0ee2c1db271d8d7885d)

5 weeks 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>
(cherry picked from commit 3a3fb2ed83f79100c116c824454095ecfb335ad7)

5 weeks 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>
(cherry picked from commit 2f769cec448d84a62b7dd0d4ff56978fe22c0cd6)

6 weeks agosparc: Fix sparc32 Fix argument passing to __libc_start_main (BZ 32981)
Adhemerval Zanella [Fri, 13 Jun 2025 14:23:44 +0000 (11:23 -0300)] 
sparc: Fix sparc32 Fix argument passing to __libc_start_main (BZ 32981)

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

(cherry picked from commit 8788bd77d68c6429c7f2dcbd22765525555c3cd8)

6 weeks agoppc64le: Revert "powerpc: Optimized strcmp for power10" (CVE-2025-5702)
Carlos O'Donell [Mon, 16 Jun 2025 17:09:57 +0000 (13:09 -0400)] 
ppc64le: Revert "powerpc: Optimized strcmp for power10" (CVE-2025-5702)

This reverts commit 3367d8e180848030d1646f088759f02b8dfe0d6f

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

Tested on ppc64le without regression.

(cherry picked from commit 15808c77b35319e67ee0dc8f984a9a1a434701bc)

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

This reverts commit b9182c793caa05df5d697427c0538936e6396d4b

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

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

Tested on ppc64le without regression.

(cherry picked from commit a7877bb6685300f159fa095c9f50b22b112cddb8)

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

This reverts commit 90bcc8721ef82b7378d2b080141228660e862d56

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

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

Tested on ppc64le with no regressions.

(cherry picked from commit c22de63588df7a8a0edceea9bb02534064c9d201)

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

This reverts commit 23f0d81608d0ca6379894ef81670cf30af7fd081

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

Tested on ppc64le with no regressions.

(cherry picked from commit 63c60101ce7c5eac42be90f698ba02099b41b965)

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>
(cherry picked from commit 404526ee2e58f3c075253943ddc9988f4bd6b80c)

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>
(cherry picked from commit 35fc356fa3b4f485bd3ba3114c9f774e5df7d3c2)

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>
(cherry picked from commit f2aeb6ff941dccc4c777b5621e77addea6cc076c)

2 months agoelf: Test case for bug 32976 (CVE-2025-4802)
Florian Weimer [Tue, 20 May 2025 17:45:06 +0000 (19:45 +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>
(cherry picked from commit d8f7a79335b0d861c12c42aec94c04cd5bb181e2)

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>
(cherry picked from commit f0c09fe61678df6f7f18fe1ebff074e62fa5ca7a)

2 months agoelf: Keep using minimal malloc after early DTV resize (bug 32412)
Florian Weimer [Thu, 13 Feb 2025 20:56:52 +0000 (21:56 +0100)] 
elf: Keep using minimal malloc after early DTV resize (bug 32412)

If an auditor loads many TLS-using modules during startup, it is
possible to trigger DTV resizing.  Previously, the DTV was marked
as allocated by the main malloc afterwards, even if the minimal
malloc was still in use.  With this change, _dl_resize_dtv marks
the resized DTV as allocated with the minimal malloc.

The new test reuses TLS-using modules from other auditing tests.

Reviewed-by: DJ Delorie <dj@redhat.com>
(cherry picked from commit aa3d7bd5299b33bffc118aa618b59bfa66059bcb)

2 months agohurd: Fix tst-stack2 test build on Hurd
Adhemerval Zanella [Fri, 9 May 2025 13:19:37 +0000 (10:19 -0300)] 
hurd: Fix tst-stack2 test build on Hurd

It requires $(shared-thread-library).  Fixes 0c342594237.

Checked on a i686-gnu build.

(cherry picked from commit f66cb3c9ebcac80b3200c3aff0e3aed6111547ba)

3 months agonptl: Fix pthread_getattr_np when modules with execstack are allowed (BZ 32897)
Adhemerval Zanella [Thu, 24 Apr 2025 15:27:44 +0000 (12:27 -0300)] 
nptl: Fix pthread_getattr_np when modules with execstack are allowed (BZ 32897)

The BZ 32653 fix (12a497c716f0a06be5946cabb8c3ec22a079771e) kept the
stack pointer zeroing from make_main_stack_executable on
_dl_make_stack_executable.  However, previously the 'stack_endp'
pointed to temporary variable created before the call of
_dl_map_object_from_fd; while now we use the __libc_stack_end
directly.

Since pthread_getattr_np relies on correct __libc_stack_end, if
_dl_make_stack_executable is called (for instance, when
glibc.rtld.execstack=2 is set) __libc_stack_end will be set to zero,
and the call will always fail.

The __libc_stack_end zero was used a mitigation hardening, but since
52a01100ad011293197637e42b5be1a479a2f4ae it is used solely on
pthread_getattr_np code.  So there is no point in zeroing anymore.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Sam James <sam@gentoo.org>
(cherry picked from commit 0c3425942374e72c3bcac28b2578117d36b0f9df)

3 months agoelf: tst-audit10: split AVX512F code into dedicated functions [BZ #32882]
Aurelien Jarno [Sat, 19 Apr 2025 18:45:07 +0000 (20:45 +0200)] 
elf: tst-audit10: split AVX512F code into dedicated functions [BZ #32882]

"Recent" GCC versions (since commit fc62716fe8d1, backported to stable
branches) emit a vzeroupper instruction at the end of functions
containing AVX instructions. This causes the tst-audit10 test to fail
on CPUs lacking AVX instructions, despite the AVX512F check. The crash
occurs in the pltenter function of tst-auditmod10b.c.

Fix that by moving the code guarded by the check_avx512 function into
specific functions using the target ("avx512f") attribute. Note that
since commit 5359c3bc91cc ("x86-64: Remove compiler -mavx512f check") it
is safe to assume that the compiler has AVX512F support, thus the
__AVX512F__ checks can be dropped.

Tested on non-AVX, AVX2 and AVX512F machines.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit e78caeb4ff812ae19d24d65f4d4d48508154277b)

3 months agox86: Detect Intel Diamond Rapids
H.J. Lu [Sat, 12 Apr 2025 15:37:29 +0000 (08:37 -0700)] 
x86: Detect Intel Diamond Rapids

Detect Intel Diamond Rapids and tune it similar to Intel Granite Rapids.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
(cherry picked from commit de14f1959ee5f9b845a7cae43bee03068b8136f0)

3 months agox86: Handle unknown Intel processor with default tuning
Sunil K Pandey [Fri, 11 Apr 2025 15:52:52 +0000 (08:52 -0700)] 
x86: Handle unknown Intel processor with default tuning

Enable default tuning for unknown Intel processor.

Tested on x86, no regression.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 9f0deff558d1d6b08c425c157f50de85013ada9c)

3 months agox86: Add ARL/PTL/CWF model detection support
Sunil K Pandey [Fri, 4 Apr 2025 01:14:20 +0000 (18:14 -0700)] 
x86: Add ARL/PTL/CWF model detection support

- Add ARROWLAKE model detection.
- Add PANTHERLAKE model detection.
- Add CLEARWATERFOREST model detection.

Intel® Architecture Instruction Set Extensions Programming Reference
https://cdrdv2.intel.com/v1/dl/getContent/671368 Section 1.2.

No regression, validated model detection on SDE.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit e53eb952b970ac94c97d74fb447418fb327ca096)

3 months agox86: Optimize xstate size calculation
Sunil K Pandey [Thu, 3 Apr 2025 20:00:45 +0000 (13:00 -0700)] 
x86: Optimize xstate size calculation

Scan xstate IDs up to the maximum supported xstate ID.  Remove the
separate AMX xstate calculation.  Instead, exclude the AMX space from
the start of TILECFG to the end of TILEDATA in xsave_state_size.

Completed validation on SKL/SKX/SPR/SDE and compared xsave state size
with "ld.so --list-diagnostics" option, no regression.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
(cherry picked from commit 70b648855185e967e54668b101d24704c3fb869d)

3 months agoelf: Fix arm-linux-gnueabihf build break from b861755a84
Adhemerval Zanella [Thu, 10 Apr 2025 12:08:22 +0000 (12:08 +0000)] 
elf: Fix arm-linux-gnueabihf build break from b861755a84

3 months agoelf: Extend glibc.rtld.execstack tunable to force executable stack (BZ 32653)
Adhemerval Zanella [Thu, 13 Feb 2025 17:02:38 +0000 (14:02 -0300)] 
elf: Extend glibc.rtld.execstack tunable to force executable stack (BZ 32653)

From the bug report [1], multiple programs still require to dlopen
shared libraries with either missing PT_GNU_STACK or with the executable
bit set.  Although, in some cases, it seems to be a hard-craft assembly
source without the required .note.GNU-stack marking (so the static linker
is forced to set the stack executable if the ABI requires it), other
cases seem that the library uses trampolines [2].

Unfortunately, READ_IMPLIES_EXEC is not an option since on some ABIs
(x86_64), the kernel clears the bit, making it unsupported.  To avoid
reinstating the broken code that changes stack permission on dlopen
(0ca8785a28), this patch extends the glibc.rtld.execstack tunable to
allow an option to force an executable stack at the program startup.

The tunable is a security issue because it defeats the PT_GNU_STACK
hardening.  It has the slight advantage of making it explicit by the
caller, and, as for other tunables, this is disabled for setuid binaries.
A tunable also allows us to eventually remove it, but from previous
experiences, it would require some time.

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

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=32653
[2] https://github.com/conda-forge/ctng-compiler-activation-feedstock/issues/143
Reviewed-by: Sam James <sam@gentoo.org>
(cherry picked from commit 12a497c716f0a06be5946cabb8c3ec22a079771e)

3 months agox86: Link tst-gnu2-tls2-x86-noxsave{,c,xsavec} with libpthread
Florian Weimer [Mon, 31 Mar 2025 19:33:18 +0000 (21:33 +0200)] 
x86: Link tst-gnu2-tls2-x86-noxsave{,c,xsavec} with libpthread

This fixes a test build failure on Hurd.

Fixes commit 145097dff170507fe73190e8e41194f5b5f7e6bf ("x86: Use separate
variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)").

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit c6e2895695118ab59c7b17feb0fcb75a53e3478c)

4 months agox86: Use separate variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)
Florian Weimer [Fri, 28 Mar 2025 08:26:59 +0000 (09:26 +0100)] 
x86: Use separate variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)

Previously, the initialization code reused the xsave_state_full_size
member of struct cpu_features for the TLSDESC state size.  However,
the tunable processing code assumes that this member has the
original XSAVE (non-compact) state size, so that it can use its
value if XSAVEC is disabled via tunable.

This change uses a separate variable and not a struct member because
the value is only needed in ld.so and the static libc, but not in
libc.so.  As a result, struct cpu_features layout does not change,
helping a future backport of this change.

Fixes commit 9b7091415af47082664717210ac49d51551456ab ("x86-64:
Update _dl_tlsdesc_dynamic to preserve AMX registers").

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 145097dff170507fe73190e8e41194f5b5f7e6bf)

4 months agox86: Skip XSAVE state size reset if ISA level requires XSAVE
Florian Weimer [Fri, 28 Mar 2025 08:26:06 +0000 (09:26 +0100)] 
x86: Skip XSAVE state size reset if ISA level requires XSAVE

If we have to use XSAVE or XSAVEC trampolines, do not adjust the size
information they need.  Technically, it is an operator error to try to
run with -XSAVE,-XSAVEC on such builds, but this change here disables
some unnecessary code with higher ISA levels and simplifies testing.

Related to commit befe2d3c4dec8be2cdd01a47132e47bdb7020922
("x86-64: Don't use SSE resolvers for ISA level 3 or above").

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 59585ddaa2d44f22af04bb4b8bd4ad1e302c4c02)

4 months agox86_64: Add atanh with FMA
Sunil K Pandey [Thu, 6 Mar 2025 00:13:38 +0000 (16:13 -0800)] 
x86_64: Add atanh with FMA

On SPR, it improves atanh bench performance by:

Before After Improvement
reciprocal-throughput 15.1715 14.8628 2%
latency 57.1941 56.1883 2%

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit c7c4a5906f326f1290b1c2413a83c530564ec4b8)

4 months agox86_64: Add sinh with FMA
Sunil K Pandey [Sat, 8 Mar 2025 16:51:10 +0000 (08:51 -0800)] 
x86_64: Add sinh with FMA

On SPR, it improves sinh bench performance by:

Before After Improvement
reciprocal-throughput 14.2017 11.815 17%
latency 36.4917 35.2114 4%

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit dded0d20f67ba1925ccbcb9cf28f0c75febe0dbe)

4 months agox86_64: Add tanh with FMA
Sunil K Pandey [Mon, 10 Mar 2025 17:24:07 +0000 (10:24 -0700)] 
x86_64: Add tanh with FMA

On Skylake, it improves tanh bench performance by:

Before  After  Improvement
max 110.89 95.826 14%
min 20.966 20.157 4%
mean 30.9601 29.8431 4%

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit c6352111c72a20b3588ae304dd99b63e25dd6d85)

4 months agonptl: Check if thread is already terminated in sigcancel_handler (BZ 32782)
Adhemerval Zanella [Wed, 12 Mar 2025 13:59:17 +0000 (10:59 -0300)] 
nptl: Check if thread is already terminated in sigcancel_handler (BZ 32782)

The SIGCANCEL signal handler should not issue __syscall_do_cancel,
which calls __do_cancel and __pthread_unwind, if the cancellation
is already in proces (and libgcc unwind is not reentrant).  Any
cancellation signal received after is ignored.

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

Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 360cce0b066f34e85e473c04cdc16e6fa426021b)

4 months agonptl: PTHREAD_COND_INITIALIZER compatibility with pre-2.41 versions (bug 32786)
Florian Weimer [Thu, 13 Mar 2025 05:07:07 +0000 (06:07 +0100)] 
nptl: PTHREAD_COND_INITIALIZER compatibility with pre-2.41 versions (bug 32786)

The new initializer and struct layout does not initialize the
__g_signals field in the old struct layout before the change in
commit c36fc50781995e6758cae2b6927839d0157f213c ("nptl: Remove
g_refs from condition variables").  Bring back fields at the end
of struct __pthread_cond_s, so that they are again zero-initialized.

Reviewed-by: Sam James <sam@gentoo.org>
(cherry picked from commit dbc5a50d12eff4cb3f782129029d04b8a76f58e7)

4 months agonptl: clear the whole rseq area before registration
Michael Jeanson [Fri, 14 Feb 2025 18:54:22 +0000 (13:54 -0500)] 
nptl: clear the whole rseq area before registration

Due to the extensible nature of the rseq area we can't explictly
initialize fields that are not part of the ABI yet. It was agreed with
upstream that all new fields will be documented as zero initialized by
userspace. Future kernels configured with CONFIG_DEBUG_RSEQ will
validate the content of all fields during registration.

Replace the explicit field initialization with a memset of the whole
rseq area which will cover fields as they are added to future kernels.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 689a62a4217fae78b9ce0db781dc2a421f2b1ab4)

4 months agoLinux: Remove attribute access from sched_getattr (bug 32781)
Florian Weimer [Wed, 12 Mar 2025 09:23:47 +0000 (10:23 +0100)] 
Linux: Remove attribute access from sched_getattr (bug 32781)

The GCC attribute expects an element count, not bytes.

(cherry picked from commit 74c68fa61b5ebf4c64605a3cc5e47154a66671ce)

4 months agomath: Remove an extra semicolon in math function declarations
Aurelien Jarno [Thu, 6 Mar 2025 18:34:15 +0000 (19:34 +0100)] 
math: Remove an extra semicolon in math function declarations

Commit 6bc301672bfbd ("math: Remove __XXX math functions from installed
math.h [BZ #32418]") left an extra semicolon after macro expansion. For
instance the ceil declaration after expansion is:

  extern double ceil (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));;

This chokes very naive parsers like gauche c-wrapper. Fix that by
removing that extra semicolon in the macro.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 443cb0b5f25129dd0f1e9f9101299d31c4700b7f)

4 months agoposix: Move environ helper variables next to environ definition (bug 32541)
Florian Weimer [Fri, 7 Mar 2025 20:40:55 +0000 (21:40 +0100)] 
posix: Move environ helper variables next to environ definition (bug 32541)

This helps with statically interposing getenv.

Updates commit 7a61e7f557a97ab597d6fca5e2d1f13f65685c61
("stdlib: Make getenv thread-safe in more cases").

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 6ef0bd02dbe34aab8b956ffa2db5679341d520f5)

4 months agoconfigure: Fix spelling of -Wl,--no-error-execstack option
Florian Weimer [Fri, 7 Mar 2025 06:52:11 +0000 (07:52 +0100)] 
configure: Fix spelling of -Wl,--no-error-execstack option

BFD ld recognizes all -no-* options (with a single leading dash)
unconditionally.

Fixes commit a2bd5008a99032830add3e4005c25b61e3207112
("Pass -Wl,--no-error-execstack for tests where -Wl,-z,execstack
is used [PR32717]").

(cherry picked from commit 59dc232df277c21239c357e3519682c26e182cd7)

4 months agoelf: Check if __attribute__ ((aligned (65536))) is supported
H.J. Lu [Fri, 7 Mar 2025 00:58:47 +0000 (08:58 +0800)] 
elf: Check if __attribute__ ((aligned (65536))) is supported

The BZ #32763 tests fail to build for MicroBlaze (which defines
MAX_OFILE_ALIGNMENT to (32768*8) in GCC, so __attribute__ ((aligned
(65536))) is unsupported).  Add a configure-time check to enable BZ #32763
tests only if __attribute__ ((aligned (65536))) is supported.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
(cherry picked from commit 9b91484bee8f6f1bf1e2d26a8df461b553784528)

4 months agostatic-pie: Skip the empty PT_LOAD segment at offset 0 [BZ #32763]
H.J. Lu [Wed, 5 Mar 2025 02:19:59 +0000 (10:19 +0800)] 
static-pie: Skip the empty PT_LOAD segment at offset 0 [BZ #32763]

As shown in

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

linker may generate an empty PT_LOAD segments at offset 0:

Elf file type is EXEC (Executable file)
Entry point 0x4000e8
There are 3 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x00000000000000f0 0x00000000000000f0  R E    0x1000
  LOAD           0x0000000000000000 0x0000000000410000 0x0000000000410000
                 0x0000000000000000 0x0000000000b5dce8  RW     0x10000
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10

 Section to Segment mapping:
  Segment Sections...
   00     .text
   01     .bss
   02

Skip the empty PT_LOAD segment at offset 0 to support such binaries.
This fixes BZ #32763.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
(cherry picked from commit 596130591ae4b058a529cc1318b95e624559054c)

4 months agoPass -Wl,--no-error-execstack for tests where -Wl,-z,execstack is used [PR32717]
Sam James [Tue, 18 Feb 2025 18:49:09 +0000 (18:49 +0000)] 
Pass -Wl,--no-error-execstack for tests where -Wl,-z,execstack is used [PR32717]

When GNU Binutils is configured with --enable-error-execstack=yes, a handful
of our tests which rely on -Wl,-z,execstack fail. Pass --Wl,--no-error-execstack
to override the behaviour and get a warning instead.

Bug: https://sourceware.org/PR32717
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit a2bd5008a99032830add3e4005c25b61e3207112)

5 months agoAArch64: Use prefer_sve_ifuncs for SVE memset
Wilco Dijkstra [Thu, 27 Feb 2025 16:28:52 +0000 (16:28 +0000)] 
AArch64: Use prefer_sve_ifuncs for SVE memset

Use prefer_sve_ifuncs for SVE memset just like memcpy.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
(cherry picked from commit 0f044be1dae5169d0e57f8d487b427863aeadab4)

5 months agoAArch64: Add SVE memset
Wilco Dijkstra [Tue, 24 Dec 2024 18:01:59 +0000 (18:01 +0000)] 
AArch64: Add SVE memset

Add SVE memset based on the generic memset with predicated load for sizes < 16.
Unaligned memsets of 128-1024 are improved by ~20% on average by using aligned
stores for the last 64 bytes.  Performance of random memset benchmark improves
by ~2% on Neoverse V1.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
(cherry picked from commit 163b1bbb76caba4d9673c07940c5930a1afa7548)

5 months agomath: Improve layout of exp/exp10 data
Wilco Dijkstra [Fri, 13 Dec 2024 15:43:07 +0000 (15:43 +0000)] 
math: Improve layout of exp/exp10 data

GCC aligns global data to 16 bytes if their size is >= 16 bytes.  This patch
changes the exp_data struct slightly so that the fields are better aligned
and without gaps.  As a result on targets that support them, more load-pair
instructions are used in exp.  Exp10 is improved by moving invlog10_2N later
so that neglog10_2hiN and neglog10_2loN can be loaded using load-pair.

The exp benchmark improves 2.5%, "144bits" by 7.2%, "768bits" by 12.7% on
Neoverse V2.  Exp10 improves by 1.5%.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 5afaf99edb326fd9f36eb306a828d129a3a1d7f7)

5 months agoaarch64: Add GCS test with signal handler
Yury Khrustalev [Thu, 23 Jan 2025 10:36:36 +0000 (10:36 +0000)] 
aarch64: Add GCS test with signal handler

Test that when we return from a function that enabled GCS at runtime
we get SIGSEGV. Also test that ucontext contains GCS block with the
GCS pointer.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agoaarch64: Add GCS tests for dlopen
Yury Khrustalev [Wed, 22 Jan 2025 17:21:26 +0000 (17:21 +0000)] 
aarch64: Add GCS tests for dlopen

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agoaarch64: Add GCS tests for transitive dependencies
Yury Khrustalev [Wed, 22 Jan 2025 15:06:18 +0000 (15:06 +0000)] 
aarch64: Add GCS tests for transitive dependencies

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agoaarch64: Add tests for Guarded Control Stack
Yury Khrustalev [Tue, 21 Jan 2025 13:33:20 +0000 (13:33 +0000)] 
aarch64: Add tests for Guarded Control Stack

These tests validate that GCS tunable works as expected depending
on the GCS markings in the test binaries.

Tests validate both static and dynamically linked binaries.

These new tests are AArch64 specific. Moreover, they are included only
if linker supports the "-z gcs=<value>" option. If built, these tests
will run on systems with and without HWCAP_GCS. In the latter case the
tests will be reported as UNSUPPORTED.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agoaarch64: Add configure checks for GCS support
Yury Khrustalev [Tue, 28 Jan 2025 16:13:51 +0000 (16:13 +0000)] 
aarch64: Add configure checks for GCS support

 - Add check that linker supports -z gcs=...
 - Add checks that main and test compiler support
   -mbranch-protection=gcs

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agoAArch64: Improve codegen for SVE powf
Yat Long Poon [Thu, 13 Feb 2025 18:03:04 +0000 (18:03 +0000)] 
AArch64: Improve codegen for SVE powf

Improve memory access with indexed/unpredicated instructions.
Eliminate register spills.  Speedup on Neoverse V1: 3%.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
(cherry picked from commit 95e807209b680257a9afe81a507754f1565dbb4d)

5 months agoAArch64: Improve codegen for SVE pow
Yat Long Poon [Thu, 13 Feb 2025 18:02:01 +0000 (18:02 +0000)] 
AArch64: Improve codegen for SVE pow

Move constants to struct.  Improve memory access with indexed/unpredicated
instructions.  Eliminate register spills.  Speedup on Neoverse V1: 24%.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
(cherry picked from commit 0b195651db3ae793187c7dd6d78b5a7a8da9d5e6)

5 months agoAArch64: Improve codegen for SVE erfcf
Yat Long Poon [Thu, 13 Feb 2025 18:00:50 +0000 (18:00 +0000)] 
AArch64: Improve codegen for SVE erfcf

Reduce number of MOV/MOVPRFXs and use unpredicated FMUL.
Replace MUL with LSL.  Speedup on Neoverse V1: 6%.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
(cherry picked from commit f5ff34cb3c75ec1061c75bb9188b3c1176426947)

5 months agoAarch64: Improve codegen in SVE exp and users, and update expf_inline
Luna Lamb [Thu, 13 Feb 2025 17:54:46 +0000 (17:54 +0000)] 
Aarch64: Improve codegen in SVE exp and users, and update expf_inline

Use unpredicted muls, and improve memory access.
7%, 3% and 1% improvement in throughput microbenchmark on Neoverse V1,
for exp, exp2 and cosh respectively.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
(cherry picked from commit c0ff447edf19bd4630fe79adf5e8b896405b059f)

5 months agoAarch64: Improve codegen in SVE asinh
Luna Lamb [Thu, 13 Feb 2025 17:52:09 +0000 (17:52 +0000)] 
Aarch64: Improve codegen in SVE asinh

Use unpredicated muls, use lanewise mla's and improve memory access.
1% regression in throughput microbenchmark on Neoverse V1.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
(cherry picked from commit 8f0e7fe61e0a2ad5ed777933703ce09053810ec4)

5 months agoRISC-V: Fix IFUNC resolver cannot access gp pointer
Yangyu Chen [Mon, 24 Feb 2025 17:12:19 +0000 (01:12 +0800)] 
RISC-V: Fix IFUNC resolver cannot access gp pointer

In some cases, an IFUNC resolver may need to access the gp pointer to
access global variables. Such an object may have l_relocated == 0 at
this time. In this case, an IFUNC resolver will fail to access a global
variable and cause a SIGSEGV.

This patch fixes this issue by relaxing the check of l_relocated in
elf_machine_runtime_setup, but added a check for SHARED case to avoid
using this code in static-linked executables. Such object have already
set up the gp pointer in load_gp function and l->l_scope will be NULL if
it is a pie object. So if we use these code to set up the gp pointer
again for static-pie, it will causing a SIGSEGV in glibc as original bug
on BZ #31317.

I have also reproduced and checked BZ #31317 using the mold commit
bed5b1731b ("illumos: Treat absolute symbols specially"), this patch can
fix the issue.

Also, we used the wrong gp pointer previously because ref->st_value is
not the relocated address but just the offset from the base address of
ELF. An edge case may happen if we reference gp pointer in a IFUNC
resolver in a PIE object, but it will not happen in compiler-generated
codes since -pie will disable relax to gp. In this case, the GP will be
initialized incorrectly since the ref->st_value is not the address after
relocation. This patch fixes this issue by adding the l->l_addr to
ref->st_value to get the relocated address for the gp pointer. We don't
use SYMBOL_ADDRESS macro here because __global_pointer$ is a special
symbol that has SHN_ABS type, but it will use PC-relative addressing in
the load_gp function using lla.

Closes: BZ #32269
Fixes: 96d1b9ac23 ("RISC-V: Fix the static-PIE non-relocated object check")
Co-authored-by: Vivian Wang <dramforever@live.com>
Signed-off-by: Yangyu Chen <cyy@cyyself.name>
(cherry picked from commit 3fd2ff7685e3ee85c8cd2896f28ad62f67d7c483)

5 months agomath: Add optimization barrier to ensure a1 + u.d is not reused [BZ #30664]
John David Anglin [Tue, 25 Feb 2025 20:57:53 +0000 (15:57 -0500)] 
math: Add optimization barrier to ensure a1 + u.d is not reused [BZ #30664]

A number of fma tests started to fail on hppa when gcc was changed to
use Ranger rather than EVRP.  Eventually I found that the value of
a1 + u.d in this is block of code was being computed in FE_TOWARDZERO
mode and not the original rounding mode:

    if (TININESS_AFTER_ROUNDING)
      {
        w.d = a1 + u.d;
        if (w.ieee.exponent == 109)
          return w.d * 0x1p-108;
      }

This caused the exponent value to be wrong and the wrong return path
to be used.

Here we add an optimization barrier after the rounding mode is reset
to ensure that the previous value of a1 + u.d is not reused.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
5 months agomath: Fix `unknown type name '__float128'` for clang 3.4 to 3.8.1 (bug 32694)
koraynilay [Sat, 22 Feb 2025 14:55:59 +0000 (15:55 +0100)] 
math: Fix `unknown type name '__float128'` for clang 3.4 to 3.8.1 (bug 32694)

When compiling a program that includes <bits/floatn.h> using a clang version
between 3.4 (included) and 3.8.1 (included), clang will fail with `unknown type
name '__float128'; did you mean '__cfloat128'?`. This changes fixes the clang
prerequirements macro call in floatn.h to check for clang 3.9 instead of 3.4,
since support for __float128 was actually enabled in 3.9 by:

commit 50f29e06a1b6a38f0bba9360cbff72c82d46cdd4
Author: Nemanja Ivanovic <nemanja.i.ibm@gmail.com>
Date:   Wed Apr 13 09:49:45 2016 +0000

    Enable support for __float128 in Clang

This fixes bug 32694.

Signed-off-by: koraynilay <koray.fra@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 29803ed3ce420f01e7c567c97fc8945d5e5e5992)

5 months agox86 (__HAVE_FLOAT128): Defined to 0 for Intel SYCL compiler [BZ #32723]
H.J. Lu [Wed, 19 Feb 2025 23:08:26 +0000 (07:08 +0800)] 
x86 (__HAVE_FLOAT128): Defined to 0 for Intel SYCL compiler [BZ #32723]

Intel compiler always defines __INTEL_LLVM_COMPILER.  When SYCL is
enabled by -fsycl, it also defines SYCL_LANGUAGE_VERSION.  Since Intel
SYCL compiler doesn't support _Float128:

https://github.com/intel/llvm/issues/16903

define __HAVE_FLOAT128 to 0 for Intel SYCL compiler.

This fixes BZ #32723.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
(cherry picked from commit 5a4573be6f96ff49111bb6cae767676b5aafa7a8)

5 months agoFix tst-aarch64-pkey to handle ENOSPC as not supported
Aurelien Jarno [Sat, 15 Feb 2025 10:08:33 +0000 (11:08 +0100)] 
Fix tst-aarch64-pkey to handle ENOSPC as not supported

The syscall pkey_alloc can return ENOSPC to indicate either that all
keys are in use or that the system runs in a mode in which memory
protection keys are disabled. In such case the test should not fail and
just return unsupported.

This matches the behaviour of the generic tst-pkey.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 60f2d6be657aa8c663ee14bd266d343ae0f35afb)

5 months agoassert: Add test for CVE-2025-0395
Siddhesh Poyarekar [Fri, 31 Jan 2025 17:16:30 +0000 (12:16 -0500)] 
assert: Add test for CVE-2025-0395

Use the __progname symbol to override the program name to induce the
failure that CVE-2025-0395 describes.

This is related to BZ #32582

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit cdb9ba84191ce72e86346fb8b1d906e7cd930ea2)

5 months agomath: Fix tanf for some inputs (BZ 32630)
Adhemerval Zanella [Sun, 2 Feb 2025 19:57:49 +0000 (16:57 -0300)] 
math: Fix tanf for some inputs (BZ 32630)

The logic was copied wrong from CORE-MATH.

(cherry picked from commit 09e7f4d594b4308fbea18e3044148d67b59757c9)

5 months agonptl: Correct stack size attribute when stack grows up [BZ #32574]
John David Anglin [Wed, 29 Jan 2025 21:51:16 +0000 (16:51 -0500)] 
nptl: Correct stack size attribute when stack grows up [BZ #32574]

Set stack size attribute to the size of the mmap'd region only
when the size of the remaining stack space is less than the size
of the mmap'd region.

This was reversed.  As a result, the initial stack size was only
135168 bytes.  On architectures where the stack grows down, the
initial stack size is approximately 8384512 bytes with the default
rlimit settings.  The small main stack size on hppa broke
applications like ruby that check for stack overflows.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
5 months agomath: Fix sinhf for some inputs (BZ 32627)
Adhemerval Zanella [Fri, 31 Jan 2025 13:34:32 +0000 (10:34 -0300)] 
math: Fix sinhf for some inputs (BZ 32627)

The logic was copied wrong from CORE-MATH.

5 months agomath: Fix log10p1f internal table value (BZ 32626)
Adhemerval Zanella [Fri, 31 Jan 2025 13:27:39 +0000 (10:27 -0300)] 
math: Fix log10p1f internal table value (BZ 32626)

It was copied wrong from CORE-MATH.

(cherry picked from commit c79277a16785c8ae96d821414f4d31d654a0177c)

6 months agoNEWS: start new section
Andreas K. Hüttel [Tue, 28 Jan 2025 20:11:22 +0000 (21:11 +0100)] 
NEWS: start new section

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoRemove advisories from release branch
Andreas K. Hüttel [Tue, 28 Jan 2025 17:45:20 +0000 (18:45 +0100)] 
Remove advisories from release branch

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoCreate ChangeLog.old/ChangeLog.30 glibc-2.41
Andreas K. Hüttel [Tue, 28 Jan 2025 17:31:33 +0000 (18:31 +0100)] 
Create ChangeLog.old/ChangeLog.30

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoBump version to 2.41
Andreas K. Hüttel [Tue, 28 Jan 2025 17:25:13 +0000 (18:25 +0100)] 
Bump version to 2.41

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agopo: update translations (final, only timestamp and line number changes)
Andreas K. Hüttel [Tue, 28 Jan 2025 12:47:28 +0000 (13:47 +0100)] 
po: update translations (final, only timestamp and line number changes)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agolibc.pot: regenerate (only line number changes)
Andreas K. Hüttel [Tue, 28 Jan 2025 11:36:07 +0000 (12:36 +0100)] 
libc.pot: regenerate (only line number changes)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoINSTALL: update last tested version numbers
Andreas K. Hüttel [Tue, 28 Jan 2025 11:31:08 +0000 (12:31 +0100)] 
INSTALL: update last tested version numbers

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agocontrib.texi: minor improvements
Andreas K. Hüttel [Mon, 27 Jan 2025 15:30:54 +0000 (16:30 +0100)] 
contrib.texi: minor improvements

Mention CORE-MATH developers by name
Fix accent

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoNEWS: Add some more news from the 2.41 cycle
Andreas K. Hüttel [Sun, 26 Jan 2025 21:45:27 +0000 (22:45 +0100)] 
NEWS: Add some more news from the 2.41 cycle

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agocontrib.texi: Update from 2.40..2.41 commit log
Andreas K. Hüttel [Mon, 27 Jan 2025 00:06:16 +0000 (01:06 +0100)] 
contrib.texi: Update from 2.40..2.41 commit log

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoNEWS: Add reference to (single) advisory
Andreas K. Hüttel [Sun, 26 Jan 2025 22:30:13 +0000 (23:30 +0100)] 
NEWS: Add reference to (single) advisory

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoNEWS: Add list of bugs fixed in 2.41
Andreas K. Hüttel [Sun, 26 Jan 2025 22:26:07 +0000 (23:26 +0100)] 
NEWS: Add list of bugs fixed in 2.41

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoNEWS: editorial changes (language, line breaks)
Andreas K. Hüttel [Sun, 26 Jan 2025 19:09:26 +0000 (20:09 +0100)] 
NEWS: editorial changes (language, line breaks)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agotestsuite: Make stdio-common/tst-printf-format-*-mem UNSUPPORTED if the mtrace output...
Xi Ruoyao [Sat, 25 Jan 2025 16:48:27 +0000 (00:48 +0800)] 
testsuite: Make stdio-common/tst-printf-format-*-mem UNSUPPORTED if the mtrace output does not exist

When gawk was not built with MPFR, there's no mtrace output and those
tests FAIL.  But we should make them UNSUPPORTED like other
tst-printf-format-* tests in the case.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Sam James <sam@gentoo.org>
Reviewed-by: Andreas K Hüttel <dilfridge@gentoo.org>
6 months agoelf: fix 'valgrind' typo in comment
Sam James [Sat, 25 Jan 2025 05:34:20 +0000 (05:34 +0000)] 
elf: fix 'valgrind' typo in comment

6 months agomalloc: cleanup casts in tst-calloc
Sam James [Mon, 13 Jan 2025 02:27:41 +0000 (02:27 +0000)] 
malloc: cleanup casts in tst-calloc

Followup to c3d1dac96bdd10250aa37bb367d5ef8334a093a1. As pointed out by
Maciej W. Rozycki, the casts are obviously useless now.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
6 months agostdlib: Test using setenv with updated environ [BZ #32588]
H.J. Lu [Fri, 24 Jan 2025 10:53:13 +0000 (18:53 +0800)] 
stdlib: Test using setenv with updated environ [BZ #32588]

Add a test for setenv with updated environ.  Verify that BZ #32588 is
fixed.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 months agoLICENSES: update CORE-MATH copyright
Aurelien Jarno [Wed, 22 Jan 2025 21:11:24 +0000 (22:11 +0100)] 
LICENSES: update CORE-MATH copyright

Many more files from the CORE-MATH have been added. Also update the
authors and copyright years.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agoLICENSES: update location of getaddrinfo.c and getnameinfo.c
Aurelien Jarno [Wed, 22 Jan 2025 21:11:24 +0000 (22:11 +0100)] 
LICENSES: update location of getaddrinfo.c and getnameinfo.c

posix/getaddrinfo.c got moved into nss/getaddrinfo.c in commit
7f602256ab5b ("Move getaddrinfo from 'posix' into 'nss'")

inet/getnameinfo.c got moved into nss/getnameinfo.c in commit
2f1c 6652 d7b3 ("Move getnameinfo from 'inet' to 'nss'")

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agoLICENSES: remove Intel License Agreement
Aurelien Jarno [Wed, 22 Jan 2025 21:11:24 +0000 (22:11 +0100)] 
LICENSES: remove Intel License Agreement

The corresponding files are gone with the IA64 removal in commit
460860f457e2 ("Remove ia64-linux-gnu").

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agostdlib: Re-implement free (environ) compatibility kludge for setenv
Florian Weimer [Fri, 24 Jan 2025 09:40:28 +0000 (10:40 +0100)] 
stdlib: Re-implement free (environ) compatibility kludge for setenv

For the originally failing application (userhelper from usermode),
it is not actually necessary to call realloc on the environ
pointer.  Yes, there will be a memory leak because the application
assigns a heap-allocated pointer to environ that it never frees,
but this leak was always there: the old realloc-based setenv had
a hidden internal variable, last_environ, that was used in a similar
way to __environ_array_list.  The application is not impacted by
the leak anyway because the relevant operations do not happen in
a loop.

The change here just uses a separte heap allocation and points
environ to that.  This means that if an application calls
free (environ) and restores the environ pointer to the value
at process start, and does not modify the environment further,
nothing bad happens.

This change should not invalidate any previous testing that went into
the original getenv thread safety change, commit 7a61e7f557a97ab597d6
("stdlib: Make getenv thread-safe in more cases").

The new test cases are modeled in part on the env -i use case from
bug 32588 (with !DO_MALLOC && !DO_EARLY_SETENV), and the previous
stdlib/tst-setenv-malloc test.  The DO_MALLOC && !DO_EARLY_SETENV
case in the new test should approximate what userhelper from the
usermode package does.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 months agoRevert "stdlib: Support malloc-managed environ arrays for compatibility"
Florian Weimer [Fri, 24 Jan 2025 07:04:23 +0000 (08:04 +0100)] 
Revert "stdlib: Support malloc-managed environ arrays for compatibility"

This reverts commit b62759db04b8ed7f829c06f1d7c3b8fb70616493.

Reason for revert: Incompatible with “env -i” and coreutils (bug 32588).

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
6 months agostdlib: Support malloc-managed environ arrays for compatibility
Florian Weimer [Wed, 22 Jan 2025 12:48:56 +0000 (13:48 +0100)] 
stdlib: Support malloc-managed environ arrays for compatibility

Some applications set environ to a heap-allocated pointer, call
setenv (expecting it to call realloc), free environ, and then
restore the original environ pointer.  This breaks after
commit 7a61e7f557a97ab597d6fca5e2d1f13f65685c61 ("stdlib: Make
getenv thread-safe in more cases") because after the setenv call,
the environ pointer does not point to the start of a heap allocation.
Instead, setenv creates a separate allocation and changes environ
to point into that.  This means that the free call in the application
results in heap corruption.

The interim approach was more compatible with other libcs because
it does not assume that the incoming environ pointer is allocated
as if by malloc (if it was written by the application).  However,
it seems to be more important to stay compatible with previous
glibc version: assume the incoming pointer is heap allocated,
and preserve this property after setenv calls.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 months agopo: Incorporate translations
Andreas K. Hüttel [Wed, 22 Jan 2025 21:50:23 +0000 (22:50 +0100)] 
po: Incorporate translations

be ca cs da de el eo es fi fr gl hr hu ia id it ja ka ko lt nb nl pl pt ro ru rw sk sl sr sv tr uk vi zh_CN zh_TW

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoUpdate advisory GLIBC-SA-2025-0001 (2.40)
Siddhesh Poyarekar [Wed, 22 Jan 2025 14:40:52 +0000 (09:40 -0500)] 
Update advisory GLIBC-SA-2025-0001 (2.40)

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
6 months agoAdd advisory text for CVE-2025-0395
Siddhesh Poyarekar [Tue, 21 Jan 2025 21:48:29 +0000 (16:48 -0500)] 
Add advisory text for CVE-2025-0395

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

6 months agoFix underallocation of abort_msg_s struct (CVE-2025-0395)
Siddhesh Poyarekar [Tue, 21 Jan 2025 21:11:06 +0000 (16:11 -0500)] 
Fix underallocation of abort_msg_s struct (CVE-2025-0395)

Include the space needed to store the length of the message itself, in
addition to the message string.  This resolves BZ #32582.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

6 months agoNEWS: Add note on Guarded Control Stack support
Yury Khrustalev [Tue, 21 Jan 2025 13:44:05 +0000 (13:44 +0000)] 
NEWS: Add note on Guarded Control Stack support

Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
6 months agoFix typo: _POSIX_REATIME_SIGNALS -> _POSIX_REALTIME_SIGNALS [BZ# 32515]
Paul Pluzhnikov [Mon, 20 Jan 2025 21:47:38 +0000 (21:47 +0000)] 
Fix typo: _POSIX_REATIME_SIGNALS -> _POSIX_REALTIME_SIGNALS [BZ# 32515]

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agoaarch64: Add HWCAP_GCS
Yury Khrustalev [Tue, 21 Jan 2025 09:39:45 +0000 (09:39 +0000)] 
aarch64: Add HWCAP_GCS

Use upper 32 bits of HWCAP.

Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
6 months agonptl: Include <stdbool.h> in tst-skeleton-affinity-inheritance.c
Florian Weimer [Tue, 21 Jan 2025 09:36:58 +0000 (10:36 +0100)] 
nptl: Include <stdbool.h> in tst-skeleton-affinity-inheritance.c

The file uses the identifiers bool, false, true.

6 months agostdlib: Test for expected sequence of random numbers from rand
Florian Weimer [Mon, 20 Jan 2025 20:06:59 +0000 (21:06 +0100)] 
stdlib: Test for expected sequence of random numbers from rand

As the test comment explains, this test is not quite valid, but
preserving the exact sequences helps distributions to port to
newer glibc versions.  We can remove this test if we ever switch
to a different implementation.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
6 months agostdlib: Fix unintended change to the random_r implementation
Florian Weimer [Mon, 20 Jan 2025 20:06:43 +0000 (21:06 +0100)] 
stdlib: Fix unintended change to the random_r implementation

Commit d5bceac99d24af1131b90027dab267e437b65cd1 changed the sequence
of random numbers.  This was completely unintended.  The statistical
properties of the new sequences are unclear, so restore the old
behavior.

Fixes commit d5bceac99d24af1131b90027dab267e437b65cd1 ("stdlib:
random_r: fix unaligned access in initstate and initstate_r
[BZ #30584]").

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
6 months agoelf: Make tst-ro-dynamic-mod.map compatible with older binutils
Florian Weimer [Mon, 20 Jan 2025 19:35:10 +0000 (20:35 +0100)] 
elf: Make tst-ro-dynamic-mod.map compatible with older binutils

Older versions such as binutils 2.35.2 do not recognize
PT_GNU_PROPERTY.

Fixes commit d3f2b71ef1d146137a25dd1367d97a14fac341c6
("aarch64: Fix tests not compatible with targets supporting GCS").

6 months agoNEWS: Add the extensible rseq ABI to new features
Michael Jeanson [Tue, 14 Jan 2025 20:03:56 +0000 (15:03 -0500)] 
NEWS: Add the extensible rseq ABI to new features

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 months agoLinux: Do not check unused bytes after sched_getattr in tst-sched_setattr
Florian Weimer [Mon, 20 Jan 2025 08:57:09 +0000 (09:57 +0100)] 
Linux: Do not check unused bytes after sched_getattr in tst-sched_setattr

Linux 6.13 was released with a change that overwrites those bytes.
This means that the check_unused subtest fails.

Update the manual accordingly.

Tested-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agoi386: Update ulps for *pi functions
Florian Weimer [Mon, 20 Jan 2025 10:33:58 +0000 (11:33 +0100)] 
i386: Update ulps for *pi functions

As seen with GCC 11.5 on an AMD Ryzen 9 7950X CPU, with an
-fpmath=sse, --disable-multi-arch build of glibc.