summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* hurd: Also make it possible to call strlen very earlyHEADmasterSergey Bugaev2023-05-171-0/+3
| | | | | | | | | | | | strlen, which is another ifunc-selected function, is invoked during early static executable startup if the argv arrives from the exec server. Make it not crash. Checked on x86_64-gnu: statically linked executables launched after the exec server is up now start up successfully. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-10-bugaevc@gmail.com>
* hurd: Fix setting up pthreadsSergey Bugaev2023-05-172-1/+94
| | | | | | | | | | | | | | | | | | | | On x86_64, we have to pass function arguments in registers, not on the stack. We also have to align the stack pointer in a specific way. Since sharing the logic with i386 does not bring much benefit, split the file back into i386- and x86_64-specific versions, and fix the x86_64 version to set up the thread properly. Bonus: i386 keeps doing the extra RPC inside __thread_set_pcsptp to fetch the state of the thread before setting it; but x86_64 no lnoger does that. Checked on x86_64-gnu and i686-gnu. Fixes be6d002ca277ffc90058d382396150cb0e785b9c "hurd: Set up the basic tree for x86_64-gnu" Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-9-bugaevc@gmail.com>
* hurd: Fix x86_64 _hurd_tls_forkSergey Bugaev2023-05-171-6/+19
| | | | | | | | | | | | | | | It is illegal to call thread_get_state () on mach_thread_self (), so this codepath cannot be used as-is to fork the calling thread's TLS. Fortunately we can use THREAD_SELF (aka %fs:0x0) to find out the value of our fs_base without calling into the kernel. Fixes: f6cf701efc61c9ad910372bda14b9a235db310a8 "hurd: Implement TLS for x86_64" Checked on x86_64-gnu: fork () now works! Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-8-bugaevc@gmail.com>
* hurd: Make sure to not use tcb->selfSergey Bugaev2023-05-173-26/+14
| | | | | | | | | | | | | | | | | | | | Unlike sigstate->thread, tcb->self did not hold a Mach port reference on the thread port it names. This means that the port can be deallocated, and the name reused for something else, without anyone noticing. Using tcb->self will then lead to port use-after-free. Fortunately nothing was accessing tcb->self, other than it being intially set to then-valid thread port name upon TCB initialization. To assert that this keeps being the case without altering TCB layout, rename self -> self_do_not_use, and stop initializing it. Also, do not (re-)allocate a whole separate and unused stack for the main thread, and just exit __pthread_setup early in this case. Found upon attempting to use tcb->self and getting unexpected crashes. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-7-bugaevc@gmail.com>
* hurd: Use __mach_setup_thread_call ()Sergey Bugaev2023-05-173-11/+15
| | | | | | | | | | | ...instead of mach_setup_thread (), which is unsuitable for setting up function calls. Checked on x86_64-gnu: the signal thread no longer crashes upon trying to process a message. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-6-bugaevc@gmail.com>
* mach: Add __mach_setup_thread_call ()Sergey Bugaev2023-05-173-16/+74
| | | | | | | | | | | | | | This is just like mach_setup_thread (), but it's suitable for making the thread call a function correctly, as opposed to explicitly setting the thread's stack and instruction pointers to the given values. Internally, it uses MACHINE_THREAD_STATE_SETUP_CALL. Unlike mach_setup_thread (), which is exported via mach.h for the benefit of the Hurd exec server, __mach_setup_thread_call () is private to glibc for the time being. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-5-bugaevc@gmail.com>
* hurd: Use MACHINE_THREAD_STATE_SETUP_CALLSergey Bugaev2023-05-171-2/+2
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-4-bugaevc@gmail.com>
* mach: Define MACHINE_THREAD_STATE_SETUP_CALLSergey Bugaev2023-05-172-0/+22
| | | | | | | | | | | | | | | | | | | | | The existing two macros, MACHINE_THREAD_STATE_SET_PC and MACHINE_THREAD_STATE_SET_SP, can be used to set program counter and the stack pointer registers in a machine-specific thread state structure. Useful as it is, this may not be enough to set up the thread to make a function call, because the machine-specific ABI may impose additional requirements. In particular, x86_64 ABI requires that upon function entry, the stack pointer is 8 less than 16-byte aligned (sp & 15 == 8). To deal with this, introduce a new macro, MACHINE_THREAD_STATE_SETUP_CALL (), which sets both stack and instruction pointers, and also applies any machine-specific requirements to make a valid function call. The default implementation simply forwards to MACHINE_THREAD_STATE_SET_PC and MACHINE_THREAD_STATE_SET_SP, but on x86_64 we additionally align the stack pointer. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230517191436.73636-3-bugaevc@gmail.com>
* Use TASK_THREAD_TIMES_INFO_COUNT when calling task_info with ↵Flavio Cruz2023-05-171-1/+1
| | | | | | | | | TASK_THREAD_TIMES_INFO This hasn't caused any problems yet but we are passing a pointer to struct task_thread_times_info which can cause problems if we populate over the existing size of the struct. Message-Id: <ZGRDDNcOM2hA3CuT@jupiter.tail36e24.ts.net>
* argp: Reformat Makefile.Carlos O'Donell2023-05-171-6/+24
| | | | | | | | | | Reflow Makefile. Sort using scripts/sort-makefile-lines.py. Code generation is changed as routines are linked in sorted order as expected. No regressions on x86_64 and i686.
* stdlib: Avoid undefined behavior in stdlib/tst-labsFlorian Weimer2023-05-171-12/+13
| | | | | | | | | The last loop could attempt to overflow beyond INT_MAX on 32-bit architectures. Also switch to GNU style. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* stdlib: Use long long int in stdlib/tst-llabsFlorian Weimer2023-05-171-15/+15
| | | | | | And adjust for GNU style. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Update kernel version to 6.3 in header constant testsJoseph Myers2023-05-163-4/+4
| | | | | | | | | This patch updates the kernel version in the tests tst-mman-consts.py, tst-mount-consts.py and tst-pidfd-consts.py to 6.3. (There are no new constants covered by these tests in 6.3 that need any other header changes.) Tested with build-many-glibcs.py.
* i386: Use pthread_barrier for synchronization on tst-bz21269DJ Delorie2023-05-161-5/+28
| | | | | | | | | | | | | | | | | | | | | | | | So I was able to reproduce the hangs in the original source, and debug it, and fix it. In doing so, I realized that we can't use anything complex to trigger the thread because that "anything" might also cause the expected segfault and force everything out of sync again. Here's what I ended up with, and it doesn't seem to hang where the original one hung quite often (in a tight while..end loop). The key changes are: 1. Calls to futex are error checked, with retries, to ensure that the futexes are actually doing what they're supposed to be doing. In the original code, nearly every futex call returned an error. 2. The main loop has checks for whether the thread ran or not, and "unlocks" the thread if it didn't (this is how the original source hangs). Note: the usleep() is not for timing purposes, but just to give the kernel an excuse to run the other thread at that time. The test will not hang without it, but is more likely to test the right bugfix if the usleep() is present.
* stdlib: Add testcases for llabs(). (BZ #30263)Joe Simmons-Talbott2023-05-162-0/+57
| | | | | | | | Test minimum and maximum long long values, zero, 32bit crossover points, and part of the range of long long values. Use '-fno-builtin' to ensure we are testing the implementation. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
* stdlib: Add testcases for labs(). (BZ #30263)Joe Simmons-Talbott2023-05-162-0/+53
| | | | | | | | Test minimum and maximum long values, zero, and part of the range of long values. Use '-fno-builtin' to ensure we are testing the implementation. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
* stdlib: Add testcases for abs(). (BZ #30263)Joe Simmons-Talbott2023-05-162-0/+48
| | | | | | | | Test minimum and maximum int values, zero, and part of the range of int values. Use '-fno-builtin' to ensure we are testing the implementation. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
* hurd: Fix computing user stack pointerSergey Bugaev2023-05-161-1/+1
| | | | | | | | | | Fixes b574ae0a2876ee94e4fe617f878407bf818c2df0 "hurd: Implement sigreturn for x86_64" Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230515083323.1358039-5-bugaevc@gmail.com>
* hurd: Fix sc_i386_thread_state layoutSergey Bugaev2023-05-162-0/+14
| | | | | | | | | | | | | | | | | | | The real i386_thread_state Mach structure has an alignment of 8 on x86_64. However, in struct sigcontext, the compiler was packing sc_gs (which is the first member of sc_i386_thread_state) into the same 8-byte slot as sc_error; this resulted in the rest of sc_i386_thread_state members having wrong offsets relative to each other, and the overall sc_i386_thread_state layout mismatching that of i386_thread_state. Fix this by explicitly adding the required padding members, and statically asserting that this results in the desired alignment. The same goes for sc_i386_float_state. Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230515083323.1358039-4-bugaevc@gmail.com>
* hurd: Align signal stack pointer after allocating stackframeSergey Bugaev2023-05-161-3/+2
| | | | | | | | | | | sizeof (*stackframe) appears to be divisible by 16, but we should not rely on that. So make sure to leave enough space for the stackframe first, and then align the final pointer at 16 bytes. Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230515083323.1358039-3-bugaevc@gmail.com>
* hurd: Fix aligning signal stack pointerSergey Bugaev2023-05-161-1/+1
| | | | | | | | | | | Fixes 60f9bf974694d50daf58d46347b06a5975ac5ddd "hurd: Port trampoline.c to x86_64" Checked on x86_64-gnu. Reported-by: Bruno Haible <bruno@clisp.org> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230515083323.1358039-2-bugaevc@gmail.com>
* wcsmbs: Reformat Makefile.Carlos O'Donell2023-05-161-6/+23
| | | | | | | | Reflow Makefile. Sort using scripts/sort-makefile-lines.py. No code generation changes observed in binary artifacts. No regressions on x86_64 and i686.
* linux: Reformat Makefile.Carlos O'Donell2023-05-161-6/+7
| | | | | | | | Reflow Makefile. Sort using scripts/sort-makefile-lines.py. No code generation changes observed in binary artifacts. No regressions on x86_64 and i686.
* stdlib: Reformat Makefile.Carlos O'Donell2023-05-161-3/+3
| | | | | | | | Reflow Makefile. Sort using scripts/sort-makefile-lines.py. No code generation changes observed in binary artifacts. No regressions on x86_64 and i686.
* stdio-common: Reformat Makefile.Carlos O'Donell2023-05-161-10/+20
| | | | | | | | | | Reflow Makefile. Sort using scripts/sort-makefile-lines.py. Code generation is changed as routines are linked in sorted order as expected. No regressions on x86_64 and i686.
* socket: Reformat Makefile.Carlos O'Donell2023-05-161-9/+38
| | | | | | | | | | Reflow Makefile. Sort using scripts/sort-makefile-lines.py. Code generation is changed as routines are linked in sorted order as expected. No regressions on x86_64 and i686.
* misc: Reformat Makefile.Carlos O'Donell2023-05-161-67/+232
| | | | | | | | | | Reflow Makefile. Sort using scripts/sort-makefile-lines.py. Code generation is changed as routines are linked in sorted order as expected. No regressions on x86_64 and i686.
* debug: Reformat Makefile.Carlos O'Donell2023-05-161-16/+18
| | | | | | | | Fix list terminator whitspace. Sort using scripts/sort-makefile-lines.py. No code generation changes observed in binary artifacts. No regressions on x86_64 and i686.
* elf: Reformat Makefile.Carlos O'Donell2023-05-161-35/+35
| | | | | | | | Fix list terminator whitspace. Sort using scripts/sort-makefile-lines.py. No code generation changes observed in binary artifacts. No regressions on x86_64 and i686.
* libio: Add __nonnull for FILE * arguments of fclose and freopenXi Ruoyao2023-05-161-3/+3
| | | | | | | | | | Calling fclose or freopen with a null FILE * is undefined behavior, and doing so in practice will cause a SIGSEGV. So it seems suitable for __nonnull. This will help the compiler to warn for some buggy code, like https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109570. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nss: Reconcile conditional declaration and use of `is_nscd'Arjun Shankar2023-05-161-3/+3
| | | | | | | | | | | | | This change harmonizes the declaration and use of `is_nscd' and fixes a build failure with the "--enable-static-nss --enable-nscd" configuration options due to `is_nscd' being used undeclared. The purpose of `is_nscd' is to avoid (nss <-> nscd) recursion in dynamically linked libc (SHARED) that is nscd-aware (USE_NSCD), and so its declaration and use should be guarded by the definition of those macros. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update syscall lists for Linux 6.3Joseph Myers2023-05-151-2/+2
| | | | | | | Linux 6.3 has no new syscalls. Update the version number in syscall-names.list to reflect that it is still current for 6.3. Tested with build-many-glibcs.py.
* hurd: rule out some mach headers when generating errno.hSamuel Thibault2023-05-112-3/+4
| | | | | | | | | | While mach/kern_return.h happens to pull mach/machine/kern_return.h, mach/machine/boolean.h, and mach/machine/vm_types.h (and realpath-ing them exposes the machine-specific machine symlink content), those headers do not actually define anything machine-specific for the content of errno.h. So we can just rule out these machine-specific from the dependency comment.
* Stop checking if MiG supports retcode.Flavio Cruz2023-05-113-65/+0
| | | | | | | | | | | | | | | | We already did the same change for Hurd (https://git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=ef5924402864ef049f40a39e73967628583bc1a4) Due to MiG requiring the subsystem to be defined early in order to know the size of a port, this was causing a division by zero error during ./configure. We could have just move subsystem to the top of the snippet, however it is simpler to just remove the check given that we have no plans to use some other MiG anyway. HAVE_MIG_RETCODE is removed completely since this will be a no-op either way (compiling against old Hurd headers will work the same, new Hurd headers will result in the same stubs since retcode is a no-op). Message-Id: <ZFspor91aoMwbh9T@jupiter.tail36e24.ts.net>
* Added Redirects to longdouble error functions [BZ #29033]Sachin Monga2023-05-107-2/+142
| | | | | | | | This patch redirects the error functions to the appropriate longdouble variants which enables the compiler to optimize for the abi ieeelongdouble. Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
* nptl: Reformat Makefile.Carlos O'Donell2023-05-102-113/+320
| | | | | | | | | | Reflow all long lines adding comment terminators. Sort all reflowed text using scripts/sort-makefile-lines.py. No code generation changes observed in binary artifacts. No regressions on x86_64 and i686. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* scripts: Add sort-makefile-lines.py to sort Makefile variables.Carlos O'Donell2023-05-101-0/+160
| | | | | | | | | | | | The scripts/sort-makefile-lines.py script sorts Makefile variables according to project expected order. The script can be used like this: $ scripts/sort-makefile-lines.py < elf/Makefile > elf/Makefile.tmp $ mv elf/Makefile.tmp elf/Makefile Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* dlopen: skip debugger notification for DSO loaded from sprof (bug 30258)Andreas Schwab2023-05-095-0/+105
| | | | Avoid inconsistent state in the debugger interface.
* aligned_alloc: conform to C17DJ Delorie2023-05-086-7/+117
| | | | | | | This patch adds the strict checking for power-of-two alignments in aligned_alloc(), and updates the manual accordingly. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* testsuite: stdlib/isomac.c: fix REQUIREMENTSнаб2023-05-081-7/+4
| | | | | | | | | All of the mentioned variables are gone. gcc is just the default and argv[1] can be used instead. /usr/include isn't hard-coded and you can pass argv[2] with -I... to adjust. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* manual: Remove unsupported line breaks in waiting-with-clock sectionFlorian Weimer2023-05-081-21/+8
| | | | | | | The argument to @deftypefun must be on a single line. Also add the missing @safety for sem_clockwait. Reported-by: Nilgün Belma Bugüner <nillguine@gmail.com>
* Enable new device_open_new RPC in libmachuser.Flavio Cruz2023-05-071-1/+2
| | | | Message-Id: <ZFfcM3DP+x7VHpWA@jupiter.tail36e24.ts.net>
* Revert "riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC."Florian Weimer2023-05-074-60/+0
| | | | | | | This reverts commit 117e8b341c5c0ace8d65feeef136fececb3fdc9c. Reason for revert: Causes elf/tst-glibcelf and elf/tst-relro-* to fail on all architectures.
* Update hurd/hurdselect.c to be more portable.Flavio Cruz2023-05-064-26/+46
| | | | | | | | | | | Summary of changes: - Use BAD_TYPECHECK to perform type checking in a cleaner way. BAD_TYPECHECK is moved into sysdeps/mach/rpc.h to avoid duplication. - Remove assertions for mach_msg_type_t since those won't work for x86_64. - Update message structs to use mach_msg_type_t directly. - Use designated initializers. Message-Id: <ZFa+roan3ioo0ONM@jupiter.tail36e24.ts.net>
* hurd: Fix ld.so nameSamuel Thibault2023-05-061-0/+1
| | | | This was set to ld-x86-64.so.1 in gcc.
* hurd: Add ioperm symbol on x86_64Samuel Thibault2023-05-062-0/+6
|
* time: Remove alloca() from getdateJoe Simmons-Talbott2023-05-051-18/+5
| | | | | | | Reduce the usage of alloca() to the bare minimum to avoid the potential for stack overflow. Use __strndup to simplify the code. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* aarch64: More configure checks for libmvecSzabolcs Nagy2023-05-052-6/+48
| | | | | Check assembler and linker support too, not just SVE ACLE in the compiler, since variant PCS requires at least binutils 2.32.1.
* aarch64: SVE ACLE configure test cleanupsSzabolcs Nagy2023-05-052-16/+27
| | | | Use more idiomatic configure test for better autoconf cache and logs.
* hppa: Fix 'concurrency' typo in commentSam James2023-05-052-2/+2
| | | | Signed-off-by: Sam James <sam@gentoo.org>