about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
...
* Reduce <limits.h> pollution due to dynamic PTHREAD_STACK_MINFlorian Weimer2021-07-125-10/+44
| | | | | | | | | | | | | | | | | | | | <limits.h> used to be a header file with no declarations. GCC's libgomp includes it in a #pragma GCC visibility hidden block. Including <unistd.h> from <limits.h> (indirectly) declares everything in <unistd.h> with hidden visibility, resulting in linker failures. This commit avoids C declarations in assembler mode and only declares __sysconf in <limits.h> (and not the entire contents of <unistd.h>). The __sysconf symbol is already part of the ABI. PTHREAD_STACK_MIN is no longer defined for __USE_DYNAMIC_STACK_SIZE && __ASSEMBLER__ because there is no possible definition. Additionally, PTHREAD_STACK_MIN is now defined by <pthread.h> for __USE_MISC because this is what developers expect based on the macro name. It also helps to avoid libgomp linker failures in GCC because libgomp includes <pthread.h> before its visibility hacks. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* hurd _Fork: Drop duplicate malloc_fork_lock callsSamuel Thibault2021-07-111-3/+0
| | | | | | This was put in __libc_fork by c32c868ab8b2 ("posix: Add _Fork [BZ #4737]") so we need to avoid locking them again in _Fork called by __libc_lock, otherwise we deadlock.
* Define PTHREAD_STACK_MIN to sysconf(_SC_THREAD_STACK_MIN)H.J. Lu2021-07-0919-605/+223
| | | | | | | | | | | | | The constant PTHREAD_STACK_MIN may be too small for some processors. Rename _SC_SIGSTKSZ_SOURCE to _DYNAMIC_STACK_SIZE_SOURCE. When _DYNAMIC_STACK_SIZE_SOURCE or _GNU_SOURCE are defined, define PTHREAD_STACK_MIN to sysconf(_SC_THREAD_STACK_MIN) which is changed to MIN (PTHREAD_STACK_MIN, sysconf(_SC_MINSIGSTKSZ)). Consolidate <bits/local_lim.h> with <bits/pthread_stack_min.h> to provide a constant target specific PTHREAD_STACK_MIN value. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Force building with -fno-commonFlorian Weimer2021-07-093-9/+8
| | | | | | | | | | As a result, is not necessary to specify __attribute__ ((nocommon)) on individual definitions. GCC 10 defaults to -fno-common on all architectures except ARC, but this change is compatible with older GCC versions and ARC, too. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Add a generic malloc test for MALLOC_ALIGNMENTH.J. Lu2021-07-096-77/+72
| | | | | | | | | 1. Add sysdeps/generic/malloc-size.h to define size related macros for malloc. 2. Move x86_64/tst-mallocalign1.c to malloc and replace ALIGN_MASK with MALLOC_ALIGN_MASK. 3. Add tst-mallocalign1 to tests-exclude-mcheck for i386 and x32 since mcheck doesn't honor MALLOC_ALIGNMENT.
* nptl: Use out-of-line wake function in __libc_lock_unlock slow pathFlorian Weimer2021-07-091-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This slightly reduces code size, as can be seen below. __libc_lock_unlock is usually used along with __libc_lock_lock in the same function. __libc_lock_lock already has an out-of-line slow path, so this change should not introduce many additional non-leaf functions. This change also fixes a link failure in 32-bit Arm thumb mode because commit 1f9c804fbd699104adefbce9e56d2c8aa711b6b9 ("nptl: Use internal low-level lock type for !IS_IN (libc)") introduced __libc_do_syscall calls outside of libc. Before x86-64: text data bss dec hex filename 1937748 20456 54896 2013100 1eb7ac libc.so.6 25601 856 12768 39225 9939 nss/libnss_db.so.2 40310 952 25144 66406 10366 nss/libnss_files.so.2 After x86-64: text data bss dec hex filename 1935312 20456 54896 2010664 1eae28 libc.so.6 25559 864 12768 39191 9917 nss/libnss_db.so.2 39764 960 25144 65868 1014c nss/libnss_files.so.2 Before i686: 2110961 11272 39144 2161377 20fae1 libc.so.6 27243 428 12652 40323 9d83 nss/libnss_db.so.2 43062 476 25028 68566 10bd6 nss/libnss_files.so.2 After i686: 2107347 11272 39144 2157763 20ecc3 libc.so.6 26929 432 12652 40013 9c4d nss/libnss_db.so.2 43132 480 25028 68640 10c20 nss/libnss_files.so.2 Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc64le: Fix typo in configureAnton Blanchard2021-07-082-2/+2
| | | | | | The configure script checks for -mlong-double-128 but mentions -mlongdouble when it fails. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc64: Remove strcspn ifunc from the loaderTulio Magno Quites Machado Filho2021-07-081-0/+18
| | | | | | | | | | 5 years ago, commit 8f1b841e452dbb083112fd036033b7f4af506ba0 unintentionally added an ifunc to the loader. That modification has not caused any harm so far, but it doesn't add any value either, because the hwcap information is available later during libc initialization. Suggested-by: Anton Blanchard <anton@ozlabs.org>
* x86: Remove wcsnlen-sse4_1 from wcslen ifunc-impl-list [BZ #28064]Noah Goldstein2021-07-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The following commit commit 6f573a27b6c8b4236445810a44660612323f5a73 Author: Noah Goldstein <goldstein.w.n@gmail.com> Date: Wed Jun 23 01:19:34 2021 -0400 x86-64: Add wcslen optimize for sse4.1 Added wcsnlen-sse4.1 to the wcslen ifunc implementation list and did not add wcslen-sse4.1 to wcslen ifunc implementation list. This commit fixes that by removing wcsnlen-sse4.1 from the wcslen ifunc implementation list and adding wcslen-sse4.1 to the ifunc implementation list. Testing: test-wcslen.c, test-rsi-wcslen.c, and test-rsi-strlen.c are passing as well as all other tests in wcsmbs and string. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86-64: Test strlen and wcslen with 0 in the RSI register [BZ #28064]H.J. Lu2021-07-083-0/+108
| | | | | | | | | | | | | | commit 6f573a27b6c8b4236445810a44660612323f5a73 Author: Noah Goldstein <goldstein.w.n@gmail.com> Date: Wed Jun 23 01:19:34 2021 -0400 x86-64: Add wcslen optimize for sse4.1 added wcsnlen-sse4.1 to the wcslen ifunc implementation list. Since the random value in the the RSI register is larger than the wide-character string length in the existing wcslen test, it didn't trigger the wcslen test failure. Add a test to force 0 into the RSI register before calling wcslen.
* x86_64: Remove unneeded static PIE check for undefined weak diagnosticFangrui Song2021-07-082-58/+0
| | | | | | | | | | | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=21782 dropped an ld diagnostic for R_X86_64_PC32 referencing an undefined weak symbol in -pie links. Arguably keeping the diagnostic like other ports is more correct, since statically resolving movl foo(%rip), %eax to the link-time zero address produces a corrupted output. It turns out that --enable-static-pie builds do not depend on the ld behavior. GCC generates GOT indirection for weak declarations for -fPIE/-fPIC, so what ld does with the PC-relative relocation doesn't really matter. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* posix: Add posix_spawn_file_actions_addclosefrom_npAdhemerval Zanella2021-07-0840-19/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a way to close a range of file descriptors on posix_spawn as a new file action. The API is similar to the one provided by Solaris 11 [1], where the file action causes the all open file descriptors greater than or equal to input on to be closed when the new process is spawned. The function posix_spawn_file_actions_addclosefrom_np is safe to be implemented by iterating over /proc/self/fd, since the Linux spawni.c helper process does not use CLONE_FILES, so its has own file descriptor table and any failure (in /proc operation) aborts the process creation and returns an error to the caller. I am aware that this file action might be redundant to the current approach of POSIX in promoting O_CLOEXEC in more interfaces. However O_CLOEXEC is still not the default and for some specific usages, the caller needs to close all possible file descriptors to avoid them leaking. Some examples are CPython (discussed in BZ#10353) and OpenJDK jspawnhelper [2] (where OpenJDK spawns a helper process to exactly closes all file descriptors). Most likely any environment which calls functions that might open file descriptor under the hood and aim to use posix_spawn might face the same requirement. Checked on x86_64-linux-gnu and i686-linux-gnu on kernel 5.11 and 4.15. [1] https://docs.oracle.com/cd/E36784_01/html/E36874/posix-spawn-file-actions-addclosefrom-np-3c.html [2] https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjava/childproc.c#L82
* io: Add closefrom [BZ #10353]Adhemerval Zanella2021-07-0836-1/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function closes all open file descriptors greater than or equal to input argument. Negative values are clamped to 0, i.e, it will close all file descriptors. As indicated by the bug report, this is a common symbol provided by different systems (Solaris, OpenBSD, NetBSD, FreeBSD) and, although its has inherent issues with not taking in consideration internal libc file descriptors (such as syslog), this is also a common feature used in multiple projects [1][2][3][4][5]. The Linux fallback implementation iterates over /proc and close all file descriptors sequentially. Although it was raised the questioning whether getdents on /proc/self/fd might return disjointed entries when file descriptor are closed; it does not seems the case on my testing on multiple kernel (v4.18, v5.4, v5.9) and the same strategy is used on different projects [1][2][3][5]. Also, the interface is set a fail-safe meaning that a failure in the fallback results in a process abort. Checked on x86_64-linux-gnu and i686-linux-gnu on kernel 5.11 and 4.15. [1] https://github.com/systemd/systemd/blob/5238e9575906297608ff802a27e2ff9effa3b338/src/basic/fd-util.c#L217 [2] https://github.com/lxc/lxc/blob/ddf4b77e11a4d08f09b7b9cd13e593f8c047edc5/src/lxc/start.c#L236 [3] https://github.com/python/cpython/blob/9e4f2f3a6b8ee995c365e86d976937c141d867f8/Modules/_posixsubprocess.c#L220 [4] https://github.com/rust-lang/rust/blob/5f47c0613ed4eb46fca3633c1297364c09e5e451/src/libstd/sys/unix/process2.rs#L303-L308 [5] https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjava/childproc.c#L82
* linux: Add close_rangeAdhemerval Zanella2021-07-0837-1/+362
| | | | | | | | | | It was added on Linux 5.9 (278a5fbaed89) with CLOSE_RANGE_CLOEXEC added on 5.11 (582f1fb6b721f). Although FreeBSD has added the same syscall, this only adds the symbol on Linux ports. This syscall is required to provided a fail-safe way to implement the closefrom symbol (BZ #10353). Checked on x86_64-linux-gnu and i686-linux-gnu on kernel 5.11 and 4.15.
* libio: Replace internal _IO_getdelim symbol with __getdelimFlorian Weimer2021-07-071-1/+1
| | | | | | | __getdelim is exported, _IO_getdelim is not. Add a hidden prototype for __getdelim. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Update MIPS libm-test-ulpsJoseph Myers2021-07-072-76/+84
|
* Update powerpc-nofpu libm-test-ulpsJoseph Myers2021-07-071-41/+45
|
* Update kernel version to 5.13 in tst-mman-consts.pyJoseph Myers2021-07-071-1/+1
| | | | | | | | This patch updates the kernel version in the test tst-mman-consts.py to 5.13. (There are no new MAP_* constants covered by this test in 5.13 that need any other header changes.) Tested with build-many-glibcs.py.
* nptl: Remove GLIBC_2.34 versions of __pthread_mutex_lock, __pthread_mutex_unlockFlorian Weimer2021-07-0732-64/+0
| | | | | | | | Now that there are no internal users anymore, these new symbol versions can be removed from the public ABI. The compatibility symbols remain. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Use internal low-level lock type for !IS_IN (libc)Florian Weimer2021-07-071-46/+5
| | | | | | | | | | This avoids an ABI hazard (types changing between different modules of glibc) without introducing linknamespace issues. In particular, NSS modules now call __lll_lock_wait_private@@GLIBC_PRIVATE to wait on internal locks (the unlock path is inlined and performs a direct system call). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* linux: Fix setsockopt fallbackAdhemerval Zanella2021-07-061-1/+3
| | | | | | | The final 2 arguments for SO_TIMESTAMP/SO_TIMESTAMPNS are being set wrongly. Checked on x86_64-linux-gnu and i686-linux-gnu.
* linux: Use the expected size for SO_TIMESTAMP{NS} convertionAdhemerval Zanella2021-07-061-2/+5
| | | | | | | Kernel returns 32-bit values for COMPAT_SO_TIMESTAMP{NS}_OLD, not 64-bit values. Checked on x86_64-linux-gnu and i686-linux-gnu.
* linux: Consolidate Linux setsockopt implementationAdhemerval Zanella2021-07-0615-14/+5
| | | | | | | | | | | | | | | | This patch consolidates the setsockopt implementation on sysdeps/unix/sysv/linux/getsockopt.c. The changes are: 1. Remove it from auto-generation syscalls.list on all architectures. 2. Add __ASSUME_SETSOCKOPT_SYSCALL as default and undef if for specific kernel versions on some architectures. This also fix a potential issue where 32-bit time_t ABI should use the linux setsockopt which overrides the underlying SO_* constants used for socket timestamping for _TIME_BITS=64. Checked on x86_64-linux-gnu and i686-linux-gnu.
* linux: Consolidate Linux getsockopt implementationAdhemerval Zanella2021-07-0615-14/+5
| | | | | | | | | | | | | | | | This patch consolidates the getsockopt Linux syscall implementation on sysdeps/unix/sysv/linux/getsockopt.c. The changes are: 1. Remove it from auto-generation syscalls.list on all architectures. 2. Add __ASSUME_GETSOCKOPT_SYSCALL as default and undef if for specific kernel versions on some architectures. This also fix a potential issue where 32-bit time_t ABI should use the linux getsockopt which overrides the underlying SO_* constants used for socket timestamping for _TIME_BITS=64. Checked on x86_64-linux-gnu and i686-linux-gnu.
* linux: Check for null value msghdr struct before useKhem Raj2021-07-052-2/+4
| | | | | | | | This avoids crashes in libc when cmsg is null and refrencing msg structure when it is null Signed-off-by: Khem Raj <raj.khem@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* resolv: Move libanl into libc (if libpthread is in libc)Florian Weimer2021-07-0265-157/+319
| | | | | | | | | | The symbols gai_cancel, gai_error, gai_suspend, getaddrinfo_a, __gai_suspend_time64 were moved using scripts/move-symbol-to-libc.py. For Hurd (which remains !PTHREAD_IN_LIBC), a few #define redirects had to be added because several pthread functions are not available under __. (Linux uses __ prefixes for most hidden aliases, and has to in some cases to avoid linknamespace issues.)
* powerpc: optimize strcpy/stpcpy for POWER9/10Pedro Franco de Carvalho2021-07-011-71/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch modifies the current POWER9 implementation of strcpy and stpcpy to optimize it for POWER9/10. Since no new POWER10 instructions are used, the original POWER9 strcpy is modified instead of creating a new implementation for POWER10. This implementation is based on both the original POWER9 implementation of strcpy and the preamble of the new POWER10 implementation of strlen. The changes also affect stpcpy, which uses the same implementation with some additional code before returning. On POWER9, averaging improvements across the benchmark inputs (length/source alignment/destination alignment), for an experiment that ran the benchmark five times, bench-strcpy showed an improvement of 5.23%, and bench-stpcpy showed an improvement of 6.59%. On POWER10, bench-strcpy showed 13.16%, and bench-stpcpy showed 13.59%. The changes are: 1. Removed the null string optimization. Although this results in a few extra cycles for the null string, in combination with the second change, this resulted in improvements for for other cases. 2. Adapted the preamble from strlen for POWER10. This is the part of the function that handles up to the first 16 bytes of the string. 3. Increased number of unrolled iterations in the main loop to 6. Reviewed-by: Matheus Castanho <msc@linux.ibm.com> Tested-by: Matheus Castanho <msc@linux.ibm.com>
* x86: Check RTM_ALWAYS_ABORT for RTM [BZ #28033]H.J. Lu2021-07-015-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html * Intel TSX will be disabled by default. * The processor will force abort all Restricted Transactional Memory (RTM) transactions by default. * A new CPUID bit CPUID.07H.0H.EDX[11](RTM_ALWAYS_ABORT) will be enumerated, which is set to indicate to updated software that the loaded microcode is forcing RTM abort. * On processors that enumerate support for RTM, the CPUID enumeration bits for Intel TSX (CPUID.07H.0H.EBX[11] and CPUID.07H.0H.EBX[4]) continue to be set by default after microcode update. * Workloads that were benefited from Intel TSX might experience a change in performance. * System software may use a new bit in Model-Specific Register (MSR) 0x10F TSX_FORCE_ABORT[TSX_CPUID_CLEAR] functionality to clear the Hardware Lock Elision (HLE) and RTM bits to indicate to software that Intel TSX is disabled. 1. Add RTM_ALWAYS_ABORT to CPUID features. 2. Set RTM usable only if RTM_ALWAYS_ABORT isn't set. This skips the string/tst-memchr-rtm etc. testcases on the affected processors, which always fail after a microcde update. 3. Check RTM feature, instead of usability, against /proc/cpuinfo. This fixes BZ #28033.
* Update syscall lists for Linux 5.13Joseph Myers2021-07-0126-2/+80
| | | | | | | | | Linux 5.13 has three new syscalls (landlock_create_ruleset, landlock_add_rule, landlock_restrict_self). Update syscall-names.list and regenerate the arch-syscall.h headers with build-many-glibcs.py update-syscalls. Tested with build-many-glibcs.py.
* s390: Fix MEMCHR_Z900_G5 ifunc-variant if n>=0x80000000 [BZ #28024]Stefan Liebler2021-07-011-0/+13
| | | | | | | | | | | | | | | On s390 (31bit), the pointer to the first byte after s always wraps around with n >= 0x80000000 and can lead to stop searching before end of s. Thus this patch just use NULL as byte after s in this case and the srst instruction stops searching with "not found" when wrapping around from top address to zero. This is observable with testcase string/test-memchr starting with commit "String: Add overflow tests for strnlen, memchr, and strncat [BZ #27974]" https://sourceware.org/git/?p=glibc.git;a=commit;h=da5a6fba0febbfc90896ce1b2eb75c6d8a88a72d
* Fix extra PLT reference in libc.so due to __glob64_time64 if build with gcc ↵Stefan Liebler2021-07-011-0/+1
| | | | | | | | | | | | | | | | 7.5 on 32bit. Starting with recent commit 84f7ce84474c1648ce96884f1c91ca7b97ca3fc2 "posix: Add glob64 with 64-bit time_t support", elf/check-localplt fails due to extra PLT reference __glob64_time64 in __glob64_time64 itself. This is observable with gcc 7.5 on x86_64 with -m32 or s390x with -m31. E.g. if build with gcc 10, gcc is generating a call to __glob64_time64.localalias. This patch is adding a hidden version of __glob64_time64 in the same way as for __globfree64_time64.
* AArch64: Add hp-timing.hWilco Dijkstra2021-07-011-0/+47
| | | | | | | | | | Add hp-timing.h using the cntvct_el0 counter. Return timing in nanoseconds so it is fully compatible with generic hp-timing. Don't set HP_TIMING_INLINE in the dynamic linker since it adds unnecessary overheads and some ancient kernels may not handle emulating cntcvt correctly. Currently cntvct_el0 is only used for timing in the benchtests. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* AArch64: Improve strnlen performanceWilco Dijkstra2021-07-011-181/+89
| | | | | | | | Optimize strnlen by avoiding UMINV which is slow on most cores. On Neoverse N1 large strings are 1.8x faster than the current version, and bench-strnlen is 50% faster overall. This version is MTE compatible. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* Linux: Avoid calling malloc indirectly from __get_nprocsFlorian Weimer2021-06-301-26/+57
| | | | | | | | malloc initialization depends on __get_nprocs, so using scratch buffers in __get_nprocs may result in infinite recursion. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* login: Move libutil into libcFlorian Weimer2021-06-3068-194/+467
| | | | | | | | | | | | | | | | The symbols forkpty, login, login_tty, logout, logwtmp, openpty were moved using scripts/move-symbol-to-libc.py. This is a single commit because most of the symbols are tied together via forkpty, for example. Several changes to use hidden prototypes are needed. This commit also updates pseudoterminal terminology on modified lines. For 390 (31-bit), this commit follows the existing style for the compat symbol version creation. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* login: Hidden prototypes for _getpt, __ptsname_r, grantpt, unlockptFlorian Weimer2021-06-308-1/+10
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add RFC 8335 Definitions from Linux 5.13Andreas Roeseler2021-06-291-0/+18
| | | | | | | | | | | | | | | | | | | | RFC 8335 defines the network utility PROBE, which builds off of the capabilities of Ping to query more detailed interface information from networking nodes. The definitions included in this patchset have been accepted into the linux net-next branch and will be included in Linux 5.13. This patchset adds the same definitions to the glibc for use in the iputils package. The relevant commits for the Linux definitions can be found here: https://github.com/torvalds/linux/commit/e542d29ca81d005651680a0a697b72ca13ddc4cc https://github.com/torvalds/linux/commit/750f4fc2a12f6632b5aa04526bf57fa06bfe8467 These changes have been tested by running the glibc tests on x86_64 Signed-off-by: Andreas Roeseler <andreas.a.roeseler@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* s390x: Update math: redirect roundeven functionStefan Liebler2021-06-293-1/+3
| | | | | | | | | | | | | After recent commit 447954a206837b5f153869cfeeeab44631c3fac9 "math: redirect roundeven function", building on s390x fails with: Error: symbol `__roundevenl' is already defined Similar to aarch64/riscv fix, this patch redirects target specific functions for s390x: commit 3213ed770cbc5821920d16caa93c85e92dd7b9f6 "Update math: redirect roundeven function"
* posix: Add _Fork [BZ #4737]Adhemerval Zanella2021-06-2833-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | Austin Group issue 62 [1] dropped the async-signal-safe requirement for fork and provided a async-signal-safe _Fork replacement that does not run the atfork handlers. It will be included in the next POSIX standard. It allow to close a long standing issue to make fork AS-safe (BZ#4737). As indicated on the bug, besides the internal lock for the atfork handlers itself; there is no guarantee that the handlers itself will not introduce more AS-safe issues. The idea is synchronize fork with the required internal locks to allow children in multithread processes to use mostly of standard function (even though POSIX states only AS-safe function should be used). On signal handles, _Fork should be used intead and only AS-safe functions should be used. For testing, the new tst-_Fork only check basic usage. I also added a new tst-mallocfork3 which uses the same strategy to check for deadlock of tst-mallocfork2 but using threads instead of subprocesses (and it does deadlock if it replaces _Fork with fork). [1] https://austingroupbugs.net/view.php?id=62
* nptl: Add glibc.pthread.stack_cache_size tunableFlorian Weimer2021-06-281-0/+4
| | | | | | | The valgrind/helgrind test suite needs a way to make stack dealloction more prompt, and this feature seems to be generally useful. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* arm: align stack in clone [BZ 28020]Szabolcs Nagy2021-06-281-0/+2
| | | | | | | The arm PCS requires 8 byte aligned stack at function entry. Previously unaligned stack could crash the clone child. Fixes bug 28020.
* Linux: Cleanups after librt moveFlorian Weimer2021-06-2810-83/+31
| | | | | | | | | | | | librt.so is no longer installed for PTHREAD_IN_LIBC, and tests are not linked against it. $(librt) is introduced globally for shared tests that need to be linked for both PTHREAD_IN_LIBC and !PTHREAD_IN_LIBC. GLIBC_PRIVATE symbols that were needed during the transition are removed again. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Linux: Move timer_settime, __timer_settime64 from librt to libcFlorian Weimer2021-06-2880-201/+224
| | | | | | | | | | | | | | | The symbols were moved using scripts/move-symbol-to-libc.py. The way the ABI intransition is implemented is changed with this commit: the implementation is now consolidated in one file with a TIMER_T_WAS_INT_COMPAT check. The shared librt is now empty, so this commit adds a placeholder symbol at the base version, GLIBC_2.2, and potentially at the GLIBC_2.3.3 version as well (the leftover from the int/timer_t ABI transition). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Move timer_gettime, __timer_gettime64 from librt to libcFlorian Weimer2021-06-2876-116/+144
| | | | | | | | | | The symbols were moved using scripts/move-symbol-to-libc.py. The way the ABI intransition is implemented is changed with this commit: the implementation is now consolidated in one file with a TIMER_T_WAS_INT_COMPAT check. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Move timer_getoverrun from librt to libcFlorian Weimer2021-06-2877-93/+103
| | | | | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. The way the ABI intransition is implemented is changed with this commit: the implementation is now consolidated in one file with a TIMER_T_WAS_INT_COMPAT check. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
* Linux: Move timer_create, timer_delete from librt to libcFlorian Weimer2021-06-2888-231/+257
| | | | | | | | | | | The symbols were moved using scripts/move-symbol-to-libc.py. timer_create and timer_delete are tied together via the int/timer_t compatibility code. The way the ABI intransition is implemented is changed with this commit: the implementation is now consolidated in one file with a TIMER_T_WAS_INT_COMPAT check. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Define TIMER_T_WAS_INT_COMPAT in kernel-posix-timers.hFlorian Weimer2021-06-288-0/+138
| | | | | | | | | This is almost equivalent to __WORDSIZE == 64 && OTHER_SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_3_3), except that this expression is true for mips64/n64 targets as well, even though those did not undergo the timer_t transition. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update math: redirect roundeven functionH.J. Lu2021-06-275-2/+5
| | | | | Redirect target specific roundeven functions for aarch64, ldbl-128ibm and riscv.
* Use GCC builtins for roundeven functions if desired.Shen-Ta Hsieh2021-06-276-0/+22
| | | | | | | | | | | | | This patch is using the corresponding GCC builtin for roundevenf, roundeven and roundevenl if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins.h. These builtin functions is supported since GCC 10. The code of the generic implementation is not changed. Signed-off-by: Shen-Ta Hsieh <ibmibmibm.tw@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86_64: roundeven with sse4.1 supportShen-Ta Hsieh2021-06-277-2/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the sse4.1 hardware floating point roundeven. Here is some benchmark results on my systems: =AMD Ryzen 9 3900X 12-Core Processor= * benchmark result before this commit | | roundeven | roundevenf | |------------|--------------|--------------| | duration | 3.75587e+09 | 3.75114e+09 | | iterations | 3.93053e+08 | 4.35402e+08 | | max | 52.592 | 58.71 | | min | 7.98 | 7.22 | | mean | 9.55563 | 8.61535 | * benchmark result after this commit | | roundeven | roundevenf | |------------|---------------|--------------| | duration | 3.73815e+09 | 3.73738e+09 | | iterations | 5.82692e+08 | 5.91498e+08 | | max | 56.468 | 51.642 | | min | 6.27 | 6.156 | | mean | 6.41532 | 6.3185 | =Intel(R) Pentium(R) CPU D1508 @ 2.20GHz= * benchmark result before this commit | | roundeven | roundevenf | |------------|--------------|--------------| | duration | 2.18208e+09 | 2.18258e+09 | | iterations | 2.39932e+08 | 2.46924e+08 | | max | 96.378 | 98.035 | | min | 6.776 | 5.94 | | mean | 9.09456 | 8.83907 | * benchmark result after this commit | | roundeven | roundevenf | |------------|--------------|--------------| | duration | 2.17415e+09 | 2.17005e+09 | | iterations | 3.56193e+08 | 4.09824e+08 | | max | 51.693 | 97.192 | | min | 5.926 | 5.093 | | mean | 6.10385 | 5.29507 | Signed-off-by: Shen-Ta Hsieh <ibmibmibm.tw@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>