about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
Commit message (Collapse)AuthorAgeFilesLines
...
* nptl: Move pthread_mutexattr_settype, __pthread_mutexattr_settype into libcFlorian Weimer2021-04-2361-87/+163
| | | | | | | | | And pthread_mutexattr_setkind_np as a compatibility symbol. __pthread_mutexattr_settype is used in mtx_init from libpthread, so this commit adds a GLIBC_2.34 symbol version for it. The symbols were moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_setrobust into libcFlorian Weimer2021-04-2361-58/+112
| | | | | | And pthread_mutexattr_getrobust_np as a compat symbol. The symbols were moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_setpshared into libcFlorian Weimer2021-04-2361-29/+64
| | | | The symbol was moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_setprotocol into libcFlorian Weimer2021-04-2361-29/+64
| | | | The symbol was moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_setprioceiling into libcFlorian Weimer2021-04-2361-29/+64
| | | | The symbol was moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_init, __pthread_mutexattr_init into libcFlorian Weimer2021-04-2361-58/+128
| | | | | | | __pthread_mutexattr_init cannot be be made a compat symbol because it is used in mtx_init, which is still in libpthread. The symbols were moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_gettype into libcFlorian Weimer2021-04-2361-58/+96
| | | | | | | | And pthread_mutexattr_getkind_np as a compatibility symbol. (There is no declaration in <pthread.h>, so there is no need to add an alias or a deprecation warning there.) The symbols were moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_getrobust into libcFlorian Weimer2021-04-2361-58/+96
| | | | | | And pthread_mutexattr_getrobust_np as a compat symbol. The symbols were moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_getpshared into libcFlorian Weimer2021-04-2361-29/+64
| | | | The symbol was moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_getprotocol into libcFlorian Weimer2021-04-2361-29/+64
| | | | The symbol was moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_getprioceiling into libcFlorian Weimer2021-04-2361-29/+64
| | | | The symbol was moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutexattr_destroy into libcFlorian Weimer2021-04-2361-58/+96
| | | | | | | And __pthread_mutexattr_destroy as a compat symbol (so no GLIBC_2.34 symbol version is added for it). The symbols were moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutex_trylock, __pthread_mutex_trylock into libcFlorian Weimer2021-04-2361-58/+128
| | | | | | | | The symbols were moved using scripts/move-symbol-to-libc.py. __pthread_mutex_trylock is used to implement mtx_timedlock, which still resides in libpthread, so add a GLIBC_2.34 version for it, to match the existing GLIBC_2.0 version.
* nptl: Move pthread_mutex_timedlock, pthread_mutex_clocklock to libcFlorian Weimer2021-04-2361-58/+128
| | | | | | | The symbols were moved using scripts/move-symbol-to-libc.py. The symbol aliasing follows pthread_cond_timedwait et al. Missing hidden prototypes had to be added to nptl/pthreadP.h for consistency.
* nptl: Move pthread_mutex_setprioceiling into libcFlorian Weimer2021-04-2361-29/+64
| | | | The symbol was moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_mutex_getprioceiling into libcFlorian Weimer2021-04-2361-29/+64
| | | | The symbol was moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_kill_other_threads_np compatibility symbol into libcFlorian Weimer2021-04-2261-29/+32
| | | | And stop including the function for new architectures.
* nptl: Move pthread_atfork compatibility symbol to libcFlorian Weimer2021-04-2233-15/+18
| | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. There is no new symbol version because of the compatibility symbol status. The __pthread_atfork reference in nptl/Versions was unused.
* nptl: Move setxid broadcast implementation into libcFlorian Weimer2021-04-211-4/+0
| | | | | | | The signal handler is exported as __nptl_setxid_sighandler, so that the libpthread initialization code can install it. This is sufficient for now because it is guarantueed to happen before the first pthread_create call.
* nptl: Move core condition variable functions into libcFlorian Weimer2021-04-2161-209/+80
| | | | | | | | | | | | | | | Onl pthread_cond_clockwait did not have a forwarder, so it needs a new symbol version. Some complications arise due to the need to supply hidden aliases, GLIBC_PRIVATE exports (for the C11 condition variable implementation that still remains in libpthread) and 64-bit time_t stubs. pthread_cond_broadcast, pthread_cond_signal, pthread_cond_timedwait, pthread_cond_wait, pthread_cond_clockwait have been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move core mutex functions into libcFlorian Weimer2021-04-2161-232/+256
| | | | | | | | | | | | | | This is complicated because of a second compilation of nptl/pthread_mutex_lock.c via nptl/pthread_mutex_cond_lock.c. PTHREAD_MUTEX_VERSIONS is introduced to suppress symbol versions in that case. The symbols __pthread_mutex_lock, __pthread_mutex_unlock, __pthread_mutex_init, __pthread_mutex_destroy, pthread_mutex_lock, pthread_mutex_unlock, pthread_mutex_init, pthread_mutex_destroy have been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* x86: Remove low-level lock optimizationFlorian Weimer2021-04-211-87/+0
| | | | | | | | | | | | | | | The current approach is to do this optimizations at a higher level, in generic code, so that single-threaded cases can be specifically targeted. Furthermore, using IS_IN (libc) as a compile-time indicator that all locks are private is no longer correct once process-shared lock implementations are moved into libc. The generic <lowlevellock.h> is not compatible with assembler code (obviously), so it's necessary to remove two long-unused #includes. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move rwlock functions with forwarders into libcFlorian Weimer2021-04-2161-174/+288
| | | | | | | | | | | | | | | The forwarders were only used internally, so new symbol versions are needed. All symbols are moved at once because the forwarders are no-ops if libpthread is not loaded, leading to inconsistencies in case of a partial migration. The symbols __pthread_rwlock_rdlock, __pthread_rwlock_unlock, __pthread_rwlock_wrlock, pthread_rwlock_rdlock, pthread_rwlock_unlock, pthread_rwlock_wrlock have been moved using scripts/move-symbol-to-libc.py. The __ symbol variants are turned into compat symbols, which is why they do not receive a GLIBC_2.34 version.
* nptl: Move pthread_key_delete into libc.Florian Weimer2021-04-2161-29/+64
| | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. tss_delete (still in libpthread) uses the __pthread_key_create alias, so that is now exported under GLIBC_PRIVATE.
* nptl: Move pthread_setspecific, __pthread_setspecific into libcFlorian Weimer2021-04-2161-58/+128
| | | | The symbols have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_getspecific, __pthread_getspecific into libcFlorian Weimer2021-04-2161-58/+128
| | | | The symbols have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_key_create, __pthread_key_create into libcFlorian Weimer2021-04-2161-58/+128
| | | | The symbols have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move part of TCB initialization from libpthread to __tls_init_tpFlorian Weimer2021-04-211-29/+0
| | | | | | | | | | | | | | | | | | | This initalization should only happen once for the main thread's TCB. At present, auditors can achieve this by not linking against libpthread. If libpthread becomes part of libc, doing this initialization in libc would happen for every audit namespace, or too late (if it happens from the main libc only). That's why moving this code into ld.so seems the right thing to do, right after the TCB initialization. For !__ASSUME_SET_ROBUST_LIST ports, this also moves the symbol __set_robust_list_avail into ld.so, as __nptl_set_robust_list_avail. It also turned into a proper boolean flag. Inline the __pthread_initialize_pids function because it seems no longer useful as a separate function. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_setcanceltype into libcFlorian Weimer2021-04-2129-29/+0
| | | | | | | | No new symbol version is required because there was a forwarder. The symbol has been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_setcancelstate into libcFlorian Weimer2021-04-2131-35/+3
| | | | | | | | No new symbol version is required because there was a forwarder. The symbol has been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_exit into libcFlorian Weimer2021-04-2129-29/+0
| | | | | | | | | | | | | | The pthread_exit symbol was moved using scripts/move-symbol-to-libc.py. No new symbol version is needed because there was a forwarder. The new tests nptl/tst-pthread_exit-nothreads and nptl/tst-pthread_exit-nothreads-static exercise the scenario that pthread_exit is called without libpthread having been linked in. This is not possible for the generic code, so these tests do not live in sysdeps/pthread for now. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __pthread_unwind_next into libcFlorian Weimer2021-04-2163-56/+65
| | | | | | | | | | | | | | | | | | | It's necessary to stub out __libc_disable_asynccancel and __libc_enable_asynccancel via rtld-stubbed-symbols because the new direct references to the unwinder result in symbol conflicts when the rtld exception handling from libc is linked in during the construction of librtld.map. unwind-forcedunwind.c is merged into unwind-resume.c. libc now needs the functions that were previously only used in libpthread. The GLIBC_PRIVATE exports of __libc_longjmp and __libc_siglongjmp are no longer needed, so switch them to hidden symbols. The symbol __pthread_unwind_next has been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_once and __pthread_once into libcFlorian Weimer2021-04-2161-58/+128
| | | | | | | | | | | | | And also the fork generation counter, __fork_generation. This eliminates the need for __fork_generation_pointer. call_once remains in libpthread and calls the exported __pthread_once symbol. pthread_once and __pthread_once have been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __pthread_cleanup_upto into libcFlorian Weimer2021-04-211-5/+2
| | | | | | | | This internal symbol is used as part of the longjmp implementation. Rename the file from nptl/pt-cleanup.c to nptl/pthread_cleanup_upto.c so that the pt-* files remain restricted to libpthread. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* x86: Restore compile-time check for shadow stack pointer in longjmpAdhemerval Zanella2021-04-211-0/+39
|
* nptl: Remove longjmp, siglongjmp from libpthreadFlorian Weimer2021-04-2129-153/+28
| | | | | | | | | | | | | | The definitions in libc are sufficient, the forwarders are no longer needed. The symbols have been moved using scripts/move-symbol-to-libc.py. s390-linux-gnu and s390x-linux-gnu need a new version placeholder to keep the GLIBC_2.19 symbol version in libpthread. Tested on i386-linux-gnu, powerpc64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu. Built with build-many-glibcs.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move legacy cancelation handling into libc as compat symbolsFlorian Weimer2021-04-2161-116/+128
| | | | | | | | | | | | | | | This affects _pthread_cleanup_pop, _pthread_cleanup_pop_restore, _pthread_cleanup_push, _pthread_cleanup_push_defer. The symbols have been moved using scripts/move-symbol-to-libc.py. No new symbol versions are added because the symbols are turned into compatibility symbols at the same time. __pthread_cleanup_pop and __pthread_cleanup_push are added as GLIBC_PRIVATE symbols because they are also used internally, for glibc's own cancellation handling. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __pthread_cleanup_routine into libcFlorian Weimer2021-04-2161-29/+64
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_mutex_consistent into libcFlorian Weimer2021-04-2161-58/+96
| | | | | | And deprecated pthread_mutex_consistent_np, its old name. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc: Add missing registers to clobbers list for syscalls [BZ #27623]Matheus Castanho2021-04-161-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | Some registers that can be clobbered by the kernel during a syscall are not listed on the clobbers list in sysdeps/unix/sysv/linux/powerpc/sysdep.h. For syscalls using sc: - XER is zeroed by the kernel on exit For syscalls using scv: - XER is zeroed by the kernel on exit - Different from the sc case, most CR fields can be clobbered (according to the ELF ABI and the Linux kernel's syscall ABI for powerpc (linux/Documentation/powerpc/syscall64-abi.rst) The same should apply to vsyscalls, which effectively execute a function call but are not currently adding these registers as clobbers either. These are likely not causing issues today, but they should be added to the clobbers list just in case things change on the kernel side in the future. Reported-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
* misc: syslog: Assume MSG_NOSIGNAL support (BZ #17144)Adhemerval Zanella2021-04-151-4/+0
| | | | | | | | MSG_NOSIGNAL was added on POSIX 2008 and Hurd seems to support it. The SIGPIPE handling also makes the implementation not thread-safe (due the sigaction usage). Checked on x86_64-linux-gnu.
* io: Move file timestamps tests out of LinuxAdhemerval Zanella2021-04-155-229/+1
| | | | | | | | | | | | Now that libsupport abstract Linux possible missing support (either due FS limitation that can't handle 64 bit timestamp or architectures that do not handle values larger than unsigned 32 bit values) the tests can be turned generic. Checked on x86_64-linux-gnu and i686-linux-gnu. I also built the tests for i686-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Remove PR_TAGGED_ADDR_ENABLE from sys/prctl.hSzabolcs Nagy2021-04-141-4/+0
| | | | | | | | | | | | | | The value of PR_TAGGED_ADDR_ENABLE was incorrect in the installed headers and the prctl command macros were missing that are needed for it to be useful (PR_SET_TAGGED_ADDR_CTRL). Linux headers have the definitions since 5.4 so it's widely available, we don't need to repeat these definitions. The remaining definitions are from Linux 5.10. To build glibc with --enable-memory-tagging, Linux 5.4 headers and binutils 2.33.1 or newer is needed. Reviewed-by: DJ Delorie <dj@redhat.com>
* linux: sysconf: Use a more explicit maximum_ARG_MAXAdhemerval Zanella2021-04-131-1/+1
|
* linux: sysconf: limit _SC_MAX_ARG to 6 MiB (BZ #25305)Michal Nazarewicz2021-04-131-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Linux 4.13, kernel limits the maximum command line arguments length to 6 MiB [1]. Normally the limit is still quarter of the maximum stack size but if that limit exceeds 6 MiB it's clamped down. glibc's __sysconf implementation for Linux platform is not aware of this limitation and for stack sizes of over 24 MiB it returns higher ARG_MAX than Linux will actually accept. This can be verified by executing the following application on Linux 4.13 or newer: #include <stdio.h> #include <string.h> #include <sys/resource.h> #include <sys/time.h> #include <unistd.h> int main(void) { const struct rlimit rlim = { 40 * 1024 * 1024, 40 * 1024 * 1024 }; if (setrlimit(RLIMIT_STACK, &rlim) < 0) { perror("setrlimit: RLIMIT_STACK"); return 1; } printf("ARG_MAX : %8ld\n", sysconf(_SC_ARG_MAX)); printf("63 * 100 KiB: %8ld\n", 63L * 100 * 1024); printf("6 MiB : %8ld\n", 6L * 1024 * 1024); char str[100 * 1024], *argv[64], *envp[1]; memset(&str, 'A', sizeof str); str[sizeof str - 1] = '\0'; for (size_t i = 0; i < sizeof argv / sizeof *argv - 1; ++i) { argv[i] = str; } argv[sizeof argv / sizeof *argv - 1] = envp[0] = 0; execve("/bin/true", argv, envp); perror("execve"); return 1; } On affected systems the program will report ARG_MAX as 10 MiB but despite that executing /bin/true with a bit over 6 MiB of command line arguments will fail with E2BIG error. Expected result is that ARG_MAX is reported as 6 MiB. Update the __sysconf function to clamp ARG_MAX value to 6 MiB if it would otherwise exceed it. This resolves bug #25305 which was market WONTFIX as suggested solution was to cap ARG_MAX at 128 KiB. As an aside and point of comparison, bionic (a libc implementation for Android systems) decided to resolve this issue by always returning 128 KiB ignoring any potential xargs regressions [2]. On older kernels this results in returning overly conservative value but that's a safer option than being aggressive and returning invalid value on recent systems. It's also worth noting that at this point all supported Linux releases have the 6 MiB barrier so only someone running an unsupported kernel version would get incorrectly truncated result. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> [1] See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=da029c11e6b12f321f36dac8771e833b65cec962 [2] See https://android.googlesource.com/platform/bionic/+/baed51ee3a13dae4b87b11870bdf7f10bdc9efc1
* linux: always update select timeout (BZ #27706)Adhemerval Zanella2021-04-121-2/+2
| | | | | | The timeout should be updated even on failure for time64 support. Checked on i686-linux-gnu.
* linux: Normalize and return timeout on select (BZ #27651)Adhemerval Zanella2021-04-121-9/+32
| | | | | | | | | | | | | | | | | | | | The commit 2433d39b697, which added time64 support to select, changed the function to use __NR_pselect6 (or __NR_pelect6_time64) on all architectures. However, on architectures where the symbol was implemented with __NR_select the kernel normalizes the passed timeout instead of return EINVAL. For instance, the input timeval { 0, 5000000 } is interpreted as { 5, 0 }. And as indicated by BZ #27651, this semantic seems to be expected and changing it results in some performance issues (most likely the program does not check the return code and keeps issuing select with unormalized tv_usec argument). To avoid a different semantic depending whether which syscall the architecture used to issue, select now always normalize the timeout input. This is a slight change for some ABIs (for instance aarch64). Checked on x86_64-linux-gnu and i686-linux-gnu.
* arm: Fix an incorrect check in ____longjmp_chk [BZ #27709]Szabolcs Nagy2021-04-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | An incorrect check in __longjmp_chk could fail on valid code causing FAIL: debug/tst-longjmp_chk2 The original check was altstack_sp + altstack_size - setjmp_sp > altstack_size i.e. sp at setjmp was outside of the altstack range. Here we know that longjmp is called from a signal handler on the altstack (SS_ONSTACK), and that it jumps in the wrong direction (sp decreases), so the check wants to ensure the jump goes to another stack. The check is wrong when altstack_sp == setjmp_sp which can happen when the altstack is a local buffer in the function that calls setjmp, so the patch allows == too. This fixes bug 27709. Note that the generic __longjmp_chk check seems to be different. (it checks if longjmp was on the altstack but does not check setjmp, so it would not catch incorrect longjmp use within the signal handler).
* Fix conform linknamespace tests due to gnu_dev_makedevStefan Liebler2021-03-311-2/+2
| | | | | | | | | | | | | | | | | If building on s390 / i686 with -Os, various conformance tests are failing with e.g. conform/ISO/assert.h/linknamespace.out: [initial] __assert_fail -> [libc.a(assert.o)] __dcgettext -> [libc.a(dcgettext.o)] __dcigettext -> [libc.a(dcigettext.o)] __getcwd -> [libc.a(getcwd.o)] __fstatat64 -> [libc.a(fstatat64.o)] gnu_dev_makedev The usage of gnu_dev_makedev was recently introduced by usage of the makedev makro in commit: 5b980d4809913088729982865188b754939bcd39 linux: Use statx for MIPSn64 This patch is now linking against __gnu_dev_makedev as also done in commit: 8b4a118222c7ed41bc653943b542915946dff1dd Fix -Os gnu_dev_* linknamespace, localplt issues (bug 15105, bug 19463).
* Move __isnanf128 to libc.soSiddhesh Poyarekar2021-03-3011-5/+11
| | | | | | | | All of the isnan functions are in libc.so due to printf_fp, so move __isnanf128 there too for consistency. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@ascii.art.br> Reviewed-by: Florian Weimer <fweimer@redhat.com>