aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-04-21wcsmbs: Add wcsdup() tests. (BZ #30266)azanella/bz30266Joe Simmons-Talbott
Enable wide character testcases for wcsdup(). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-21string: Add tests for strndup (BZ #30266)Joe Simmons-Talbott
Copy strncpy tests for strndup. Covers some basic testcases with random strings. Remove tests that set the destination's bytes and checked the resulting buffer's bytes. Remove wide character test support since wcsndup() doesn't exist. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-21string: Add tests for strdup (BZ #30266)Joe Simmons-Talbott
Copy strcpy tests for strdup. Covers some basic testcases with random strings. Add a zero-length string testcase. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-21string: Allow use of test-string.h for non-ifunc implementations.Joe Simmons-Talbott
Mark two variables as unused to silence warning when using test-string.h for non-ifunc implementations. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-21hurd: Don't migrate reply port into __init1_tcbheadSergey Bugaev
Properly differentiate between setting up the real TLS with TLS_INIT_TP, and setting up the early TLS (__init1_tcbhead) in static builds. In the latter case, don't yet migrate the reply port into the TCB, and don't yet set __libc_tls_initialized to 1. This also lets us move the __init1_desc assignment inside _hurd_tls_init (). Fixes cd019ddd892e182277fadd6aedccc57fa3923c8d "hurd: Don't leak __hurd_reply_port0" Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-20hurd: Make dl-sysdep's open () cope with O_IGNORE_CTTYSergey Bugaev
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230419160207.65988-6-bugaevc@gmail.com>
2023-04-20Created tunable to force small pages on stack allocation.Cupertino Miranda
Created tunable glibc.pthread.stack_hugetlb to control when hugepages can be used for stack allocation. In case THP are enabled and glibc.pthread.stack_hugetlb is set to 0, glibc will madvise the kernel not to use allow hugepages for stack allocations. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-20malloc: Add missing shared thread library flagsAdhemerval Zanella
So tst-memalign-3 builds on Hurd.
2023-04-20linux: Re-flow and sort multiline Makefile definitionsAdhemerval Zanella
2023-04-20posix: Re-flow and sort multiline Makefile definitionsAdhemerval Zanella
2023-04-19build-many-glibcs.py: --disable-gcov for gcc-firstJan-Benedict Glaw
This is also being tracked n GCC [1]. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100289
2023-04-18malloc: set NON_MAIN_ARENA flag for reclaimed memalign chunk (BZ #30101)DJ Delorie
Based on these comments in malloc.c: size field is or'ed with NON_MAIN_ARENA if the chunk was obtained from a non-main arena. This is only set immediately before handing the chunk to the user, if necessary. The NON_MAIN_ARENA flag is never set for unsorted chunks, so it does not have to be taken into account in size comparisons. When we pull a chunk off the unsorted list (or any list) we need to make sure that flag is set properly before returning the chunk. Use the rounded-up size for chunk_ok_for_memalign() Do not scan the arena for reusable chunks if there's no arena. Account for chunk overhead when determining if a chunk is a reuse candidate. mcheck interferes with memalign, so skip mcheck variants of memalign tests. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2023-04-18hurd: Microoptimize sigreturnSergey Bugaev
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-18rcmd.c: Fix indentation in last commitSiddhesh Poyarekar
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-04-18inet/rcmd.c: fix warn unused resultFrédéric Bérat
Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in glibc. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-04-18hurd: Avoid leaking task & thread portsSergey Bugaev
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-18hurd: Simplify _S_catch_exception_raiseSergey Bugaev
_hurd_thread_sigstate () already handles finding an existing sigstate before allocating a new one, so just use that. Bonus: this will only lock the _hurd_siglock once. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-17hurd: Run init_pids () before init_dtable ()Sergey Bugaev
Much as the comment says, things on _hurd_subinit assume that _hurd_pid is already initialized by the time _hurd_subinit is run, so _hurd_proc_subinit has to run before it. Specifically, init_dtable () calls _hurd_port2fd (), which uses _hurd_pid and _hurd_pgrp to set up ctty handling. With _hurd_subinit running before _hurd_proc_subinit, ctty setup was broken: 13<--33(pid1255)->term_getctty () = 0 4<--39(pid1255) task16(pid1255)->mach_port_deallocate (pn{ 10}) = 0 13<--33(pid1255)->term_open_ctty (0 0) = 0x40000016 (Invalid argument) Fix this by running the _hurd_proc_subinit hook in the correct place -- just after _hurd_portarray is set up (so the proc server port is available in its usual place) and just before running _hurd_subinit. Fixes 1ccbb9258eed0f667edf459a28ba23a805549b36 ("hurd: Notify the proc server later during initialization"). Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-17hurd: Fix restoring reply port in sigreturnSergey Bugaev
We must not use the user's reply port (scp->sc_reply_port) for any of our own RPCs, otherwise various things break. So, use MACH_PORT_DEAD as a reply port when destroying our reply port, and make sure to do this after _hurd_sigstate_unlock (), which may do a gsync_wake () RPC. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-17wcsmbs: Re-flow and sort routines, tests variables in MakefileFlorian Weimer
Eliminate strop-tests because it does not seem to be a simplification. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-17debug: Re-flow and sort routines variable in MakefileFlorian Weimer
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-17hurd: Avoid extra ctty RPCs in init_dtable ()Sergey Bugaev
It is common to have (some of) stdin, stdout and stderr point to the very same port. We were making the ctty RPCs that _hurd_port2fd () does for each one of them separately: 1. term_getctty () 2. mach_port_deallocate () 3. term_open_ctty () Instead, let's detect this case and duplicate the ctty port we already have. This means we do 1 RPC instead of 3 (and create a single protid on the server side) if the file is our ctty, and no RPCs instead of 1 if it's not. A clear win! Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-17math: Improve fmod(f) performanceWilco Dijkstra
Optimize the fast paths (x < y) and (x/y < 2^12). Delay handling of special cases to reduce the number of instructions executed before the fast paths. Performance improvements for fmod: Skylake Zen2 Neoverse V1 subnormals 11.8% 4.2% 11.5% normal 3.9% 0.01% -0.5% close-exponents 6.3% 5.6% 19.4% Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-17Benchtests: Adjust timingWilco Dijkstra
Adjust iteration counts so benchmarks don't run too slowly or quickly. Ensure benchmarks take less than 10 seconds on older, slower cores and more than 0.5 seconds on fast cores. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-14hurd: Only check for TLS initialization inside rtld or in static buildsSergey Bugaev
When glibc is built as a shared library, TLS is always initialized by the call of TLS_INIT_TP () macro made inside the dynamic loader, prior to running the main program (see dl-call_tls_init_tp.h). We can take advantage of this: we know for sure that __LIBC_NO_TLS () will evaluate to 0 in all other cases, so let the compiler know that explicitly too. Also, only define _hurd_tls_init () and TLS_INIT_TP () under the same conditions (either !SHARED or inside rtld), to statically assert that this is the case. Other than a microoptimization, this also helps with avoiding awkward sharing of the __libc_tls_initialized variable between ld.so and libc.so that we would have to do otherwise -- we know for sure that no sharing is required, simply because __libc_tls_initialized would always be set to true inside libc.so. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230319151017.531737-25-bugaevc@gmail.com>
2023-04-14hurd: Remove __hurd_local_reply_portSergey Bugaev
Now that the signal code no longer accesses it, the only real user of it was mig-reply.c, so move the logic for managing the port there. If we're in SHARED and outside of rtld, we know that __LIBC_NO_TLS () always evaluates to 0, and a TLS reply port will always be used, not __hurd_reply_port0. Still, the compiler does not see that __hurd_reply_port0 is never used due to its address being taken. To deal with this, explicitly compile out __hurd_reply_port0 when we know we won't use it. Also, instead of accessing the port via THREAD_SELF->reply_port, this uses THREAD_GETMEM and THREAD_SETMEM directly, avoiding possible miscompilations. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-14malloc: Assure that THP mode read do write OOB end of stringtAdhemerval Zanella
2023-04-13malloc: Assure that THP mode is always null terminatedAdhemerval Zanella
2023-04-13hurd: Mark two tests as unsupportedSamuel Thibault
They make the whole testsuite hang/crash.
2023-04-13hurd: Restore destroying receive rights on sigreturnSamuel Thibault
Just subtracting a ref is making signal/tst-signal signal/tst-raise signal/tst-minsigstksz-5 htl/tst-raise1 fail.
2023-04-12aio: Fix freeing memorySamuel Thibault
The content of the pool array is initialized only until pool_size, pointers between pool_size and pool_max_size were not initialized by the realloc call in get_elem so they should not be freed. This fixes aio tests crashing at their termination on GNU/Hurd.
2023-04-11Revert "hurd: Only check for TLS initialization inside rtld or in static builds"Samuel Thibault
This reverts commit b37899d34d2190ef4b454283188f22519f096048. Apparently we load libc.so (and thus start using its functions) before calling TLS_INIT_TP, so libc.so functions should not actually assume that TLS is always set up.
2023-04-11hurd: Don't leak __hurd_reply_port0Sergey Bugaev
Previously, once we set up TLS, we would implicitly switch from using __hurd_reply_port0 to reply_port inside the TCB, leaving the former unused. But we never deallocated it, so it got leaked. Instead, migrate the port into the new TCB's reply_port slot. This avoids both the port leak and an extra syscall to create a new reply port for the TCB. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230319151017.531737-28-bugaevc@gmail.com>
2023-04-10hurd: Improve reply port handling when exiting signal handlersSergey Bugaev
If we're doing signals, that means we've already got the signal thread running, and that implies TLS having been set up. So we know that __hurd_local_reply_port will resolve to THREAD_SELF->reply_port, and can access that directly using the THREAD_GETMEM and THREAD_SETMEM macros. This avoids potential miscompilations, and should also be a tiny bit faster. Also, use mach_port_mod_refs () and not mach_port_destroy () to destroy the receive right. mach_port_destroy () should *never* be used on mach_task_self (); this can easily lead to port use-after-free vulnerabilities if the task has any other references to the same port. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230319151017.531737-26-bugaevc@gmail.com>
2023-04-10hurd: Only check for TLS initialization inside rtld or in static buildsSergey Bugaev
When glibc is built as a shared library, TLS is always initialized by the call of TLS_INIT_TP () macro made inside the dynamic loader, prior to running the main program (see dl-call_tls_init_tp.h). We can take advantage of this: we know for sure that __LIBC_NO_TLS () will evaluate to 0 in all other cases, so let the compiler know that explicitly too. Also, only define _hurd_tls_init () and TLS_INIT_TP () under the same conditions (either !SHARED or inside rtld), to statically assert that this is the case. Other than a microoptimization, this also helps with avoiding awkward sharing of the __libc_tls_initialized variable between ld.so and libc.so that we would have to do otherwise -- we know for sure that no sharing is required, simply because __libc_tls_initialized would always be set to true inside libc.so. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230319151017.531737-25-bugaevc@gmail.com>
2023-04-10elf: Stop including tls.h in ldsodefs.hSergey Bugaev
Nothing in there needs tls.h Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230319151017.531737-24-bugaevc@gmail.com>
2023-04-10hurd: Port trampoline.c to x86_64Sergey Bugaev
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230403115621.258636-3-bugaevc@gmail.com>
2023-04-10hurd: Do not declare local variables volatileSergey Bugaev
These are just regular local variables that are not accessed in any funny ways, not even though a pointer. There's absolutely no reason to declare them volatile. It only ends up hurting the quality of the generated machine code. If anything, it would make sense to decalre sigsp as *pointing* to volatile memory (volatile void *sigsp), but evidently that's not needed either. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230403115621.258636-2-bugaevc@gmail.com>
2023-04-10hurd: Implement x86_64/intr-msg.hSergey Bugaev
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230319151017.531737-18-bugaevc@gmail.com>
2023-04-10hurd: Add sys/ucontext.h and sigcontext.h for x86_64Sergey Bugaev
This is based on the Linux port's version, but laid out to match Mach's struct i386_thread_state, much like the i386 version does. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-04-10hurd: Stop depending on the default_pager stubs provided by gnumachFlavio Cruz
The hurd source tree already provides the same stubs and they are only needed there. Message-Id: <ZDN3rDdjMowtUWf7@jupiter.tail36e24.ts.net>
2023-04-08manual: update AddressSanitizer discussionPaul Eggert
* manual/string.texi (Truncating Strings): Update obsolescent reference and use the more-generic term “AddressSanitizer”. Mention fortification, too. -fcheck-pointer-bounds is no longer supported.
2023-04-08manual: document snprintf truncation betterPaul Eggert
2023-04-08manual: improve string section wordingPaul Eggert
* manual/string.texi: Editorial fixes. Do not say “text” when “string” or “string contents” is meant, as a C string can contain bytes that are not valid text in the current encoding. When warning about strcat efficiency, warn similarly about strncat and wcscat. “coping” → “copying”. Mention at the start of the two problematic sections that problems are discussed at section end.
2023-04-08manual: fix texinfo typoPaul Eggert
* manual/creature.texi (Feature Test Macros): Fix “creature.texi:309: warning: `.' or `,' must follow @xref, not f”.
2023-04-06<stdio.h>: Make fopencookie, vasprintf, asprintf available by defaultFlorian Weimer
FreeBSD makes these functions available by default, so we should not treat them as GNU-specific and restrict them to _GNU_SOURCE. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-06<string.h>: Make strchrnul, strcasestr, memmem available by defaultFlorian Weimer
FreeBSD makes them available by default, too, so there does not seem to be a reason to restrict these functions to _GNU_SOURCE. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-05<sys/platform/x86.h>: Add PREFETCHI supportH.J. Lu
Add PREFETCHI support to <sys/platform/x86.h>. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2023-04-05<sys/platform/x86.h>: Add AMX-COMPLEX supportH.J. Lu
Add AMX-COMPLEX support to <sys/platform/x86.h>. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2023-04-05<sys/platform/x86.h>: Add AVX-NE-CONVERT supportH.J. Lu
Add AVX-NE-CONVERT support to <sys/platform/x86.h>. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>