aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-04-01x86: Update _dl_tlsdesc_dynamic to preserve caller-saved registersH.J. Lu24-213/+920
Compiler generates the following instruction sequence for GNU2 dynamic TLS access: leaq tls_var@TLSDESC(%rip), %rax call *tls_var@TLSCALL(%rax) or leal tls_var@TLSDESC(%ebx), %eax call *tls_var@TLSCALL(%eax) CALL instruction is transparent to compiler which assumes all registers, except for EFLAGS and RAX/EAX, are unchanged after CALL. When _dl_tlsdesc_dynamic is called, it calls __tls_get_addr on the slow path. __tls_get_addr is a normal function which doesn't preserve any caller-saved registers. _dl_tlsdesc_dynamic saved and restored integer caller-saved registers, but didn't preserve any other caller-saved registers. Add _dl_tlsdesc_dynamic IFUNC functions for FNSAVE, FXSAVE, XSAVE and XSAVEC to save and restore all caller-saved registers. This fixes BZ #31372. Add GLRO(dl_x86_64_runtime_resolve) with GLRO(dl_x86_tlsdesc_dynamic) to optimize elf_machine_runtime_setup. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 0aac205a814a8511e98d02b91a8dc908f1c53cde)
2024-04-01x86-64: Save APX registers in ld.so trampolineH.J. Lu1-6/+46
Add APX registers to STATE_SAVE_MASK so that APX registers are saved in ld.so trampoline. This fixes BZ #31371. Also update STATE_SAVE_OFFSET and STATE_SAVE_MASK for i386 which will be used by i386 _dl_tlsdesc_dynamic. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit dfb05f8e704edac70db38c4c8ee700769d91a413)
2024-03-22LoongArch: Correct {__ieee754, _}_scalb -> {__ieee754, _}_scalbfcaiyinyu1-1/+1
2024-03-20powerpc: Placeholder and infrastructure/build support to add Power11 ↵Amrita H S15-5/+27
related changes. The following three changes have been added to provide initial Power11 support. 1. Add the directories to hold Power11 files. 2. Add support to select Power11 libraries based on AT_PLATFORM. 3. Let submachine=power11 be set automatically. Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Peter Bergner <bergner@linux.ibm.com> (cherry picked from commit 1ea051145612f199d8716ecdf78b084b00b5a727)
2024-03-20powerpc: Add HWCAP3/HWCAP4 data to TCB for Power Architecture.Manjunath Matti12-19/+74
This patch adds a new feature for powerpc. In order to get faster access to the HWCAP3/HWCAP4 masks, similar to HWCAP/HWCAP2 (i.e. for implementing __builtin_cpu_supports() in GCC) without the overhead of reading them from the auxiliary vector, we now reserve space for them in the TCB. Suggested-by: Peter Bergner <bergner@linux.ibm.com> Reviewed-by: Peter Bergner <bergner@linux.ibm.com> (cherry picked from commit 3ab9b88e2ac91062b6d493fe32bd101a55006c6a)
2024-03-18linux: Use rseq area unconditionally in sched_getcpu (bug 31479)Florian Weimer1-8/+0
Originally, nptl/descr.h included <sys/rseq.h>, but we removed that in commit 2c6b4b272e6b4d07303af25709051c3e96288f2d ("nptl: Unconditionally use a 32-byte rseq area"). After that, it was not ensured that the RSEQ_SIG macro was defined during sched_getcpu.c compilation that provided a definition. This commit always checks the rseq area for CPU number information before using the other approaches. This adds an unnecessary (but well-predictable) branch on architectures which do not define RSEQ_SIG, but its cost is small compared to the system call. Most architectures that have vDSO acceleration for getcpu also have rseq support. Fixes: 2c6b4b272e6b4d07303af25709051c3e96288f2d Fixes: 1d350aa06091211863e41169729cee1bca39f72f Reviewed-by: Arjun Shankar <arjun@redhat.com> (cherry picked from commit 7a76f218677d149d8b7875b336722108239f7ee9)
2024-03-04Use gcc __builtin_stdc_* builtins in stdbit.h if possibleJakub Jelinek4-15/+856
The following patch uses the GCC 14 __builtin_stdc_* builtins in stdbit.h for the type-generic macros, so that when compiled with GCC 14 or later, it supports not just 8/16/32/64-bit unsigned integers, but also 128-bit (if target supports them) and unsigned _BitInt (any supported precision). And so that the macros don't expand arguments multiple times and can be evaluated in constant expressions. The new testcase is gcc's gcc/testsuite/gcc.dg/builtin-stdc-bit-1.c adjusted to test stdbit.h and the type-generic macros in there instead of the builtins and adjusted to use glibc test framework rather than gcc style tests with __builtin_abort (). Signed-off-by: Jakub Jelinek <jakub@redhat.com> Reviewed-by: Joseph Myers <josmyers@redhat.com> (cherry picked from commit da89496337b97e6a2aaf1e81d55cf998f6db1070)
2024-02-27S390: Do not clobber r7 in clone [BZ #31402]Stefan Liebler3-12/+63
Starting with commit e57d8fc97b90127de4ed3e3a9cdf663667580935 "S390: Always use svc 0" clone clobbers the call-saved register r7 in error case: function or stack is NULL. This patch restores the saved registers also in the error case. Furthermore the existing test misc/tst-clone is extended to check all error cases and that clone does not clobber registers in this error case. (cherry picked from commit 02782fd12849b6673cb5c2728cb750e8ec295aa3)
2024-02-22math: Update mips64 ulpsXi Ruoyao1-3/+4
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> (cherry picked from commit e2a65ecc4b30a797df7dc6529f09b712aa256029)
2024-02-12mips: FIx clone3 implementation (BZ 31325)Adhemerval Zanella1-5/+27
For o32 we need to setup a minimal stack frame to allow cprestore on __thread_start_clone3 (which instruct the linker to save the gp for PIC). Also, there is no guarantee by kABI that $8 will be preserved after syscall execution, so we need to save it on the provided stack. Checked on mipsel-linux-gnu. Reported-by: Khem Raj <raj.khem@gmail.com> Tested-by: Khem Raj <raj.khem@gmail.com> (cherry picked from commit bbd248ac0d75efdef8fe61ea69b1fb25fb95b6e7)
2024-02-05arm: Remove wrong ldr from _dl_start_user (BZ 31339)Adhemerval Zanella1-1/+0
The commit 49d877a80b29d3002887b084eec6676d9f5fec18 (arm: Remove _dl_skip_args usage) removed the _SKIP_ARGS literal, which was previously loader to r4 on loader _start. However, the cleanup did not remove the following 'ldr r4, [sl, r4]' on _dl_start_user, used to check to skip the arguments after ld self-relocations. In my testing, the kernel initially set r4 to 0, which makes the ldr instruction just read the _GLOBAL_OFFSET_TABLE_. However, since r4 is a callee-saved register; a different runtime might not zero initialize it and thus trigger an invalid memory access. Checked on arm-linux-gnu. Reported-by: Adrian Ratiu <adrian.ratiu@collabora.com> Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com> (cherry picked from commit 1e25112dc0cb2515d27d8d178b1ecce778a9d37a)
2024-01-31Replace advisories directoryAndreas K. Hüttel10-194/+2
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-31Create ChangeLog.old/ChangeLog.28glibc-2.39Andreas K. Hüttel1-0/+8505
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-31version.h, include/features.h: Bump version to 2.39Andreas K. Hüttel2-3/+3
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-31po: Update translationsAndreas K. Hüttel38-845/+694
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-31libc.pot: regenerateAndreas K. Hüttel1-31/+26
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-31INSTALL, install.texi: minor updates, regenerateAndreas K. Hüttel2-6/+6
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-30contrib.texi: updateAndreas K. Hüttel1-8/+24
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-30NEWS: insert advisories and fixed bugs for 2.39Andreas K. Hüttel1-4/+133
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-30S390: Fix building with --disable-mutli-arch [BZ #31196]Stefan Liebler2-2/+6
Starting with commits - 7ea510127e2067efa07865158ac92c330c379950 string: Add libc_hidden_proto for strchrnul - 22999b2f0fb62eed1af4095d062bd1272d6afeb1 string: Add libc_hidden_proto for memrchr building glibc on s390x with --disable-multi-arch fails if only the C-variant of strchrnul / memrchr is used. This is the case if gcc uses -march < z13. The build fails with: ../sysdeps/s390/strchrnul-c.c:28:49: error: ‘__strchrnul_c’ undeclared here (not in a function); did you mean ‘__strchrnul’? 28 | __hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); With --disable-multi-arch, __strchrnul_c is not available as string/strchrnul.c is just included without defining STRCHRNUL and thus we also don't have to create the internal hidden symbol. Tested-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-30Fix typoAndreas K. Hüttel1-1/+1
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-30manual/io: Fix swapped reading and writing phrase.Joe Simmons-Talbott1-1/+1
Reviewed-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-30Update advisory format and introduce some automationSiddhesh Poyarekar8-67/+182
Simplify the advisory format by dropping the -Backport tags and instead stick to using just the -Commit tags. To identify backports, put a substring of git-describe into the release version in the brackets next to the commit ref. This way, it not only identifies that the fix (or regression) is on the release/2.YY/master branch, it also disambiguates regressions/fixes in the branch from those in the tarball. Add a README to make it easier for consumers to understand the format. Additionally, the Release wiki needs to be updated to inform the release manager to: 1. Generate a NEWS snipped from the advisories directory AND 2. on release/2.YY/master, replace the advisories directory with a text file pointing to the advisories directory in master so that we don't have to update multiple locations. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-30Document CVE-2023-6246, CVE-2023-6779, and CVE-2023-6780Arjun Shankar3-0/+43
This commit adds "advisories" entries for the above three CVEs.
2024-01-30syslog: Fix integer overflow in __vsyslog_internal (CVE-2023-6780)Arjun Shankar1-1/+2
__vsyslog_internal calculated a buffer size by adding two integers, but did not first check if the addition would overflow. This commit fixes that. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2024-01-30syslog: Fix heap buffer overflow in __vsyslog_internal (CVE-2023-6779)Arjun Shankar1-11/+28
__vsyslog_internal used the return value of snprintf/vsnprintf to calculate buffer sizes for memory allocation. If these functions (for any reason) failed and returned -1, the resulting buffer would be too small to hold output. This commit fixes that. All snprintf/vsnprintf calls are checked for negative return values and the function silently returns upon encountering them. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-01-30syslog: Fix heap buffer overflow in __vsyslog_internal (CVE-2023-6246)Arjun Shankar4-15/+82
__vsyslog_internal did not handle a case where printing a SYSLOG_HEADER containing a long program name failed to update the required buffer size, leading to the allocation and overflow of a too-small buffer on the heap. This commit fixes that. It also adds a new regression test that uses glibc.malloc.check. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2024-01-30Use binutils 2.42 branch in build-many-glibcs.pyJoseph Myers1-1/+1
This patch makes build-many-glibcs.py use binutils 2.42 branch. Tested with build-many-glibcs.py (host-libraries, compilers and glibcs builds).
2024-01-29elf: correct relocation statistics for !ELF_MACHINE_START_ADDRESSAndreas Schwab1-4/+3
Fixes: 6628c742b2 ("elf: Remove prelink support")
2024-01-26Relicense IBM portions of resolv/base64.c resolv/res_debug.c.Carlos O'Donell3-38/+55
This change relicenses the IBM portions of resolv/base64.c and resolv/res_debug.c to a new license that does not have use-limited patent language. The top-level LICENSE file is updated with the license. The relicensing was approved by IBM. Signed-off-by: Brad Topol, IBM Director of Open Technologies <btopol@us.ibm.com> Signed-off-by: Richard Fontana <rfontana@redhat.com> Signed-off-by: Carlos O'Donell <carlos@redhat.com>
2024-01-25localedata: Use consistent values for grouping and mon_groupingMike FABIAN133-233/+292
Resolves: BZ # 31205 Adapt test cases in test-grouping_iterator.c
2024-01-24manual: fix order of arguments of memalign and aligned_alloc (Bug 27547)Dennis Brendel1-2/+2
On the summary page the order of the function arguments was reversed, but it is in correct order in the other places of the manual. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-01-24manual, NEWS: Document malloc side effect of dynamic TLS changesFlorian Weimer2-0/+14
The increased malloc subsystem usage is a side effect of commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow tls access after dlopen [BZ #19924]"). Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2024-01-24NEWS: Update temporary files ignored by ldconfigFlorian Weimer1-2/+2
Fixes commit 2aa0974d2573441bffd596b07bff8698b1f2f18c ("elf: ldconfig should skip temporary files created by package managers") and commit cfb5a97a93ea656e3b2263e42142a4032986d9ba ("ldconfig: Fixes for skipping temporary files."). Reported-by: Guillem Jover <guillem@debian.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-23po: Incorporate translations (sr)Andreas K. Hüttel1-4/+45
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-23string: Disable stack protector for memset in early static initializationAdhemerval Zanella1-0/+1
For ports that use the default memset, the compiler might generate early calls before the stack protector is initialized (for instance, riscv with -fstack-protector-all on _dl_aux_init). Checked on riscv64-linux-gnu-rv64imafdc-lp64d. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2024-01-23qsort: Fix a typo causing unnecessary malloc/free (BZ 31276)Xi Ruoyao1-1/+1
In qsort_r we allocate a buffer sized QSORT_STACK_SIZE (1024) on stack and we intend to use it if all elements can fit into it. But there is a typo: if (total_size < sizeof buf) buf = tmp; else /* allocate a buffer on heap and use it ... */ Here "buf" is a pointer, thus sizeof buf is just 4 or 8, instead of 1024. There is also a minor issue that we should use "<=" instead of "<". This bug is detected debugging some strange heap corruption running the Ruby-3.3.0 test suite (on an experimental Linux From Scratch build using Binutils-2.41.90 and Glibc trunk, and also Fedora Rawhide [1]). It seems Ruby is doing some wild "optimization" by jumping into somewhere in qsort_r instead of calling it normally, resulting in a double free of buf if we allocate it on heap. The issue can be reproduced deterministically with: LD_PRELOAD=/usr/lib/libc_malloc_debug.so MALLOC_CHECK_=3 \ LD_LIBRARY_PATH=. ./ruby test/runner.rb test/ruby/test_enum.rb in Ruby-3.3.0 tree after building it. This change would hide the issue for Ruby, but Ruby is likely still buggy (if using this "optimization" sorting larger arrays). [1]:https://kojipkgs.fedoraproject.org/work/tasks/9729/111889729/build.log Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-01-22riscv: add support for static PIEAndreas Schwab1-0/+11
In order to support static PIE the startup code must avoid relocations before __libc_start_main is called.
2024-01-22sh: Fix static build with --enable-fortifyAdhemerval Zanella1-2/+2
For static the internal symbols should not be prepended with the internal __GI_. Checked with a make check for sh4-linux-gnu.
2024-01-22sparc: Fix sparc64 memmove length comparison (BZ 31266)Adhemerval Zanella1-1/+1
The small counts copy bytes comparsion should be unsigned (as the memmove size argument). It fixes string/tst-memmove-overflow on sparcv9, where the input size triggers an invalid code path. Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
2024-01-22sparc64: Remove unwind information from signal return stubs [BZ#31244]Adhemerval Zanella1-2/+5
Similar to sparc32 fix, remove the unwind information on the signal return stubs. This fixes the regressions: FAIL: nptl/tst-cancel24-static FAIL: nptl/tst-cond8-static FAIL: nptl/tst-mutex8-static FAIL: nptl/tst-mutexpi8-static FAIL: nptl/tst-mutexpi9 On sparc64-linux-gnu.
2024-01-22sparc: Remove 64 bit check on sparc32 wordsize (BZ 27574)Adhemerval Zanella1-9/+4
The sparc32 is always 32 bits. Checked on sparcv9-linux-gnu.
2024-01-22Use --disable-default-pie for sparc in build-many-glibcs.pyAdhemerval Zanella1-4/+6
The staticcally built binaries fails without this option [1]. Checked on sparc64-linux-gnu and sparcv9-linux-gnu. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=29575
2024-01-19Further build-many-glibcs.py fixes for utcnow() deprecationJoseph Myers1-9/+14
It turns out that the replacement of datetime.datetime.utcnow(), for a warning produced early in running build-many-glibcs.py with Python 3.12, (a) wasn't complete (there were other uses elsewhere in the script also needing updating) and (b) broke reading of build-time from build-state.json, because an aware datetime was written out including +00:00 for the timezone, which was not expected by the strptime call. Fix the first by making the change to datetime.datetime.now(datetime.timezone.utc) for all the remaining utcnow() calls. Fix the second by using strftime with an explicit format instead of just str() when formatting build times for build-state.json and and email subjects, and then setting the timezone explicitly when reading from build-state.json. (Other uses, in particular messages output by the bot, continue to use str() as the precise format should not matter in those cases; it shouldn't actually matter for email subjects either but it seems a good idea to keep those short.) Tested with a bot-cycle run and checking the format of times in build-state.json afterwards.
2024-01-18sparc: Do not test preservation of NaN payloads for LEONDaniel Cederman1-0/+30
The FPU used by LEON does not preserve NaN payload. This change allows the math/test-*-canonicalize tests to pass on LEON. Signed-off-by: Daniel Cederman <cederman@gaisler.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-18sparc: Force calculation that raises exceptionDaniel Cederman1-5/+6
Use the math_force_eval() macro to force the calculation to complete and raise the exception. With this change the math/test-fenv test pass. Signed-off-by: Daniel Cederman <cederman@gaisler.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-18sparc: Fix llrint and llround missing exceptions on SPARC V8Daniel Cederman1-0/+43
Conversions from a float to a long long on SPARC v8 uses a libgcc function that may not raise the correct exceptions on overflow. It also may raise spurious "inexact" exceptions on non overflow cases. This patch fixes the problem in the same way as for RV32. Signed-off-by: Daniel Cederman <cederman@gaisler.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-18sparc: Remove unwind information from signal return stubs [BZ #31244]Daniel Cederman2-4/+16
The functions were previously written in C, but were not compiled with unwind information. The ENTRY/END macros includes .cfi_startproc and .cfi_endproc which adds unwind information. This caused the tests cleanup-8 and cleanup-10 in the GCC testsuite to fail. This patch adds a version of the ENTRY/END macros without the CFI instructions that can be used instead. sigaction registers a restorer address that is located two instructions before the stub function. This patch adds a two instruction padding to avoid that the unwinder accesses the unwind information from the function that the linker has placed right before it in memory. This fixes an issue with pthread_cancel that caused tst-mutex8-static (and other tests) to fail. Signed-off-by: Daniel Cederman <cederman@gaisler.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-18sparc: Prevent stfsr from directly following floating-point instructionDaniel Cederman1-1/+6
On LEON, if the stfsr instruction is immediately following a floating-point operation instruction in a running program, with no other instruction in between the two, the stfsr might behave as if the order was reversed between the two instructions and the stfsr occurred before the floating-point operation. Add a nop instruction before the stfsr to prevent this from happening. Signed-off-by: Daniel Cederman <cederman@gaisler.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-18sparc: Use existing macros to avoid code duplicationDaniel Cederman1-7/+3
Macros for using inline assembly to access the fp state register exists in both fenv_private.h and in fpu_control.h. Let fenv_private.h use the macros from fpu_control.h Signed-off-by: Daniel Cederman <cederman@gaisler.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>