]> sourceware.org Git - glibc.git/log
glibc.git
6 hours agoelf: Introduce _dl_relocate_object_no_relro
Florian Weimer [Wed, 6 Nov 2024 09:33:44 +0000 (10:33 +0100)]
elf: Introduce _dl_relocate_object_no_relro

And make _dl_protect_relro apply RELRO conditionally.

Reviewed-by: DJ Delorie <dj@redhat.com>
6 hours agoelf: Do not define consider_profiling, consider_symbind as macros
Florian Weimer [Wed, 6 Nov 2024 09:33:44 +0000 (10:33 +0100)]
elf: Do not define consider_profiling, consider_symbind as macros

This avoids surprises when refactoring the code if these identifiers
are re-used later in the file.

Reviewed-by: DJ Delorie <dj@redhat.com>
6 hours agoelf: rtld_multiple_ref is always true
Florian Weimer [Wed, 6 Nov 2024 09:33:44 +0000 (10:33 +0100)]
elf: rtld_multiple_ref is always true

For a long time, libc.so.6 has dependend on ld.so, which
means that there is a reference to ld.so in all processes,
and rtld_multiple_ref is always true.  In fact, if
rtld_multiple_ref were false, some of the ld.so setup code
would not run.

Reviewed-by: DJ Delorie <dj@redhat.com>
20 hours agoAdd Arm HWCAP2_* constants from Linux 3.15 and 6.2 to <bits/hwcap.h>
Aurelien Jarno [Sat, 2 Nov 2024 09:52:54 +0000 (10:52 +0100)]
Add Arm HWCAP2_* constants from Linux 3.15 and 6.2 to <bits/hwcap.h>

Linux 3.15 and 6.2 added HWCAP2_* values for Arm. These bits have
already been added to dl-procinfo.{c,h} in commits 9aea0cb842f02 and
8ebe9c0b38a9. Also add them to <bits/hwcap.h> so that they can be used
in user code. For example, for checking bits in the value returned by
getauxval(AT_HWCAP2).

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
41 hours agoAdd feature test macro _ISOC2Y_SOURCE
Lenard Mollenkopf [Tue, 22 Oct 2024 13:17:54 +0000 (15:17 +0200)]
Add feature test macro _ISOC2Y_SOURCE

This patch starts preparation for C2Y support in glibc headers by
adding a feature test macro _ISOC2Y_SOURCE and corresponding
__GLIBC_USE (ISOC2Y). (I mostly copied the work of Joseph Myers
for C2X). As with other such macros, C2Y features are also
enabled by compiling for a standard newer than C23, or by using
_GNU_SOURCE.

This patch does not itself enable anything new in the headers for C2Y;
that is to be done in followup patches. (For example an implementation
of WG14 N3349.)

Once C2Y becomes an actual standard we'll presumably move to using the
actual year in the feature test macro and __GLIBC_USE, with some
period when both macro spellings are accepted, as was done with
_ISOC2X_SOURCE.

Tested for x86_64.

Signed-off-by: Lenard Mollenkopf <glibc@lenardmollenkopf.de>
2 days agoadded license for sysdeps/ieee754/flt-32/e_gammaf_r.c
Paul Zimmermann [Fri, 11 Oct 2024 10:22:07 +0000 (12:22 +0200)]
added license for sysdeps/ieee754/flt-32/e_gammaf_r.c

5 days agoAArch64: Remove SVE erf and erfc tables
Joe Ramsay [Fri, 1 Nov 2024 15:48:54 +0000 (15:48 +0000)]
AArch64: Remove SVE erf and erfc tables

By using a combination of mask-and-add instead of the shift-based
index calculation the routines can share the same table as other
variants with no performance degradation.

The tables change name because of other changes in downstream AOR.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 days agox86_64: Add exp2m1f with FMA
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:55 +0000 (15:21 -0300)]
x86_64: Add exp2m1f with FMA

The CORE-MATH exp2m1f implementation showed slight worse latency
when using x86_64 baseline ABI.  This patch adds a ifunc variant
with similar performance for x86_64-v3.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agox86_64: Add exp10m1f with FMA
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:54 +0000 (15:21 -0300)]
x86_64: Add exp10m1f with FMA

The CORE-MATH exp10m1f implementation showed slight worse latency
when using x86_64 baseline ABI.  This patch adds a ifunc variant
with similar performance for x86_64-v3.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agomath: Use log10p1f from CORE-MATH
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:53 +0000 (15:21 -0300)]
math: Use log10p1f from CORE-MATH

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

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 (M1,
gcc 13.2.1), and powerpc (POWER10, gcc 13.2.1):

Latency                      master        patched   improvement
x86_64                      68.5251        32.2627        52.92%
x86_64v2                    68.8912        32.7887        52.41%
x86_64v3                    59.3427        27.0521        54.41%
i686                        162.026        103.383        36.19%
aarch64                     26.8513        14.5695        45.74%
power10                     12.7426         8.4929        33.35%
powerpc                     16.6768        9.29135        44.29%

reciprocal-throughput        master        patched   improvement
x86_64                      26.0969        12.4023        52.48%
x86_64v2                    25.0045        11.0748        55.71%
x86_64v3                    20.5610        10.2995        49.91%
i686                        89.8842        78.5211        12.64%
aarch64                     17.1200         9.4832        44.61%
power10                      6.7814         6.4258         5.24%
powerpc                      15.769         7.6825        51.28%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agomath: Use log1pf from CORE-MATH
Adhemerval Zanella [Sun, 20 Oct 2024 17:52:49 +0000 (14:52 -0300)]
math: Use log1pf from CORE-MATH

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

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 (M1,
gcc 13.2.1), and powerpc (POWER10, gcc 13.2.1):

Latency                      master        patched   improvement
x86_64                      71.8142        38.9668        45.74%
x86_64v2                    71.9094        39.1321        45.58%
x86_64v3                    60.1000        32.4016        46.09%
i686                        147.105        104.258        29.13%
aarch64                     26.4439        14.0050        47.04%
power10                     19.4874         9.4146        51.69%
powerpc                     17.6145        8.00736        54.54%

reciprocal-throughput        master        patched   improvement
x86_64                      19.7604        12.7254        35.60%
x86_64v2                    19.0039        11.9455        37.14%
x86_64v3                    16.8559        11.9317        29.21%
i686                        82.3426        73.9718        10.17%
aarch64                     14.4665         7.9614        44.97%
power10                     11.9974         8.4117        29.89%
powerpc                     7.15222         6.0914        14.83%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agomath: Use log2p1f from CORE-MATH
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:51 +0000 (15:21 -0300)]
math: Use log2p1f from CORE-MATH

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

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                      70.1462        47.0090        32.98%
x86_64v2                    70.2513        47.6160        32.22%
x86_64v3                    60.4840        39.9443        33.96%
i686                        164.068        122.909        25.09%
aarch64                     25.9169        16.9207        34.71%
power10                     18.1261        9.8592         45.61%
powerpc                     17.2683        9.38665        45.64%

reciprocal-throughput        master        patched   improvement
x86_64                      26.2240        16.4082        37.43%
x86_64v2                    25.0911        15.7480        37.24%
x86_64v3                    20.9371        11.7264        43.99%
i686                        90.4209        95.3073        -5.40%
aarch64                     16.8537        8.9561         46.86%
power10                     12.9401        6.5555         49.34%
powerpc                     9.01763        7.54745        16.30%

The performance decrease for i686 is mostly due the use of x87 fpu,
when building with '-msse2 -mfpmath=sse:

                             master        patched   improvement
latency                     164.068        102.982        37.23%
reciprocal-throughput       89.1968        82.5117         7.49%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agomath: Use log10f from CORE-MATH
Adhemerval Zanella [Mon, 21 Oct 2024 18:51:27 +0000 (15:51 -0300)]
math: Use log10f from CORE-MATH

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

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                      49.9017        33.5143        32.84%
x86_64v2                    50.4878        33.5623        33.52%
x86_64v3                    50.0991        27.6078        44.89%
i686                        140.874        106.086        24.69%
aarch64                     19.2846        11.3573        41.11%
power10                     14.0994        7.7739        44.86%
powerpc                     14.2898        7.92497        44.54%

reciprocal-throughput        master        patched   improvement
x86_64                      17.8336        12.9074        27.62%
x86_64v2                    16.4418        11.3220        31.14%
x86_64v3                    15.6002        10.5158        32.59%
i686                        66.0678        80.2287        -21.43%
aarch64                      9.4906        6.8393        27.94%
power10                      7.5255        5.5084        26.80%
powerpc                      9.5204        6.98055        26.68%

The performance decrease for i686 is mostly due the use of x87 fpu,
when building with '-msse2 -mfpmath=sse':

                             master        patched   improvement
latency                     140.874        77.1137        45.26%
reciprocal-throughput        64.481        56.4397        12.47%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agomath: Use expm1f from CORE-MATH
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:49 +0000 (15:21 -0300)]
math: Use expm1f from CORE-MATH

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

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                      96.7402        36.4026        62.37%
x86_64v2                    97.5391        33.4625        65.69%
x86_64v3                    82.1778        30.8668        62.44%
i686                         120.58        94.8302        21.35%
aarch64                     32.3558        12.8881        60.17%
power10                     23.5087        9.8574         58.07%
powerpc                     23.4776        9.06325        61.40%

reciprocal-throughput        master        patched   improvement
x86_64                      27.8224        15.9255        42.76%
x86_64v2                    27.8364        9.6438         65.36%
x86_64v3                    20.3227        9.6146         52.69%
i686                        63.5629        59.4718         6.44%
aarch64                     17.4838        7.1082         59.34%
power10                     12.4644        8.7829         29.54%
powerpc                     14.2152        5.94765        58.16%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agomath: Use exp2m1f from CORE-MATH
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:48 +0000 (15:21 -0300)]
math: Use exp2m1f from CORE-MATH

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

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).  The
only change is to handle FLT_MAX_EXP for FE_DOWNWARD or FE_TOWARDZERO.

The benchmark inputs are based on exp2f ones.

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                      40.6042        48.7104       -19.96%
x86_64v2                    40.7506        35.9032        11.90%
x86_64v3                    35.2301        31.7956        9.75%
i686                        102.094        94.6657        7.28%
aarch64                     18.2704        15.1387        17.14%
power10                     11.9444         8.2402        31.01%

reciprocal-throughput        master        patched   improvement
x86_64                      20.8683        16.1428        22.64%
x86_64v2                    19.5076        10.4474        46.44%
x86_64v3                    19.2106        10.4014        45.86%
i686                        56.4054        59.3004        -5.13%
aarch64                     12.0781         7.3953        38.77%
power10                      6.5306         5.9388         9.06%

The generic implementation calls __ieee754_exp2f and x86_64 provides
an optimized ifunc version (built with -mfma -mavx2, not correctly
rounded).  This explains the performance difference for x86_64.

Same for i686, where the ABI provides an optimized __ieee754_exp2f
version built with '-msse2 -mfpmath=sse'.  When built wth same
flags, the new algorithm shows a better performance:

                            master        patched    improvement
latency                    102.094        91.2823         10.59%
reciprocal-throughput      56.4054        52.7984          6.39%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agomath: Use exp10m1f from CORE-MATH
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:47 +0000 (15:21 -0300)]
math: Use exp10m1f from CORE-MATH

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

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).  I mostly
fixed some small issues in corner cases (sNaN handling, -INFINITY,
a specific overflow check).

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                      45.4690        49.5845        -9.05%
x86_64v2                    46.1604        36.2665        21.43%
x86_64v3                    37.8442        31.0359        17.99%
i686                        121.367        93.0079        23.37%
aarch64                     21.1126        15.0165        28.87%
power10                     12.7426        8.4929         33.35%

reciprocal-throughput        master        patched   improvement
x86_64                      19.6005        17.4005        11.22%
x86_64v2                    19.6008        11.1977        42.87%
x86_64v3                    17.5427        10.2898        41.34%
i686                        59.4215        60.9675        -2.60%
aarch64                     13.9814        7.9173         43.37%
power10                      6.7814        6.4258          5.24%

The generic implementation calls __ieee754_exp10f which has an
optimized version, although it is not correctly rounded, which is
the main culprit of the the latency difference for x86_64 and
throughp for i686.

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agobenchtests: Add log10p1f benchmark
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:46 +0000 (15:21 -0300)]
benchtests: Add log10p1f benchmark

It is based on log2f data.

Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agobenchtests: Add log1p benchmark
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:45 +0000 (15:21 -0300)]
benchtests: Add log1p benchmark

Random inputs x*2^e where x is random in [1/2,1] and e in [-29,127].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agobenchtests: Add log2p1f benchmark
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:44 +0000 (15:21 -0300)]
benchtests: Add log2p1f benchmark

It is based on log2f data.

Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agobenchtests: Add log10f benchmark
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:43 +0000 (15:21 -0300)]
benchtests: Add log10f benchmark

The inputs are random numbers in the form x*2^e where x is random
in [0x1p-1,0x1p+0] and e in [-126,127].

Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agobenchtests: Add expm1f benchmark
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:42 +0000 (15:21 -0300)]
benchtests: Add expm1f benchmark

The inputs are modeled based on expm1-inputs, with the range
adapted to binary32 range.

Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agobenchtests: Add exp2m1f benchmark
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:41 +0000 (15:21 -0300)]
benchtests: Add exp2m1f benchmark

The input is based on exp2f benchmark.

Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agobenchtests: Add exp10m1f benchmark
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:40 +0000 (15:21 -0300)]
benchtests: Add exp10m1f benchmark

The input is based on exp10f benchmark.

Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agomath: Add e_gammaf_r to glibc code and style
Adhemerval Zanella [Fri, 25 Oct 2024 18:21:39 +0000 (15:21 -0300)]
math: Add e_gammaf_r to glibc code and style

Also remove the use of builtins in favor of standard names, compiler
already inline them (if supported) with current compiler options.
It also fixes and issue where __builtin_roundeven is not support on
gcc older than version 10.

Checked on x86_64-linux-gnu and i686-linux_gnu.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 days agoLoongArch: Add RSEQ_SIG in rseq.h.
caiyinyu [Sat, 26 Oct 2024 08:33:07 +0000 (16:33 +0800)]
LoongArch: Add RSEQ_SIG in rseq.h.

Signed-off-by: caiyinyu <caiyinyu@loongson.cn>
5 days agonptl: Add <thread_pointer.h> for LoongArch
Michael Jeanson [Wed, 23 Oct 2024 20:18:06 +0000 (16:18 -0400)]
nptl: Add <thread_pointer.h> for LoongArch

This will be required by the rseq extensible ABI implementation on all
Linux architectures exposing the '__rseq_size' and '__rseq_offset'
symbols to set the initial value of the 'cpu_id' field which can be used
by applications to test if rseq is available and registered. As long as
the symbols are exposed it is valid for an application to perform this
test even if rseq is not yet implemented in libc for this architecture.

Both code paths are compile tested with build-many-glibcs.py but I don't
have access to any hardware to run the tests.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
5 days agoLink tst-clock_gettime with $(librt)
Joseph Myers [Thu, 31 Oct 2024 17:43:52 +0000 (17:43 +0000)]
Link tst-clock_gettime with $(librt)

This is needed to avoid link failures for the timer_* functions on
Hurd.

Tested with build-many-glibcs.py for i686-gnu.

6 days agopowerpc64: Obviate the need for ROP protection in clone/clone3
Sachin Monga [Wed, 30 Oct 2024 20:43:37 +0000 (16:43 -0400)]
powerpc64: Obviate the need for ROP protection in clone/clone3

Save lr in a non-volatile register before scv in clone/clone3.
For clone, the non-volatile register was unused and already
saved/restored.  Remove the dead code from clone.

Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
6 days agoAdd tests of time, gettimeofday, clock_gettime
Joseph Myers [Wed, 30 Oct 2024 16:48:38 +0000 (16:48 +0000)]
Add tests of time, gettimeofday, clock_gettime

There are no tests specifically focused on the functions time,
gettimeofday and clock_gettime, although there are some incidental
uses in tests of other functions.  Add tests specifically for these
three functions.

Tested for x86_64 and x86.

7 days agoAdd more tests of pthread attributes initial values
Joseph Myers [Tue, 29 Oct 2024 17:35:21 +0000 (17:35 +0000)]
Add more tests of pthread attributes initial values

There are various existing tests that call pthread_attr_init and then
verify properties of the resulting initial values retrieved with
pthread_attr_get* functions.  However, those are missing coverage of
the initial values retrieved with pthread_attr_getschedparam and
pthread_attr_getstacksize.  Add testing for initial values from those
functions as well.

(tst-attr2 covers pthread_attr_getdetachstate,
pthread_attr_getguardsize, pthread_attr_getinheritsched,
pthread_attr_getschedpolicy, pthread_attr_getscope.  tst-attr3 covers
some of those together with pthread_attr_getaffinity_np.
tst-pthread-attr-sigmask covers pthread_attr_getsigmask_np.
pthread_attr_getstack has unspecified results if called before the
relevant attributes have been set, while pthread_attr_getstackaddr is
deprecated.)

Tested for x86_64.

8 days agoDocument further requirement on mixing streams / file descriptors
Joseph Myers [Mon, 28 Oct 2024 22:22:26 +0000 (22:22 +0000)]
Document further requirement on mixing streams / file descriptors

The gilbc manual has some documentation in llio.texi of requirements
for moving between I/O on FILE * streams and file descriptors on the
same open file description.

The documentation of what must be done on a FILE * stream to move from
it to either a file descriptor or another FILE * for the same open
file description seems to match POSIX.  However, there is an
additional requirement in POSIX on the *second* of the two handles
being moved between, which is not mentioned in the glibc manual: "If
any previous active handle has been used by a function that explicitly
changed the file offset, except as required above for the first
handle, the application shall perform an lseek() or fseek() (as
appropriate to the type of handle) to an appropriate location.".

Document this requirement on seeking in the glibc manual, limited to
the case that seems relevant to glibc (the new channel is a previously
active stream, on which the seeking previously occurred).  Note that
I'm not sure what the "except as required above for the first handle"
is meant to be about, so I haven't documented anything for it.  As far
as I can tell, nothing specified for moving from the first handle
actually list calling a seek function as one of the steps to be done.
(Current POSIX doesn't seem to have any relevant rationale for this
section.  The rationale in the 1996 edition says "In requiring the
seek to an appropriate location for the new handle, the application is
required to know what it is doing if it is passing streams with seeks
involved.  If the required seek is not done, the results are undefined
(and in fact the program probably will not work on many common
implementations)." - which also doesn't help in understanding the
purpose of "except as required above for the first handle".)

Tested with "make info" and "make pdf".

8 days agopowerpc64le: Adhere to ABI stack alignment requirement
Sachin Monga [Mon, 28 Oct 2024 21:11:39 +0000 (16:11 -0500)]
powerpc64le: Adhere to ABI stack alignment requirement

The ABI requires all stack frames be 16-byte aligned.

Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
9 days agoAArch64: Small optimisation in AdvSIMD erf and erfc
Joe Ramsay [Mon, 28 Oct 2024 14:58:35 +0000 (14:58 +0000)]
AArch64: Small optimisation in AdvSIMD erf and erfc

In both routines, reduce register pressure such that GCC 14 emits no
spills for erf and fewer spills for erfc.  Also use more efficient
comparison for the special-case in erf.

Benchtests show erf improves by 6.4%, erfc by 1.0%.

9 days agoRevert "elf: Run constructors on cyclic recursive dlopen (bug 31986)"
Florian Weimer [Mon, 28 Oct 2024 13:45:30 +0000 (14:45 +0100)]
Revert "elf: Run constructors on cyclic recursive dlopen (bug 31986)"

This reverts commit 9897ced8e78db5d813166a7ccccfd5a42c69ef20.

Adjust the test expectations in elf/tst-dlopen-auditdup-auditmod.c
accordingly.

9 days agoelf: Change ldconfig auxcache magic number (bug 32231)
Florian Weimer [Mon, 28 Oct 2024 13:45:30 +0000 (14:45 +0100)]
elf: Change ldconfig auxcache magic number (bug 32231)

In commit c628c2296392ed3bf2cb8d8470668e64fe53389f (elf: Remove
ldconfig kernel version check), the layout of auxcache entries
changed because the osversion field was removed from
struct aux_cache_file_entry.  However, AUX_CACHEMAGIC was not
changed, so existing files are still used, potentially leading
to unintended ldconfig behavior.  This commit changes AUX_CACHEMAGIC,
so that the file is regenerated.

Reported-by: DJ Delorie <dj@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
11 days agoSHARED-FILES: Mention bundled Linux 6.10 headers.
Carlos O'Donell [Thu, 24 Oct 2024 12:30:25 +0000 (08:30 -0400)]
SHARED-FILES: Mention bundled Linux 6.10 headers.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
11 days agolibio: Fix crash in fputws [BZ #20632]
Peter Ammon [Mon, 9 Sep 2024 03:34:12 +0000 (20:34 -0700)]
libio: Fix crash in fputws [BZ #20632]

This fixes a buffer overflow in wide character string output, reproducing
when output fails, such as if the output fd is closed or is redirected
to a full device.

Wide character output data attempts to maintain the invariant that
`_IO_buf_base <= _IO_write_base <= _IO_write_end <= _IO_buf_end` (that is,
that the write region is a sub-region of `_IO_buf`). Prior to this commit,
this invariant is violated by the `_IO_wfile_overflow` function as so:

1. `_IO_wsetg` is called, assigning `_IO_write_base` to `_IO_buf_base`
2. `_IO_doallocbuf` is called, which jumps to `_IO_wfile_doallocate` via
    the _IO_wfile_jumps vtable. This function then assigns the wide data
    `_IO_buf_base` and `_IO_buf_end` to a malloc'd buffer.

Thus the invariant is violated. The fix is simply to reverse the order:
malloc the `_IO_buf` first and then assign `_IO_write_base` to it.

We also take this opportunity to defensively guard the initialization of
the number of unwritten characters via pointer arithmetic. We now check
that the buffer end is not before the buffer beginning; this matches a
similar defensive check in the narrow analogue `fileops.c`.

Add a test which fails without the fix.

Signed-off-by: Peter Ammon <corydoras@ridiculousfish.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
11 days agostdio-common: Fix scanf parsing for NaN types [BZ #30647]
Avinal Kumar [Fri, 25 Oct 2024 10:18:27 +0000 (15:48 +0530)]
stdio-common: Fix scanf parsing for NaN types [BZ #30647]

The scanf family of functions like sscanf and fscanf currently
ignore nan() and nan(n-char-sequence).  This happens because
__vfscanf_internal only checks for 'nan'.

This commit adds support for all valid nan types i.e.  nan, nan()
and nan(n-char-sequence), where n-char-sequence can be
[a-zA-Z0-9_]+, thus fixing the bug 30647.  Any other representation
of NaN should result in conversion error.

New tests are also added to verify the correct parsing of NaN types for
float, double and long double formats.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agoelf: Fix map_complete Systemtap probe in dl_open_worker
Florian Weimer [Fri, 25 Oct 2024 15:41:53 +0000 (17:41 +0200)]
elf: Fix map_complete Systemtap probe in dl_open_worker

The refactoring did not take the change of variable into account.
Fixes commit 43db5e2c0672cae7edea7c9685b22317eae25471
("elf: Signal RT_CONSISTENT after relocation processing in dlopen
(bug 31986)").

12 days agoelf: Signal RT_CONSISTENT after relocation processing in dlopen (bug 31986)
Florian Weimer [Fri, 25 Oct 2024 14:50:10 +0000 (16:50 +0200)]
elf: Signal RT_CONSISTENT after relocation processing in dlopen (bug 31986)

Previously, a la_activity audit event was generated before
relocation processing completed.  This does did not match what
happened during initial startup in elf/rtld.c (towards the end
of dl_main).  It also caused various problems if an auditor
tried to open the same shared object again using dlmopen:
If it was the directly loaded object, it had a search scope
associated with it, so the early exit in dl_open_worker_begin
was taken even though the object was unrelocated.  This caused
the r_state == RT_CONSISTENT assert to fail.  Avoidance of the
assert also depends on reversing the order of r_state update
and auditor event (already implemented in a previous commit).

At the later point, args->map can be NULL due to failure,
so use the assigned namespace ID instead if that is available.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agoelf: Signal LA_ACT_CONSISTENT to auditors after RT_CONSISTENT switch
Florian Weimer [Fri, 25 Oct 2024 14:50:10 +0000 (16:50 +0200)]
elf: Signal LA_ACT_CONSISTENT to auditors after RT_CONSISTENT switch

Auditors can call into the dynamic loader again if
LA_ACT_CONSISTENT, and  those recursive calls could observe
r_state != RT_CONSISTENT.

We should consider failing dlopen/dlmopen/dlclose if
r_state != RT_CONSISTENT.  The dynamic linker is probably not
in a state in which it can handle reentrant calls.  This
needs further investigation.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agoelf: Run constructors on cyclic recursive dlopen (bug 31986)
Florian Weimer [Fri, 25 Oct 2024 14:50:10 +0000 (16:50 +0200)]
elf: Run constructors on cyclic recursive dlopen (bug 31986)

This is conceptually similar to the reported bug, but does not
depend on auditing.  The fix is simple: just complete execution
of the constructors.  This exposed the fact that the link map
for statically linked executables does not have l_init_called
set, even though constructors have run.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 days agoLinux: Match kernel text for SCHED_ macros
Florian Weimer [Fri, 25 Oct 2024 13:00:50 +0000 (15:00 +0200)]
Linux: Match kernel text for SCHED_ macros

This avoids -Werror build issues in strace, which bundles UAPI
headers, but does not include them as system headers.

Fixes commit c444cc1d8335243c5c4e636d6a26c472df85522c
("Linux: Add missing scheduler constants to <sched.h>").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
12 days agolibio: Correctly link tst-popen-fork against libpthread
Arjun Shankar [Fri, 25 Oct 2024 07:33:45 +0000 (09:33 +0200)]
libio: Correctly link tst-popen-fork against libpthread

tst-popen-fork failed to build for Hurd due to not being linked with
libpthread.  This commit fixes that.

Tested with build-many-glibcs.py for i686-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
13 days agoAdd more tests of pthread_mutexattr_gettype and pthread_mutexattr_settype
Joseph Myers [Wed, 23 Oct 2024 16:45:15 +0000 (16:45 +0000)]
Add more tests of pthread_mutexattr_gettype and pthread_mutexattr_settype

Add basic tests of pthread_mutexattr_gettype and
pthread_mutexattr_settype with each valid mutex kind, plus test for
EINVAL with an invalid mutex kind.

Tested for x86_64.

2 weeks agolibio: Fix a deadlock after fork in popen
Arjun Shankar [Fri, 18 Oct 2024 14:03:25 +0000 (16:03 +0200)]
libio: Fix a deadlock after fork in popen

popen modifies its file handler book-keeping under a lock that wasn't
being taken during fork.  This meant that a concurrent popen and fork
could end up copying the lock in a "locked" state into the fork child,
where subsequently calling popen would lead to a deadlock due to the
already (spuriously) held lock.

This commit fixes the deadlock by appropriately taking the lock before
fork, and releasing/resetting it in the parent/child after the fork.

A new test for concurrent popen and fork is also added.  It consistently
hangs (and therefore fails via timeout) without the fix applied.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 weeks agoconfigure: default to --prefix=/usr on GNU/Linux
DJ Delorie [Fri, 11 Oct 2024 22:13:41 +0000 (18:13 -0400)]
configure: default to --prefix=/usr on GNU/Linux

I'm getting tired of always typing --prefix=/usr
so making it the default.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agomanual: Document stdio.h functions that may be macros
DJ Delorie [Thu, 10 Oct 2024 21:16:35 +0000 (17:16 -0400)]
manual: Document stdio.h functions that may be macros

Glibc has two gnu-extension functions that are implemented as
macros but not documented as such: fread_unlocked and
fwrite_unlocked.  Document them as such.

Additionally, putc_unlocked and getc_unlocked are documented in
POSIX as possibly being macros.  Update the manual to add a warning
about those also, depite glibc not implementing them as macros.

2 weeks agoCheck time arguments to pthread_timedjoin_np and pthread_clockjoin_np
Joseph Myers [Mon, 21 Oct 2024 20:56:48 +0000 (20:56 +0000)]
Check time arguments to pthread_timedjoin_np and pthread_clockjoin_np

The pthread_timedjoin_np and pthread_clockjoin_np functions do not
check that a valid time has been specified.  The documentation for
these functions in the glibc manual isn't sufficiently detailed to say
if they should, but consistency with POSIX functions such as
pthread_mutex_timedlock and pthread_cond_timedwait strongly indicates
that an EINVAL error is appropriate (even if there might be some
ambiguity about exactly where such a check should go in relation to
other checks for whether the thread exists, whether it's immediately
joinable, etc.).  Copy the logic for such a check used in
pthread_rwlock_common.c.

pthread_join_common had some logic calling valid_nanoseconds before
commit 9e92278ffad441daf588ff1ff5bd8094aa33fbfd, "nptl: Remove
clockwait_tid"; I haven't checked exactly what cases that detected.

Tested for x86_64 and x86.

2 weeks agoAdd .b4-config file
Jonathan Wakely [Thu, 17 Oct 2024 15:49:45 +0000 (16:49 +0100)]
Add .b4-config file

This makes b4 use inbox.sourceware.org instead of the default host
lore.kernel.org, so that every b4 user doesn't have to configure this
themselves for the glibc repo.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 weeks agolinux: Fix tst-syscall-restart.c on old gcc (BZ 32283)
Adhemerval Zanella [Fri, 18 Oct 2024 11:48:22 +0000 (08:48 -0300)]
linux: Fix tst-syscall-restart.c on old gcc (BZ 32283)

To avoid a parameter name omitted error.

2 weeks agosparc: Fix restartable syscalls (BZ 32173)
Adhemerval Zanella [Fri, 13 Sep 2024 14:11:56 +0000 (11:11 -0300)]
sparc: Fix restartable syscalls (BZ 32173)

The commit 'sparc: Use Linux kABI for syscall return'
(86c5d2cf0ce046279baddc7faa27da71f1a89fde) did not take into account
a subtle sparc syscall kABI constraint.  For syscalls that might block
indefinitely, on an interrupt (like SIGCONT) the kernel will set the
instruction pointer to just before the syscall:

arch/sparc/kernel/signal_64.c
476 static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
477 {
[...]
525                 if (restart_syscall) {
526                         switch (regs->u_regs[UREG_I0]) {
527                         case ERESTARTNOHAND:
528                         case ERESTARTSYS:
529                         case ERESTARTNOINTR:
530                                 /* replay the system call when we are done */
531                                 regs->u_regs[UREG_I0] = orig_i0;
532                                 regs->tpc -= 4;
533                                 regs->tnpc -= 4;
534                                 pt_regs_clear_syscall(regs);
535                                 fallthrough;
536                         case ERESTART_RESTARTBLOCK:
537                                 regs->u_regs[UREG_G1] = __NR_restart_syscall;
538                                 regs->tpc -= 4;
539                                 regs->tnpc -= 4;
540                                 pt_regs_clear_syscall(regs);
541                         }

However, on a SIGCONT it seems that 'g1' register is being clobbered after the
syscall returns.  Before 86c5d2cf0ce046279, the 'g1' was always placed jus
before the 'ta' instruction which then reloads the syscall number and restarts
the syscall.

On master, where 'g1' might be placed before 'ta':

  $ cat test.c
  #include <unistd.h>

  int main ()
  {
    pause ();
  }
  $ gcc test.c -o test
  $ strace -f ./t
  [...]
  ppoll(NULL, 0, NULL, NULL, 0

On another terminal

  $ kill -STOP 2262828

  $ strace -f ./t
  [...]
  --- SIGSTOP {si_signo=SIGSTOP, si_code=SI_USER, si_pid=2521813, si_uid=8289} ---
  --- stopped by SIGSTOP ---

And then

  $ kill -CONT 2262828

Results in:

  --- SIGCONT {si_signo=SIGCONT, si_code=SI_USER, si_pid=2521813, si_uid=8289} ---
  restart_syscall(<... resuming interrupted ppoll ...>) = -1 EINTR (Interrupted system call)

Where the expected behaviour would be:

  $ strace -f ./t
  [...]
  ppoll(NULL, 0, NULL, NULL, 0)           = ? ERESTARTNOHAND (To be restarted if no handler)
  --- SIGSTOP {si_signo=SIGSTOP, si_code=SI_USER, si_pid=2521813, si_uid=8289} ---
  --- stopped by SIGSTOP ---
  --- SIGCONT {si_signo=SIGCONT, si_code=SI_USER, si_pid=2521813, si_uid=8289} ---
  ppoll(NULL, 0, NULL, NULL, 0

Just moving the 'g1' setting near the syscall asm is not suffice,
the compiler might optimize it away (as I saw on cancellation.c by
trying this fix).  Instead, I have change the inline asm to put the
'g1' setup in ithe asm block.  This would require to change the asm
constraint for INTERNAL_SYSCALL_NCS, since the syscall number is not
constant.

Checked on sparc64-linux-gnu.

Reported-by: René Rebe <rene@exactcode.de>
Tested-by: Sam James <sam@gentoo.org>
Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agosupport: Make support_process_state_wait return the found state
Adhemerval Zanella [Fri, 13 Sep 2024 14:10:05 +0000 (11:10 -0300)]
support: Make support_process_state_wait return the found state

So caller can check which state was found if multiple ones are
asked.

Checked on x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
3 weeks agoEnable transliteration rules with two input characters in scn_IT [BZ #32280]
Mike FABIAN [Tue, 15 Oct 2024 16:40:25 +0000 (18:40 +0200)]
Enable transliteration rules with two input characters in scn_IT [BZ #32280]

Should work now because https://sourceware.org/bugzilla/show_bug.cgi?id=31859 has been fixed.

3 weeks agolocale: Fix some spelling typos
Jonathan Wakely [Mon, 14 Oct 2024 13:08:45 +0000 (14:08 +0100)]
locale: Fix some spelling typos

Replace several cases of "Ingore" with "Ignore".

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoLoongArch: Regenerate loongarch/arch-syscall.h by build-many-glibcs.py update-syscalls.
caiyinyu [Fri, 11 Oct 2024 04:48:14 +0000 (12:48 +0800)]
LoongArch: Regenerate loongarch/arch-syscall.h by build-many-glibcs.py update-syscalls.

3 weeks agomanual: Fix and test @deftypef* function formatting
Carlos O'Donell [Wed, 9 Oct 2024 22:32:26 +0000 (18:32 -0400)]
manual: Fix and test @deftypef* function formatting

The manual contained several instances of incorrect formatting
that were correct texinfo but produced incorrectly rendered manuals
or incorrect behaviour from the tooling.

The most important was incorrect quoting of function returns
by failing to use {} to quote the return.  The impact of this
mistake means that 'info libc func' does not jump to the function
in question but instead to the introductory page under the assumption
that func doesn't exist.  The function returns are now correctly
quoted.

The second issue was the use of a category specifier with
@deftypefun which doesn't accept a category specifier.  If a category
specifier is required then @deftypefn needs to be used. This is
corrected by changing the command to @deftypefn for such functions
that used {Deprecated function} as a category.

The last issue is a missing space between the function name and the
arguments which results in odd function names like "epoll_wait(int"
instead of "epoll_wait".  This also impacts the use of 'info libc'
and is corrected.

We additionally remove ';' from the end of function arguments and
add an 'int' return type for dprintf.

Lastly we add a new test check-deftype.sh which verifies the expected
formatting of @deftypefun, @deftypefunx, @deftypefn, and
@deftypefnx.  The new test is also run as the summary file is
generated to ensure we don't generate incorrect results.

The existing check-safety.sh is also run directly as a test to increase
coverage since the existing tests only ran on manual install.

The new tests now run as part of the standard "make check" that
pre-commit CI runs and developers should run.

No regressions on x86_64.

HTML and PDF rendering reviewed and looks correct for all changes.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoreplace tgammaf by the CORE-MATH implementation
Paul Zimmermann [Tue, 8 Oct 2024 09:28:04 +0000 (11:28 +0200)]
replace tgammaf by the CORE-MATH implementation

The CORE-MATH implementation is correctly rounded (for any rounding mode).
This can be checked by exhaustive tests in a few minutes since there are
less than 2^32 values to check against for example GNU MPFR.
This patch also adds some bench values for tgammaf.

Tested on x86_64 and x86 (cfarm26).

With the initial GNU libc code it gave on an Intel(R) Core(TM) i7-8700:

      "tgammaf": {
       "": {
        "duration": 3.50188e+09,
        "iterations": 2e+07,
        "max": 602.891,
        "min": 65.1415,
        "mean": 175.094
       }
      }

With the new code:

      "tgammaf": {
       "": {
        "duration": 3.30825e+09,
        "iterations": 5e+07,
        "max": 211.592,
        "min": 32.0325,
        "mean": 66.1649
       }
      }

With the initial GNU libc code it gave on cfarm26 (i686):

  "tgammaf": {
   "": {
    "duration": 3.70505e+09,
    "iterations": 6e+06,
    "max": 2420.23,
    "min": 243.154,
    "mean": 617.509
   }
  }

With the new code:

  "tgammaf": {
   "": {
    "duration": 3.24497e+09,
    "iterations": 1.8e+07,
    "max": 1238.15,
    "min": 101.155,
    "mean": 180.276
   }
  }

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Changes in v2:
    - include <math.h> (fix the linknamespace failures)
    - restored original benchtests/strcoll-inputs/filelist#en_US.UTF-8 file
    - restored original wrapper code (math/w_tgammaf_compat.c),
      except for the dealing with the sign
    - removed the tgammaf/float entries in all libm-test-ulps files
    - address other comments from Joseph Myers
      (https://sourceware.org/pipermail/libc-alpha/2024-July/158736.html)

Changes in v3:
    - pass NULL argument for signgam from w_tgammaf_compat.c
    - use of math_narrow_eval
    - added more comments

Changes in v4:
    - initialize local_signgam to 0 in math/w_tgamma_template.c
    - replace sysdeps/ieee754/dbl-64/gamma_productf.c by dummy file

Changes in v5:
    - do not mention local_signgam any more in math/w_tgammaf_compat.c
    - initialize local_signgam to 1 instead of 0 in w_tgamma_template.c
      and added comment

Changes in v6:
    - pass NULL as 2nd argument of __ieee754_gammaf_r in
      w_tgammaf_compat.c, and check for NULL in e_gammaf_r.c

Changes in v7:
    - added Signed-off-by line for Alexei Sibidanov (author of the code)

Changes in v8:
    - added Signed-off-by line for Paul Zimmermann (submitted of the patch)

Changes in v9:
    - address comments from review by Adhemerval Zanella
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoAdd IPPROTO_SMC from Linux 6.11 to netinet/in.h
Adhemerval Zanella [Tue, 8 Oct 2024 18:45:30 +0000 (15:45 -0300)]
Add IPPROTO_SMC from Linux 6.11 to netinet/in.h

Linux 6.11 adds a define IPPROTO_SMC to its include/uapi/linux/in.h
(commit d25a92ccae6b).

Checked on x86_64-linux-gnu.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agomisc: Add support for Linux uio.h RWF_ATOMIC flag
Adhemerval Zanella [Tue, 8 Oct 2024 18:45:29 +0000 (15:45 -0300)]
misc: Add support for Linux uio.h RWF_ATOMIC flag

Linux 6.11 adds the new flag for pwritev2 (commit
c34fc6f26ab86d03a2d47446f42b6cd492dfdc56).

Checked on x86_64-linux-gnu on 6.11 kernel.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agolinux: Update stat-generic.h with linux 6.11
Adhemerval Zanella [Tue, 8 Oct 2024 18:45:28 +0000 (15:45 -0300)]
linux: Update stat-generic.h with linux 6.11

It adds the new constants from 'fs: Add initial atomic write support
info to statx' (commit 0f9ca80fa4f9670ba09721e4e36b8baf086a500c).

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoUpdate kernel version to 6.11 in header constant tests
Adhemerval Zanella [Tue, 8 Oct 2024 18:45:27 +0000 (15:45 -0300)]
Update kernel version to 6.11 in header constant tests

This patch updates the kernel version in the tests tst-mount-consts.py,
and tst-sched-consts.py to 6.11.

There are no new constants covered by these tests in 6.11.

Tested with build-many-glibcs.py.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agolinux: Add MAP_DROPPABLE from Linux 6.11
Adhemerval Zanella [Tue, 8 Oct 2024 18:45:26 +0000 (15:45 -0300)]
linux: Add MAP_DROPPABLE from Linux 6.11

This request the page to be never written out to swap, it will be zeroed
under memory pressure (so kernel can just drop the page), it is inherited
by fork, it is not counted against @code{mlock} budget, and if there is
no enough memory to service a page faults there is no fatal error (so not
signal is sent).

Tested with build-many-glibcs.py.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoUpdate PIDFD_* constants for Linux 6.11
Adhemerval Zanella [Tue, 8 Oct 2024 18:45:25 +0000 (15:45 -0300)]
Update PIDFD_* constants for Linux 6.11

Linux 6.11 adds some more PIDFD_* constants for 'pidfs: allow retrieval
of namespace file descriptors'
(5b08bd408534bfb3a7cf5778da5b27d4e4fffe12).

Tested with build-many-glibcs.py.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoUpdate syscall lists for Linux 6.11
Adhemerval Zanella [Tue, 8 Oct 2024 18:45:24 +0000 (15:45 -0300)]
Update syscall lists for Linux 6.11

Linux 6.11 changes for syscall are:

  * fstat/newfstatat for loongarch (it should be safe to add since
    255dc1e4ed8 that undefine them).
  * clone3 for nios2, which only adds the entry point but defined
    __ARCH_BROKEN_SYS_CLONE3 (the syscall will always return ENOSYS).
  * uretprobe for x86_64 and x32.

Update syscall-names.list and regenerate the arch-syscall.h headers
with build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoUse Linux 6.11 in build-many-glibcs.py
Adhemerval Zanella [Tue, 8 Oct 2024 18:45:23 +0000 (15:45 -0300)]
Use Linux 6.11 in build-many-glibcs.py

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agoFix header guard in sysdeps/mach/hurd/x86_64/vm_param.h
Joseph Myers [Wed, 9 Oct 2024 17:14:58 +0000 (17:14 +0000)]
Fix header guard in sysdeps/mach/hurd/x86_64/vm_param.h

GCC mainline produces a -Wheader-guard error building for x86_64-gnu.
Fix what seems to be incorrect macro naming in the #ifndef
conditional.

Tested with build-many-glibc.py for x86_64-gnu (GCC mainline).

Message-ID: <fd800046-5ecb-ebd5-4df1-29d4eb3d5433@redhat.com>

4 weeks agort: more clock_nanosleep tests addendum
DJ Delorie [Tue, 8 Oct 2024 18:30:21 +0000 (14:30 -0400)]
rt: more clock_nanosleep tests addendum

Forgot to change the first-line description.

4 weeks agort: more clock_nanosleep tests
DJ Delorie [Wed, 18 Sep 2024 02:52:37 +0000 (22:52 -0400)]
rt: more clock_nanosleep tests

Test that clock_nanosleep rejects out of range time values.

Test that clock_nanosleep actually sleeps for at least the
requested time relative to the requested clock.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agostdlib: Make abort/_Exit AS-safe (BZ 26275)
Adhemerval Zanella [Thu, 3 Oct 2024 18:41:10 +0000 (15:41 -0300)]
stdlib: Make abort/_Exit AS-safe (BZ 26275)

The recursive lock used on abort does not synchronize with a new process
creation (either by fork-like interfaces or posix_spawn ones), nor it
is reinitialized after fork().

Also, the SIGABRT unblock before raise() shows another race condition,
where a fork or posix_spawn() call by another thread, just after the
recursive lock release and before the SIGABRT signal, might create
programs with a non-expected signal mask.  With the default option
(without POSIX_SPAWN_SETSIGDEF), the process can see SIG_DFL for
SIGABRT, where it should be SIG_IGN.

To fix the AS-safe, raise() does not change the process signal mask,
and an AS-safe lock is used if a SIGABRT is installed or the process
is blocked or ignored.  With the signal mask change removal,
there is no need to use a recursive loc.  The lock is also taken on
both _Fork() and posix_spawn(), to avoid the spawn process to see the
abort handler as SIG_DFL.

A read-write lock is used to avoid serialize _Fork and posix_spawn
execution.  Both sigaction (SIGABRT) and abort() requires to lock
as writer (since both change the disposition).

The fallback is also simplified: there is no need to use a loop of
ABORT_INSTRUCTION after _exit() (if the syscall does not terminate the
process, the system is broken).

The proposed fix changes how setjmp works on a SIGABRT handler, where
glibc does not save the signal mask.  So usage like the below will now
always abort.

  static volatile int chk_fail_ok;
  static jmp_buf chk_fail_buf;

  static void
  handler (int sig)
  {
    if (chk_fail_ok)
      {
        chk_fail_ok = 0;
        longjmp (chk_fail_buf, 1);
      }
    else
      _exit (127);
  }
  [...]
  signal (SIGABRT, handler);
  [....]
  chk_fail_ok = 1;
  if (! setjmp (chk_fail_buf))
    {
      // Something that can calls abort, like a failed fortify function.
      chk_fail_ok = 0;
      printf ("FAIL\n");
    }

Such cases will need to use sigsetjmp instead.

The _dl_start_profile calls sigaction through _profil, and to avoid
pulling abort() on loader the call is replaced with __libc_sigaction.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
4 weeks agolinux: Use GLRO(dl_vdso_time) on time
Adhemerval Zanella [Wed, 4 Sep 2024 13:22:44 +0000 (10:22 -0300)]
linux: Use GLRO(dl_vdso_time) on time

The BZ#24967 fix (1bdda52fe92fd01b424c) missed the time for
architectures that define USE_IFUNC_TIME.  Although it is not
an issue, since there is no pointer mangling, there is also no need
to call dl_vdso_vsym since the vDSO setup was already done by the
loader.

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

4 weeks agolinux: Use GLRO(dl_vdso_gettimeofday) on gettimeofday
Adhemerval Zanella [Wed, 4 Sep 2024 13:10:31 +0000 (10:10 -0300)]
linux: Use GLRO(dl_vdso_gettimeofday) on gettimeofday

The BZ#24967 fix (1bdda52fe92fd01b424c) missed the gettimeofday for
architectures that define USE_IFUNC_GETTIMEOFDAY.  Although it is not
an issue, since there is no pointer mangling, there is also no need
to call dl_vdso_vsym since the vDSO setup was already done by the
loader.

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

4 weeks agoS390: Don't use r11 for cu-instructions as used as frame-pointer. [BZ# 32192]
Stefan Liebler [Fri, 27 Sep 2024 08:26:29 +0000 (10:26 +0200)]
S390: Don't use r11 for cu-instructions as used as frame-pointer. [BZ# 32192]

Building the s390 specific iconv modules - utf16-utf32-z9.c, utf8-utf32-z9.c
and utf8-utf16-z9.c - with -fno-omit-frame-pointer leads to a build error
"error: %r11 cannot be used in 'asm' here" as r11 is needed as frame-pointer.

The cuXY-instructions need two even-odd register pairs. Therefore the register
pinning is used. This patch just uses a different register pair.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agostdio-common/Makefile: Fix FAIL: lint-makefiles
H.J. Lu [Tue, 8 Oct 2024 00:46:45 +0000 (08:46 +0800)]
stdio-common/Makefile: Fix FAIL: lint-makefiles

Fix stdio-common/Makefile:

@@ -224,12 +224,12 @@
   tst-freopen4 \
   tst-freopen5 \
   tst-freopen6 \
+  tst-freopen7 \
   tst-freopen64-2 \
   tst-freopen64-3 \
   tst-freopen64-4 \
   tst-freopen64-6 \
   tst-freopen64-7 \
-  tst-freopen7 \
   tst-fseek \
   tst-fwrite \
   tst-fwrite-memstrm \

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agoFix whitespace related license issues.
Carlos O'Donell [Mon, 7 Oct 2024 22:04:22 +0000 (18:04 -0400)]
Fix whitespace related license issues.

Several copies of the licenses in files contained whitespace related
problems.  Two cases are addressed here, the first is two spaces
after a period which appears between "PURPOSE." and "See". The other
is a space after the last forward slash in the URL. Both issues are
corrected and the licenses now match the official textual description
of the license (and the other license in the sources).

Since these whitespaces changes do not alter the paragraph structure of
the license, nor create new sentences, they do not change the license.

4 weeks agoAdd freopen special-case tests: thread cancellation
Joseph Myers [Mon, 7 Oct 2024 19:44:25 +0000 (19:44 +0000)]
Add freopen special-case tests: thread cancellation

Add tests of freopen adding or removing "c" (non-cancelling I/O) from
the mode string (so completing my planned tests of freopen with
different features used in the mode strings).  Note that it's in the
nature of the uncertain time at which cancellation might act (possibly
during freopen, possibly during subsequent reads) that these can leak
memory or file descriptors, so these do not include leak tests.

Tested for x86_64.

4 weeks agohurd: Add missing va_end call in fcntl implementation. [BZ #32234]
Bruno Haible [Thu, 3 Oct 2024 11:25:29 +0000 (13:25 +0200)]
hurd: Add missing va_end call in fcntl implementation. [BZ #32234]

* sysdeps/mach/hurd/fcntl.c (__libc_fcntl): Add va_end call in two code paths.

5 weeks agoriscv: align .preinit_array (bug 32228)
Andreas Schwab [Wed, 2 Oct 2024 09:19:50 +0000 (11:19 +0200)]
riscv: align .preinit_array (bug 32228)

The section contains an array of pointers, so it should be aligned to
pointer size.

5 weeks agolinux: sparc: Fix clone for LEON/sparcv8 (BZ 31394)
Adhemerval Zanella [Mon, 2 Sep 2024 19:58:51 +0000 (16:58 -0300)]
linux: sparc: Fix clone for LEON/sparcv8 (BZ 31394)

The sparc clone mitigation (faeaa3bc9f76030) added the use of
flushw, which is not support by LEON/sparcv8.  As discussed on
the libc-alpha, 'ta 3' is a working alternative [1].

[1] https://sourceware.org/pipermail/libc-alpha/2024-August/158905.html

Checked with a build for sparcv8-linux-gnu targetting leon.

Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
5 weeks agolinux: sparc: Fix syscall_cancel for LEON
Adhemerval Zanella [Mon, 2 Sep 2024 19:58:24 +0000 (16:58 -0300)]
linux: sparc: Fix syscall_cancel for LEON

LEON2/LEON3 are both sparcv8, which does not support branch hints
(bne,pn) nor the return instruction.

Checked with a build for sparcv8-linux-gnu targetting leon. I also
checked some cancellation tests with qemu-system (targeting LEON3).

Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
5 weeks agomath: Improve layout of expf data
Wilco Dijkstra [Wed, 24 Jul 2024 14:17:47 +0000 (15:17 +0100)]
math: Improve layout of expf data

GCC aligns global data to 16 bytes if their size is >= 16 bytes.  This patch
changes the exp2f_data struct slightly so that the fields are better aligned.
As a result on targets that support them, load-pair instructions accessing
poly_scaled and invln2_scaled are now 16-byte aligned.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agoDisable _TIME_BITS if the compiler defaults to it
Adhemerval Zanella [Tue, 10 Sep 2024 12:22:19 +0000 (09:22 -0300)]
Disable _TIME_BITS if the compiler defaults to it

Even though building glibc with 64 bit time_t flags is not supported,
and the usual way is to patch the build system to avoid it; some
systems do enable it by default, and it increases the requirements
to build glibc in such cases (it also does not help newcomers when
trying to build glibc).

The conform namespace and linknamespace tests also do not expect
that flag to be set by default, so disable it as well.

Checked with a build/check for major ABI and some (i386, arm,
mipsel, hppa) with a toolchain that has LFS flags by default.
Reviewed-by: DJ Delorie <dj@redhat.com>
5 weeks agoDisable _FILE_OFFSET_BITS if the compiler defaults to it
Adhemerval Zanella [Tue, 10 Sep 2024 12:22:18 +0000 (09:22 -0300)]
Disable _FILE_OFFSET_BITS if the compiler defaults to it

Even though building glibc with LFS flags is not supported, and the
the usual way is to patch the build system to avoid it [1]; some system
do enable it by default, and it increases the requirements to build
glibc in such cases (it also does not help newcomers when trying
to build glibc).

The conform namespace and linknamespace tests also do not expect
that flag to be set by default, so disable it as well.

Checked with a build/check for major ABI and some (i386, arm,
mipsel, hppa) with a toolchain that has LFS flags by default.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=31624
Reviewed-by: DJ Delorie <dj@redhat.com>
5 weeks agoDo not use -Wp to disable fortify (BZ 31928)
Adhemerval Zanella [Tue, 10 Sep 2024 12:22:17 +0000 (09:22 -0300)]
Do not use -Wp to disable fortify (BZ 31928)

The -Wp does not work properly if the compiler is configured to enable
fortify by default, since it bypasses the compiler driver (which defines
the fortify flags in this case).

This patch is similar to the one used on Ubuntu [1].

I checked with a build for x86_64-linux-gnu, i686-linux-gnu,
aarch64-linux-gnu, s390x-linux-gnu, and riscv64-linux-gnu with
gcc-13 that enables the fortify by default.

Co-authored-by: Matthias Klose <matthias.klose@canonical.com>
[1] https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/glibc/tree/debian/patches/ubuntu/fix-fortify-source.patch
Reviewed-by: DJ Delorie <dj@redhat.com>
5 weeks agolibio: Set _vtable_offset before calling _IO_link_in [BZ #32148]
H.J. Lu [Sat, 7 Sep 2024 15:32:32 +0000 (08:32 -0700)]
libio: Set _vtable_offset before calling _IO_link_in [BZ #32148]

Since _IO_vtable_offset is used to detect the old binaries, set it
in _IO_old_file_init_internal before calling _IO_link_in which checks
_IO_vtable_offset.  Add a glibc 2.0 test with copy relocation on
_IO_stderr_@GLIBC_2.0 to verify that fopen won't cause memory corruption.
This fixes BZ #32148.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
5 weeks agoAdd a new fwrite test that exercises buffer overflow
Tulio Magno Quites Machado Filho [Thu, 26 Sep 2024 14:30:29 +0000 (11:30 -0300)]
Add a new fwrite test that exercises buffer overflow

Exercises fwrite's internal buffer when doing a file operation.
The new test, exercises 2 overflow behaviors:

1. Call fwrite multiple times making usage of fwrite's internal buffer.
   The total number of bytes written is larger than fwrite's internal
   buffer, forcing an automatic flush.

2. Call fwrite a single time with an amount of data that is larger than
   fwrite's internal buffer.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agox86/string: Fixup alignment of main loop in str{n}cmp-evex [BZ #32212]
Noah Goldstein [Fri, 27 Sep 2024 22:50:10 +0000 (15:50 -0700)]
x86/string: Fixup alignment of main loop in str{n}cmp-evex [BZ #32212]

The loop should be aligned to 32-bytes so that it can ideally run out
the DSB. This is particularly important on Skylake-Server where
deficiencies in it's DSB implementation make it prone to not being
able to run loops out of the DSB.

For example running strcmp-evex on 200Mb string:

32-byte aligned loop:
    - 43,399,578,766      idq.dsb_uops
not 32-byte aligned loop:
    - 6,060,139,704       idq.dsb_uops

This results in a 25% performance degradation for the non-aligned
version.

The fix is to just ensure the code layout is such that the loop is
aligned. (Which was previously the case but was accidentally dropped
in 84e7c46df).

NB: The fix was actually 64-byte alignment. This is because 64-byte
alignment generally produces more stable performance than 32-byte
aligned code (cache line crosses can affect perf), so if we are going
past 16-byte alignmnent, might as well go to 64. 64-byte alignment
also matches most other functions we over-align, so it creates a
common point of optimization.

Times are reported as ratio of Time_With_Patch /
Time_Without_Patch. Lower is better.

The values being reported is the geometric mean of the ratio across
all tests in bench-strcmp and bench-strncmp.

Note this patch is only attempting to improve the Skylake-Server
strcmp for long strings. The rest of the numbers are only to test for
regressions.

Tigerlake Results Strings <= 512:
    strcmp : 1.026
    strncmp: 0.949

Tigerlake Results Strings > 512:
    strcmp : 0.994
    strncmp: 0.998

Skylake-Server Results Strings <= 512:
    strcmp : 0.945
    strncmp: 0.943

Skylake-Server Results Strings > 512:
    strcmp : 0.778
    strncmp: 1.000

The 2.6% regression on TGL-strcmp is due to slowdowns caused by
changes in alignment of code handling small sizes (most on the
page-cross logic). These should be safe to ignore because 1) We
previously only 16-byte aligned the function so this behavior is not
new and was essentially up to chance before this patch and 2) this
type of alignment related regression on small sizes really only comes
up in tight micro-benchmark loops and is unlikely to have any affect
on realworld performance.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agostdio-common: Fix memory leak in tst-freopen4* tests on UNSUPPORTED
Florian Weimer [Sat, 28 Sep 2024 19:06:11 +0000 (21:06 +0200)]
stdio-common: Fix memory leak in tst-freopen4* tests on UNSUPPORTED

The temp_dir allocation leaks if support_can_chroot returns false.

5 weeks agoLinux: Block signals around _Fork (bug 32215)
Florian Weimer [Sat, 28 Sep 2024 07:44:25 +0000 (09:44 +0200)]
Linux: Block signals around _Fork (bug 32215)

This hides the inconsistent TCB state (missing robust mutex list) from
signal handlers.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agoUpdate to Unicode 16.0.0 [BZ #32168]
Mike FABIAN [Thu, 12 Sep 2024 13:02:55 +0000 (15:02 +0200)]
Update to Unicode 16.0.0 [BZ #32168]

Unicode 16.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 16.0.0, using
the generator scripts contributed by Mike FABIAN (Red Hat).

Changes in CHARMAP and WIDTH:

    Total added characters in newly generated CHARMAP: 5185
    Total removed characters in newly generated WIDTH: 1
    Total added characters in newly generated WIDTH: 170

The removed character from WIDTH is U+1171E AHOM CONSONANT SIGN MEDIAL RA.
It changed like this:

UnicodeData.txt 15.1.0: 1171E;AHOM CONSONANT SIGN MEDIAL RA;Mn;0;NSM;;;;;N;;;;;
UnicodeData.txt 16.0.0: 1171E;AHOM CONSONANT SIGN MEDIAL RA;Mc;0;L;;;;;N;;;;;

EastAsianWidth.txt 15.1.0: 1171D..1171F   ; N  # Mn     [3] AHOM CONSONANT SIGN MEDIAL LA..AHOM CONSONANT SIGN MEDIAL LIGATING RA
EastAsianWidth.txt 16.0.0: 1171E          ; N  # Mc         AHOM CONSONANT SIGN MEDIAL RA

I.e it changed from Mn (Mark Nonspacing) to Mc (Mark Spacing
combining). So it should now have width 1 instead of 0, therefore it
is OK that it was removed from WIDTH, characters not in WIDTH get
width 1 by default.

Nothing suspicious when browsing the list of the 170 added characters.

Changes in ctype:

    alpha: Added 4452 characters in new ctype which were not in old ctype
    combining: Added 51 characters in new ctype which were not in old ctype
    combining_level3: Added 43 characters in new ctype which were not in old ctype
    graph: Added 5185 characters in new ctype which were not in old ctype
    lower: Added 25 characters in new ctype which were not in old ctype
    print: Added 5185 characters in new ctype which were not in old ctype
    punct: Missing 33 characters of old ctype in new ctype
    punct: Added 766 characters in new ctype which were not in old ctype
    tolower: Added 27 characters in new ctype which were not in old ctype
    totitle: Added 27 characters in new ctype which were not in old ctype
    toupper: Added 27 characters in new ctype which were not in old ctype
    upper: Added 27 characters in new ctype which were not in old ctype

Nothing suspicous in the additions.

About the 33 characters removed from `punct`:

U+0363 - U+036F are identical in UnicodeData.txt. Difference in DerivedCoreProperties.txt:

DerivedCoreProperties.txt 15.1.0: not there.
DerivedCoreProperties.txt 16.0.0: 0363..036F    ; Alphabetic # Mn  [13] COMBINING LATIN SMALL LETTER A..COMBINING LATIN SMALL LETTER X

So that’s the reason why they are added to `alpha` and removed from `punct`.

Same for U+1DD3 - U+1DE6, they are identical in UnicodeData.txt but there is a difference in DerivedCoreProperties.txt:

DerivedCoreProperties.txt 15.1.0: 1DE7..1DF4    ; Alphabetic # Mn  [14] COMBINING LATIN SMALL LETTER ALPHA..COMBINING LATIN SMALL LETTER U WITH DIAERESIS
DerivedCoreProperties.txt 16.0.0: 1DD3..1DF4    ; Alphabetic # Mn  [34] COMBINING LATIN SMALL LETTER FLATTENED OPEN A ABOVE..COMBINING LATIN SMALL LETTER U WITH DIAERESIS

So they became `Alphabetic` and were thus added to `alpha` and removed from `punct`.

Resolves: BZ #32168

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agomanual: Document that feof and ferror are mutually exclusive
Florian Weimer [Fri, 27 Sep 2024 09:41:12 +0000 (11:41 +0200)]
manual: Document that feof and ferror are mutually exclusive

This is not completely clear from the C standard (although there
is footnote number 289 in C11), but I assume that our implementation
works this way.

Reviewed-by: DJ Delorie <dj@redhat.com>
5 weeks agostdio-common: Add new test for fdopen
Sergey Kolosov [Wed, 25 Sep 2024 13:51:23 +0000 (15:51 +0200)]
stdio-common: Add new test for fdopen

This commit adds fdopen test with all modes.
Reviewed-by: DJ Delorie <dj@redhat.com>
5 weeks agoFix missing randomness in __gen_tempname (bug 32214)
Andreas Schwab [Wed, 25 Sep 2024 09:49:30 +0000 (11:49 +0200)]
Fix missing randomness in __gen_tempname (bug 32214)

Make sure to update the random value also if getrandom fails.

Fixes: 686d542025 ("posix: Sync tempname with gnulib")
6 weeks agoarc: Cleanup arcbe
Pavel Kozlov [Fri, 20 Sep 2024 17:58:52 +0000 (18:58 +0100)]
arc: Cleanup arcbe

Remove the mention of arcbe ABI to avoid any mislead.
ARC big endian ABI is no longer supported.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 weeks agoarc: Remove HAVE_ARC_BE macro and disable big-endian port
Florian Weimer [Wed, 25 Sep 2024 09:24:54 +0000 (11:24 +0200)]
arc: Remove HAVE_ARC_BE macro and disable big-endian port

It is no longer needed, now that ARC is always little endian.

6 weeks agoscripts: Remove arceb-linux-gnu from build-many-glibcs.py
Florian Weimer [Wed, 25 Sep 2024 09:24:54 +0000 (11:24 +0200)]
scripts: Remove arceb-linux-gnu from build-many-glibcs.py

This was discussed on the hallway track at GNU Tools Cauldron
2024.  There are concerns about stability of the big-endian
GCC backend, and Linux removed support for the only big-endian
ARC platform in commit dd7c7ab01a04d645b7e7baa8530bfd81e31a2202
("ARC: [plat-eznps]: Drop support for EZChip NPS platform").

6 weeks agoLoongArch: Undef __NR_fstat and __NR_newfstatat.
caiyinyu [Tue, 24 Sep 2024 03:09:32 +0000 (11:09 +0800)]
LoongArch: Undef __NR_fstat and __NR_newfstatat.

In Linux 6.11, fstat and newfstatat are added back. To avoid the messy
usage of the fstat, newfstatat, and statx system calls, we will continue
using statx only in glibc, maintaining consistency with previous versions of
the LoongArch-specific glibc implementation.

Signed-off-by: caiyinyu <caiyinyu@loongson.cn>
Reviewed-by: Xi Ruoyao <xry111@xry111.site>
Suggested-by: Florian Weimer <fweimer@redhat.com>
6 weeks agoAdd tests of fread
Joseph Myers [Tue, 24 Sep 2024 14:06:22 +0000 (14:06 +0000)]
Add tests of fread

There seem to be no glibc tests specifically for the fread function.
Add basic tests of that function.

Tested for x86_64.

6 weeks agonptl: Prefer setresuid32 in tst-setuid2
Florian Weimer [Tue, 24 Sep 2024 11:48:11 +0000 (13:48 +0200)]
nptl: Prefer setresuid32 in tst-setuid2

Use the setresuid32 system call if it is available, prefering
it over setresuid.  If both system calls exist, setresuid
is the 16-bit variant.  This fixes a build failure on
sparcv9-linux-gnu.

6 weeks agoelf: Move __rtld_malloc_init_stubs call into _dl_start_final
Florian Weimer [Tue, 24 Sep 2024 11:23:10 +0000 (13:23 +0200)]
elf: Move __rtld_malloc_init_stubs call into _dl_start_final

Calling an extern function in a different translation unit before
self-relocation is brittle.  The compiler may load the address
at an earlier point in _dl_start, before self-relocation.  In
_dl_start_final, the call is behind a compiler barrier, so this
cannot happen.

This page took 0.097 seconds and 5 git commands to generate.