about summary refs log tree commit diff
path: root/sysdeps/mach
Commit message (Collapse)AuthorAgeFilesLines
* posix: Remove posix waitidAdhemerval Zanella2020-02-271-0/+106
| | | | | | | | | | | | | | | | The POSIX waitid implementation is problematic in some ways: - It emulates using waitpid, which default implementation calls wait4 and wait4 returns ENOSYS as default. - Also by using waitpid it does not allod support the WNOWAIT, WEXITED, WSTOPPED, or WCONTINUED flag. With current POSIX specification the flags are no longer marked as optional. Also due BZ#23091 Hurd still uses the implementation, so it is moved to as a Hurd arch-specific folder (with some minor cleanups). Checked against a i686-gnu (run-built-tests=no)
* <fd_to_filename.h>: Add type safety and port to HurdFlorian Weimer2020-02-181-0/+19
| | | | | | | | | The new type struct fd_to_filename makes the allocation of the backing storage explicit. Hurd uses /dev/fd, not /proc/self/fd. Co-Authored-By: Paul Eggert <eggert@cs.ucla.edu>
* x86: Avoid single-argument _Static_assert in <tls.h>Florian Weimer2020-02-171-8/+12
| | | | | Older GCC versions do not support this extension. Fixes commit f1bdee61797 ("x86 tls: Use _Static_assert for TLS access size assertion").
* x86 tls: Use _Static_assert for TLS access size assertionSamuel Thibault2020-02-171-26/+20
|
* pthread: Move robust mutex tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-161-5/+11
| | | | | tst-robust8.c prints some mutex internals for nptl debugging, this needed to be made conditioned by getting built with nptl.
* htl: Remove stub warning for pthread_mutexattr_setpsharedSamuel Thibault2020-02-161-1/+0
| | | | It actually is implemented.
* htl: Add missing functions and defines for robust mutexesSamuel Thibault2020-02-161-0/+6
|
* htl: Only check pthread_self coherency when DEBUG is setSamuel Thibault2020-02-151-0/+4
| | | | | htl has been widely tested for a long time now with this coherency checked successfully.
* hurd: Add THREAD_GET/SETMEM/_NCSamuel Thibault2020-02-151-0/+108
| | | | Store them in the TCB, and use them for accessing _hurd_sigstate.
* hurd tls: update comment about fields at the end of tcbheadSamuel Thibault2020-02-151-2/+2
|
* ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]Florian Weimer2020-02-152-10/+0
| | | | | | | | | | | | | | | | | | | Exporting functions and relying on symbol interposition from libc.so makes the choice of implementation dependent on DT_NEEDED order, which is not what some compiler drivers expect. This commit replaces one magic mechanism (symbol interposition) with another one (preprocessor-/compiler-based redirection). This makes the hand-over from the minimal malloc to the full malloc more explicit. Removing the ABI symbols is backwards-compatible because libc.so is always in scope, and the dynamic loader will find the malloc-related symbols there since commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c ("ld.so: Support moving versioned symbols between sonames [BZ #24741]"). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* io: Implement lchmod using fchmodat [BZ #14578]Florian Weimer2020-02-121-0/+1
|
* htl C11 threads: Avoid pthread_ symbols visibility in static librarySamuel Thibault2020-02-107-10/+6
|
* hurd: Add __pthread_spin_wait and use itSamuel Thibault2020-02-112-3/+12
| | | | | | | | | 900778283ac3 ("htl: make pthread_spin_lock really spin") made pthread_spin_lock really spin and not block, but the current users of __pthread_spin_lock were assuming that it blocks, i.e. they use it as a lightweight mutex fitting in just one int. __pthread_spin_wait provides that support back.
* pthread: Move most barrier tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-101-0/+1
| | | | So they can be checked with htl too.
* pthread: Move most sem tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-101-0/+9
| | | | So they can be checked with htl too.
* htl: Make sem_wait/sem_timedwait interruptibleSamuel Thibault2020-02-104-3/+33
|
* htl: Add support for semaphore maximum valueSamuel Thibault2020-02-101-0/+3
|
* hurd: Make nanosleep a cancellation pointSamuel Thibault2020-02-101-0/+5
|
* htl: Add support for libc cancellation pointsSamuel Thibault2020-02-101-2/+18
|
* htl: XFAIL rwlock tests which need pshared supportSamuel Thibault2020-02-091-0/+2
|
* pthread: Move most cond tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-091-0/+11
| | | | So they can be checked with htl too.
* htl: Report missing mutex lock on pthread_cond_*waitSamuel Thibault2020-02-091-0/+51
|
* htl: Fix default guard sizeSamuel Thibault2020-02-091-0/+4
| | | | | When it is not hardcoded by the architecture with PAGESIZE, we need to use the dynamic values from __vm_page_size.
* pthread: Move most mutex tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-091-0/+5
| | | | | | So they can be checked with htl too. XFAIL tst-mutex4, for which support is still missing in htl.
* htl: make pthread_spin_lock really spinSamuel Thibault2020-02-091-1/+1
| | | | | __spin_lock would actually use gsync_wait to block, which is not what pthread_spin_lock is about.
* htl: Fix calling pthread_exit in the child of a forkSamuel Thibault2020-02-091-0/+9
| | | | | We need to reset the threads counter, otherwise pthread_exit() would not call exit(0).
* C11 threads: Move implementation to sysdeps/pthreadSamuel Thibault2020-02-095-0/+53
| | | | | | | so it gets shared by nptl and htl. Also add htl versions of thrd_current and thrd_yield. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroySamuel Thibault2020-02-092-5/+5
|
* htl: Move internal mutex/rwlock symbols to GLIBC_PRIVATESamuel Thibault2020-02-091-7/+0
| | | | | Their prototypes have never been made public, and they are not used outside libc (checked on the whole Debian archive)
* htl: Remove duplicate filesSamuel Thibault2020-02-092-56/+0
| | | | The generic versions have the same content.
* htl: Remove unused filesSamuel Thibault2020-02-091-1/+0
| | | | These have never been used.
* y2038: Define __suseconds64_t type to be used with struct __timeval64Lukasz Majewski2020-02-071-0/+1
| | | | | | | | | | | | | | | The __suseconds64_t type is supposed to be the 64 bit type across all architectures. It would be mostly used internally in the glibc - however, when passed to Linux kernel (very unlikely), if necessary, it shall be converted to 32 bit type (i.e. __suseconds_t) Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* htl: Add internal version of __pthread_mutex_timedlockSamuel Thibault2020-01-131-1/+2
| | | | The C11 threads implementation will need it.
* htl: Avoid exposing unixoid functionsSamuel Thibault2020-01-132-1/+4
| | | | C11 threads should not expose them.
* htl: Add type sizes in bits/pthreadtypes-arch.h and check themSamuel Thibault2020-01-132-0/+4
|
* hurd: Fix message reception for timer_threadSamuel Thibault2020-01-051-1/+2
| | | | | | | Without a proper size, we get MACH_RCV_TOO_LARGE instead of MACH_MSG_SUCCESS. * sysdeps/mach/hurd/setitimer.c (timer_thread): Add return_code_type field to received message, and set the receive size in __mach_msg call.
* htl: Add __errno_location and __h_errno_locationSamuel Thibault2020-01-041-0/+2
| | | | | | | | As explained on https://sourceware.org/ml/libc-alpha/2020-01/msg00049.html the presence of __errno_location in libpthread.so on GNU/Linux makes libpthread getting linked in for libstdc++. This aligns on that behavior, to avoid issues that only GNU/Hurd would get.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-01357-357/+357
|
* hurd: Global signal dispositionJeremie Koenig2019-12-2913-55/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds _hurd_sigstate_set_global_rcv used by libpthread to enable POSIX-confirming behavior of signals on a per-thread basis. This also provides a sigstate destructor _hurd_sigstate_delete, and a global process signal state, which needs to be locked and check when global disposition is enabled, thus the addition of _hurd_sigstate_lock _hurd_sigstate_actions _hurd_sigstate_pending _hurd_sigstate_unlock helpers. This also updates all the glibc code accordingly. This also drops support for get_int(INIT_SIGMASK), which did not make sense any more since we do not have a single signal thread any more. During fork/spawn, this also reinitializes the child global sigstate's lock. That cures an issue that would very rarely cause a deadlock in the child in fork, tries to unlock ss' critical section lock at the end of fork. This will typically (always?) be observed in /bin/sh, which is not surprising as that is the foremost caller of fork. To reproduce an intermediate state, add an endless loop if _hurd_global_sigstate is locked after __proc_dostop (cast through volatile); that is, while still being in the fork's parent process. When that triggers (use the libtool testsuite), the signal thread has already locked ss (which is _hurd_global_sigstate), and is stuck at hurdsig.c:685 in post_signal, trying to lock _hurd_siglock (which the main thread already has locked and keeps locked until after __task_create). This is the case that ss->thread == MACH_PORT_NULL, that is, a global signal. In the main thread, between __proc_dostop and __task_create is the __thread_abort call on the signal thread which would abort any current kernel operation (but leave ss locked). Later in fork, in the parent, when _hurd_siglock is unlocked in fork, the parent's signal thread can proceed and will unlock eventually the global sigstate. In the client, _hurd_siglock will likewise be unlocked, but the global sigstate never will be, as the client's signal thread has been configured to restart execution from _hurd_msgport_receive. Thus, when the child tries to unlock ss' critical section lock at the end of fork, it will first lock the global sigstate, will spin trying to lock it, which can never be successful, and we get our deadlock. Options seem to be: * Move the locking of _hurd_siglock earlier in post_signal -- but that may generally impact performance, if this locking isn't generally needed anyway? On the other hand, would it actually make sense to wait here until we are not any longer in a critical section (which is meant to disable signal delivery anyway (but not for preempted signals?))? * Clear the global sigstate in the fork's child with the rationale that we're anyway restarting the signal thread from a clean state. This has now been implemented. Why has this problem not been observed before Jérémie's patches? (Or has it? Perhaps even more rarely?) In _S_msg_sig_post, the signal is now posted to a *global receiver thread*, whereas previously it was posted to the *designated signal-receiving thread*. The latter one was in a critical section in fork, so didn't try to handle the signal until after leaving the critical section? (Not completely analyzed and verified.) Another question is what the signal is that is being received during/around the time __proc_dostop executes.
* hurd sendmsg: Fix warning on calling CMSG_*HDRSamuel Thibault2019-12-291-2/+2
|
* hurd: Add getcontext, makecontext, setcontext, swapcontextThomas Schwinge2019-12-296-0/+440
| | | | | | | | | | Adapted from the Linux x86 functions. Not thoroughly tested, but manual testing as well as glibc tests look fine, and manual -lpthread testing also looks fine (within the given bounds for a new stack to be used with makecontext). This has also been in use in Debian since 2013.
* hurd: Support sending file descriptors over Unix socketsEmilio Pozuelo Monfort2019-12-292-13/+157
|
* Implement waitpid in terms of wait4Adhemerval Zanella2019-12-191-0/+1
| | | | | | This also consolidate all waitpid implementations. Checked on x86_64-linux-gnu.
* hurd: Do not make sigprocmask available in ld.soFlorian Weimer2019-12-183-11/+2
| | | | | | | | | | | After commit f7649d5780aa4682393b9daedd653e4d9c12784c ("dlopen: Do not block signals"), the dynamic linker no longer uses sigprocmask, which means that it does not have to be made available explicitly on hurd. This reverts commit 892badc9bbcd4a6f8c2eb6c8a99be3aa22517532 ("hurd: Make __sigprocmask GLIBC_PRIVATE") and commit d5ed9ba29a3c818b3433a1784862494968abda45 ("hurd: Fix ld.so link"), but keeps the comment changes from the second commit.
* hurd: Make getrandom honour GRND_NONBLOCKJames Clarke2019-12-171-1/+5
| | | | | | * sysdeps/mach/hurd/getrandom.c (__getrandom): Open the random source with O_NONBLOCK when the GRND_NONBLOCK flag is provided. Message-Id: <20191217182929.90989-1-jrtc27@jrtc27.com>
* hurd: Fix local PLTSamuel Thibault2019-12-132-2/+5
| | | | | | | | | | * include/sys/random.h (__getrandom): Add hidden prototype. * stdlib/getrandom.c (getrandom): Rename to hidden definition __getrandom. Add weak alias. * sysdeps/mach/hurd/getrandom.c (getrandom): Likewise. * sysdeps/unix/sysv/linux/getrandom.c (getrandom): Likewise. * sysdeps/mach/hurd/getentropy.c (getentropy): Use __getrandom instead of getrandom.
* hurd: Fix __close_nocancel_nostatus availabilitySamuel Thibault2019-12-134-6/+37
| | | | | | | | | | | | | | Not only libc/rtld use __close_nocancel_nostatus. * sysdeps/mach/hurd/Makefile [$(subdir) == io] (sysdep_routines): Add close_nocancel_nostatus. * sysdeps/mach/hurd/Versions (libc): Add __close_nocancel_nostatus to GLIBC_PRIVATE. * sysdeps/mach/hurd/not-cancel.h (__close_nocancel_nostatus): Declare function instead of defining inline. [IS_IN (libc) || IS_IN (rtld)] (__close_nocancel_nostatus): Make function hidden. * sysdeps/mach/hurd/close_nocancel_nostatus.c: New file.
* hurd: add getrandom and getentropy implementationsAndrew Eggenberger2019-12-132-0/+107
| | | | | * sysdeps/mach/hurd/getentropy.c: New file. * sysdeps/mach/hurd/getrandom.c: Likewise.
* hurd: Implement __close_nocancel_nostatusSamuel Thibault2019-12-131-0/+62
| | | | * sysdeps/mach/hurd/not-cancel.h: New file.