about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* malloc/tst-mallocfork2: Kill lingering process for unexpected failuresAdhemerval Zanella2020-02-271-11/+28
| | | | | | | | | | | | | | | If the test fails due some unexpected failure after the children creation, either in the signal handler by calling abort or in the main loop; the created children might not be killed properly. This patches fixes it by: * Avoid aborting in the signal handler by setting a flag that an error has occured and add a check in the main loop. * Add a atexit handler to handle kill child processes. Checked on x86_64-linux-gnu.
* elf: Apply attribute_relro to pointers in elf/dl-minimal.cFlorian Weimer2020-02-261-8/+8
| | | | | | | | | | | | | The present code leaves the function pointers unprotected, but moves some of the static functions into .data.rel.ro instead. This causes the linker to produce an allocatable, executable, writable section and eventually an RWX load segment. Not only do we really do not want that, it also breaks valgrind because valgrind does not load debuginfo from the mmap interceptor if all it sees are RX and RWX mappings. Fixes commit 3a0ecccb599a6b1ad4b149dc569c0080e92d057b ("ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]").
* powerpc: Refactor fenvinline.hRogerio Alves2020-02-251-13/+19
| | | | | | | This patch refactor fenviline.h replaces some statements for builtins. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* nss_nis: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer2020-02-256-28/+54
| | | | | This commit removes the minor optimization based on strong aliases because it loses type safety.
* csu: Use ELF constructor instead of _init in libc.soFlorian Weimer2020-02-253-8/+8
| | | | | | | | On !ELF_INITFINI architectures, _init is no longer called by the dynamic linker. We can use an ELF constructor instead because the constructor order does not matter. (The other constructors are used to set up libio vtable bypasses and do not depend on this initialization routine.)
* ldbl-128ibm: make ieee754.h work with IEEE 128 long doublePaul E. Murphy2020-02-212-2/+96
| | | | | | | | | | | | | Instead of attempting something more creative, just copy the small struct from ldbl-128 and enable it when IEEE long double is present, and update the ibm long double variant if supported. Likewise, provide a shadow copy of math_ldbl.h to prevent the ibm128 specific long double header from poisoning unrelated files due to it's usage in math_private.h. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* ldbl-128ibm-compat: fixup subdir location of several funcsPaul E. Murphy2020-02-211-16/+16
| | | | | | | | | | | | | | | | | We want to ensure that if a second file is built to support ieee128 long double, we built its companion implementation with ibm128 long double. The shared object versions of these files build correctly because the aliasing is sufficiently complex to prevent the redirects from applying when defining them. However, this does not prevent the static object variants from becoming quietly broken due to redirects. This is intentionally avoided by marking such objects to be built with -mabi=ibmlongdouble. Shuffle the misplaced routines to build against the subdir which defines the needed symbols.
* ldbl-128ibm-compat: enforce correct abi flags on internal filePaul E. Murphy2020-02-211-0/+11
| | | | | | A number of utility files and helper objects should also be explicitly configured to build with the ibm128 ABI to prevent gremlins when enabling IEEE long double.
* ldbl-128ibm-compat: Provide ieee128 symbols to narrow functionsTulio Magno Quites Machado Filho2020-02-204-14/+75
| | | | | | | | | | Move the narrow math aliasing macros into a new sysdep header file math-narrow-alias-float128.h. Then, provide an override header to supply the necessary changes to supply the *ieee128 aliases of these symbols. This adds ieee128 aliases for faddl, fdivl, fmull, fsubl, daddl, ddivl, dmull, dsubl.
* Undefine redirections after long double definition on __LDBL_COMPAT [BZ #23294]Tulio Magno Quites Machado Filho2020-02-204-7/+112
| | | | | | After defining the long double redirections to double, __MATHDECL_1 has to be redefined to its previous state in order to avoid redirecting all subsequent types.
* nios2: Fix Linux kABI for syscall returnAdhemerval Zanella2020-02-201-1/+1
| | | | From the type introduced at 861be5fd66.
* Fix use-after-free in glob when expanding ~user (bug 25414)Andreas Schwab2020-02-201-12/+13
| | | | | The value of `end_name' points into the value of `dirname', thus don't deallocate the latter before the last use of the former.
* nptl: Move pthread_setschedparam implementation into libcFlorian Weimer2020-02-2032-38/+1
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_getschedparam implementation into libcFlorian Weimer2020-02-2032-34/+3
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add hidden prototypes for __sched_getparam, __sched_getschedulerFlorian Weimer2020-02-203-0/+4
| | | | | | This will enable them to be used in libc.so without PLTs. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_cond_init implementation into libcFlorian Weimer2020-02-2035-67/+8
| | | | | | | | | | | It is necessary to export __pthread_cond_init from libc because the C11 condition variable needs it and is still left in libpthread. This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_cond_destroy implementation into libcFlorian Weimer2020-02-2035-64/+13
| | | | | | | | | | | It is necessary to export __pthread_cond_destroy from libc because the C11 condition variable needs it and is still left in libpthread. This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_condattr_init implementation into libcFlorian Weimer2020-02-2032-34/+1
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_condattr_destroy implementation into libcFlorian Weimer2020-02-2032-32/+3
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_setscope implementation into libcFlorian Weimer2020-02-2032-36/+1
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_getscope implementation into libcFlorian Weimer2020-02-2032-33/+3
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_setschedpolicy implementation into libcFlorian Weimer2020-02-2032-34/+1
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_getschedpolicy implementation into libcFlorian Weimer2020-02-2032-33/+3
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Sort routines list in Makefile alphabeticallyFlorian Weimer2020-02-201-7/+21
| | | | | | | This will make it easier to review changes which move implementations from libpthread to libc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Use .NOTPARALLEL in Makefile only if actually running testsFlorian Weimer2020-02-201-1/+3
| | | | | | It is safe to build the tests in parallel. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Block all signals on timer_create thread (BZ#10815)Adhemerval Zanella2020-02-196-63/+221
| | | | | | | | | | | | | | | | | | | | The behavior of the signal mask on threads created by timer_create for SIGEV_THREAD timers are implementation-defined and glibc explicit unblocks all signals before calling the user-defined function. This behavior, although not incorrect standard-wise, opens a race if a program using a blocked rt-signal plus sigwaitinfo (and without an installed signal handler for the rt-signal) receives a signal while executing the used-defined function for SIGEV_THREAD. A better alternative discussed in bug report is to rather block all signals (besides the internal ones not available to application usage). This patch fixes this issue by only unblocking SIGSETXID (used on set*uid function) and SIGCANCEL (used for thread cancellation). Checked on x86_64-linux-gnu and i686-linux-gnu.
* Fix tst-pkey expectations on pkey_get [BZ #23202]Lucas A. M. Magalhaes2020-02-191-4/+6
| | | | | | | | | | | | | | | | From the GNU C Library manual, the pkey_set can receive a combination of PKEY_DISABLE_WRITE and PKEY_DISABLE_ACCESS. However PKEY_DISABLE_ACCESS is more restrictive than PKEY_DISABLE_WRITE and includes its behavior. The test expects that after setting (PKEY_DISABLE_WRITE|PKEY_DISABLE_ACCESS) pkey_get should return the same. This may not be true as PKEY_DISABLE_ACCESS will succeed in describing the state of the key in this case. The pkey behavior during signal handling is different between x86 and POWER. This change make the test compatible with both architectures. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* y2038: linux: Provide __gettimeofday64 implementationLukasz Majewski2020-02-184-3/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the glibc the gettimeofday can use vDSO (on power and x86 the USE_IFUNC_GETTIMEOFDAY is defined), gettimeofday syscall or 'default' ___gettimeofday() from ./time/gettime.c (as a fallback). In this patch the last function (___gettimeofday) has been refactored and moved to ./sysdeps/unix/sysv/linux/gettimeofday.c to be Linux specific. The new __gettimeofday64 explicit 64 bit function for getting 64 bit time from the kernel (by internally calling __clock_gettime64) has been introduced. Moreover, a 32 bit version - __gettimeofday has been refactored to internally use __gettimeofday64. The __gettimeofday is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary check for time_t potential overflow and conversion of struct __timeval64 to 32 bit struct timespec. The iFUNC vDSO direct call optimization has been removed from both i686 and powerpc32 (USE_IFUNC_GETTIMEOFDAY is not defined for those architectures anymore). The Linux kernel does not provide a y2038 safe implementation of gettimeofday neither it plans to provide it in the future, clock_gettime64 should be used instead. Keeping support for this optimization would require to handle another build permutation (!__ASSUME_TIME64_SYSCALLS && USE_IFUNC_GETTIMEOFDAY) which adds more complexity and has limited use (since the idea is to eventually have a y2038 safe glibc build). Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test proper usage of both __gettimeofday64 and __gettimeofday. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> [Including some commit message improvement]
* Linux: Work around kernel bugs in chmod on /proc/self/fd paths [BZ #14578]Florian Weimer2020-02-182-63/+45
| | | | | | | | | | It appears that the ability to change symbolic link modes through such paths is unintended. On several file systems, the operation fails with EOPNOTSUPP, even though the symbolic link permissions are updated. The expected behavior is a failure to update the permissions, without file system changes. Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
* Introduce <elf-initfini.h> and ELF_INITFINI for all architecturesFlorian Weimer2020-02-1826-105/+330
| | | | | | | | | | | | | | | | This supersedes the init_array sysdeps directory. It allows us to check for ELF_INITFINI in both C and assembler code, and skip DT_INIT and DT_FINI processing completely on newer architectures. A new header file is needed because <dl-machine.h> is incompatible with assembler code. <sysdep.h> is compatible with assembler code, but it cannot be included in all assembler files because on some architectures, it redefines register names, and some assembler files conflict with that. <elf-initfini.h> is replicated for legacy architectures which need DT_INIT/DT_FINI support. New architectures follow the generic default and disable it.
* mips: Fix bracktrace result for signal framesAdhemerval Zanella2020-02-183-0/+102
| | | | | | | | | | | | | | | | MIPS fallback code handle a frame where its FDE can not be obtained (for instance a signal frame) by reading the kernel allocated signal frame and adding '2' to the value of 'sc_pc' [1]. The added value is used to recognize an end of an EH region on mips16 [2]. The fix adjust the obtained signal frame value and remove the libgcc added value by checking if the previous frame is a signal frame one. Checked with backtrace and tst-sigcontext-get_pc tests on mips-linux-gnu and mips64-linux-gnu. [1] libgcc/config/mips/linux-unwind.h from gcc code. [2] gcc/config/mips/mips.h from gcc code. */
* Move implementation of <file_change_detection.h> into a C fileFlorian Weimer2020-02-187-125/+174
| | | | | | | | | | | file_change_detection_for_stat partially initialize struct file_change_detection in some cases, when the size member alone determines the outcome of all comparisons. This results in maybe-uninitialized compiler warnings in case of sufficiently aggressive inlining. Once the implementation is moved into a separate C file, this kind of inlining is no longer possible, so the compiler warnings are gone.
* <fd_to_filename.h>: Add type safety and port to HurdFlorian Weimer2020-02-189-33/+206
| | | | | | | | | The new type struct fd_to_filename makes the allocation of the backing storage explicit. Hurd uses /dev/fd, not /proc/self/fd. Co-Authored-By: Paul Eggert <eggert@cs.ucla.edu>
* Prepare redirections for IEEE long double on powerpc64leGabriel F. T. Gomes2020-02-1714-43/+159
| | | | | | | | | | | | | | | | | | | | | | | | | All functions that have a format string, which can consume a long double argument, must have one version for each long double format supported on a platform. On powerpc64le, these functions currently have two versions (i.e.: long double with the same format as double, and long double with IBM Extended Precision format). Support for a third long double format option (i.e. long double with IEEE long double format) is being prepared and all the aforementioned functions now have a third version (not yet exported on the master branch, but the code is in). For these functions to get selected (during build time), references to them in user programs (or dependent libraries) must get redirected to the aforementioned new versions of the functions. This patch installs the header magic required to perform such redirections. Notice, however, that since the redirections only happen when __LONG_DOUBLE_USES_FLOAT128 is set to 1, and no platform (including powerpc64le) currently does it, no redirections actually happen. Redirections and the exporting of the new functions will happen at the same time (when powerpc64le adds ldbl-128ibm-compat to their Implies. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> Reviewed-by: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* 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>