about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* hurd: Remove __hurd_threadvar_stack_{offset,mask}Sergey Bugaev2023-04-036-46/+2
| | | | | | | | | | | Noone is or should be using __hurd_threadvar_stack_{offset,mask}, we have proper TLS now. These two remaining variables are never set to anything other than zero, so any code that would try to use them as described would just dereference a zero pointer and crash. So remove them entirely. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230319151017.531737-6-bugaevc@gmail.com>
* hurd: Make exception subcode a longSergey Bugaev2023-04-033-4/+5
| | | | | | | On EXC_BAD_ACCESS, exception subcode is used to pass the faulting memory address, so it needs to be (at least) pointer-sized. Thus, make it into a long. This matches the corresponding change in GNU Mach. Message-Id: <20230319151017.531737-5-bugaevc@gmail.com>
* time: Fix strftime(3) API regarding nullabilityAlejandro Colomar2023-03-311-1/+2
| | | | | | | | strftime(3) doesn't accept null pointers in any of the parameters. Cc: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Update arm libm-tests-ulpsAdhemerval Zanella2023-03-301-0/+1
| | | | For the next test from cf7ffdd8a5f6da55397e10b3860062944312824c.
* getlogin_r: fix missing fallback if loginuid is unset (bug 30235)Andreas Schwab2023-03-301-4/+1
| | | | | When /proc/self/loginuid is not set, we should still fall back to using the traditional utmp lookup, instead of failing right away.
* memalign: Support scanning for aligned chunks.DJ Delorie2023-03-293-28/+390
| | | | | | | | | | | | | | | | This patch adds a chunk scanning algorithm to the _int_memalign code path that reduces heap fragmentation by reusing already aligned chunks instead of always looking for chunks of larger sizes and splitting them. The tcache macros are extended to allow removing a chunk from the middle of the list. The goal is to fix the pathological use cases where heaps grow continuously in workloads that are heavy users of memalign. Note that tst-memalign-2 checks for tcache operation, which malloc-check bypasses. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* malloc: Use C11 atomics on memusageAdhemerval Zanella2023-03-291-82/+111
| | | | | | Checked on x86_64-linux-gnu. Reviewed-by: DJ Delorie <dj@redhat.com>
* Remove --enable-tunables configure optionAdhemerval Zanella Netto2023-03-2948-513/+75
| | | | | | | | | | | | And make always supported. The configure option was added on glibc 2.25 and some features require it (such as hwcap mask, huge pages support, and lock elisition tuning). It also simplifies the build permutations. Changes from v1: * Remove glibc.rtld.dynamic_sort changes, it is orthogonal and needs more discussion. * Cleanup more code. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Remove --disable-experimental-malloc optionAdhemerval Zanella2023-03-298-39/+4
| | | | | | | | | | | | | | | | | | | It is the default since 2.26 and it has bitrotten over the years, By using it multiple malloc tests fails: FAIL: malloc/tst-memalign-2 FAIL: malloc/tst-memalign-2-malloc-hugetlb1 FAIL: malloc/tst-memalign-2-malloc-hugetlb2 FAIL: malloc/tst-memalign-2-mcheck FAIL: malloc/tst-mxfast-malloc-hugetlb1 FAIL: malloc/tst-mxfast-malloc-hugetlb2 FAIL: malloc/tst-tcfree2 FAIL: malloc/tst-tcfree2-malloc-hugetlb1 FAIL: malloc/tst-tcfree2-malloc-hugetlb2 Checked on x86_64-linux-gnu. Reviewed-by: DJ Delorie <dj@redhat.com>
* Allow building with --disable-nscd againFlavio Cruz2023-03-281-0/+6
| | | | | The change 88677348b4de breaks the build with undefiend references to the NSCD functions.
* system: Add "--" after "-c" for sh (BZ #28519)Joe Simmons-Talbott2023-03-284-2/+22
| | | | | | | | | | | Prevent sh from interpreting a user string as shell options if it starts with '-' or '+'. Since the version of /bin/sh used for testing system() is different from the full-fledged system /bin/sh add support to it for handling "--" after "-c". Add a testcase to ensure the expected behavior. Signed-off-by: Joe Simmons-Talbott <josimmon@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* posix: Fix some crashes in wordexp [BZ #18096]Julian Squires2023-03-282-7/+8
| | | | | | | | | Without these fixes, the first three included tests segfault (on a NULL dereference); the fourth aborts on an assertion, which is itself unnecessary. Signed-off-by: Julian Squires <julian@cipht.net> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* LoongArch: ldconfig: Add comments for using EF_LARCH_OBJABI_V1caiyinyu2023-03-281-0/+6
| | | | | We added Adhemerval Zanella's comment to explain the reason for using EF_LARCH_OBJABI_V1.
* elf: Take into account ${sysconfdir} in elf/tst-ldconfig-p.shRomain Geissler2023-03-272-6/+7
| | | | | | Take into account ${sysconfdir} in elf/tst-ldconfig-p.sh. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix tst-glibc-hwcaps-prepend-cache with custom configure prefix valueRomain Geissler2023-03-271-3/+7
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix tst-ldconfig-ld_so_conf-update with custom configure prefix valueRomain Geissler2023-03-271-5/+8
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: introduce support_sysconfdir_prefixRomain Geissler2023-03-273-1/+11
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove set-hooks.h from generic includesAdhemerval Zanella Netto2023-03-271-0/+0
| | | | | | | | | | | | | | The hooks mechanism uses symbol sets for running lists of functions, which requires either extra linker directives to provide any hardening (such as RELRO) or additional code (such as pointer obfuscation via mangling with random value). Currently only hurd uses set-hooks.h so we remove it from the generic includes. The generic implementation uses direct function calls which provide hardening and good code generation, observability and debugging without the need for extra linking options or special code handling. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Remove --with-default-link configure optionAdhemerval Zanella Netto2023-03-278-51/+7
| | | | | | | Now that there is no need to use a special linker script to hardening internal data structures, remove the --with-default-link configure option and associated definitions. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* libio: Remove the usage of __libc_IO_vtablesAdhemerval Zanella Netto2023-03-2722-513/+637
| | | | | | | | | | | | | | Instead of using a special ELF section along with a linker script directive to put the IO vtables within the RELRO section, the libio vtables are all moved to an array marked as data.relro (so linker will place in the RELRO segment without the need of extra directives). To avoid static linking namespace issues and including all vtable referenced objects, all required function pointers are set to weak alias. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* libio: Do not autogenerate stdio_lim.hAdhemerval Zanella Netto2023-03-276-69/+43
| | | | | | | | | | | | | Instead define the required fields in system dependend files. The only system dependent definition is FILENAME_MAX, which should match POSIX PATH_MAX, and it is obtained from either kernel UAPI or mach headers. Currently set pre-defined value from current kernels. It avoids a circular dependendy when including stdio.h in gen-as-const-headers files. Checked on x86_64-linux-gnu and i686-linux-gnu Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Move libc_freeres_ptrs and libc_subfreeres to hidden/weak functionsAdhemerval Zanella Netto2023-03-2790-243/+584
| | | | | | | | | | | | | | | | | | | | They are both used by __libc_freeres to free all library malloc allocated resources to help tooling like mtrace or valgrind with memory leak tracking. The current scheme uses assembly markers and linker script entries to consolidate the free routine function pointers in the RELRO segment and to be freed buffers in BSS. This patch changes it to use specific free functions for libc_freeres_ptrs buffers and call the function pointer array directly with call_function_static_weak. It allows the removal of both the internal macros and the linker script sections. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* benchtests: Move libmvec benchtest inputs to benchtests directoryJoe Ramsay2023-03-2753-1/+1
| | | | | | | This allows other targets to use the same inputs for their own libmvec microbenchmarks without having to duplicate them in their own subdirectory. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* stdio-common: tests: don't double-define _FORTIFY_SOURCESam James2023-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exactly the same as 35bcb08eaa953c9b8bef6ab2486dc4361e1f26c0. If using -D_FORITFY_SOURCE=3 (in my case, I've patched GCC to add =3 instead of =2 (we've done =2 for years in Gentoo)), building glibc tests will fail on tst-bz11319-fortify2 like: ``` <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition cc1: all warnings being treated as errors ``` It's just because we're always setting -D_FORTIFY_SOURCE=2 rather than unsetting it first. If F_S is already 2, it's harmless, but if it's another value (say, 1, or 3), the compiler will bawk. (I'm not aware of a reason this couldn't be tested with =3, but the toolchain support is limited for that (too new), and we want to run the tests everywhere possible.) As Siddhesh noted previously, we could implement some fallback logic to determine the maximal F_S value supported by the toolchain, which is a bit easier now that autoconf-archive has been updated for F_S=3 (https://github.com/autoconf-archive/autoconf-archive/pull/269), but let's revisit this if it continues to crop up. Signed-off-by: Sam James <sam@gentoo.org> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* LoongArch: ldconfig: Ignore EF_LARCH_OBJABI_V1 in shared objectsXi Ruoyao2023-03-271-1/+1
| | | | | | | | | | | | | | | | Binutils 2.40 sets EF_LARCH_OBJABI_V1 for shared objects: $ ld --version | head -n1 GNU ld (GNU Binutils) 2.40 $ echo 'int dummy;' > dummy.c $ cc dummy.c -shared $ readelf -h a.out | grep Flags Flags: 0x43, DOUBLE-FLOAT, OBJ-v1 We need to ignore it in ldconfig or ldconfig will consider all shared objects linked by Binutils 2.40 "unsupported". Maybe we should stop setting EF_LARCH_OBJABI_V1 for shared objects, but Binutils 2.40 is already released and we cannot change it.
* _dl_map_object_from_fd: Remove unnecessary debugger notification in error pathAndreas Schwab2023-03-271-11/+1
| | | | | | | After commit ed3ce71f5c ("elf: Move la_activity (LA_ACT_ADD) after _dl_add_to_namespace_list() (BZ #28062)") it is no longer necessary to reset the debugger state in the error case, since the debugger notification only happens after no more errors can occur.
* hppa: Drop 16-byte pthread lock alignmentJohn David Anglin2023-03-262-3/+9
| | | | | | | | | | | | | | | | | Linux threads were removed about 12 years ago and the current nptl implementation only requires 4-byte alignment for pthread locks. The 16-byte alignment causes various issues. For example in building ignition-msgs, we have: /usr/include/google/protobuf/map.h:124:37: error: static assertion failed 124 | static_assert(alignof(value_type) <= 8, ""); | ~~~~~~~~~~~~~~~~~~~~^~~~ This is caused by the 16-byte pthread lock alignment. Signed-off-by: John David Anglin <dave.anglin@bell.net>
* Minor: don't call _dl_debug_update (which can have side effects) inside assertPaul Pluzhnikov2023-03-261-2/+6
|
* x86: Don't check PREFETCHWT1 in tst-cpu-features-cpuinfo.cDJ Delorie2023-03-211-0/+3
| | | | | | | Don't check PREFETCHWT1 against /proc/cpuinfo since kernel doesn't report PREFETCHWT1 in /proc/cpuinfo. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
* Declare wcstofN, wcstofNx for C2xJoseph Myers2023-03-141-14/+16
| | | | | | | | | WG14 accepted the changes in N3105 to define wcstofN and wcstofNx functions for C2x. Thus enable those for C2x (given also __GLIBC_USE (IEC_60559_TYPES_EXT) and support for the relevant _FloatN / _FloatNx type) rather than only for __USE_GNU. Tested for x86_64.
* Update printf %b/%B C2x supportJoseph Myers2023-03-144-1/+95
| | | | | | | | | | | | | | | | WG14 recently accepted two additions to the printf/scanf %b/%B support: there are now PRIb* and SCNb* macros in <inttypes.h>, and printf %B is now an optional feature defined in normative text, instead of recommended practice, with corresponding PRIB* macros that can also be used to test whether that optional feature is supported. See N3072 items 14 and 15 for details (those changes were accepted, some other changes in that paper weren't). Add the corresponding PRI* macros to glibc and update one place in the manual referring to %B as recommended. (SCNb* should naturally be added at the same time as the corresponding scanf %b support.) Tested for x86_64 and x86.
* ARC: run child from the separate start block in __clonePavel Kozlov2023-03-131-15/+25
| | | | | | | For better debug experience use separate code block with extra cfi_* directives to run child (same as in __clone3). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: Add the clone3 wrapperPavel Kozlov2023-03-132-0/+92
| | | | | | | | | | | Use the clone3 wrapper on ARC. It doesn't care about stack alignment. All callers should provide an aligned stack. It follows the internal signature: extern int clone3 (struct clone_args *__cl_args, size_t __size, int (*__func) (void *__arg), void *__arg); Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* LoongArch: Add get_rounding_mode.caiyinyu2023-03-131-0/+38
|
* LoongArch: Add support for ldconfig.caiyinyu2023-03-134-2/+162
|
* linux: fix ntp_gettime abi break (BZ# 30156)Kacper Piwiński2023-03-101-2/+9
| | | | | | | | | | | | | | | | Between versions v2.11 and v2.12 struct ntptimeval got new fields. That wasn't a problem because new function ntp_gettimex was created (and made default) to support new struct. Old ntp_gettime was not using new fields so it was safe to call with old struct definition. Then commits 5613afe9e3dff and b6ad64b907a (added for 64 bit time_t support), ntp_gettime start setting new fields. Sets fields manually to maintain compatibility with v2.11 struct definition. Resolves #30156 Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Add missing dependency between resolvfail and testobj1.soArsen Arsenović2023-03-101-0/+1
| | | | | | | | It was possible to run this test individually and have it fail because it can't find testobj1.so. This patch adds that dependency, to prevent such issues. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* elf: Add -z lazy to some more testsArsen Arsenović2023-03-101-0/+19
| | | | | | | Some toolchains, such as that used on Gentoo Hardened, set -z now out of the box. This trips up a couple of tests. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Benchtests: Remove simple_str(r)chrWilco Dijkstra2023-03-082-31/+38
| | | | | | | | Instead of benchmarking slow byte oriented loops, include the optimized generic strchr and strrchr implementation. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Benchtests: Remove simple_str(n)casecmpWilco Dijkstra2023-03-082-37/+2
| | | | | | | Remove the slow byte oriented loops. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Benchtests: Remove simple_memcmpWilco Dijkstra2023-03-081-31/+1
| | | | | | Remove the slow byte oriented simple_memcmp. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Benchtests: Remove simple_strcspn/strpbrk/strsepWilco Dijkstra2023-03-085-177/+4
| | | | | | | | | Remove simple_strcspn/strpbrk/strsep which are significantly slower than the generic implementations. Also remove oldstrsep and oldstrtok since they are practically identical to the generic implementation. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Benchtests: Remove memchr_strnlenWilco Dijkstra2023-03-082-11/+2
| | | | | | | | Remove memchr_strnlen since it is now the same as generic_strnlen. Adjust iteration count to reduce benchmark time. Keep memchr_strlen since the generic strlen does not use memchr. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Benchtests: Remove simple_mem(r)chrWilco Dijkstra2023-03-082-30/+26
| | | | | | | | Instead of benchmarking slow byte oriented loops, include the optimized generic memchr/memrchr implementation. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Benchtests: Remove simple_strcpy_chkWilco Dijkstra2023-03-082-27/+1
| | | | | | | Remove the slow byte oriented simple_strcpy_chk and simple_stpcpy_chk. Adjust iteration count to increase benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Benchtests: Remove simple_str(n)cmpWilco Dijkstra2023-03-082-74/+24
| | | | | | | Instead of benchmarking slow byte oriented loops, include the optimized generic strcmp/strncmp implementation. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* malloc: Fix transposed arguments in sysmalloc_mmap_fallback callRobert Morell2023-03-081-2/+2
| | | | | | | | | | | | git commit 0849eed45daa ("malloc: Move MORECORE fallback mmap to sysmalloc_mmap_fallback") moved a block of code from sysmalloc to a new helper function sysmalloc_mmap_fallback(), but 'pagesize' is used for the 'minsize' argument and 'MMAP_AS_MORECORE_SIZE' for the 'pagesize' argument. Fixes: 0849eed45daa ("malloc: Move MORECORE fallback mmap to sysmalloc_mmap_fallback") Signed-off-by: Robert Morell <rmorell@nvidia.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* rt: fix shm_open not set ENAMETOOLONG when name exceeds {_POSIX_PATH_MAX}abushwang2023-03-083-7/+15
| | | | | | | | according to man-pages-posix-2017, shm_open() function may fail if the length of the name argument exceeds {_POSIX_PATH_MAX} and set ENAMETOOLONG Signed-off-by: abushwang <abushwangs@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* posix: Ensure the initial signal disposition for tst-spawn7Adhemerval Zanella Netto2023-03-081-0/+6
| | | | | | | | | | To avoid possible failure if any parent set any initial signal disposition as SIG_IGN (for instance if the testcase is issued with nohup). Checked on x86_64-linux-gnu. Tested-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
* hurd: fix build of tst-system.cAdam Yi2023-03-081-0/+1
| | | | | | | | | | | | We made tst-system.c depend on pthread, but that requires linking with $(shared-thread-library). It does not fail under Linux because the variable expands to nothing under Linux, but it fails for Hurd. I tested verified via cross-compiling that "make check" now works for Hurd. Signed-off-by: Adam Yi <ayi@janestreet.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>