about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* conform/conformtest.py: Extend tokenizer to cover character constantsFlorian Weimer2020-02-171-6/+5
| | | | Such constants are used in __USE_EXTERN_INLINES blocks.
* stdlib: Reduce namespace pollution in <inttypes.h>Florian Weimer2020-02-171-24/+24
| | | | | | The namespace pollution results in conform test failures if the tests are run __USE_EXTERN_INLINES defined (e.g., when configuring with CC="gcc -O3" CXX="g++ -O3").
* x86: Avoid single-argument _Static_assert in <tls.h>Florian Weimer2020-02-173-24/+36
| | | | | 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-173-78/+60
|
* htl: Link internal htl tests against libpthreadSamuel Thibault2020-02-171-1/+1
|
* pthread: Fix building tst-robust8 with nptlSamuel Thibault2020-02-162-3/+5
| | | | NPTL's pthreadP.h needs internal definitions
* pthread: Move robust mutex tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-1615-8/+21
| | | | | 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-163-0/+12
|
* 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-152-5/+114
| | | | 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-1560-266/+202
| | | | | | | | | | | | | | | | | | | 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>
* Remove weak declaration of free from <inline-hashtab.h>Florian Weimer2020-02-151-8/+3
| | | | | | | | elf/dl-minimal.c provides a definition of free, so the function pointer is always non-null, even before the final relocation of the loader. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* elf: Extract _dl_sym_post, _dl_sym_find_caller_map from elf/dl-sym.cFlorian Weimer2020-02-152-82/+110
| | | | | | | The definitions are moved into a new file, elf/dl-sym-post.h, so that this code can be used by the dynamic loader as well. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* elf: Introduce the rtld-stubbed-symbols makefile variableFlorian Weimer2020-02-151-9/+13
| | | | | | | This generalizes a mechanism used for stack-protector support, so that it can be applied to other symbols if required. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* arm: fix use of INTERNAL_SYSCALL_CALLAndreas Schwab2020-02-151-1/+1
| | | | | Remove extra argument from INTERNAL_SYSCALL_CALL macro call. Fixes commit bc2eb9321e ("linux: Remove INTERNAL_SYSCALL_DECL").
* linux: Remove INTERNAL_SYSCALL_DECLAdhemerval Zanella2020-02-14107-546/+425
| | | | | | | | | | | With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, the INTERNAL_SYSCALL_DECL is an empty declaration on all ports. This patch removes the 'err' argument on INTERNAL_SYSCALL* macro and remove the INTERNAL_SYSCALL_DECL usage. Checked with a build against all affected ABIs.
* nptl: Remove ununsed pthread-errnos.h ruleAdhemerval Zanella2020-02-142-15/+1
|
* linux: Consolidate INLINE_SYSCALLAdhemerval Zanella2020-02-1433-486/+60
| | | | | | | | | | | With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, there is no need to replicate the INLINE_SYSCALL. The generic Linux sysdep.h includes errno.h even for !__ASSEMBLER__, which is ok now and it allows cleanup some archaic code that assume otherwise. Checked with a build against all affected ABIs.
* s390: Consolidate Linux syscall definitionAdhemerval Zanella2020-02-143-192/+103
| | | | | | The {INTERNAL,INLINE}_SYSCALL are defined only on s390 sysdep.h. Checked on s390x-linux-gnu and s390-linux-gnu.
* riscv: Avoid clobbering register parameters in syscallAdhemerval Zanella2020-02-141-28/+56
| | | | | | | | | | | | | | The riscv INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (bug 25523). Checked with riscv64-linux-gnu-rv64imafdc-lp64d build.
* microblaze: Avoid clobbering register parameters in syscallAdhemerval Zanella2020-02-141-35/+56
| | | | | | | | | | | | | | The microblaze INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (bug 25523). Checked with microblaze-linux-gnu and microblazeel-linux-gnu build.
* nios2: Use Linux kABI for syscall returnAdhemerval Zanella2020-02-141-5/+5
| | | | | | | | | | It changes the nios INTERNAL_SYSCALL_RAW macro to return a negative value instead of the 'r2' register value on the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked with a build against nios2-linux-gnu.
* mips: Use Linux kABI for syscall returnAdhemerval Zanella2020-02-143-53/+23
| | | | | | | | | | | | | It changes the mips INTERNAL_SYSCALL* and internal_syscall* macros to return a negative value instead of the 'a3' register value on then 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. The redefinition of INTERNAL_VSYSCALL_CALL is also no longer required. Checked on mips64-linux-gnu, mips64n32-linux-gnu, and mips-linux-gnu.
* mips64: Consolidate Linux sysdep.hAdhemerval Zanella2020-02-144-455/+70
| | | | | | | | | | | | | The mips64 Linux syscall macros only differs argument type and the requirement of sign-extending values on n32. The headers are consolidate by parameterizing the arguments with a new type, __syscall_arg_t, and by defining the ARGIFY for n64. Also, the generic unix mips64 sysdep is essentially the same, only the load instruction need to be adjusted depending of the ABI. Checked on mips64-linux-gnu and mips64n32-linux-gnu.
* ia64: Use Linux kABI for syscall returnAdhemerval Zanella2020-02-141-34/+24
| | | | | | | | | | It changes the ia64 INTERNAL_SYSCALL_NCS macro to return a negative value instead of the 'r10' register value on the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked on ia64-linux-gnu.
* alpha: Refactor syscall and Use Linux kABI for syscall returnAdhemerval Zanella2020-02-143-395/+348
| | | | | | | | | | | | | | It highly unlikely that alpha will be ported to anything else than Linux, so this patch moves the generic unix syscall definition to Linux and adapt it to Linux kernel ABI. It changes the internal_syscall* macros to return a negative value instead of the '$19' register value on the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked on alpha-linux-gnu.
* sparc: Avoid clobbering register parameters in syscallAdhemerval Zanella2020-02-141-27/+53
| | | | | | | | | | | | | | The sparc INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (bug 25523). Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
* sparc: Use Linux kABI for syscall returnAdhemerval Zanella2020-02-143-48/+38
| | | | | | | | | | | | | | | | | It changes the sparc internal_syscall* macros to return a negative value instead of the 'g1' register value in the 'err' macro argument. The __SYSCALL_STRING macro is also changed to no set the 'g1' value, since 'o1' already holds all the required information to check if syscall has failed. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. The redefinition of INTERNAL_VSYSCALL_CALL is also no longer required. Checked on sparc64-linux-gnu and sparcv9-linux-gnu. It fixes the sporadic issues on sparc32 where clock_nanosleep does not act as cancellation entrypoint.
* powerpc: Use Linux kABI for syscall returnAdhemerval Zanella2020-02-141-7/+5
| | | | | | | | | | | | It changes the powerpc INTERNAL_VSYSCALL_CALL and INTERNAL_SYSCALL_NCS to return a negative value instead of the returning the CR value in the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked on powerpc64-linux-gnu, powerpc64le-linux-gnu, and powerpc-linux-gnu-power4.
* powerpc: Consolidate Linux syscall definitionAdhemerval Zanella2020-02-143-409/+209
| | | | | | | | | | | | | | | | | | | | | | | | The diferences between powerpc64{le} and powerpc32 Linux sysdep.h are: 1. On both vDSO and syscall macros the volatile registers r9, r10, r11, and r12 are used as input operands on powerpc32 and as clobber registers on powerpc64. However the outcome is essentially the same, it advertise the register might be clobbered by the kernel (although Linux won't leak register information to userland in such case). 2. The LOADARGS* macros uses a different size to check for invalid types. 3. The pointer mangling support guard pointer loading uses ABI specific instruction and register. This patch consolidates on only one sysdep by using the the powerpc64 version as default and add the adjustments required for powerpc32. Checked on powerpc64-linux-gnu, powerpc64le-linux-gnu, and powerpc-linux-gnu-power4.
* i386: Enable CET support in ucontext functionsH.J. Lu2020-02-146-3/+425
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. getcontext and swapcontext are updated to save the caller's shadow stack pointer and return address. 2. setcontext and swapcontext are updated to restore shadow stack and jump to new context directly. 3. makecontext is updated to allocate a new shadow stack and set the caller's return address to the helper code, L(exitcode). 4. Since we no longer save and restore EAX, ECX and EDX in getcontext, setcontext and swapcontext, we can use them as scratch register slots to enable CET in ucontext functions. Since makecontext allocates a new shadow stack when making a new context and kernel allocates a new shadow stack for clone/fork/vfork syscalls, we track the current shadow stack base. In setcontext and swapcontext, if the target shadow stack base is the same as the current shadow stack base, we unwind the shadow stack. Otherwise it is a stack switch and we look for a restore token. We enable shadow stack at run-time only if program and all used shared objects, including dlopened ones, are shadow stack enabled, which means that they must be compiled with GCC 8 or above and glibc 2.28 or above. We need to save and restore shadow stack only if shadow stack is enabled. When caller of getcontext, setcontext, swapcontext and makecontext is compiled with smaller ucontext_t, shadow stack won't be enabled at run-time. We check if shadow stack is enabled before accessing the extended field in ucontext_t. Tested on i386 CET/non-CET machines. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* tst-clone3: Use __NR_futex_time64 if we don't have __NR_futexAlistair Francis2020-02-141-0/+4
| | | | | | | | | | | We can't include sysdep.h in the test case (it introduces lots of strange failures) so __NR_futex isn't redifined to __NR_futex_time64 by 64-bit time_t 32-bit archs (y2038 safe). To allow the test to pass let's just do the __NR_futex_time64 syscall if we don't have __NR_futex defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc64: Add memory protection key support [BZ #23202]Florian Weimer2020-02-143-0/+145
| | | | | | | | | The 32-bit protection key behavior is somewhat unclear on 32-bit powerpc, so this change is restricted to the 64-bit variants. Flag translation is needed because of hardware differences between the POWER implementation (read and write flags) and the Intel implementation (write and read+write flags).
* ldbl-128ibm-compat: Provide a scalb implementationTulio Magno Quites Machado Filho2020-02-143-0/+54
| | | | | | Reuse the template in order to provide the redirect for scalbl to __scalbieee128, but avoid any extra aliasing as this is intended to support long double redirects only.
* Add a generic scalb implementationTulio Magno Quites Machado Filho2020-02-1413-139/+91
| | | | | | | | | | | | | | | | | | | | | | | This is a preparatory patch to enable building a _Float128 variant to ease reuse when building a _Float128 variant to alias this long double only symbol. Notably, stubs are added where missing to the native _Float128 sysdep dir to prevent building these newly templated variants created inside the build directories. Also noteworthy are the changes around LIBM_SVID_COMPAT. These changes are not intuitive. The templated version is only enabled when !LIBM_SVID_COMPAT, and the compat version is predicated entirely on LIBM_SVID_COMPAT. Thus, exactly one is stubbed out entirely when building. The nldbl scalb compat files are updated to account for this. Likewise, fixup the reuse of m68k's e_scalb{f,l}.c to include it's override of e_scalb.c. Otherwise, the search path finds the templated copy in the build directory. This could be futher simplified by providing an overridden template, but I lack the hardware to verify.
* Adjust thresholds in Bessel function implementations (bug 14469).Joseph Myers2020-02-144-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent discussion in bug 14469 notes that a threshold in float Bessel function implementations, used to determine when to use a simpler implementation approach, results in substantially inaccurate results. As I discussed in <https://sourceware.org/ml/libc-alpha/2013-03/msg00345.html>, a heuristic argument suggests 2^(S+P) as the right order of magnitude for a suitable threshold, where S is the number of significand bits in the floating-point type and P is the number of significant bits in the representation of the floating-point type, and the float and ldbl-96 implementations use thresholds that are too small. Some threshold does need using, there or elsewhere in the implementation, to avoid spurious underflow and overflow for large arguments. This patch sets the thresholds in the affected implementations to more heuristically justifiable values. Results will still be inaccurate close to zeroes of the functions (thus this patch does *not* fix any of the bugs for Bessel function inaccuracy); fixing that would require a different implementation approach, likely along the lines described in <http://www.cl.cam.ac.uk/~jrh13/papers/bessel.ps.gz>. So the justification for a change such as this would be statistical rather than based on particular tests that had excessive errors and no longer do so (no doubt such tests could be found, but would probably be too fragile to add to the testsuite, as liable to give large errors again from very small implementation changes or even from compiler changes). See <https://sourceware.org/ml/libc-alpha/2020-02/msg00638.html> for such statistics of the resulting improvements for float functions. Tested (glibc testsuite) for x86_64.
* resolv: Fix ABA race in /etc/resolv.conf change detection [BZ #25420]Florian Weimer2020-02-141-6/+13
| | | | | | | | | | __resolv_conf_get_current should only record the initial file change data if after verifying that file just read matches the original measurement. Fixes commit aef16cc8a4c670036d45590877 ("resolv: Automatically reload a changed /etc/resolv.conf file [BZ #984]"). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* resolv: Enhance __resolv_conf_load to capture file change dataFlorian Weimer2020-02-143-7/+19
| | | | | | | The data is captured after reading the file. This allows callers to check the change data against an earlier measurement. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* resolv: Fix file handle leak in __resolv_conf_load [BZ #25429]Florian Weimer2020-02-141-1/+7
| | | | | | | | | | | | | | res_vinit_1 did not close the stream on errors, only on success. This change moves closing the stream to __resolv_conf_load, for both the success and error cases. Fixes commit 89f187a40fc0ad4e22838526bfe34d73f758b776 ("resolv: Use getline for configuration file reading in res_vinit_1") and commit 3f853f22c87f0b671c0366eb290919719fa56c0e ("resolv: Lift domain search list limits [BZ #19569] [BZ #21475]"), where memory allocation was introduced into res_vinit_1. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* resolv: Use <file_change_detection.h> in __resolv_conf_get_currentFlorian Weimer2020-02-141-35/+8
| | | | | | | Only minor functional changes (i.e., regarding the handling of directories, which are now treated as empty files). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add STATX_ATTR_VERITY from Linux 5.5 to bits/statx-generic.h.Joseph Myers2020-02-131-0/+1
| | | | | | | | This patch adds the new STATX_ATTR_VERITY macro from Linux 5.5 to glibc's bits/statx-generic.h. (This only does anything if glibc is being used with old kernel headers.) Tested for x86_64.
* Use gcc -finput-charset=ascii for check-installed-headers.Stefan Liebler2020-02-135-5/+6
| | | | | | | | | | | | | | | | | | | | A non-ascii character in the installed headers leads now to: error: failure to convert ascii to UTF-8 Such a finding in s390 specific fenv.h leads to fails in GCC testsuite. See glibc commit 08aea89ef67c5780ae734073494df0a451bce20f. Adding this gcc option also to our tests was proposed by Florian Weimer. This change also found a hit in resource.h where now "microseconds" is used. I've adjusted all the resource.h files. I've used the following command to check for further hits in headers. LC_ALL=C find -name "*.h" -exec grep -PHn "[\x80-\xFF]" {} \; Tested on s390x and x86_64. Reviewed-by: Zack Weinberg <zackw@panix.com>
* math/test-sinl-pseudo: Use stack protector only if availableFlorian Weimer2020-02-131-0/+2
| | | | | This fixes commit 9333498794cde1d5cca518bad ("Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487).").
* alpha: Fix static gettimeofday symbolAdhemerval Zanella2020-02-132-6/+5
| | | | | | | | By undef strong_alias on alpha implementation, the default_symbol_version macro becomes an empty macro on static build. It fixes the issue introduced at c953219420. Checked on alpha-linux-gnu with a 'make check run-built-tests=no'.
* nss_nisplus: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer2020-02-131-0/+1
| | | | Reviewed-by: DJ Delorie <dj@redhat.com>
* nss_dns: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer2020-02-133-0/+6
| | | | Reviewed-by: DJ Delorie <dj@redhat.com>
* nss_files: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer2020-02-1315-0/+38
| | | | Reviewed-by: DJ Delorie <dj@redhat.com>
* nss_db: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer2020-02-133-1/+3
| | | | Reviewed-by: DJ Delorie <dj@redhat.com>