about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* htl: Enable tst-cancelx?[45]Samuel Thibault2020-08-067-1/+1991
| | | | | | | * nptl/{tst-cancel4-common.c, tst-cancel4-common.h, tst-cancel4.c, tst-cancel5.c, tst-cancelx4.c, tst-cancelx5.c}: Move to sysdeps/pthread/ * nptl/Makefile: Move corresponding rules to... * sysdeps/pthread/Makefile: ... here.
* hurd: Add missing hidden defSamuel Thibault2020-08-061-0/+1
| | | | * sysdeps/mach/hurd/sched_gets.c (__sched_getscheduler): Add hidden def.
* hurd: Rework sbrkSamuel Thibault2020-08-053-9/+32
| | | | | | | | | | | | | | | | | | | | | | | | | Making the brk start exactly at the end of the main application binary was requiring to get it through the _end symbol, which does not work any more with recent toolchains, and actually produces in libc.so a confusing external _end symbol that produces odd results, see https://sourceware.org/bugzilla/show_bug.cgi?id=23499 Trying to do so is quite outdated anyway with the tendency for address randomization. Using _end was also allowing to include the main binary data within the RLIMIT_DATA, but this also seems outdated with dynamic library loading, and nowadays' memory consumption via malloc and mmap rather than statically-allocated data. This adds a BRK_START macro in <vm_param.h> that just tells where we want to start the brk, and thus removes the _end symbol. * sysdeps/mach/hurd/i386/vm_param.h: New file. * sysdeps/mach/hurd/brk.c: Use BRK_START as brk start instead of _end. Also ignore __data_start. * hurd/Versions: Remove _end symbol. * sysdeps/mach/hurd/i386/libc.abilist: Remove _end symbol.
* hurd: Implement basic sched_get/setschedulerSamuel Thibault2020-08-052-0/+75
| | | | | * sysdeps/mach/hurd/sched_gets.c: New file. * sysdeps/mach/hurd/sched_sets.c: New file.
* x86: Rename Intel CPU feature namesH.J. Lu2020-08-052-15/+15
| | | | | | | | | | | | | | | Intel64 and IA-32 Architectures Software Developer’s Manual has changed the following CPU feature names: 1. The CPU feature of Enhanced Intel SpeedStep Technology is renamed from EST to EIST. 2. The CPU feature which supports Platform Quality of Service Monitoring (PQM) capability is changed to Intel Resource Director Technology (Intel RDT) Monitoring capability, i.e. PQM is renamed to RDT_M. 3. The CPU feature which supports Platform Quality of Service Enforcement (PQE) capability is changed to Intel Resource Director Technology (Intel RDT) Allocation capability, i.e. PQE is renamed to RDT_A.
* Regenerate configure scripts.Carlos O'Donell2020-08-042-1/+2
|
* RISC-V: Update lp64d libm-test-ulps according to HiFive UnleashedMaciej W. Rozycki2020-08-041-15/+18
| | | | | | | Produced with HiFive Unleashed hardware using Linux 5.8-rc5 exactly and GCC 10.0.1 20200426. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* powerpc: Fix incorrect cache line size load in memset (bug 26332)Florian Weimer2020-08-031-2/+2
| | | | | | | | | | | | | | | | __GLRO loaded the word after the requested variable on big-endian PowerPC, where LOWORD is 4. This can cause the memset implement go wrong because the masking with the cache line size produces wrong results, particularly if the loaded value happens to be 1. The __GLRO macro is not used in any place where loading the lower 32-bit word of a 64-bit value is desired, so the +4 offset is always wrong. Fixes commit 18363b4f010da9ba459b13310b113ac0647c2fcc ("powerpc: Move cache line size to rtld_global_ro") and bug 26332. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update Nios II libm-test-ulps file.Chung-Lin Tang2020-08-031-11/+11
|
* aarch64: Use future HWCAP2_MTE in ifunc resolverSzabolcs Nagy2020-07-271-2/+8
| | | | | | | | | | | Make glibc MTE-safe on systems where MTE is available. This allows using heap tagging with an LD_PRELOADed malloc implementation that enables MTE. We don't document this as guaranteed contract yet, so glibc may not be MTE safe when HWCAP2_MTE is set (older glibcs certainly aren't). This is mainly for testing and debugging. The HWCAP flag is not exposed in public headers until Linux adds it to its uapi. The HWCAP value reservation will be in Linux 5.9.
* Update x86-64 libm-test-ulpsAndreas K. Hüttel2020-07-251-2/+2
| | | | | | x86_64 Intel(R) Core(TM) i5-8265U gcc (Gentoo 10.1.0-r2 p3) 10.1.0 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* aarch64: Respect p_flags when protecting code with PROT_BTISzabolcs Nagy2020-07-241-1/+8
| | | | | | | | | | | | Use PROT_READ and PROT_WRITE according to the load segment p_flags when adding PROT_BTI. This is before processing relocations which may drop PROT_BTI in case of textrels. Executable stacks are not protected via PROT_BTI either. PROT_BTI is hardening in case memory corruption happened, it's value is reduced if there is writable and executable memory available so missing it on such memory is fine, but we should respect the p_flags and should not drop PROT_WRITE.
* powerpc: Fix POWER10 selectionTulio Magno Quites Machado Filho2020-07-211-0/+1
| | | | | | | | | | Add a line that was missing from a previous commit. Without increasing str, the null-byte is not validated, and _dl_string_platform returns -1. Fixes: d2ba3677da7a ("powerpc: Add support for POWER10") Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* powerpc64le: guarantee a .gnu.attributes section [BZ #26220]Paul E. Murphy2020-07-211-0/+8
| | | | | | | | | | Upstream GCC 11 development is now building the ibm128 runtime support (in libgcc) without a .gnu.attributes section on ppc64le. Ensure we have one to replace by building one ibm128 file in libc and libm with attributes. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* Update powerpc-nofpu libm-test-ulps.Joseph Myers2020-07-201-30/+30
|
* hurd: Fix longjmp check for sigstateSamuel Thibault2020-07-182-2/+2
| | | | | * sysdeps/mach/hurd/i386/____longjmp_chk.S,__longjmp.S: Properly check for sigstate being NULL.
* hurd: Fix longjmp early in initializationSamuel Thibault2020-07-182-2/+16
| | | | | | | | | When e.g. an LD_PRELOAD fails, _dl_signal_exception/error longjmps, but TLS is not initialized yet, let along signal state. We thus mustn't look at them within __longjmp. * sysdeps/mach/hurd/i386/____longjmp_chk.S,__longjmp.S: Check for initialized value of %gs, and that sigstate is non-NULL.
* AArch64: Improve strlen_asimd performance (bug 25824)Wilco Dijkstra2020-07-175-126/+161
| | | | | | | | | | | | | | | | | Optimize strlen using a mix of scalar and SIMD code. On modern micro architectures large strings are 2.6 times faster than existing strlen_asimd and 35% faster than the new MTE version of strlen. On a random strlen benchmark using small sizes the speedup is 7% vs strlen_asimd and 40% vs the MTE strlen. This fixes the main strlen regressions on Cortex-A53 and other cores with a simple Neon unit. Rename __strlen_generic to __strlen_mte, and select strlen_asimd when MTE is not enabled (this is waiting on support for a HWCAP_MTE bit). This fixes big-endian bug 25824. Passes GLIBC regression tests. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* Linux: Remove rseq supportFlorian Weimer2020-07-1648-1092/+5
| | | | | | | | | | | | | | | | | | The kernel ABI is not finalized, and there are now various proposals to change the size of struct rseq, which would make the glibc ABI dependent on the version of the kernels used for building glibc. This is of course not acceptable. This reverts commit 48699da1c468543ade14777819bd1b4d652709de ("elf: Support at least 32-byte alignment in static dlopen"), commit 8f4632deb3545b2949cec5454afc3cb21a0024ea ("Linux: rseq registration tests"), commit 6e29cb3f61ff5432c78a1c84b0d9b123a350ab36 ("Linux: Use rseq in sched_getcpu if available"), and commit 0c76fc3c2b346dc5401dc055d97d4279632b0fb3 ("Linux: Perform rseq registration at C startup and thread creation"), resolving the conflicts introduced by the ARC port and the TLS static surplus changes. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* arm: remove string/tst-memmove-overflow XFAILAurelien Jarno2020-07-161-5/+0
| | | | | | | | | | | | | The arm string/tst-memmove-overflow XFAIL has been added in commit eca1b233322 ("arm: XFAIL string/tst-memmove-overflow due to bug 25620") as a way to reproduce the reported bug. Now that this bug has been fixed in commits 79a4fa341b8 ("arm: CVE-2020-6096: fix memcpy and memmove for negative length [BZ #25620]") and beea3610507 ("arm: CVE-2020-6096: Fix multiarch memcpy for negative length [BZ #25620]"), let's remove the XFAIL. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* AArch64: Rename IS_ARES to IS_NEOVERSE_N1Wilco Dijkstra2020-07-153-4/+8
| | | | | | Rename IS_ARES to IS_NEOVERSE_N1 since that is a bit clearer. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* AArch64: Add optimized Q-register memcpyWilco Dijkstra2020-07-155-4/+255
| | | | | | | | | | | | | | | | Add a new memcpy using 128-bit Q registers - this is faster on modern cores and reduces codesize. Similar to the generic memcpy, small cases include copies up to 32 bytes. 64-128 byte copies are split into two cases to improve performance of 64-96 byte copies. Large copies align the source rather than the destination. bench-memcpy-random is ~9% faster than memcpy_falkor on Neoverse N1, so make this memcpy the default on N1 (on Centriq it is 15% faster than memcpy_falkor). Passes GLIBC regression tests. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* AArch64: Align ENTRY to a cachelineWilco Dijkstra2020-07-151-1/+1
| | | | | | | Given almost all uses of ENTRY are for string/memory functions, align ENTRY to a cacheline to simplify things. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Remove --enable-obsolete-rpc configure flagPetr Vorel2020-07-131-162/+0
| | | | | | | | | | | | | | | | | | | | | | Sun RPC was removed from glibc. This includes rpcgen program, librpcsvc, and Sun RPC headers. Also test for bug #20790 was removed (test for rpcgen). Backward compatibility for old programs is kept only for architectures and ABIs that have been added in or before version 2.28. libtirpc is mature enough, librpcsvc and rpcgen are provided in rpcsvc-proto project. NOTE: libnsl code depends on Sun RPC (installed libnsl headers use installed Sun RPC headers), thus --enable-obsolete-rpc was a dependency for --enable-obsolete-nsl (removed in a previous commit). The arc ABI list file has to be updated because the port was added with the sunrpc symbols Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* hurd: Fix build-many-glibcs.pyAdhemerval Zanella2020-07-133-0/+3
| | | | | | | | It fixes the issue report by Joseph [1]. Checked with a build-many-glibcs.py build for i686-gnu. [1] https://sourceware.org/pipermail/libc-alpha/2020-July/116134.html
* x86: Support usable check for all CPU featuresH.J. Lu2020-07-1363-732/+854
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support usable check for all CPU features with the following changes: 1. Change struct cpu_features to struct cpuid_features { struct cpuid_registers cpuid; struct cpuid_registers usable; }; struct cpu_features { struct cpu_features_basic basic; struct cpuid_features features[COMMON_CPUID_INDEX_MAX]; unsigned int preferred[PREFERRED_FEATURE_INDEX_MAX]; ... }; so that there is a usable bit for each cpuid bit. 2. After the cpuid bits have been initialized, copy the known bits to the usable bits. EAX/EBX from INDEX_1 and EAX from INDEX_7 aren't used for CPU feature detection. 3. Clear the usable bits which require OS support. 4. If the feature is supported by OS, copy its cpuid bit to its usable bit. 5. Replace HAS_CPU_FEATURE and CPU_FEATURES_CPU_P with CPU_FEATURE_USABLE and CPU_FEATURE_USABLE_P to check if a feature is usable. 6. Add DEPR_FPU_CS_DS for INDEX_7_EBX_13. 7. Unset MPX feature since it has been deprecated. The results are 1. If the feature is known and doesn't requre OS support, its usable bit is copied from the cpuid bit. 2. Otherwise, its usable bit is copied from the cpuid bit only if the feature is known to supported by OS. 3. CPU_FEATURE_USABLE/CPU_FEATURE_USABLE_P are used to check if the feature can be used. 4. HAS_CPU_FEATURE/CPU_FEATURE_CPU_P are used to check if CPU supports the feature.
* x86: Remove __ASSEMBLER__ check in init-arch.hH.J. Lu2020-07-111-5/+1
| | | | | | | | | | | | | Since commit 430388d5dc0e1861b869096f4f5d946d7d74232a Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Aug 3 08:04:49 2018 -0700 x86: Don't include <init-arch.h> in assembly codes removed all usages of <init-arch.h> from assembly codes, we can remove __ASSEMBLER__ check in init-arch.h.
* x86: Remove the unused __x86_prefetchwH.J. Lu2020-07-115-24/+5
| | | | | | | | | | | | | Since commit c867597bff2562180a18da4b8dba89d24e8b65c4 Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Jun 8 13:57:50 2016 -0700 X86-64: Remove previous default/SSE2/AVX2 memcpy/memmove removed the only usage of __x86_prefetchw, we can remove the unused __x86_prefetchw.
* ARC: Build InfrastructureVineet Gupta2020-07-1014-0/+366
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: ABI listsVineet Gupta2020-07-1018-0/+4671
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: Linux Startup and Dynamic LoadingVineet Gupta2020-07-102-0/+116
| | | | | | | | A big shoutout to Cupertino Miranda <cmiranda@synopsys.com> for his valuable contribution in initial bringup and debugging on Linux and later in solving pesky unwinding/cancelation failures in testsuite. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: Linux ABIVineet Gupta2020-07-1013-0/+600
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: Linux Syscall InterfaceVineet Gupta2020-07-1015-0/+941
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: hardware floating point supportVineet Gupta2020-07-1020-0/+711
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: math soft float supportVineet Gupta2020-07-105-0/+203
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: Atomics and Locking primitivesVineet Gupta2020-07-101-0/+69
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: Thread Local Storage supportVineet Gupta2020-07-105-0/+240
| | | | | | This includes all 4 TLS addressing models Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: startup and dynamic linking codeVineet Gupta2020-07-107-0/+591
| | | | | | Code for C runtime startup and dynamic loading including PLT layout. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ARC: ABI ImplementationVineet Gupta2020-07-1017-0/+547
| | | | | | This code deals with the ARC ABI. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc64: Fix calls when r2 is not used [BZ #26173]Tulio Magno Quites Machado Filho2020-07-106-4/+49
| | | | | | | | | Teach the linker that __mcount_internal, __sigjmp_save_symbol, __syscall_error and __GI_exit do not use r2, so that it does not need to recover r2 after the call. Test at configure time if the assembler supports @notoc and define USE_PPC64_NOTOC.
* Update i686 libm-test-ulpsPatsy Franklin2020-07-091-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without my ULP patch these 18 tests fail on i686: https://koji.fedoraproject.org/koji/taskinfo?taskID=46467301 + cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 85 model name : Intel Xeon Processor (Cascadelake) FAIL: math/test-double-j0 FAIL: math/test-double-y0 FAIL: math/test-float-erfc FAIL: math/test-float-j0 FAIL: math/test-float-j1 FAIL: math/test-float-lgamma FAIL: math/test-float-tgamma FAIL: math/test-float-y0 FAIL: math/test-float32-erfc FAIL: math/test-float32-j0 FAIL: math/test-float32-j1 FAIL: math/test-float32-lgamma FAIL: math/test-float32-tgamma FAIL: math/test-float32-y0 FAIL: math/test-float32x-j0 FAIL: math/test-float32x-y0 FAIL: math/test-float64-j0 FAIL: math/test-float64-y0 With my ULP patch applied these tests now pass: https://koji.fedoraproject.org/koji/taskinfo?taskID=46436310
* linux: Fix syscall list generation instructionsMaciej W. Rozycki2020-07-091-1/+1
| | | | | | | | | | | Make the instructions for syscall list generation match Makefile and refer to `update-syscall-lists'; there has been no `update-arch-syscall' target. Also use single quotes around the command to stick to the ASCII character set. Fixes 4cf0d223052d ("Linux: Add tables with system call numbers"). Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* sysv: linux: Add 64-bit time_t variant for shmctlAdhemerval Zanella2020-07-0914-49/+330
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To provide a y2038 safe interface a new symbol __shmctl64 is added and __shmctl is change to call it instead (it adds some extra buffer copying for the 32 bit time_t implementation). Two new structures are added: 1. kernel_shmid64_ds: used internally only on 32-bit architectures to issue the syscall. A handful of architectures (hppa, i386, mips, powerpc32, and sparc32) require specific implementations due to their kernel ABI. 2. shmid_ds64: this is only for __TIMESIZE != 64 to use along with the 64-bit shmctl. It is different than the kernel struct because the exported 64-bit time_t might require different alignment depending on the architecture ABI. So the resulting implementation does: 1. For 64-bit architectures it assumes shmid_ds already contains 64-bit time_t fields and will result in just the __shmctl symbol using the __shmctl64 code. The shmid_ds argument is passed as-is to the syscall. 2. For 32-bit architectures with default 64-bit time_t (newer ABIs such riscv32 or arc), it will also result in only one exported symbol but with the required high/low time handling. 3. Finally for 32-bit architecture with both 32-bit and 64-bit time_t support we follow the already set way to provide one symbol with 64-bit time_t support and implement the 32-bit time_t support using of the 64-bit one. The default 32-bit symbol will allocate and copy the shmid_ds over multiple buffers, but this should be deprecated in favor of the __shmctl64 anyway. Checked on i686-linux-gnu and x86_64-linux-gnu. I also did some sniff tests on powerpc, powerpc64, mips, mips64, armhf, sparcv9, and sparc64. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysvipc: Remove the linux shm-pad.h fileAdhemerval Zanella2020-07-0912-172/+198
| | | | | | | | | | | | | | Each architecture overrides the struct msqid_ds which its required kernel ABI one. Checked on x86_64-linux-gnu and some bases sysvipc tests on hppa, mips, mipsle, mips64, mips64le, sparc64, sparcv9, powerpc64le, powerpc64, and powerpc. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysvipc: Split out linux struct shmid_dsAdhemerval Zanella2020-07-093-33/+59
| | | | | | | | | | | | This will allow us to have architectures specify their own version. Not semantic changes expected. Checked with a build against the all affected ABIs. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysv: linux: Add 64-bit time_t variant for msgctlAdhemerval Zanella2020-07-0914-52/+349
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To provide a y2038 safe interface a new symbol __msgctl64 is added and __msgctl is change to call it instead (it adds some extra buffer coping for the 32 bit time_t implementation). Two new structures are added: 1. kernel_msqid64_ds: used internally only on 32-bit architectures to issue the syscall. A handful of architectures (hppa, i386, mips, powerpc32, and sparc32) require specific implementations due to their kernel ABI. 2. msqid_ds64: this is only for __TIMESIZE != 64 to use along with the 64-bit msgctl. It is different than the kernel struct because the exported 64-bit time_t might require different alignment depending on the architecture ABI. So the resulting implementation does: 1. For 64-bit architectures it assumes msqid_ds already contains 64-bit time_t fields and will result in just the __msgctl symbol using the __msgctl64 code. The msgid_ds argument is passed as-is to the syscall. 2. For 32-bit architectures with default 64-bit time_t (newer ABIs such riscv32 or arc), it will also result in only one exported symbol but with the required high/low time handling. 3. Finally for 32-bit architecture with both 32-bit and 64-bit time_t support we follow the already set way to provide one symbol with 64-bit time_t support and implement the 32-bit time_t support using the 64-bit time_t. The default 32-bit symbol will allocate and copy the msqid_ds over multiple buffers, but this should be deprecated in favor of the __msgctl64 anyway. Checked on i686-linux-gnu and x86_64-linux-gnu. I also did some sniff tests on powerpc, powerpc64, mips, mips64, armhf, sparcv9, and sparc64. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com>
* sysvipc: Remove the linux msq-pad.h fileAdhemerval Zanella2020-07-0911-157/+210
| | | | | | | | | | | | | | Each architecture overrides the struct msqid_ds which its required kernel ABI one. Checked on x86_64-linux-gnu and some bases sysvipc tests on hppa, mips, mipsle, mips64, mips64le, sparc64, sparcv9, powerpc64le, powerpc64, and powerpc. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com>
* sysvipc: Split out linux struct semid_dsAdhemerval Zanella2020-07-093-33/+58
| | | | | | | | | | | | This will allow us to have architectures specify their own version. Not semantic changes expected. Checked with a build against the all affected ABIs. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* sysv: linux: Add 64-bit time_t variant for semctlAdhemerval Zanella2020-07-0916-64/+372
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Different than others 64-bit time_t syscalls, the SysIPC interface does not provide a new set of syscall for y2038 safeness. Instead it uses unused fields in semid_ds structure to return the high bits for the timestamps. To provide a y2038 safe interface a new symbol __semctl64 is added and __semctl is change to call it instead (it adds some extra buffer copying for the 32 bit time_t implementation). Two new structures are added: 1. kernel_semid64_ds: used internally only on 32-bit architectures to issue the syscall. A handful of architectures (hppa, i386, mips, powerpc32, sparc32) require specific implementations due their kernel ABI. 2. semid_ds64: this is only for __TIMESIZE != 64 to use along with the 64-bit semctl. It is different than the kernel struct because the exported 64-bit time_t might require different alignment depending on the architecture ABI. So the resulting implementation does: 1. For 64-bit architectures it assumes semid_ds already contains 64-bit time_t fields and will result in just the __semctl symbol using the __semctl64 code. The semid_ds argument is passed as-is to the syscall. 2. For 32-bit architectures with default 64-bit time_t (newer ABIs such riscv32 or arc), it will also result in only one exported symbol but with the required high/low handling. It might be possible to optimize it further to avoid the kernel_semid64_ds to semun transformation if the exported ABI for the architectures matches the expected kernel ABI, but the implementation is already complex enough and don't think this should be a hotspot in any case. 3. Finally for 32-bit architecture with both 32-bit and 64-bit time_t support we follow the already set way to provide one symbol with 64-bit time_t support and implement the 32-bit time_t support using the 64-bit one. The default 32-bit symbol will allocate and copy the semid_ds over multiple buffers, but this should be deprecated in favor of the __semctl64 anyway. Checked on i686-linux-gnu and x86_64-linux-gnu. I also did some sniff tests on powerpc, powerpc64, mips, mips64, armhf, sparcv9, and sparc64. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Vineet Gupta <vgupta@synopsys.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* rtld: Avoid using up static TLS surplus for optimizations [BZ #25051]Szabolcs Nagy2020-07-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On some targets static TLS surplus area can be used opportunistically for dynamically loaded modules such that the TLS access then becomes faster (TLSDESC and powerpc TLS optimization). However we don't want all surplus TLS to be used for this optimization because dynamically loaded modules with initial-exec model TLS can only use surplus TLS. The new contract for surplus static TLS use is: - libc.so can have up to 192 bytes of IE TLS, - other system libraries together can have up to 144 bytes of IE TLS. - Some "optional" static TLS is available for opportunistic use. The optional TLS is now tunable: rtld.optional_static_tls, so users can directly affect the allocated static TLS size. (Note that module unloading with dlclose does not reclaim static TLS. After the optional TLS runs out, TLS access is no longer optimized to use static TLS.) The default setting of rtld.optional_static_tls is 512 so the surplus TLS is 3*192 + 4*144 + 512 = 1664 by default, the same as before. Fixes BZ #25051. Tested on aarch64-linux-gnu and x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>