]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
5 months agomalloc: Add size check when moving fastbin->tcache
Ben Kallus [Tue, 11 Feb 2025 19:29:51 +0000 (14:29 -0500)] 
malloc: Add size check when moving fastbin->tcache

By overwriting a forward link in a fastbin chunk that is subsequently
moved into the tcache, it's possible to get malloc to return an
arbitrary address [0].

When a chunk is fetched from a fastbin, its size is checked against the
expected chunk size for that fastbin (see malloc.c:3991). This patch
adds a similar check for chunks being moved from a fastbin to tcache,
which renders obsolete the exploitation technique described above.

Now updated to use __glibc_unlikely instead of __builtin_expect, as
requested.

[0]: https://github.com/shellphish/how2heap/blob/master/glibc_2.39/fastbin_reverse_into_tcache.c

Signed-off-by: Ben Kallus <benjamin.p.kallus.gr@dartmouth.edu>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agonss: Improve network number parsers (bz 32573, 32575)
Tobias Stoeckmann [Wed, 12 Feb 2025 18:46:06 +0000 (19:46 +0100)] 
nss: Improve network number parsers (bz 32573, 32575)

Make sure that numbers never overflow uint32_t in inet_network to
properly validate octets encountered in IPv4 addresses.

Avoid malloca in NSS networks file code because /etc/networks lines
can be arbitrarily long. Instead of handcrafting the input for
inet_network by adding ".0" octets if they are missing, just left shift
the result. Also, do not accept invalid entries, but ignore the line
instead.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agonptl: Remove unused __g_refs comment.
Carlos O'Donell [Fri, 7 Feb 2025 18:01:36 +0000 (13:01 -0500)] 
nptl: Remove unused __g_refs comment.

In the block comment for __pthread_cond_wait_common we mention
__g_refs, but the implementation no longer uses group references.

5 months agoadvisories: Fix up GLIBC-SA-2025-0001
Siddhesh Poyarekar [Thu, 13 Feb 2025 17:37:48 +0000 (12:37 -0500)] 
advisories: Fix up GLIBC-SA-2025-0001

Add ref for the test case as well as backports.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.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>
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>
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>
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>
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>
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>
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>
5 months agomath: Consolidate coshf and sinhf internal tables
Adhemerval Zanella [Mon, 3 Feb 2025 21:24:19 +0000 (18:24 -0300)] 
math: Consolidate coshf and sinhf internal tables

The libm size improvement built with "--enable-stack-protector=strong
--enable-bind-now=yes --enable-fortify-source=2":

Before:

   text    data     bss     dec     hex filename
 585192     860      12  586064   8f150 aarch64-linux-gnu/math/libm.so
 960775    1068      12  961855   ead3f x86_64-linux-gnu/math/libm.so
1189174    5544     368 1195086  123c4e powerpc64le-linux-gnu/math/libm.so

After:

   text    data     bss     dec     hex filename
 584952     860      12  585824   8f060 aarch64-linux-gnu/math/libm.so
 960615    1068      12  961695   eac9f x86_64-linux-gnu/math/libm.so
1189078    5544     368 1194990  123bee powerpc64le-linux-gnu/math/libm.so

The are small code changes for x86_64 and powerpc64le, which do not
affect performance; but on aarch64 with gcc-14 I see a slight better
code generation due the usage of ldq for floating point constant loading.
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
5 months agomath: Consolidate acoshf and asinhf internal tables
Adhemerval Zanella [Mon, 3 Feb 2025 21:24:18 +0000 (18:24 -0300)] 
math: Consolidate acoshf and asinhf internal tables

The libm size improvement built with "--enable-stack-protector=strong
--enable-bind-now=yes --enable-fortify-source=2":

Before:

   text    data     bss     dec     hex filename
 587304     860      12  588176   8f990 aarch64-linux-gnu-master/math/libm.so
 962855    1068      12  963935   eb55f x86_64-linux-gnu-master/math/libm.so
1191222    5544     368 1197134  12444e powerpc64le-linux-gnu-master/math/libm.so

After:

   text    data     bss     dec     hex filename
 585192     860      12  586064   8f150 aarch64-linux-gnu/math/libm.so
 960775    1068      12  961855   ead3f x86_64-linux-gnu/math/libm.so
1189174    5544     368 1195086  123c4e powerpc64le-linux-gnu/math/libm.so

The are small code changes for x86_64 and powerpc64le, which do not
affect performance; but on aarch64 with gcc-14 I see a slight better
code generation due the usage of ldq for floating point constant loading.
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
5 months agomath: Use tanpif from CORE-MATH
Adhemerval Zanella [Fri, 20 Dec 2024 16:38:40 +0000 (13:38 -0300)] 
math: Use tanpif from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic tanpif.

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):

latency                      master        patched   improvement
x86_64                      85.1683        47.7990        43.88%
x86_64v2                    76.8219        41.4679        46.02%
x86_64v3                    73.7775        37.7734        48.80%
aarch64 (Neoverse)          35.4514        18.0742        49.02%
power8                      22.7604        10.1054        55.60%
power10                     22.1358         9.9553        55.03%

reciprocal-throughput        master        patched   improvement
x86_64                      41.0174        19.4718        52.53%
x86_64v2                    34.8565        11.3761        67.36%
x86_64v3                    34.0325         9.6989        71.50%
aarch64 (Neoverse)          25.4349         9.2017        63.82%
power8                      13.8626         3.8486        72.24%
power10                     11.7933         3.6420        69.12%

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agomath: Use sinpif from CORE-MATH
Adhemerval Zanella [Fri, 20 Dec 2024 16:31:56 +0000 (13:31 -0300)] 
math: Use sinpif from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic sinpif.

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):

latency                      master        patched   improvement
x86_64                      47.5710        38.4455        19.18%
x86_64v2                    46.8828        40.7563        13.07%
x86_64v3                    44.0034        34.1497        22.39%
aarch64 (Neoverse)          19.2493        14.1968        26.25%
power8                      23.5312        16.3854        30.37%
power10                     22.6485        10.2888        54.57%

reciprocal-throughput        master        patched   improvement
x86_64                      21.8858        11.6717        46.67%
x86_64v2                    22.0620        11.9853        45.67%
x86_64v3                    21.5653        11.3291        47.47%
aarch64 (Neoverse)          13.0615         6.5499        49.85%
power8                      16.2030         6.9580        57.06%
power10                     12.8911         4.2858        66.75%

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agomath: Use cospif from CORE-MATH
Adhemerval Zanella [Fri, 20 Dec 2024 16:25:39 +0000 (13:25 -0300)] 
math: Use cospif from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic cospif.

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):

latency                    master        patched   improvement
x86_64                    47.4679        38.4157        19.07%
x86_64v2                  46.9686        38.3329        18.39%
x86_64v3                  43.8929        31.8510        27.43%
aarch64 (Neoverse)        18.8867        13.2089        30.06%
power8                    22.9435         7.8023        65.99%
power10                   15.4472        7.77505        49.67%

reciprocal-throughput      master        patched   improvement
x86_64                    20.9518        11.4991        45.12%
x86_64v2                  19.8699        10.5921        46.69%
x86_64v3                  19.3475         9.3998        51.42%
aarch64 (Neoverse)        12.5767         6.2158        50.58%
power8                    15.0566         3.2654        78.31%
power10                    9.2866         3.1147        66.46%

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agomath: Use atanpif from CORE-MATH
Adhemerval Zanella [Fri, 20 Dec 2024 16:18:32 +0000 (13:18 -0300)] 
math: Use atanpif from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic atanpif.

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):

latency                     master        patched   improvement
x86_64                     66.3296        52.7558        20.46%
x86_64v2                   66.0429        51.4007        22.17%
x86_64v3                   60.6294        48.7876        19.53%
aarch64 (Neoverse)         24.3163        20.9110        14.00%
power8                     16.5766        13.3620        19.39%
power10                    16.5115        13.4072        18.80%

reciprocal-throughput       master        patched   improvement
x86_64                     30.8599        16.0866        47.87%
x86_64v2                   29.2286        15.4688        47.08%
x86_64v3                   23.0960        12.8510        44.36%
aarch64 (Neoverse)         15.4619        10.6752        30.96%
power8                      7.9200         5.2483        33.73%
power10                     6.8539         4.6262        32.50%

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agomath: Use atan2pif from CORE-MATH
Adhemerval Zanella [Fri, 20 Dec 2024 16:01:20 +0000 (13:01 -0300)] 
math: Use atan2pif from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic atan2pif.

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):

latency                 master        patched   improvement
x86_64                 79.4006        70.8726        10.74%
x86_64v2               77.5136        69.1424        10.80%
x86_64v3               71.8050        68.1637         5.07%
aarch64 (Neoverse)     27.8363        24.7700        11.02%
power8                 39.3893        17.2929        56.10%
power10                19.7200        16.8187        14.71%

reciprocal-throughput   master        patched   improvement
x86_64                 38.3457        30.9471        19.29%
x86_64v2               37.4023        30.3112        18.96%
x86_64v3               33.0713        24.4891        25.95%
aarch64 (Neoverse)     19.3683        15.3259        20.87%
power8                 19.5507        8.27165        57.69%
power10                9.05331        7.63775        15.64%

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agomath: Use asinpif from CORE-MATH
Adhemerval Zanella [Fri, 20 Dec 2024 14:10:53 +0000 (11:10 -0300)] 
math: Use asinpif from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic asinpif.

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):

latency                 master        patched   improvement
x86_64                 46.4996        41.6126        10.51%
x86_64v2               46.7551        38.8235        16.96%
x86_64v3               42.6235        33.7603        20.79%
aarch64 (Neoverse)     17.4161        14.3604        17.55%
power8                 10.7347         9.0193        15.98%
power10                10.6420         9.0362        15.09%

reciprocal-throughput   master        patched   improvement
x86_64                 24.7208        16.5544        33.03%
x86_64v2               24.2177        14.8938        38.50%
x86_64v3               20.5617        10.5452        48.71%
aarch64 (Neoverse)     13.4827        7.17613        46.78%
power8                 6.46134        3.56089        44.89%
power10                5.79007        3.49544        39.63%

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agomath: Use acospif from CORE-MATH
Adhemerval Zanella [Fri, 20 Dec 2024 13:42:35 +0000 (10:42 -0300)] 
math: Use acospif from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic acospif.

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):

latency                  master        patched   improvement
x86_64                  54.8281        42.9070        21.74%
x86_64v2                54.1717        42.7497        21.08%
x86_64v3                49.3552        34.1512        30.81%
aarch64 (Neoverse)      17.9395        14.3733        19.88%
power8                  20.3110         8.8609        56.37%
power10                 11.3113        8.84067        21.84%

reciprocal-throughput    master        patched   improvement
x86_64                  21.2301        14.4803        31.79%
x86_64v2                20.6858        13.9506        32.56%
x86_64v3                16.1944        11.3377        29.99%
aarch64 (Neoverse)      11.4474        7.13282        37.69%
power8                  10.6916        3.57547        66.56%
power10                 4.64269        3.54145        23.72%

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agobenchtests: Add tanpif
Adhemerval Zanella [Thu, 23 Jan 2025 20:57:53 +0000 (17:57 -0300)] 
benchtests: Add tanpif

Random inputs in the range of [-4,4].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agobenchtests: Add sinpif
Adhemerval Zanella [Thu, 23 Jan 2025 20:57:11 +0000 (17:57 -0300)] 
benchtests: Add sinpif

Random inputs in the range of [-4,4].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agobenchtests: Add cospif
Adhemerval Zanella [Thu, 23 Jan 2025 20:56:11 +0000 (17:56 -0300)] 
benchtests: Add cospif

Random inputs in the range of [-4,4].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agobenchtests: Add atanpif
Adhemerval Zanella [Thu, 23 Jan 2025 20:51:40 +0000 (17:51 -0300)] 
benchtests: Add atanpif

Random inputs in the range of [-10,10].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agobenchtests: Add atan2pif
Adhemerval Zanella [Thu, 23 Jan 2025 20:50:46 +0000 (17:50 -0300)] 
benchtests: Add atan2pif

Random inputs in the range of [-10,10].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agobenchtests: Add asinpif
Adhemerval Zanella [Thu, 23 Jan 2025 20:49:38 +0000 (17:49 -0300)] 
benchtests: Add asinpif

Random inputs in the range of [-1,1].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agobenchtests: Add acospif
Adhemerval Zanella [Thu, 23 Jan 2025 20:49:06 +0000 (17:49 -0300)] 
benchtests: Add acospif

Random inputs in the range of [-1,1].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 months agohurd: Replace char foo[1024] with string_t
Samuel Thibault [Mon, 10 Feb 2025 19:06:35 +0000 (20:06 +0100)] 
hurd: Replace char foo[1024] with string_t

Like already done in various other places and advised by Roland in

https://lists.gnu.org/archive/html/bug-hurd/2012-04/msg00124.html

5 months agohurd: Drop useless buffer initialization in ttyname*
Samuel Thibault [Mon, 10 Feb 2025 19:09:20 +0000 (20:09 +0100)] 
hurd: Drop useless buffer initialization in ttyname*

The RPC stub will write a string anyway.

5 months agomig_strncpy: ensure destination string is null terminated
Flavio Cruz [Mon, 10 Feb 2025 03:37:56 +0000 (22:37 -0500)] 
mig_strncpy: ensure destination string is null terminated

Message-ID: <xaqw66fuawxm5hzgjscfg2oyp6lxflm5tnbb7u253pw3gmdy4m@5z42mw2qz2l2>

5 months agohtl: stop exporting __pthread_default_barrierattr.
gfleury [Sun, 9 Feb 2025 20:01:08 +0000 (22:01 +0200)] 
htl: stop exporting __pthread_default_barrierattr.

since all symbol that use it are now in libc
Message-ID: <20250209200108.865599-9-gfleury@disroot.org>

5 months agohtl: move pthread_barrier_wait into libc.
gfleury [Sun, 9 Feb 2025 20:01:07 +0000 (22:01 +0200)] 
htl: move pthread_barrier_wait into libc.

Message-ID: <20250209200108.865599-8-gfleury@disroot.org>

5 months agohtl: move pthread_barrier_init into libc.
gfleury [Sun, 9 Feb 2025 20:01:06 +0000 (22:01 +0200)] 
htl: move pthread_barrier_init into libc.

Message-ID: <20250209200108.865599-7-gfleury@disroot.org>

5 months agohtl: move pthread_barrier_destroy into libc.
gfleury [Sun, 9 Feb 2025 20:01:05 +0000 (22:01 +0200)] 
htl: move pthread_barrier_destroy into libc.

Message-ID: <20250209200108.865599-6-gfleury@disroot.org>

5 months agohtl: move pthread_barrierattr_getpshared, pthread_barrierattr_setpshared into libc.
gfleury [Sun, 9 Feb 2025 20:01:04 +0000 (22:01 +0200)] 
htl: move pthread_barrierattr_getpshared, pthread_barrierattr_setpshared into libc.

Message-ID: <20250209200108.865599-5-gfleury@disroot.org>

5 months agohtl: move pthread_barrierattr_init into libc.
gfleury [Sun, 9 Feb 2025 20:01:03 +0000 (22:01 +0200)] 
htl: move pthread_barrierattr_init into libc.

Message-ID: <20250209200108.865599-4-gfleury@disroot.org>

5 months agohtl: move pthread_barrierattr_destroy into libc.
gfleury [Sun, 9 Feb 2025 20:01:02 +0000 (22:01 +0200)] 
htl: move pthread_barrierattr_destroy into libc.

Message-ID: <20250209200108.865599-3-gfleury@disroot.org>

5 months agohtl: move __pthread_default_barrierattr into libc.
gfleury [Sun, 9 Feb 2025 20:01:01 +0000 (22:01 +0200)] 
htl: move __pthread_default_barrierattr into libc.

Message-ID: <20250209200108.865599-2-gfleury@disroot.org>

5 months agomanual: Update signal descriptions
DJ Delorie [Fri, 17 Jan 2025 22:34:02 +0000 (17:34 -0500)] 
manual: Update signal descriptions

Based on auditing all the signals and source trees for Hurd and
Linux...

SIGSYS - This is not used for a bad system call (ENOSYS is used
for that).  This is used by SECCOMP and some cases where an invalid
sub-function was requested.

SIGSTKFLT - Note it used to be a coprocessor stack fault but is now
obsolete and available for general user use.

SIGLOST - Hurd only now; note that its original purpose as an NFS
lock lost signal is obsolete.

SIGPWR - Note this is for power lost *and* power restored, and is
more a user-mode signal than a kernel-generated signal.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 months agolibio: Replace __LP64__ with __WORDSIZE
Tulio Magno Quites Machado Filho [Thu, 30 Jan 2025 18:51:01 +0000 (15:51 -0300)] 
libio: Replace __LP64__ with __WORDSIZE

__LP64__ is a GCC extension and shouldn't be used in an installed
header.

Fixes: 596a61cf6b (libio: Start to return errors when flushing fwrite's buffer [BZ #29459], 2025-01-28)
Reported-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
5 months agopowerpc64le: Also avoid IFUNC for __mempcpy
Florian Weimer [Sun, 2 Feb 2025 15:21:39 +0000 (16:21 +0100)] 
powerpc64le: Also avoid IFUNC for __mempcpy

Code used during early static startup in elf/dl-tls.c uses
__mempcpy.

Fixes commit cbd9fd236981717d3d4ee942986ea912e9707c32 ("Consolidate
TLS block allocation for static binaries with ld.so").

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agoelf: Build dl-tls.o with early startup symbol redirections
Florian Weimer [Sun, 2 Feb 2025 15:22:23 +0000 (16:22 +0100)] 
elf: Build dl-tls.o with early startup symbol redirections

This is required when building for powerpc64le POWER8 with GCC 8
at least.

Fixes commit cbd9fd236981717d3d4ee942986ea912e9707c32 ("Consolidate
TLS block allocation for static binaries with ld.so").

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agomanual: make @manpageurl more specific to each output
DJ Delorie [Tue, 10 Dec 2024 21:57:21 +0000 (16:57 -0500)] 
manual: make @manpageurl more specific to each output

Tweak the @manpageurl macro to customize the output for
each of html, info, and pdf output.  HTML and PDF (at
least, these days) support clicking on the link title,
whereas info does not.  Add text to the intro section
explaining which man pages are normative and which
aren't.

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.

5 months agoelf: Use _dl_find_object instead of _dl_find_dso_for_object in dlopen
Florian Weimer [Sun, 2 Feb 2025 19:10:09 +0000 (20:10 +0100)] 
elf: Use _dl_find_object instead of _dl_find_dso_for_object in dlopen

The _dl_find_object function uses a binary search and is faster if
there are many objects.

5 months agoelf: Add fast path to dlopen for fully-opened maps
Florian Weimer [Sun, 2 Feb 2025 19:10:09 +0000 (20:10 +0100)] 
elf: Add fast path to dlopen for fully-opened maps

If the map is already fully open (has matching flags and its
own scope allocated), it is not necessary to unprotected memory
during dlopen.

5 months agoelf: Determine the caller link map in _dl_open
Florian Weimer [Sun, 2 Feb 2025 19:10:09 +0000 (20:10 +0100)] 
elf: Determine the caller link map in _dl_open

No functional change expected.

This is in preparation of adding a fast path to dlopen in case
no link map changes are required.

5 months agoelf: Merge __dl_libc_freemem into __rtld_libc_freeres
Florian Weimer [Sun, 2 Feb 2025 19:10:09 +0000 (20:10 +0100)] 
elf: Merge __dl_libc_freemem into __rtld_libc_freeres

The functions serve very similar purposes.  The advantage of
__rtld_libc_freeres is that it is located within ld.so, so it is
more natural to poke at link map internals there.

This slightly regresses cleanup capabilities for statically linked
binaries.  If that becomes a problem, we should start calling
__rtld_libc_freeres from __libc_freeres (perhaps after renaming it).

5 months agoelf: Add l_soname accessor function for DT_SONAME values
Florian Weimer [Sun, 2 Feb 2025 19:10:09 +0000 (20:10 +0100)] 
elf: Add l_soname accessor function for DT_SONAME values

It's not necessary to introduce temporaries because the compiler
is able to evaluate l_soname just once in constracts like:

  l_soname (l) != NULL && strcmp (l_soname (l), LIBC_SO) != 0

5 months agoelf: Split _dl_lookup_map, _dl_map_new_object from _dl_map_object
Florian Weimer [Sun, 2 Feb 2025 19:10:08 +0000 (20:10 +0100)] 
elf: Split _dl_lookup_map, _dl_map_new_object from _dl_map_object

So that they can eventually be called separately from dlopen.

5 months agohurd: Use the new __proc_reauthenticate_complete protocol
Sergey Bugaev [Sat, 1 Feb 2025 17:17:38 +0000 (18:17 +0100)] 
hurd: Use the new __proc_reauthenticate_complete protocol

5 months agoelf: Do not add a copy of _dl_find_object to libc.so
Florian Weimer [Sat, 1 Feb 2025 11:37:58 +0000 (12:37 +0100)] 
elf: Do not add a copy of _dl_find_object to libc.so

This reduces code size and dependencies on ld.so internals from
libc.so.

Fixes commit f4c142bb9fe6b02c0af8cfca8a920091e2dba44b
("arm: Use _dl_find_object on __gnu_Unwind_Find_exidx (BZ 31405)").

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agohtl: move pthread_setcancelstate into libc.
gfleury [Sat, 1 Feb 2025 08:02:02 +0000 (10:02 +0200)] 
htl: move pthread_setcancelstate into libc.

sysdeps/pthread/sem_open.c: call pthread_setcancelstate directely
since forward declaration is gone on hurd too
Message-ID: <20250201080202.494671-1-gfleury@disroot.org>

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.

5 months agomanual: Safety annotations for timespec_get and timespec_getres
Tulio Magno Quites Machado Filho [Tue, 28 Jan 2025 18:31:01 +0000 (15:31 -0300)] 
manual: Safety annotations for timespec_get and timespec_getres

Add preliminary annotations that are consistent with clock_gettime and
clock_getres.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
5 months agosh: Fix tst-guard1 build
Adhemerval Zanella [Fri, 31 Jan 2025 12:34:36 +0000 (09:34 -0300)] 
sh: Fix tst-guard1 build

The tests uses ARCH_MIN_GUARD_SIZE and the sysdep.h include is not
required.

5 months agomanual: Add links to POSIX Semaphores man-pages documentation
Arjun Shankar [Tue, 14 Jan 2025 01:52:10 +0000 (02:52 +0100)] 
manual: Add links to POSIX Semaphores man-pages documentation

The POSIX Semaphores functions are currently undocumented in our info
pages.  This commit adds links to the man-pages documentation for all
the `sem_*' functions (except `sem_clockwait') so that they refer to
some useful documentation instead of just being stubs.  `sem_clockwait'
isn't documented by man-pages but thankfully already has a small useful
blurb in our own docs.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agomanual: Consolidate POSIX Semaphores docs in Threads chapter
Arjun Shankar [Tue, 14 Jan 2025 01:52:09 +0000 (02:52 +0100)] 
manual: Consolidate POSIX Semaphores docs in Threads chapter

This commit moves the `sem_*' family of functions from the IPC chapter,
replacing them with a reference to their new location in the Threads
chapter.  `sem_clockwait' is also moved out of the Non-POSIX Extensions
subsection since it is now included in the standard since Issue 8:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_clockwait.html

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agold.so: Decorate BSS mappings
Petr Malat [Tue, 28 Jan 2025 10:08:20 +0000 (11:08 +0100)] 
ld.so: Decorate BSS mappings

Decorate BSS mappings with [anon: glibc: .bss <file>], for example
[anon: glibc: .bss /lib/libc.so.6]. The string ".bss" is already used
by bionic so use the same, but add the filename as well. If the name
would be longer than what the kernel allows, drop the directory part
of the path.

Refactor glibc.mem.decorate_maps check to a separate function and use
it to avoid assembling a name, which would not be used later.

Signed-off-by: Petr Malat <oss@malat.biz>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 months agonptl: Add support for setup guard pages with MADV_GUARD_INSTALL
Adhemerval Zanella [Wed, 8 Jan 2025 18:16:48 +0000 (15:16 -0300)] 
nptl: Add support for setup guard pages with MADV_GUARD_INSTALL

Linux 6.13 (662df3e5c3766) added a lightweight way to define guard areas
through madvise syscall.  Instead of PROT_NONE the guard region through
mprotect, userland can madvise the same area with a special flag, and
the kernel ensures that accessing the area will trigger a SIGSEGV (as for
PROT_NONE mapping).

The madvise way has the advantage of less kernel memory consumption for
the process page-table (one less VMA per guard area), and slightly less
contention on kernel (also due to the fewer VMA areas being tracked).

The pthread_create allocates a new thread stack in two ways: if a guard
area is set (the default) it allocates the memory range required using
PROT_NONE and then mprotect the usable stack area. Otherwise, if a
guard page is not set it allocates the region with the required flags.

For the MADV_GUARD_INSTALL support, the stack area region is allocated
with required flags and then the guard region is installed.  If the
kernel does not support it, the usual way is used instead (and
MADV_GUARD_INSTALL is disabled for future stack creations).

The stack allocation strategy is recorded on the pthread struct, and it
is used in case the guard region needs to be resized.  To avoid needing
an extra field, the 'user_stack' is repurposed and renamed to 'stack_mode'.

This patch also adds a proper test for the pthread guard.

I checked on x86_64, aarch64, powerpc64le, and hppa with kernel 6.13.0-rc7.

Reviewed-by: DJ Delorie <dj@redhat.com>
6 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>
6 months agomanual: Update compatibility note on flushing of line-oriented files
Florian Weimer [Wed, 29 Jan 2025 09:28:10 +0000 (10:28 +0100)] 
manual: Update compatibility note on flushing of line-oriented files

Operation systems which represent text files in a line-oriented
fashion (and not as byte streams with a character sequence reserved
for line termination) logically cannot flush a buffer without
also creating a terminated line.

Update this portability note and move it to the Binary Streams
section.  Add another related compatibility concern, too.

6 months agohtl: move pthread_setcanceltype into libc.
gfleury [Fri, 3 Jan 2025 10:37:50 +0000 (12:37 +0200)] 
htl: move pthread_setcanceltype into libc.

Message-ID: <20250103103750.870897-7-gfleury@disroot.org>

6 months agohtl: move pthread_mutex_consistent, pthread_mutex_consistent_np into libc.
gfleury [Fri, 3 Jan 2025 10:37:49 +0000 (12:37 +0200)] 
htl: move pthread_mutex_consistent, pthread_mutex_consistent_np into libc.

Message-ID: <20250103103750.870897-6-gfleury@disroot.org>

6 months agohtl: move pthread_mutex_destroy into libc.
gfleury [Fri, 3 Jan 2025 10:37:48 +0000 (12:37 +0200)] 
htl: move pthread_mutex_destroy into libc.

Message-ID: <20250103103750.870897-5-gfleury@disroot.org>

6 months agohtl: move pthread_mutex_getprioceiling, pthread_mutex_setprioceiling into libc
gfleury [Fri, 3 Jan 2025 10:37:47 +0000 (12:37 +0200)] 
htl: move pthread_mutex_getprioceiling, pthread_mutex_setprioceiling into libc

Message-ID: <20250103103750.870897-4-gfleury@disroot.org>

6 months agohtl: move pthread_mutex_{lock, unlock, trylock, timedlock, clocklock}
gfleury [Fri, 3 Jan 2025 10:37:46 +0000 (12:37 +0200)] 
htl: move pthread_mutex_{lock, unlock, trylock, timedlock, clocklock}

I haven't exposed _pthread_mutex_lock,  _pthread_mutex_trylock and
_pthread_mutex_unlock in GLIBC_PRIVATE since there aren't used in any
code in libpthread
Message-ID: <20250103103750.870897-3-gfleury@disroot.org>

6 months agohtl: move pthread_mutex_init into libc.
gfleury [Fri, 3 Jan 2025 10:37:45 +0000 (12:37 +0200)] 
htl: move pthread_mutex_init into libc.

Message-ID: <20250103103750.870897-2-gfleury@disroot.org>

6 months agohtl: remove leftover for pthread_mutexattr_settype
gfleury [Tue, 28 Jan 2025 23:33:04 +0000 (00:33 +0100)] 
htl: remove leftover for pthread_mutexattr_settype

from b386295727d35a83aa3d4750e198cbf8040c9a23

6 months agoAdd test of input file flushing / offset issues
Joseph Myers [Tue, 28 Jan 2025 23:39:12 +0000 (23:39 +0000)] 
Add test of input file flushing / offset issues

Having fixed several bugs relating to flushing of FILE* streams (with
fflush and other operations) and their offsets (both the file position
indicator in the FILE*, and the offset in the underlying open file
description), especially after ungetc but not limited to that case,
add a test that more systematically covers different combinations of
cases for such issues, with 57220 separate scenarios tested (which
include examples of all the five separate fixed bugs), all of which
pass given the five previous bug fixes.

Tested for x86_64.

6 months agoFix fflush handling for mmap files after ungetc (bug 32535)
Joseph Myers [Tue, 28 Jan 2025 23:20:08 +0000 (23:20 +0000)] 
Fix fflush handling for mmap files after ungetc (bug 32535)

As discussed in bug 32535, fflush fails on files opened for reading
using mmap after ungetc.  Fix the logic to handle this case and still
compute the file offset correctly.

Tested for x86_64.

6 months agoFix fseek handling for mmap files after ungetc or fflush (bug 32529)
Joseph Myers [Tue, 28 Jan 2025 22:35:21 +0000 (22:35 +0000)] 
Fix fseek handling for mmap files after ungetc or fflush (bug 32529)

As discussed in bug 32529, fseek fails on files opened for reading
using mmap after ungetc.  The implementation of fseek for such files
has an offset computation that's also incorrect after fflush.  A
combined fix addresses both problems (with tests for both included as
well) and it seems reasonable to consider them a single bug.

Tested for x86_64.

6 months agoMake fflush (NULL) flush input files (bug 32369)
Joseph Myers [Tue, 28 Jan 2025 21:53:49 +0000 (21:53 +0000)] 
Make fflush (NULL) flush input files (bug 32369)

As discussed in bug 32369 and required by POSIX, the POSIX feature
fflush (NULL) should flush input files, not just output files.  The
POSIX requirement is that "fflush() shall perform this flushing action
on all streams for which the behavior is defined above", and the
definition for input files is for "a stream open for reading with an
underlying file description, if the file is not already at EOF, and
the file is one capable of seeking".

Implement this requirement in glibc.  (The underlying flushing
implementation is what deals with avoiding errors for seeking on an
unseekable file.)

Tested for x86_64.

6 months agoMake fclose seek input file to right offset (bug 12724)
Joseph Myers [Tue, 28 Jan 2025 20:22:56 +0000 (20:22 +0000)] 
Make fclose seek input file to right offset (bug 12724)

As discussed in bug 12724 and required by POSIX, before an input file
(based on an underlying seekable file descriptor) is closed, fclose is
sometimes required to seek that file descriptor to the correct offset,
so that any other file descriptors sharing the underlying open file
description are left at that offset (as a motivating example, a script
could call a sequence of commands each of which processes some data
from (seekable) stdin using stdio; fclose needs to do this so that
each successive command can read exactly the data not handled by
previous commands), but glibc fails to do this.

The precise POSIX wording has changed a few times; in the 2024 edition
it's "If the file is not already at EOF, and the file is one capable
of seeking, the file offset of the underlying open file description
shall be set to the file position of the stream if the stream is the
active handle to the underlying file description.".

Add appropriate logic to _IO_new_file_close_it to handle this case.  I
haven't made any attempt to test or change things in this area for the
"old" functions.

Note that there was a previous attempt to fix bug 12724, reverted in
commit eb6cbd249f4465b01f428057bf6ab61f5f0c07e3.  The fix version here
addresses the original test in that bug report without breaking the
one given in a subsequent comment in that bug report (which works with
glibc before the patch, but maybe was broken by the original fix that
was reverted).

The logic here tries to take care not to seek the file, even to its
newly computed current offset, if at EOF / possibly not the active
handle; even seeking to the current offset would be problematic
because of a potential race (fclose computes the current offset,
another thread or process with the active handle does its own seek,
fclose does a seek (not permitted by POSIX in this case) that loses
the effect of the seek on the active handle in another thread or
process).  There are tests included for various cases of being or not
being the active handle, though there aren't tests for the potential
race condition.

Tested for x86_64.

6 months agoFix fflush after ungetc on input file (bug 5994)
Joseph Myers [Tue, 28 Jan 2025 19:38:27 +0000 (19:38 +0000)] 
Fix fflush after ungetc on input file (bug 5994)

As discussed in bug 5994 (plus duplicates), POSIX requires fflush
after ungetc to discard pushed-back characters but preserve the file
position indicator.  For this purpose, each ungetc decrements the file
position indicator by 1; it is unspecified after ungetc at the start
of the file, and after ungetwc, so no special handling is needed for
either of those cases.

This is fixed with appropriate logic in _IO_new_file_sync.  I haven't
made any attempt to test or change things in this area for the "old"
functions; the case of files using mmap is addressed in a subsequent
patch (and there seem to be no problems in this area with files opened
with fmemopen).

Tested for x86_64.

6 months agolibio: Add a new fwrite test that evaluates partial writes
Tulio Magno Quites Machado Filho [Tue, 28 Jan 2025 18:37:44 +0000 (15:37 -0300)] 
libio: Add a new fwrite test that evaluates partial writes

Test if the file-position is correctly updated when fwrite tries to
flush its internal cache but is not able to completely write all items.

Reviewed-by: DJ Delorie <dj@redhat.com>
6 months agolibio: Start to return errors when flushing fwrite's buffer [BZ #29459]
Tulio Magno Quites Machado Filho [Tue, 28 Jan 2025 18:37:44 +0000 (15:37 -0300)] 
libio: Start to return errors when flushing fwrite's buffer [BZ #29459]

When an error happens, fwrite is expected to return a value that is less
than nmemb.  If this error happens while flushing its internal buffer,
fwrite is in a complex scenario: all the data might have been written to
the buffer, indicating a successful copy, but the buffer is expected to
be flushed and it was not.

POSIX.1-2024 states the following about errors on fwrite:

    If an error occurs, the resulting value of the file-position indicator
    for the stream is unspecified.

    The fwrite() function shall return the number of elements successfully
    written, which may be less than nitems if a write error is encountered.

With that in mind, this commit modifies _IO_new_file_write in order to
return the total number of bytes written via the file pointer.  It also
modifies fwrite in order to use the new information and return the
correct number of bytes written even when sputn returns EOF.

Add 2 tests:

1. tst-fwrite-bz29459: This test is based on the reproducer attached to
   bug 29459.  In order to work, it requires to pipe stdout to another
   process making it hard to reuse test-driver.c.  This code is more
   specific to the issue reported.
2. tst-fwrite-pipe: Recreates the issue by creating a pipe that is shared
   with a child process.  Reuses test-driver.c.  Evaluates a more generic
   scenario.

Co-authored-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
6 months agoAdd new tests for fopen
Martin Coufal [Thu, 23 Jan 2025 12:04:06 +0000 (13:04 +0100)] 
Add new tests for fopen

Adding some basic tests for fopen, testing different modes, stream
positioning and concurrent read/write operation on files.
Reviewed-by: DJ Delorie <dj@redhat.com>
6 months agoIncrease version to 2.41.9000, add new section to NEWS glibc-2.41.9000
Andreas K. Hüttel [Tue, 28 Jan 2025 17:42:35 +0000 (18:42 +0100)] 
Increase version to 2.41.9000, add new section to NEWS

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>