aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-03-05linux: Prefix AT_HWCAP with 0x on LD_SHOW_AUXVAdhemerval Zanella1-4/+4
Suggested-by: Stefan Liebler <stli@linux.ibm.com> Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
2025-03-05Remove dl-procinfo.hAdhemerval Zanella28-58/+0
powerpc was the only architecture with arch-specific hooks for LD_SHOW_AUXV, and with the information moved to ld diagnostics there is no need to keep the _dl_procinfo hook. Checked with a build for all affected ABIs. Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
2025-03-05powerpc: Remove unused dl-procinfo.hAdhemerval Zanella6-131/+109
The _dl_string_platform is moved to hwcapinfo.h, since it is only used by hwcapinfo.c and test-get_hwcap internal test. Checked on powerpc64le-linux-gnu. Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
2025-03-05powerpc: Move cache geometry information to ld diagnosticsAdhemerval Zanella2-66/+50
From LD_SHOW_AUXV output. Checked on powerpc64le-linux-gnu. Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
2025-03-05powerpc: Move AT_HWCAP descriptions to ld diagnosticsAdhemerval Zanella8-211/+227
The ld.so diagnostics already prints AT_HWCAP values, but only in hexadecimal. To avoid duplicating the strings, consolidate the hwcap_names from cpu-features.h on a new file, dl-hwcap-info.h (and it also improves the hwcap string description with more values). For future AT_HWCAP3/AT_HWCAP4 extensions, it is just a matter to add them on dl-hwcap-info.c so both ld diagnostics and tunable filtering will parse the new values. Checked on powerpc64le-linux-gnu. Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
2025-03-05benchtests: Add random strlen benchmarkWilco Dijkstra2-0/+195
Add a new randomized strlen test similar to bench-random-memcpy. Instead of repeating the same call to strlen over and over again, it times a large number of different strings. The distribution of the string length and alignment is based on SPEC2017. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-05benchtests: Improve large memcpy/memset benchmarksWilco Dijkstra4-43/+14
Adjust sizes between 64KB and 16MB and iterations based on length. Remove incorrect uses of alloc_bufs since we're not interested in measuring Linux clear_page time. Use getpagesize() - 1 instead of 4095 when aligning within a page. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-03-04manual: Explain sched_yield semantics with different schedulersSiddhesh Poyarekar1-9/+22
The manual entry for sched_yield mentions that the function call could be a nop if there are no other tasks with the same absolute priority. Expand the explanation to include example schedulers on Linux so that it's clear that sched_yield may not always result in a different task being scheduled. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Joseph Myers <josmyers@redhat.com>
2025-03-04Pass -Wl,--no-error-execstack for tests where -Wl,-z,execstack is used [PR32717]Sam James5-0/+49
When GNU Binutils is configured with --enable-error-execstack=yes, a handful of our tests which rely on -Wl,-z,execstack fail. Pass --Wl,--no-error-execstack to override the behaviour and get a warning instead. Bug: https://sourceware.org/PR32717 Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-03-03malloc: Add integrity check to largebin nextsizesBen Kallus1-0/+3
If attacker overwrites the bk_nextsize link in the first chunk of a largebin that later has a smaller chunk inserted into it, malloc will write a heap pointer into an attacker-controlled address [0]. This patch adds an integrity check to mitigate this attack. [0]: https://github.com/shellphish/how2heap/blob/master/glibc_2.39/large_bin_attack.c Signed-off-by: Ben Kallus <benjamin.p.kallus.gr@dartmouth.edu> Reviewed-by: DJ Delorie <dj@redhat.com>
2025-03-03libio: Clean up fputc/putc commentsSamuel Zeter1-3/+0
Remove duplicate comments in stdio.h Signed-off-by: Samuel Zeter <samuelzeter@gmail.com> Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-03-02htl: move pthread_once into libcSamuel Thibault8-8/+16
2025-02-28Remove unused dl-procinfo.hWilco Dijkstra29-724/+9
Remove unused _dl_hwcap_string defines. As a result many dl-procinfo.h headers can be removed. This also removes target specific _dl_procinfo implementations which only printed HWCAP strings using dl_hwcap_string. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-28LoongArch: Optimize f{max,min}imum_mag_num{,f}Xi Ruoyao6-192/+78
Following the logic of the previous commits. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2025-02-28LoongArch: Optimize f{max,min}imum_num{,f}Xi Ruoyao6-193/+78
Following the logic of the previous commits. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2025-02-28LoongArch: Optimize f{max,min}imum_mag{,f}Xi Ruoyao4-120/+38
Following the logic of the previous commit. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2025-02-28LoongArch: Optimize f{max,min}imum{,f}Xi Ruoyao4-88/+48
The code now looks like: fclass.s $fa2, $fa0 movfr2gr.s $t0, $fa2 slli.w $t0, $t0, 0x0 fclass.s $fa2, $fa1 movfr2gr.s $t1, $fa2 or $t0, $t0, $t1 andi $t0, $t0, 0x3 bnez $t0, 1f fmin.s $fa0, $fa0, $fa1 ret 1: fmul.s $fa0, $fa0, $fa1 ret This looks really bad, with expensive movfr2gr instructions, redundant sign-extensions and masking (arguably it's a compiler missed-optimzation), and a branch. Rewrite it with inline assembly: fcmp.cor.s $fcc0, $fa0, $fa0 fcmp.cor.s $fcc1, $fa1, $fa1 fsel $fa2, $fa0, $fa1, $fcc0 fsel $fa0, $fa1, $fa0, $fcc1 fmax.s $fa0, $fa2, $fa0 ret Note that we cannot make it more readable with "double a = __builtin_isnanf (x) ? y : x" because this C statement only happens to produce what we want with https://gcc.gnu.org/PR66462, if this bug is fixed in the future the generated code may change. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2025-02-27AArch64: Use prefer_sve_ifuncs for SVE memsetWilco Dijkstra1-1/+1
Use prefer_sve_ifuncs for SVE memset just like memcpy. Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2025-02-26sysdeps/ieee754: Fix remainder sign of zero for FE_DOWNWARD (BZ #32711)Sergei Zimmerman3-1/+11
Single-precision remainderf() and quad-precision remainderl() implementation derived from Sun is affected by an issue when the result is +-0. IEEE754 requires that if remainder(x, y) = 0, its sign shall be that of x regardless of the rounding direction. The implementation seems to have assumed that x - x = +0 in all rounding modes, which is not the case. When rounding direction is roundTowardNegative the sign of an exact zero sum (or difference) is −0. Regression tests that triggered this erroneous behavior are added to math/libm-test-remainder.inc. Tested for cross riscv64 and powerpc. Original fix by: Bruce Evans <bde@FreeBSD.org> in FreeBSD's a2ddfa5ea726c56dbf825763ad371c261b89b7c7. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-02-25math: Add optimization barrier to ensure a1 + u.d is not reused [BZ #30664]John David Anglin1-0/+3
A number of fma tests started to fail on hppa when gcc was changed to use Ranger rather than EVRP. Eventually I found that the value of a1 + u.d in this is block of code was being computed in FE_TOWARDZERO mode and not the original rounding mode: if (TININESS_AFTER_ROUNDING) { w.d = a1 + u.d; if (w.ieee.exponent == 109) return w.d * 0x1p-108; } This caused the exponent value to be wrong and the wrong return path to be used. Here we add an optimization barrier after the rounding mode is reset to ensure that the previous value of a1 + u.d is not reused. Signed-off-by: John David Anglin <dave.anglin@bell.net>
2025-02-25RISC-V: Fix IFUNC resolver cannot access gp pointerYangyu Chen1-6/+11
In some cases, an IFUNC resolver may need to access the gp pointer to access global variables. Such an object may have l_relocated == 0 at this time. In this case, an IFUNC resolver will fail to access a global variable and cause a SIGSEGV. This patch fixes this issue by relaxing the check of l_relocated in elf_machine_runtime_setup, but added a check for SHARED case to avoid using this code in static-linked executables. Such object have already set up the gp pointer in load_gp function and l->l_scope will be NULL if it is a pie object. So if we use these code to set up the gp pointer again for static-pie, it will causing a SIGSEGV in glibc as original bug on BZ #31317. I have also reproduced and checked BZ #31317 using the mold commit bed5b1731b ("illumos: Treat absolute symbols specially"), this patch can fix the issue. Also, we used the wrong gp pointer previously because ref->st_value is not the relocated address but just the offset from the base address of ELF. An edge case may happen if we reference gp pointer in a IFUNC resolver in a PIE object, but it will not happen in compiler-generated codes since -pie will disable relax to gp. In this case, the GP will be initialized incorrectly since the ref->st_value is not the address after relocation. This patch fixes this issue by adding the l->l_addr to ref->st_value to get the relocated address for the gp pointer. We don't use SYMBOL_ADDRESS macro here because __global_pointer$ is a special symbol that has SHN_ABS type, but it will use PC-relative addressing in the load_gp function using lla. Closes: BZ #32269 Fixes: 96d1b9ac23 ("RISC-V: Fix the static-PIE non-relocated object check") Co-authored-by: Vivian Wang <dramforever@live.com> Signed-off-by: Yangyu Chen <cyy@cyyself.name>
2025-02-24AArch64: Remove LP64 and ILP32 ifdefsWilco Dijkstra6-61/+16
Remove LP64 and ILP32 ifdefs. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-24AArch64: Simplify lrintWilco Dijkstra1-51/+0
Simplify lrint. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-24AArch64: Remove AARCH64_R macroWilco Dijkstra4-33/+16
Remove AArch64_R relocation macro. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-24AArch64: Cleanup pointer manglingWilco Dijkstra4-58/+27
Cleanup pointer mangling. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-24AArch64: Remove PTR_REG definesWilco Dijkstra7-68/+41
Remove PTR_REG defines. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-24AArch64: Remove PTR_ARG/SIZE_ARG definesWilco Dijkstra35-106/+0
This series removes various ILP32 defines that are now no longer needed. Remove PTR_ARG/SIZE_ARG. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-24stdlib: Add single-threaded fast path to rand()Wilco Dijkstra1-0/+7
Improve performance of rand() and __random() by adding a single-threaded fast path. Bench-random-lock shows about 5x speedup on Neoverse V1. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-24Increase the amount of data tested in stdio-common/tst-fwrite-pipe.cStefan Liebler1-2/+2
The number of iterations and the length of the string are not high enough on some systems causing the test to return false-positives. Testcase stdio-common/tst-fwrite-bz29459.c was fixed in the same way in 1b6f868625403d6b7683af840e87d2b18d5d7731 (Increase the amount of data tested in stdio-common/tst-fwrite-bz29459.c, 2025-02-14) Testcases stdio-common/tst-fwrite-bz29459.c and stdio-common/tst-fwrite-pipe.c were introcued in 596a61cf6b51ce2d58b8ca4e1d1f4fdfe1440dbc (libio: Start to return errors when flushing fwrite's buffer [BZ #29459], 2025-01-28)
2025-02-24posix: Rewrite cpuset testsFrédéric Bérat5-83/+249
Rewriting the cpuset macros test to cover more use cases and port the tests to the new test infrastructure. The use cases include bad actor access attempts, before and after the CPU set structure. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
2025-02-24support: Add support_next_to_fault_before support functionFrédéric Bérat2-10/+39
Refactor the support_next_to_fault and add the support_next_to_fault_before method returns a buffer with a protected page before it, to be able to test buffer underflow accesses. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
2025-02-23math: Fix `unknown type name '__float128'` for clang 3.4 to 3.8.1 (bug 32694)koraynilay1-2/+2
When compiling a program that includes <bits/floatn.h> using a clang version between 3.4 (included) and 3.8.1 (included), clang will fail with `unknown type name '__float128'; did you mean '__cfloat128'?`. This changes fixes the clang prerequirements macro call in floatn.h to check for clang 3.9 instead of 3.4, since support for __float128 was actually enabled in 3.9 by: commit 50f29e06a1b6a38f0bba9360cbff72c82d46cdd4 Author: Nemanja Ivanovic <nemanja.i.ibm@gmail.com> Date: Wed Apr 13 09:49:45 2016 +0000 Enable support for __float128 in Clang This fixes bug 32694. Signed-off-by: koraynilay <koray.fra@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-02-21nptl: clear the whole rseq area before registrationMichael Jeanson2-6/+6
Due to the extensible nature of the rseq area we can't explictly initialize fields that are not part of the ABI yet. It was agreed with upstream that all new fields will be documented as zero initialized by userspace. Future kernels configured with CONFIG_DEBUG_RSEQ will validate the content of all fields during registration. Replace the explicit field initialization with a memset of the whole rseq area which will cover fields as they are added to future kernels. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-02-21aarch64: Add GCS test with signal handlerYury Khrustalev2-0/+106
Test that when we return from a function that enabled GCS at runtime we get SIGSEGV. Also test that ucontext contains GCS block with the GCS pointer. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-02-21aarch64: Add GCS tests for dlopenYury Khrustalev8-1/+101
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-02-21aarch64: Add GCS tests for transitive dependenciesYury Khrustalev11-16/+195
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-02-21aarch64: Add tests for Guarded Control StackYury Khrustalev15-1/+186
These tests validate that GCS tunable works as expected depending on the GCS markings in the test binaries. Tests validate both static and dynamically linked binaries. These new tests are AArch64 specific. Moreover, they are included only if linker supports the "-z gcs=<value>" option. If built, these tests will run on systems with and without HWCAP_GCS. In the latter case the tests will be reported as UNSUPPORTED. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-02-21aarch64: Add configure checks for GCS supportYury Khrustalev2-0/+116
- Add check that linker supports -z gcs=... - Add checks that main and test compiler support -mbranch-protection=gcs Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-02-20manual: Mark setlogmask as AS-unsafe and AC-unsafe.Carlos O'Donell1-1/+1
This fixes the check-safety.sh failure with commit ad9c4c536115ba38be3e63592a632709ec8209b4, and correctly marks the function AS-unsafe and AC-unsafe due to the use of the non-recursive lock. Tested on x86_64 without regressions. Reviewed-by: Frédéric Bérat <fberat@redhat.com>
2025-02-20AArch64: Add SVE memsetWilco Dijkstra4-0/+129
Add SVE memset based on the generic memset with predicated load for sizes < 16. Unaligned memsets of 128-1024 are improved by ~20% on average by using aligned stores for the last 64 bytes. Performance of random memset benchmark improves by ~2% on Neoverse V1. Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
2025-02-20x86 (__HAVE_FLOAT128): Defined to 0 for Intel SYCL compiler [BZ #32723]H.J. Lu1-2/+6
Intel compiler always defines __INTEL_LLVM_COMPILER. When SYCL is enabled by -fsycl, it also defines SYCL_LANGUAGE_VERSION. Since Intel SYCL compiler doesn't support _Float128: https://github.com/intel/llvm/issues/16903 define __HAVE_FLOAT128 to 0 for Intel SYCL compiler. This fixes BZ #32723. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-02-19manual: Document setlogmask as MT-safe.Carlos O'Donell1-4/+1
setlogmask(3) was made MT-safe in glibc-2.33 with the fix for bug 26100. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-02-17math: Consolidate acosf and asinf internal tablesAdhemerval Zanella5-32/+85
The libm size improvement built with gcc-14, "--enable-stack-protector=strong --enable-bind-now=yes --enable-fortify-source=2": Before: 582292 844 12 583148 8e5ec aarch64-linux-gnu/math/libm.so 975133 1076 12 976221 ee55d x86_64-linux-gnu/math/libm.so 1203586 5608 368 1209562 1274da powerpc64le-linux-gnu/math/libm.so After: 581972 844 12 582828 8e4ac aarch64-linux-gnu/math/libm.so 974941 1076 12 976029 ee49d x86_64-linux-gnu/math/libm.so 1203394 5608 368 1209370 12741a powerpc64le-linux-gnu/math/libm.so Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-02-17math: Consolidate acospif and asinpif internal tablesAdhemerval Zanella5-104/+120
The libm size improvement built with gcc-14, "--enable-stack-protector=strong --enable-bind-now=yes --enable-fortify-source=2": Before: text data bss dec hex filename 583444 844 12 584300 8ea6c aarch64-linux-gnu/math/libm.so 976349 1076 12 977437 eea1d x86_64-linux-gnu/math/libm.so 1204738 5608 368 1210714 12795a powerpc64le-linux-gnu/math/libm.so After: 582292 844 12 583148 8e5ec aarch64-linux-gnu/math/libm.so 975133 1076 12 976221 ee55d x86_64-linux-gnu/math/libm.so 1203586 5608 368 1209562 1274da powerpc64le-linux-gnu/math/libm.so Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-02-17math: Consolidate cospif and sinpif internal tablesAdhemerval Zanella5-115/+124
The libm size improvement built with gcc-14, "--enable-stack-protector=strong --enable-bind-now=yes --enable-fortify-source=2": Before: text data bss dec hex filename 584500 844 12 585356 8ee8c aarch64-linux-gnu/math/libm.so 977341 1076 12 978429 eedfd x86_64-linux-gnu/math/libm.so 1205762 5608 368 1211738 127d5a powerpc64le-linux-gnu/math/libm.so After: text data bss dec hex filename 583444 844 12 584300 8ea6c aarch64-linux-gnu/math/libm.so 976349 1076 12 977437 eea1d x86_64-linux-gnu/math/libm.so 1204738 5608 368 1210714 12795a powerpc64le-linux-gnu/math/libm.so Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-02-16htl: don't export __pthread_default_rwlockattr anymore.gfleury3-3/+0
since now all symbloy that use it are in libc Message-ID: <20250216145434.7089-11-gfleury@disroot.org>
2025-02-16htl: move pthread_rwlock_init into libc.gfleury8-9/+15
Signed-off-by: gfleury <gfleury@disroot.org> Message-ID: <20250216145434.7089-10-gfleury@disroot.org>
2025-02-16htl: move pthread_rwlock_destroy into libc.gfleury8-9/+17
Signed-off-by: gfleury <gfleury@disroot.org> Message-ID: <20250216145434.7089-9-gfleury@disroot.org>
2025-02-16htl: move pthread_rwlock_{rdlock, timedrdlock, timedwrlock, wrlock, ↵gfleury14-40/+95
clockrdlock, clockwrlock} into libc. Signed-off-by: gfleury <gfleury@disroot.org> Message-ID: <20250216145434.7089-8-gfleury@disroot.org>
2025-02-16htl: move pthread_rwlock_unlock into libc.gfleury10-10/+16
Signed-off-by: gfleury <gfleury@disroot.org> Message-ID: <20250216145434.7089-7-gfleury@disroot.org>