aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-07-19Fix getting return address in elf/tst-audit28.c.Stefan Liebler
Starting with commit 1bcfe0f732066ae5336b252295591ebe7e51c301, the test was enhanced and the object for __builtin_return_address (0) is searched with _dl_find_object. Unfortunately on e.g. s390 (31bit), a postprocessing step is needed as the highest bit has to be masked out. This can be done with __builtin_extract_return_addr. Without this postprocessing, _dl_find_object returns with -1 and the content of dlfo is invalid, which may lead to segfaults in basename. Therefore those checks are now only done on success. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-07-18[PATCH v1] x86: Use `3/4*sizeof(per-thread-L3)` as low bound for NT threshold.Noah Goldstein
On some machines we end up with incomplete cache information. This can make the new calculation of `sizeof(total-L3)/custom-divisor` end up lower than intended (and lower than the prior value). So reintroduce the old bound as a lower bound to avoid potentially regressing code where we don't have complete information to make the decision. Reviewed-by: DJ Delorie <dj@redhat.com>
2023-07-18x86: Fix slight bug in `shared_per_thread` cache size calculation.Noah Goldstein
After: ``` commit af992e7abdc9049714da76cae1e5e18bc4838fb8 Author: Noah Goldstein <goldstein.w.n@gmail.com> Date: Wed Jun 7 13:18:01 2023 -0500 x86: Increase `non_temporal_threshold` to roughly `sizeof_L3 / 4` ``` Split `shared` (cumulative cache size) from `shared_per_thread` (cache size per socket), the `shared_per_thread` *can* be slightly off from the previous calculation. Previously we added `core` even if `threads_l2` was invalid, and only used `threads_l2` to divide `core` if it was present. The changed version only included `core` if `threads_l2` was valid. This change restores the old behavior if `threads_l2` is invalid by adding the entire value of `core`. Reviewed-by: DJ Delorie <dj@redhat.com>
2023-07-19Update i686 libm-test-ulps (again)Andreas K. Hüttel
Based on feedback by Arsen Arsenović <arsen@gentoo.org> Linux-6.1.38-gentoo-dist-hardened x86_64 AMD Ryzen 7 3800X 8-Core Processor -march=x86-64-v2 Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-18Update i686 libm-test-ulpsAndreas K. Hüttel
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-18Merge translations (de, ro, uk, zh_TW)Andreas K. Hüttel
Line numbers, version numbers, template date changed everywhere Nontrivial changes in de, ro, uk, zh_TW Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-17Regenerate libc.potAndreas K. Hüttel
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-17configure: Use autoconf 2.71Siddhesh Poyarekar
Bump autoconf requirement to 2.71 to allow regenerating configure on more recent distributions. autoconf 2.71 has been in Fedora since F36 and is the current version in Debian stable (bookworm). It appears to be current in Gentoo as well. All sysdeps configure and preconfigure scripts have also been regenerated; all changes are trivial transformations that do not affect functionality. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-17Update sparc libm-test-ulpsAdhemerval Zanella
2023-07-13s390: Add the clone3 wrapperAdhemerval Zanella
It follows the internal signature: extern int clone3 (struct clone_args *__cl_args, size_t __size, int (*__func) (void *__arg), void *__arg); Checked on s390x-linux-gnu and s390-linux-gnu.
2023-07-13manual: Fix typos in struct dl_find_objectBert Wesarg
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-07-12sparc: Fix la_symbind for bind-now (BZ 23734)Adhemerval Zanella
The sparc ABI has multiple cases on how to handle JMP_SLOT relocations, (sparc_fixup_plt/sparc64_fixup_plt). For BINDNOW, _dl_audit_symbind will be responsible to setup the final relocation value; while for lazy binding _dl_fixup/_dl_profile_fixup will call the audit callback and tail cail elf_machine_fixup_plt (which will call sparc64_fixup_plt). This patch fixes by issuing the SPARC specific routine on bindnow and forwarding the audit value to elf_machine_fixup_plt for lazy resolution. It fixes the la_symbind for bind-now tests on sparc64 and sparcv9: elf/tst-audit24a elf/tst-audit24b elf/tst-audit24c elf/tst-audit24d Checked on sparc64-linux-gnu and sparcv9-linux-gnu. Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
2023-07-12i386: make debug wrappers compatible with static PIEAndreas Schwab
Static PIE requires the use of PLT relocation.
2023-07-11LoongArch: Fix soft-float bug about _dl_runtime_resolve{,lsx,lasx}caiyinyu
2023-07-11LoongArch: Add vector implementation for _dl_runtime_resolve.caiyinyu
2023-07-11LoongArch: config: Added HAVE_LOONGARCH_VEC_ASM.caiyinyu
This patch checks if assembler supports vector instructions to generate LASX/LSX code or not, and then define HAVE_LOONGARCH_VEC_ASM macro We have added support for vector instructions in binutils-2.41 See: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=75b2f521b101d974354f6ce9ed7c054d8b2e3b7a commit 75b2f521b101d974354f6ce9ed7c054d8b2e3b7a Author: mengqinggang <mengqinggang@loongson.cn> Date: Thu Jun 22 10:35:28 2023 +0800 LoongArch: gas: Add lsx and lasx instructions support gas/ChangeLog: * config/tc-loongarch.c (md_parse_option): Add lsx and lasx option. (loongarch_after_parse_args): Add lsx and lasx option. opcodes/ChangeLog: * loongarch-opc.c (struct loongarch_ase): Add lsx and lasx instructions.
2023-07-10sysdeps: Add missing hidden definitions for i386Frédéric Bérat
Add missing libc_hidden_builtin_def for memset_chk and MEMCPY_CHK on i386.
2023-07-10sysdeps/s390: Exclude fortified routines from being built with _FORTIFY_SOURCEFrédéric Bérat
Depending on build configuration, the [routine]-c.c files may be chosen to provide fortified routines implementation. While [routines].c implementation were automatically excluded, the [routines]-c.c ones were not. This patch fixes that by adding these file to the list to be filtered.
2023-07-07Translations: Add new ro support and update others.Carlos O'Donell
This brings in the new Romanian language translations, and updates nine other translations. Important translations in this update include the Italian and Japanese translations for ESTALE which remove the mention of "NFS" from the error message translation.
2023-07-07elf: _dl_find_object may return 1 during early startup (bug 30515)Florian Weimer
Success is reported with a 0 return value, and failure is -1. Enhance the kitchen sink test elf/tst-audit28 to cover _dl_find_object as well. Fixes commit 5d28a8962dcb ("elf: Add _dl_find_object function") and bug 30515. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2023-07-07LoongArch: config: Rewrite check on static PIE.caiyinyu
It's better to add "\" before "EOF" and remove "\" before "$".
2023-07-06Revert "hppa: Drop 16-byte pthread lock alignment"John David Anglin
This change reverts commits c4468cd3995b4236ea886901109b194641132b08 and ab991a3d1b401ded6bd4f027352da8262b021a11.
2023-07-06realloc: Limit chunk reuse to only growing requests [BZ #30579]Siddhesh Poyarekar
The trim_threshold is too aggressive a heuristic to decide if chunk reuse is OK for reallocated memory; for repeated small, shrinking allocations it leads to internal fragmentation and for repeated larger allocations that fragmentation may blow up even worse due to the dynamic nature of the threshold. Limit reuse only when it is within the alignment padding, which is 2 * size_t for heap allocations and a page size for mmapped allocations. There's the added wrinkle of THP, but this fix ignores it for now, pessimizing that case in favor of keeping fragmentation low. This resolves BZ #30579. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reported-by: Nicolas Dusart <nicolas@freedelity.be> Reported-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Tested-by: Aurelien Jarno <aurelien@aurel32.net>
2023-07-06vfscanf-internal: Remove potentially unbounded allocasAdhemerval Zanella
Some locales define a list of mapping pairs of alternate digits and separators for input digits (to_inpunct). This require the scanf to create a list of all possible inputs for the optional type modifier 'I'. Checked on x86_64-linux-gnu. Reviewed-by: Joe Simmons-Talbott <josimmon@redhat.com>
2023-07-05fileops: Don't process ,ccs= as individual mode flags (BZ#18906)Joe Simmons-Talbott
In processing the first 7 individual characters of the mode for fopen if ,ccs= is used those characters will be processed as well. Stop processing individual mode flags once a comma is encountered. This has the effect of requiring ,ccs= to be the last mode flag in the mode string. Add a testcase to check that the ,ccs= mode flag is not processed as individual mode flags. Reviewed-by: DJ Delorie <dj@redhat.com>
2023-07-05sysdeps/ieee754/ldbl-128ibm-compat: Fix warn unused resultFrédéric Bérat
Return value from *scanf and *asprintf routines are now properly checked in test-scanf-ldbl-compat-template.c and test-printf-ldbl-compat.c. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05libio/bits/stdio2-decl.h: Avoid PLT entries with _FORTIFY_SOURCEFrédéric Bérat
The change is meant to avoid unwanted PLT entry for the fgets_unlocked routine when _FORTIFY_SOURCE is set. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05libio/bits/stdio2.h: Clearly separate declaration from definitionsFrédéric Bérat
Move declarations from libio/bits/stdio.h to existing libio/bits/stdio2-decl.h. This will enable future use of __REDIRECT_FORTIFY in place of some __REDIRECT. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05misc/bits/syslog.h: Clearly separate declaration from definitionFrédéric Bérat
This allows to include bits/syslog-decl.h in include/sys/syslog.h and therefore be able to create the libc_hidden_builtin_proto (__syslog_chk) prototype. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05misc/bits/select2.h: Clearly separate declaration from definitionsFrédéric Bérat
The __fdelt_chk declaration needs to be available so that libc_hidden_proto can be used while not redefining __FD_ELT. Thus, misc/bits/select-decl.h is created to hold the corresponding prototypes. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05unistd: Avoid PLT entries with _FORTIFY_SOURCEFrédéric Bérat
The change is meant to avoid unwanted PLT entries for the read_chk, getdomainname_chk and getlogin_r_chk routines when _FORTIFY_SOURCE is set. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05posix/bits/unistd.h: Clearly separate declaration from definitionsFrédéric Bérat
This change is similar to what was done for bits/wchar2.h. Routines declaration are moved into a dedicated bits/unistd-decl.h file which is then included into the bits/unistd.h file. This will allow to adapt the files so that PLT entries are not created when _FORTIFY_SOURCE is enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05wchar: Avoid PLT entries with _FORTIFY_SOURCEFrédéric Bérat
The change is meant to avoid unwanted PLT entries for the wmemset and wcrtomb routines when _FORTIFY_SOURCE is set. On top of that, ensure that *_chk routines have their hidden builtin definitions available. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05misc/sys/cdefs.h: Create FORTIFY redirects for internal callsFrédéric Bérat
The __REDIRECT* macros are creating aliases which may lead to unwanted PLT entries when fortification is enabled. To prevent these entries, the REDIRECT alias should be set to point to the existing __GI_* aliases. This is done transparently by creating a __REDIRECT_FORTIFY* version of these macros, that can be overwritten internally when necessary. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05stdio: Ensure *_chk routines have their hidden builtin definition availableFrédéric Bérat
If libc_hidden_builtin_{def,proto} isn't properly set for *_chk routines, there are unwanted PLT entries in libc.so. There is a special case with __asprintf_chk: If ldbl_* macros are used for asprintf, ABI gets broken on s390x, if it isn't, ppc64le isn't building due to multiple asm redirections. This is due to the inclusion of bits/stdio-lbdl.h for ppc64le whereas it isn't for s390x. This header creates redirections, which are not compatible with the ones generated using libc_hidden_def. Yet, we can't use libc_hidden_ldbl_proto on s390x since it will not create a simple strong alias (e.g. as done on x86_64), but a versioned alias, leading to ABI breakage. This results in errors on s390x: /usr/bin/ld: glibc/iconv/../libio/bits/stdio2.h:137: undefined reference to `__asprintf_chk' Original __asprintf_chk symbols: 00000000001395b0 T __asprintf_chk 0000000000177e90 T __nldbl___asprintf_chk __asprintf_chk symbols with ldbl_* macros: 000000000012d590 t ___asprintf_chk 000000000012d590 t __asprintf_chk@@GLIBC_2.4 000000000012d590 t __GI___asprintf_chk 000000000012d590 t __GL____asprintf_chk___asprintf_chk 0000000000172240 T __nldbl___asprintf_chk __asprintf_chk symbols with the patch: 000000000012d590 t ___asprintf_chk 000000000012d590 T __asprintf_chk 000000000012d590 t __GI___asprintf_chk 0000000000172240 T __nldbl___asprintf_chk Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-05string: Ensure *_chk routines have their hidden builtin definition availableFrédéric Bérat
If libc_hidden_builtin_{def,proto} isn't properly set for *_chk routines, there are unwanted PLT entries in libc.so. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05sysdeps: Ensure ieee128*_chk routines to be properly namedFrédéric Bérat
The *_chk routines naming doesn't match the name that would be generated using libc_hidden_ldbl_proto. Since the macro is needed for some of these *_chk functions for _FORTIFY_SOURCE to be enabled, that needed to be fixed. While at it, all the *_chk function get renamed appropriately for consistency, even if not strictly necessary. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
2023-07-05Exclude routines from fortificationFrédéric Bérat
Since the _FORTIFY_SOURCE feature uses some routines of Glibc, they need to be excluded from the fortification. On top of that: - some tests explicitly verify that some level of fortification works appropriately, we therefore shouldn't modify the level set for them. - some objects need to be build with optimization disabled, which prevents _FORTIFY_SOURCE to be used for them. Assembler files that implement architecture specific versions of the fortified routines were not excluded from _FORTIFY_SOURCE as there is no C header included that would impact their behavior. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-05Allow glibc to be built with _FORTIFY_SOURCEFrédéric Bérat
Add --enable-fortify-source option. It is now possible to enable fortification through a configure option. The level may be given as parameter, if none is provided, the configure script will determine what is the highest level possible that can be set considering GCC built-ins availability and set it. If level is explicitly set to 3, configure checks if the compiler supports the built-in function necessary for it or raise an error if it isn't. If the configure option isn't explicitly enabled, it _FORTIFY_SOURCE is forcibly undefined (and therefore disabled). The result of the configure checks are new variables, ${fortify_source} and ${no_fortify_source} that can be used to appropriately populate CFLAGS. A dedicated patch will follow to make use of this variable in Makefiles when necessary. Updated NEWS and INSTALL. Adding dedicated x86_64 variant that enables the configuration. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-07-03manual: Update documentation of strerror and related functionsFlorian Weimer
The current implementation of strerror is thread-safe, but this has implications for the lifetime of the return string. Describe the strerror_l function. Describe both variants of the strerror_r function. Mention the lifetime of the returned string for strerrorname_np and strerrordesc_np. Clarify that perror output depends on the current locale. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-03manual: Enhance documentation of the <ctype.h> functionsFlorian Weimer
Describe the problems with signed characters, and the glibc extension to deal with most of them. Mention that the is* functions return zero for the special argument EOF. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-03Always do locking when accessing streams (bug 15142, bug 14697)Andreas Schwab
Now that abort no longer calls fflush there is no reason to avoid locking the stdio streams anywhere. This fixes a conformance issue and potential heap corruption during exit.
2023-07-03hurd: Implement MAP_EXCLSergey Bugaev
MAP_FIXED is defined to silently replace any existing mappings at the address range being mapped over. This, however, is a dangerous, and only rarely desired behavior. Various Unix systems provide replacements or additions to MAP_FIXED: * SerenityOS and Linux provide MAP_FIXED_NOREPLACE. If the address space already contains a mapping in the requested range, Linux returns EEXIST. SerenityOS returns ENOMEM, however that is a bug, as the MAP_FIXED_NOREPLACE implementation is intended to be compatible with Linux. * FreeBSD provides the MAP_EXCL flag that has to be used in combination with MAP_FIXED. It returns EINVAL if the requested range already contains existing mappings. This is directly analogous to the O_EXCL flag in the open () call. * DragonFly BSD, NetBSD, and OpenBSD provide MAP_TRYFIXED, but with different semantics. DragonFly BSD returns ENOMEM if the requested range already contains existing mappings. NetBSD does not return an error, but instead creates the mapping at a different address if the requested range contains mappings. OpenBSD behaves the same, but also notes that this is the default behavior even without MAP_TRYFIXED (which is the case on the Hurd too). Since the Hurd leans closer to the BSD side, add MAP_EXCL as the primary API to request the behavior of not replacing existing mappings. Declare MAP_FIXED_NOREPLACE and MAP_TRYFIXED as aliases of (MAP_FIXED|MAP_EXCL), so any existing software that checks for either of those macros will pick them up automatically. For compatibility with Linux, return EEXIST if a mapping already exists. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230625231751.404120-5-bugaevc@gmail.com>
2023-07-03hurd: Fix mapping at address 0 with MAP_FIXEDSergey Bugaev
Zero address passed to mmap () typically means the caller doesn't have any specific preferred address. Not so if MAP_FIXED is passed: in this case 0 means literal 0. Fix this case to pass anywhere = 0 into vm_map. Also add some documentation. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230625231751.404120-4-bugaevc@gmail.com>
2023-07-03hurd: Fix calling vm_deallocate (NULL)Sergey Bugaev
Only call vm_deallocate when we do have the old buffer, and check for unexpected errors. Spotted while debugging a msgids/readdir issue on x86_64-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230625231751.404120-3-bugaevc@gmail.com>
2023-07-03hurd: Map brk non-executableSergey Bugaev
The rest of the heap (backed by individual pages) is already mapped RW. Mapping these pages RWX presents a security hazard. Also, in another branch memory gets allocated using vm_allocate, which sets memory protection to VM_PROT_DEFAULT (which is RW). The mismatch between protections prevents Mach from coalescing the VM map entries. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230625231751.404120-2-bugaevc@gmail.com>
2023-07-03htl: Let Mach place thread stacksSergey Bugaev
Instead of trying to allocate a thread stack at a specific address, looping over the address space, just set the ANYWHERE flag in vm_allocate (). The previous behavior: - defeats ASLR (for Mach versions that support ASLR), - is particularly slow if the lower 4 GB of the address space are mapped inaccessible, as we're planning to do on 64-bit Hurd, - is just silly. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230625231751.404120-1-bugaevc@gmail.com>
2023-07-02mach: strerror must not return NULL (bug 30555)Samuel Thibault
This follows 1d44530a5be2 ("string: strerror must not return NULL (bug 30555)"): « For strerror, this fixes commit 28aff047818eb1726394296d27b ("string: Implement strerror in terms of strerror_l"). This commit avoids returning NULL for strerror_l as well, although POSIX allows this behavior for strerror_l. »
2023-07-01hppa: xfail debug/tst-ssp-1 when have-ssp is yes (gcc-12 and later)John David Anglin
2023-07-01support: Build with exceptions and asynchronous unwind tables [BZ #30587]John David Anglin
Changing tst-cleanup4.c to use xread instead of read caused the nptl/tst-cleanupx4 test to fail. The routines in libsupport.a need to be built with exception handling and asynchronous unwind table support. v2: Use "CFLAGS-.oS" instead of "override CFLAGS".