about summary refs log tree commit diff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* ldbl-128ibm-compat: PLT redirects for using ldbl redirects internallyPaul E. Murphy2020-03-256-23/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tweak the PLT bypass magic when building glibc with long double redirects. This is made more difficult by the fact we only get one chance to redirect functions. This happens via the public headers. There are roughly three classes of redirect we need to attend to today: 1. Simple redirects, redirected via cdef macro overrides and and new libc_hidden_ldbl_proto macro. 2. Internal usage of internal API, e.g __snprintf, which has no direct analogue. This is bypassed directly on case-by- case basis. 3. Double redirects, e.g sscanf and related. These require a heavier handed approach of macro renaming to existing symbols. Most simple redirects are handled via 1. Ideally, the libc_* macro would live in libc-symbols.h, but in practice the macros needed for it to do anything useful live in cdefs.h, so they are defined in the local override. Notably, the internal name of the asprintf generated for ieee ldbl redirects is renamed to work with internal prefixed usage. This resolves the local plt usage introduced when building glibc with ldbl == ieee128 on ppc64le. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* y2038: linux: Provide __futimesat64 implementationLukasz Majewski2020-03-091-0/+4
| | | | | | | | | This conversion patch for supporting 64 bit time for futimesat only differs from the work performed for futimes (when providing __futimes64) with passing also the file name (and path) to utimensat. All the design and conversion decisions are exactly the same as for futimens conversion.
* y2038: linux: Provide __lutimes64 implementationLukasz Majewski2020-03-091-0/+3
| | | | | | | | | | | This conversion patch for supporting 64 bit time for lutimes mostly differs from the work performed for futimes (when providing __futimes64) with adding the AT_SYMLINK_NOFOLLOW flag to utimensat. It also supports passing file name instead of file descriptor number, but this is not relevant for utimensat used to implement it. All the design and conversion decisions are exactly the same as for futimens conversion.
* y2038: linux: Provide __futimes64 implementationLukasz Majewski2020-03-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __futimes64 explicit 64 bit function for setting file's 64 bit attributes for access and modification time (by specifying file descriptor number). Internally, the __utimensat64_helper function is used. This patch is necessary for having architectures with __WORDSIZE == 32 Y2038 safe. Moreover, a 32 bit version - __futimes has been refactored to internally use __futimes64. The __futimes is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion of struct timeval to 64 bit struct __timeval64. The check if struct timevals' usec fields are in the range between 0 and 1000000 has been removed as Linux kernel performs it internally in the implementation of utimensat (the conversion between struct __timeval64 and __timespec64 is not relevant for this particular check). Last but not least, checks for tvp{64} not being NULL have been preserved from the original code as some legacy user space programs may rely on it. 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 the proper usage of both __futimes64 and __futimes.
* y2038: linux: Provide __utime64 implementationLukasz Majewski2020-03-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces auto generated wrapper (as described in sysdeps/unix/sysv/linux/syscalls.list) for utime with one which adds extra support for setting file's access and modification 64 bit time on machines with __TIMESIZE != 64. Internally, the __utimensat_time64 helper function is used. This patch is necessary for having architectures with __WORDSIZE == 32 && __TIMESIZE != 64 Y2038 safe. Moreover, a 32 bit version - __utime has been refactored to internally use __utime64. The __utime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion between struct utimbuf and struct __utimbuf64. 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 __utime64 and __utime. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __utimes64 implementationLukasz Majewski2020-03-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __utimes64 explicit 64 bit function for setting file's 64 bit attributes for access and modification time. Internally, the __utimensat64_helper function is used. This patch is necessary for having architectures with __WORDSIZE == 32 Y2038 safe. Moreover, a 32 bit version - __utimes has been refactored to internally use __utimes64. The __utimes is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion of struct timeval to 64 bit struct __timeval64. 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 __utimes64 and __utimes. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: Introduce struct __utimbuf64 - new internal glibc typeLukasz Majewski2020-03-031-0/+12
| | | | | | | | | | | This type is a glibc's "internal" type to store file's access and modification times in __time64_t rather than __time_t, which makes it Y2038-proof. Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* ldbl-128ibm-compat: Redirect long double functions to f128/ieee128 functionsTulio Magno Quites Machado Filho2020-02-281-3/+6
| | | | | | | | | | | | | | | | Modify the headers to redirect long double functions to global __*f128 symbols or to __*ieee128 otherwise. Most of the functions in math.h benefit from the infrastructure already available for __LDBL_COMPAT. The only exceptions are nexttowardf and nexttoward that need especial treatment. Both math/bits/mathcalls-helper-functions.h and math/bits/mathcalls.h were modified in order to provide alternative redirection destinations that are essential to support functions that should not be redirected to the same name pattern of the rest of the functions, i.e.: __fpclassify, __signbit, __iseqsig, __issignaling, isinf, finite and isnan, which will be redirected to __*f128 instead of __*ieee128 used for the rest.
* nss_nis: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer2020-02-252-1/+30
| | | | | 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-251-1/+1
| | | | | | | | 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.)
* Add hidden prototypes for __sched_getparam, __sched_getschedulerFlorian Weimer2020-02-201-0/+2
| | | | | | This will enable them to be used in libc.so without PLTs. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __gettimeofday64 implementationLukasz Majewski2020-02-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* Move implementation of <file_change_detection.h> into a C fileFlorian Weimer2020-02-181-90/+20
| | | | | | | | | | | 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.
* ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]Florian Weimer2020-02-155-3/+99
| | | | | | | | | | | | | | | | | | | 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>
* io: Implement lchmod using fchmodat [BZ #14578]Florian Weimer2020-02-121-0/+1
|
* Add internal <file_change_detection.h> header fileFlorian Weimer2020-02-121-0/+140
| | | | | | | | | | | The code started out with bits form resolv/resolv_conf.c, but it was enhanced to deal with directories and FIFOs in a more predictable manner. A test case is included as well. This will be used to implement the /etc/resolv.conf change detection. This currently lives in a header file only. Once there are multiple users, the implementations should be moved into C files.
* y2038: linux: Provide __settimeofday64 implementationLukasz Majewski2020-02-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __settimeofday64 explicit 64 bit function for setting 64 bit time in the kernel (by internally calling __clock_settime64). Moreover, a 32 bit version - __settimeofday has been refactored to internally use __settimeofday64. The __settimeofday is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion of struct timeval to 64 bit struct __timespec64. Internally the settimeofday uses __settimeofday64. This patch is necessary for having architectures with __WORDSIZE == 32 Y2038 safe. 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 __settimeofday64 and __settimeofday. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: Provide conversion helpers for struct __timeval64Lukasz Majewski2020-02-071-0/+49
| | | | | | | | | | | | Those functions allow easy conversion between Y2038 safe, glibc internal struct __timeval64 and other time related data structures (like struct timeval or struct __timespec64). Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: Introduce struct __timeval64 - new internal glibc typeLukasz Majewski2020-02-071-0/+14
| | | | | | | | | | | | | | This type is a glibc's "internal" type similar to struct timeval but whose tv_sec field is a __time64_t rather than a time_t, which makes it Y2038-proof. This struct is NOT supposed to be passed to the kernel - instead it shall be converted to struct __timespec64 and clock_[sg]ettime syscalls shall be used (which are now Y2038 safe). Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __timespec_get64 implementationLukasz Majewski2020-02-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new instance of Linux specific timespec_get.c file placed in ./sysdeps/unix/sysv/linux/. When compared to this file version from ./time directory, it provides __timespec_get64 explicit 64 bit function for getting 64 bit time in the struct __timespec64 (for compilation using C11 standard). Moreover, a 32 bit version - __timespec_get internally uses __timespec_get64. The __timespec_get is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion to 32 bit struct timespec. Internally the timespec_get uses __clock_gettime64. This patch is necessary for having architectures with __WORDSIZE == 32 Y2038 safe. 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 __timespec_get64 and __timespec_get. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* rt: avoid PLT setup in timer_[sg]ettimeAndreas Schwab2020-02-031-2/+2
| | | | | | | | | | The functions __timer_gettime64 and __timer_settime64 live in librt, not libc. Use proper hidden aliases so that the callers do not need to set up the PLT register. Fixes commits cae1635a70 ("y2038: linux: Provide __timer_settime64 implementation") and 562cdc19c7 ("y2038: linux: Provide __timer_gettime64 implementation").
* y2038: linux: Provide __sched_rr_get_interval64 implementationLukasz Majewski2020-02-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | This patch replaces auto generated wrapper (as described in sysdeps/unix/sysv/linux/syscalls.list) for sched_rr_get_interval with one which adds extra support for reading 64 bit time values on machines with __TIMESIZE != 64. There is no functional change for architectures already supporting 64 bit time ABI. The sched_rr_get_interval declaration in ./include/sched.h is not followed by corresponding libc_hidden_proto(), so it has been assumed that newly introduced syscall wrapper doesn't require libc_hidden_def() (which has been added by template used with auto generation script). Moreover, the code for building sched_rr_gi.c file is already placed in ./posix/Makefiles, so there was no need to add it elsewhere. Performed tests and validation are the same as for timer_gettime() conversion (sysdeps/unix/sysv/linux/timer_gettime.c). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __timerfd_settime64 implementationLukasz Majewski2020-02-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces auto generated wrapper (as described in sysdeps/unix/sysv/linux/syscalls.list) for timerfd_settime with one which adds extra support for reading and writing from Linux kernel 64 bit time values on machines with __TIMESIZE != 64. There is no functional change for archs already supporting 64 bit time ABI. This patch is conceptually identical to timer_settime conversion already done in sysdeps/unix/sysv/linux/timer_settime.c. Please refer to corresponding commit message for detailed description of introduced functions and the testing procedure. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> --- Changes for v4: - Update date from 2019 to 2020 Changes for v3: - Add missing libc_hidden_def() Changes for v2: - Remove "Contributed by" from the file header - Remove early check for (fd < 0) in __timerfd_settime64 as the fd correctness check is already done in Linux kernel - Add single descriptive comment line to provide concise explanation of the code
* y2038: linux: Provide __timerfd_gettime64 implementationLukasz Majewski2020-02-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces auto generated wrapper (as described in sysdeps/unix/sysv/linux/syscalls.list) for timerfd_gettime with one which adds extra support for reading 64 bit time values on machines with __TIMESIZE != 64. There is no functional change for architectures already supporting 64 bit time ABI. This patch is conceptually identical to timer_gettime conversion already done in sysdeps/unix/sysv/linux/timer_gettime.c. Please refer to corresponding commit message for detailed description of introduced functions and the testing procedure. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> --- Changes for v4: - Update date from 2019 to 2020 Changes for v3: - Add missing libc_hidden_def() Changes for v2: - Remove "Contributed by" from the file header - Remove early check for (fd < 0) in __timerfd_gettime64 as the fd correctness check is already done in Linux kernel - Add single descriptive comment line to provide concise explanation of the code
* Update version numbers for 2.31 releaseSiddhesh Poyarekar2020-02-011-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-0133-33/+33
|
* Do not redirect calls to __GI_* symbols, when redirecting to *ieee128Tulio Magno Quites Machado Filho2019-12-272-2/+12
| | | | | | | | | | | | | | | | | | | | | | On platforms where long double has IEEE binary128 format as a third option (initially, only powerpc64le), many exported functions are redirected to their __*ieee128 equivalents. This redirection is provided by installed headers such as stdio-ldbl.h, and is supposed to work correctly with user code. However, during the build of glibc, similar redirections are employed, in internal headers, such as include/stdio.h, in order to avoid extra PLT entries. These redirections conflict with the redirections to __*ieee128, and must be avoided during the build. This patch protects the second redirections with a test for __LONG_DOUBLE_USES_FLOAT128, a new macro that is defined to 1 when functions that deal with long double typed values reuses the _Float128 implementation (this is currently only true for powerpc64le). Tested for powerpc64le, x86_64, and with build-many-glibcs.py. Co-authored-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Implement waitpid in terms of wait4Adhemerval Zanella2019-12-191-0/+1
| | | | | | This also consolidate all waitpid implementations. Checked on x86_64-linux-gnu.
* hurd: Fix local PLTSamuel Thibault2019-12-131-0/+10
| | | | | | | | | | * include/sys/random.h (__getrandom): Add hidden prototype. * stdlib/getrandom.c (getrandom): Rename to hidden definition __getrandom. Add weak alias. * sysdeps/mach/hurd/getrandom.c (getrandom): Likewise. * sysdeps/unix/sysv/linux/getrandom.c (getrandom): Likewise. * sysdeps/mach/hurd/getentropy.c (getentropy): Use __getrandom instead of getrandom.
* dlopen: Rework handling of pending NODELETE statusFlorian Weimer2019-12-131-20/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit a2e8aa0d9ea648068d8be52dd7b15f1b6a008e23 ("Block signals during the initial part of dlopen") was deemed necessary because of read-modify-write operations like the one in add_dependency in elf/dl-lookup.c. In the old code, we check for any kind of NODELETE status and bail out: /* Redo the NODELETE check, as when dl_load_lock wasn't held yet this could have changed. */ if (map->l_nodelete != link_map_nodelete_inactive) goto out; And then set pending status (during relocation): if (flags & DL_LOOKUP_FOR_RELOCATE) map->l_nodelete = link_map_nodelete_pending; else map->l_nodelete = link_map_nodelete_active; If a signal arrives during relocation and the signal handler, through lazy binding, adds a global scope dependency on the same map, it will set map->l_nodelete to link_map_nodelete_active. This will be overwritten with link_map_nodelete_pending by the dlopen relocation code. To avoid such problems in relation to the l_nodelete member, this commit introduces two flags for active NODELETE status (irrevocable) and pending NODELETE status (revocable until activate_nodelete is invoked). As a result, NODELETE processing in dlopen does not introduce further reasons why lazy binding from signal handlers is unsafe during dlopen, and a subsequent commit can remove signal blocking from dlopen. This does not address pre-existing issues (unrelated to the NODELETE changes) which make lazy binding in a signal handler during dlopen unsafe, such as the use of malloc in both cases. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Add more missing placeholder abi symbol from nanosleep moveAdhemerval Zanella2019-12-091-0/+36
| | | | | | | | | | | | | | | | | | | | This patch adds the missing __libpthread_version_placeholder for GLIBC_2.2.6 version from the nanosleep implementation move from libpthread to libc (79a547b162). It also fixes the wrong compat symbol definitions added by changing back the version used on vfork check and remove the __libpthread_version_placeholder added on some ABI (4f4bb489e0dd). The __libpthread_version_placeholder is also refactored to make it simpler to add new compat_symbols by adding a new macro compat_symbol_unique which uses the compiler extension __COUNTER__ to generate unique strong alias to be used with compat_symbol. Checked with a updated-abi on the all affected abis of the nanosleep move. Change-Id: I347a4dbdc931bb42b359456932dd1e17aa4d4078
* y2038: linux: Provide __timer_settime64 implementationLukasz Majewski2019-12-051-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __timer_settime64 explicit 64 bit function for setting flags, interval and value of specified timer. Moreover, a 32 bit version - __timer_settime has been refactored to internally use __timer_settime64. The __timer_settime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit struct __timespec64 from struct timespec (and opposite when old_value pointer is provided). The new __timer_settime64 syscall available from Linux 5.1+ has been used, when applicable. The original INLINE_SYSCALL() macro has been replaced with INLINE_SYSCALL_CALL() to avoid explicit passing the number of arguments. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\ make xcheck PARALLELMFLAGS="-j8" - The glibc has been build tested (make PARALLELMFLAGS="-j8") for x86 (i386), x86_64-x32, and armv7 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 - Use of cross-test-ssh.sh for ARM (armv7): make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with timer_settime64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_settime64 syscall. - Linux v4.19 (no timer_settime64 support) with default minimal kernel version for contemporary glibc (3.2.0) This kernel doesn't support timer_settime64 syscall, so the fallback to timer_settime is tested. Above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __timer_gettime64 implementationLukasz Majewski2019-12-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __timer_gettime64 explicit 64 bit function for reading status of specified timer. To be more precise - the remaining time and interval set with timer_settime. Moreover, a 32 bit version - __timer_gettime has been refactored to internally use __timer_gettime64. The __timer_gettime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion from 64 bit struct __timespec64 to struct timespec. The new __timer_gettime64 syscall available from Linux 5.1+ has been used, when applicable. The original INLINE_SYSCALL() macro has been replaced with INLINE_SYSCALL_CALL() to avoid explicit passing the number of arguments. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\ make xcheck PARALLELMFLAGS="-j8" - The glibc has been build tested (make PARALLELMFLAGS="-j8") for x86 (i386), x86_64-x32, and armv7 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 - Use of cross-test-ssh.sh for ARM (armv7): make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with timer_gettime64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_gettime64 syscall. - Linux v4.19 (no timer_gettime64 support) with default minimal kernel version for contemporary glibc (3.2.0) This kernel doesn't support timer_gettime64 syscall, so the fallback to timer_gettime is tested. Above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* time: Introduce glibc's internal struct __itimerspec64Lukasz Majewski2019-12-051-0/+11
| | | | | | | | | | This change provides the glibc's internal struct itimerspec representation, which is explicitly supporting 64 bit time (by using struct __timespec64). Such representation is necessary to provide correct time after Y2038 (time_t overflow) on devices with __TIMESIZE == 32. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/clock_gettime: Use clock_gettime64 if avaliableAlistair Francis2019-12-041-0/+3
| | | | | | | | With the clock_gettime64 call we prefer to use vDSO. There is no call to clock_gettime64 on glibc with older headers and kernel 5.1+ if it doesn't support vDSO. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ldbl-128ibm-compat: Add strfmon_l with IEEE long double formatRajalakshmi Srinivasaraghavan2019-12-031-0/+1
| | | | | | | | | | | | Similarly to what has been done for printf-like functions, more specifically to the internal implementation in __vfprintf_internal, this patch extends __vstrfmon_l_internal to deal with long double values with binary128 format (as a third format option and reusing the float128 implementation). Tested for powerpc64le, powerpc64, x86_64, and with build-many-glibcs. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* hurd: Fix ld.so __access override from libcSamuel Thibault2019-12-011-1/+2
| | | | | | ld.so symbols to be overriden by libc need to be extern to really get overriden. __access happens to have never been exposed, putting it to GLIBC_PRIVATE.
* hurd: Fix ld.so __getcwd override from libcSamuel Thibault2019-12-011-1/+2
| | | | | | ld.so symbols to be overriden by libc need to be extern to really get overriden. __getcwd happens to have never been exposed, putting it to GLIBC_PRIVATE.
* Remove all loaded objects if dlopen fails, ignoring NODELETE [BZ #20839]Florian Weimer2019-11-271-0/+20
| | | | | | | | | | | | | This introduces a “pending NODELETE” state in the link map, which is flipped to the persistent NODELETE state late in dlopen, via activate_nodelete. During initial relocation, symbol binding records pending NODELETE state only. dlclose ignores pending NODELETE state. Taken together, this results that a partially completed dlopen is rolled back completely because new NODELETE mappings are unloaded. Tested on x86_64-linux-gnu and i386-linux-gnu. Change-Id: Ib2a3d86af6f92d75baca65431d74783ee0dbc292
* Use DEPRECATED_SCANF macro for remaining C99-compliant scanf functionsGabriel F. T. Gomes2019-11-221-6/+0
| | | | | | | | | | | | | | | | | | | | When the commit commit 03992356e6fedc5a5e9d32df96c1a2c79ea28a8f Author: Zack Weinberg <zackw@panix.com> Date: Sat Feb 10 11:58:35 2018 -0500 Use C99-compliant scanf under _GNU_SOURCE with modern compilers. added the DEPRECATED_SCANF macro to select when redirections of *scanf functions to their ISO C99 compliant versions should happen, it accidentally missed doing it for vfwscanf, vwscanf, and vswscanf. Tested for powerpc64le and with build-many-glibcs (i686-linux-gnu and nios2-linux-gnu are failing with current master, and with this patch, but I didn't see a regression). Change-Id: I706b344a3fb50be017cdab9251d9da18a3ba8c60
* Enable inlining issignalingf within glibcPaul A. Clarke2019-11-211-0/+53
| | | | | | | | | issignalingf is a very small function used in some areas where better performance (and smaller code) might be helpful. Create inline implementation for issignalingf. Reviewed-by: Joseph Myers <joseph@codesourcery.com>
* Avoid zero-length array at the end of struct link_map [BZ #25097]Florian Weimer2019-11-151-8/+10
| | | | | | | | | | | | l_audit ends up as an internal array with _rtld_global, and GCC 10 warns about this. This commit does not change the layout of _rtld_global, so it is suitable for backporting. Future changes could allocate more of the audit state dynamically and remove it from always-allocated data structures, to optimize the common case of inactive auditing. Change-Id: Ic911100730f9124d4ea977ead8e13cee64b84d45
* y2038: linux: Provide __ppoll64 implementationLukasz Majewski2019-11-111-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __ppoll64 explicit 64 bit function for handling polling events (with struct timespec specified timeout) for a set of file descriptors. Moreover, a 32 bit version - __ppoll has been refactored to internally use __ppoll64. The __ppoll is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit struct __timespec64. The new ppoll_time64 syscall available from Linux 5.1+ has been used, when applicable. The Linux kernel checks if passed tv_nsec value overflows, so there is no need to repeat it in the glibc. When ppoll syscall on systems supporting 32 bit time ABI is used, the check is performed if passed data (which may have 64 bit tv_sec) fits into 32 bit range. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\ make xcheck PARALLELMFLAGS="-j8" - The glibc has been build tested (make PARALLELMFLAGS="-j8") for x86 (i386), x86_64-x32, and armv7 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 - Use of cross-test-ssh.sh for ARM (armv7): make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with ppoll_time64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports ppoll_time64 syscall. - Linux v4.19 (no ppoll_time64 support) with default minimal kernel version for contemporary glibc This kernel doesn't support ppoll_time64 syscall, so the fallback to ppoll is tested. Above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed.
* sysdeps/clock_nanosleep: Use clock_nanosleep_time64 if avaliableAlistair Francis2019-11-081-0/+8
| | | | | | The clock_nanosleep syscall is not supported on newer 32-bit platforms (such as RV32). To fix this issue let's use clock_nanosleep_time64 if it is avaliable.
* Refactor nanosleep in terms of clock_nanosleepAdhemerval Zanella2019-11-061-0/+3
| | | | | | | | | | | | | The generic version is straightforward. For Hurd, its nanosleep implementation is moved to clock_nanosleep with adjustments from generic unix implementation. The generic clock_nanosleep unix version is also removed since it calls nanosleep. Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* posix: Sync regex with gnulibAdhemerval Zanella2019-11-061-0/+2
| | | | | | | | | | | | | It sync with gnulib commit 6cfb4302b3e1da14d706198b693558290e9b00f4 and contains the fixes: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=32915b2a8a43825720755113bdffe9f67a591748 https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=48f07576b8cd935b48e1050551f45ab1a79b9f01 https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=5e407aba1f775d51b25481cb55f324c9868f62d7 https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4e02b30c761c76d04057fa5f6bba71401f9310cd https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=79f8ee4e389f8cb1339f8abed9a7d29816e2a2d4 Checked on x86_64-linux-gnu and i686-linux-gnu.
* y2038: linux: Provide __futimens64 implementationLukasz Majewski2019-11-021-0/+7
| | | | | | | | | | | | | | | | | | | This patch provides new __futimens64 explicit 64 bit function for setting access and modification time of file (by using its file descriptor). Moreover, a 32 bit version - __futimens has been refactored to internally use __futimens64. The __futimens is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions to 64 bit struct __timespec64. When pointer to struct __timespec64 is NULL - the file access and modification time is set to the current one (by the kernel) and no conversions from struct timespec to __timespec64 are performed. The __futimens64 reuses __utimensat64_helper defined for __utimensat64. The test procedure for __futimens64 is the same as for __utimensat64 conversion patch.
* y2038: linux: Provide __utimensat64 implementationLukasz Majewski2019-11-021-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __utimensat64 explicit 64 bit function for setting access and modification time of a file. Moreover, a 32 bit version - __utimensat has been refactored to internally use __utimensat64. The __utimensat is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions to 64 bit struct __timespec64. When pointer to struct __timespec64 is NULL - the file access and modification time is set to the current one and no conversions from struct timespec to __timespec64 are performed. The new utimensat_time64 syscall available from Linux 5.1+ has been used, when applicable. The new helper function - __utimensat64_helper - has been introduced to facilitate code re-usage on function providing futimens syscall handling. The Linux kernel checks if passed tv_nsec value overflows, so there is no need to repeat it in glibc. When utimensat syscall on systems supporting 32 bit time ABI is used, the check is performed if passed data (which may have 64 bit tv_sec) fits into 32 bit range. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make xcheck PARALLELMFLAGS="-j8" - The glibc has been build tested (make PARALLELMFLAGS="-j8") for x86 (i386), x86_64-x32, and armv7 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 - Use of cross-test-ssh.sh for ARM (armv7): make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with utimensat_time64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports utimensat_time64 syscall. - Linux v4.19 (no utimensat_time64 support) with default minimal kernel version for contemporary glibc This kernel doesn't support utimensat_time64 syscall, so the fallback to utimensat is tested. The above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed.
* Sync intprops.h with gnulibAdhemerval Zanella2019-10-311-45/+169
| | | | | | It sync with gnulib commit f5756b919addb9e8ce03f4e61a10e4fcff14874a. Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>