about summary refs log tree commit diff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* hurd: Move {,f,l}xstat{,at} and xmknod{at} to compat symbolsSamuel Thibault2020-11-111-31/+0
| | | | | | We do not actually need them, so we can move their implementations into the standard {,f,l}stat{,at} variants and only keep compatibility wrappers.
* hurd: keep only required PLTs in ld.soSamuel Thibault2020-11-119-8/+10
| | | | | | | | | | | | | | | | | | | | | We need NO_RTLD_HIDDEN because of the need for PLT calls in ld.so. See Roland's comment in https://sourceware.org/bugzilla/show_bug.cgi?id=15605 "in the Hurd it's crucial that calls like __mmap be the libc ones instead of the rtld-local ones after the bootstrap phase, when the dynamic linker is being used for dlopen and the like." We used to just avoid all hidden use in the rtld ; this commit switches to keeping only those that should use PLT calls, i.e. essentially those defined in sysdeps/mach/hurd/dl-sysdep.c: __assert_fail __assert_perror_fail __*stat64 _exit This fixes a few startup issues, notably the call to __tunable_get_val that is made before PLTs are set up.
* misc: Add internal __getauxval2 functionFlorian Weimer2020-10-271-0/+5
| | | | | | | | The explicit error return value (without in-band signaling) avoids complicated steps to detect errors based on whether errno has been updated. Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* time: Add 64-bit time_t support for ftimeAdhemerval Zanella2020-10-273-0/+29
| | | | | | | | | It basically calls the 64-bit __clock_gettime64 and adds the overflow check. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Reinstate ftime and add deprecate message on ftime usageAdhemerval Zanella2020-10-271-0/+1
| | | | | | | This patch revert "Move ftime to a compatibility symbol" (commit 14633d3e568eb9770a7e5046eff257113e0453fb). Checked on x86_64-linux-gnu and i686-linux-gnu.
* Move vtimes to a compatibility symbolAdhemerval Zanella2020-10-191-1/+0
| | | | | | | | | | | | | | I couldn't pinpoint which standard has added it, but no other POSIX system supports it and/or no longer provide it. The 'struct vtimes' also has a lot of drawbacks due its limited internal type size. I couldn't also see find any project that actually uses this symbol, either in some dignostic way (such as sanitizer). So I think it should be safer to just move to compat symbol, instead of deprecated. The idea it to avoid new ports to export such broken interface (riscv32 for instance). Checked on x86_64-linux-gnu and i686-linux-gnu.
* y2038: linux: Provide __time64 implementationLukasz Majewski2020-10-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the glibc the time function can use vDSO (on power and x86 the USE_IFUNC_TIME is defined), time syscall or 'default' time() from ./time/time.c (as a fallback). In this patch the last function (time) has been refactored and moved to ./sysdeps/unix/sysv/linux/time.c to be Linux specific. The new __time64 explicit 64 bit function for providing 64 bit value of seconds after epoch (by internally calling __clock_gettime64) has been introduced. Moreover, a 32 bit version - __time has been refactored to internally use __time64. The __time is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary check for time_t potential overflow. The iFUNC vDSO direct call optimization has been removed from both i686 and powerpc32 (USE_IFUNC_TIME is not defined for those architectures anymore). The Linux kernel does not provide a y2038 safe implementation of time 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_TIME 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 __time64 and __time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* linux: Add __readdir_unlockedAdhemerval Zanella2020-10-161-0/+1
| | | | | | And use it on readdir_r implementation. Checked on i686-linux-gnu.
* linux: Simplify opendir buffer allocationAdhemerval Zanella2020-10-161-1/+2
| | | | | | | | | The fallback allocation is removed, so the possible size constraint should be analyzed just once; __alloc_dir assumes that 'statp' argument is non-null, and the max_buffer_size move to close its used. Checked on x86_64-linux-gnu and i686-linux-gnu.
* linux: Add 64-bit time_t support for wait3Adhemerval Zanella2020-10-161-0/+4
| | | | | | | | It basically calls the 64-bit time_t wait4 internal symbol. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Move ftime to a compatibility symbolAdhemerval Zanella2020-10-161-1/+0
| | | | | | | | | | It was made deprecated on 2.31, so it moves to compat symbol after two releases. It was also removed from exported symbol for riscv32 (since ABI will be supported on for 2.33). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* y2038: Remove not used __fstatat_time64 defineLukasz Majewski2020-10-151-1/+0
| | | | | This define is only present in the ./include/sys/stat.h file. As it is not used in any other place it is eligible to be removed.
* linux: Move xmknod{at} to compat symbolsAdhemerval Zanella2020-10-091-2/+2
| | | | | | | | | | | It also decouple mknod{at} from xmknod{at}. The riscv32 ABI was added on 2.33, so it is safe to remove the old __xmknot{at} symbols and just provide the newer mknod{at} ones. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* linux: Add {f}stat{at} y2038 supportAdhemerval Zanella2020-10-091-0/+20
| | | | | | | | | | | | | | | | | | | | A new struct __stat{64}_t64 type is added with the required __timespec64 time definition. Only LFS is added, 64-bit time with 32-bit offsets is not supposed to be supported (no existing glibc configuration supports such a combination). It is done with an extra __NR_statx call plus a conversion to the new __stat{64}_t64 type. The statx call is done only for 32-bit time_t ABIs. Internally some extra routines to copy from/to struct stat{64} to struct __stat{64} used on multiple implementations (stat, fstat, lstat, and fstatat) are added on a extra implementation (stat_t64_cp.c). Alse some extra routines to copy from statx to __stat{64} is added on statx_cp.c. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* linux: Disentangle fstatat from fxstatatAdhemerval Zanella2020-10-091-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It implements all the required syscall for the all Linux kABIS on fstatat{64} instead of calling fxstatat{64}. On non-LFS implementation, it handles 3 cases: 1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios): it issues __NR_fstat64 plus handle the overflow on st_ino, st_size, or st_blocks. 2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k, microblaze, mips32, s390, sh, powerpc, and sparc32): it issues __NR_fstatat64 and convert the result to struct stat. 3. 64-bit kABI outliers (mips64 and mips64-n32): it issues __NR_newfstatat and convert the result to struct stat. The generic LFS implementation handles multiple cases: 1. XSTAT_IS_XSTAT64 being 1: 1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and x86_64): it issues __NR_newfstatat. 1.2. 64-bit kABI outlier (alpha): it issues __NR_fstatat64. 1.3. 64-bit kABI outlier where struct stat64 does not match kernel one (sparc64): it issues __NR_fstatat64 and convert the result to struct stat64. 1.4. 32-bit kABI with default 64-bit time_t (arc, riscv32): it issues __NR_statx and convert the result to struct stat64. 2. Old ABIs with XSTAT_IS_XSTAT64 being 0: 2.1. All kABIs with non-LFS support (arm, csky, i386, hppa, m68k, microblaze, nios2, sh, powerpc32, and sparc32): it issues __NR_fstatat64. 2.2. 64-bit kABI outliers (mips64 and mips64-n32): it issues __NR_newfstatat and convert the result to struct stat64. It allows to remove all the hidden definitions from the {f,l}xstat{64} (some are still kept because Hurd requires it). Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Remove mknod wrapper functions, move them to symbolsAdhemerval Zanella2020-10-091-5/+9
| | | | | | | | | | | | | | | | | | | This patch removes the mknod and mknodat static wrapper and add the symbols on the libc with the expected names. Both the prototypes of the internal symbol linked by the static wrappers and the inline redirectors are also removed from the installed sys/stat.h header file. The wrapper implementation license LGPL exception is also removed since it is no longer statically linked to binaries. Internally the _STAT_VER* definitions are moved to the arch-specific xstatver.h file. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Remove stat wrapper functions, move them to exported symbolsAdhemerval Zanella2020-10-091-37/+55
| | | | | | | | | | | | | | | | | | | | | | | | This patch removes the stat, stat64, lstat, lstat64, fstat, fstat64, fstatat, and fstatat64 static wrapper and add the symbol on the libc with the expected names. Both the prototypes of the internal symbol linked by the static wrappers and the inline redirectors are also removed from the installed sys/stat.h header file. The wrapper implementation license LGPL exception is also removed since it is no longer statically linked to binaries. Internally the _STAT_VER* definitions are moved to a arch-specific xstatver.h file. The internal defines that redirects internals {f}stat{at} to their {f}xstat{at} counterparts are removed for Linux (!NO_RTLD_HIDDEN). Hurd still requires them since {f}stat{at} pulls extra objects that makes the loader build fail otherwise (I haven't dig into why exactly). Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* elf: Make __rtld_env_path_list and __rtld_search_dirs global variablesFlorian Weimer2020-10-081-0/+4
| | | | | | | | | They have been renamed from env_path_list and rtld_search_dirs to avoid linknamespace issues. This change will allow future use these variables in diagnostics. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Implement __rtld_malloc_is_completeFlorian Weimer2020-10-081-0/+4
| | | | | | | | In some cases, it is difficult to determine the kind of malloc based on the execution context, so a function to determine that is helpful. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix GCC 11 -Warray-parameter warning for __sigsetjmp (bug 26647)Joseph Myers2020-10-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This patch fixes part of bug 26647 (-Werror=array-parameter error building with GCC 11 because of __sigsetjmp being declared using an array parameter in one header and a pointer parameter in another). The fix is to split the struct __jmp_buf_tag definition out to a separate bits/types/ header so it can be included in pthread.h, so that pthread.h can declare __sigsetjmp with the type contents visible, so can use an array (as in setjmp.h) rather than a pointer in the declaration. Note that several other build failures with GCC 11 remain. This does not fix the jmp_buf-related -Wstringop-overflow errors (also discussed in bug 26647), or -Warray-parameter errors for other functions (bug 26686), or -Warray-bounds errors (bug 26687). Tested, with older compilers, natively for x86_64 and with build-many-glibc.py for aarch64-linux-gnu. Tested with build-many-glibcs.py with GCC mainline for aarch64-linux-gnu that this gets past the -Warray-parameter issue for __sigsetjmp (with the next build failure being the other one discussed in bug 26647).
* linux: Add time64 recvmmsg supportAdhemerval Zanella2020-09-281-0/+8
| | | | | | | | | | | | | | | The wire-up syscall __NR_recvmmsg_time64 (for 32-bit) or __NR_recvmmsg (for 64-bit) is used as default. The 32-bit fallback is used iff __ASSUME_TIME64_SYSCALLS is not defined, which assumes the kernel ABI provides either __NR_socketcall or __NR_recvmmsg (32-bit time_t). It does not handle the timestamps on ancillary data (SCM_TIMESTAMPING records). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* linux: Add time64 support for nanosleepAdhemerval Zanella2020-09-281-0/+9
| | | | | | | | | It uses __clock_nanosleep64 and adds the __nanosleep64 symbol. Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15 kernel). Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* linux: Add time64 sigtimedwait supportAdhemerval Zanella2020-09-281-0/+8
| | | | | | | | | | | The syscall __NR_sigtimedwait_time64 (for 32-bit) or __NR_sigtimedwait (for 64-bit) is used as default. The 32-bit fallback is used iff __ASSUME_TIME64_SYSCALLS is not defined, which assumes the kernel ABI provides either __NR_rt_sigtimedwait (32-bit time_t). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* linux: Add time64 select supportAdhemerval Zanella2020-09-282-0/+14
| | | | | | | | | | | | | The syscall __NR_pselect6_time64 (32-bit) or __NR_pselect6 (64-bit) is used as default. For architectures with __ASSUME_TIME64_SYSCALLS the 32-bit fallback uses __NR_select/__NR__newselect or __NR_pselect6 (it should cover the microblaze case where older kernels do not provide __NR_pselect6). Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15 kernel). Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* linux: Add time64 pselect supportAdhemerval Zanella2020-09-111-0/+16
| | | | | | | | | | | | | | | The syscall __NR_pselect6_time64 (32-bit) or __NR_pselect6 (64-bit) is used as default. For architectures with __ASSUME_TIME64_SYSCALLS the 32-bit fallback uses __NR_pselec6. To accomodate microblaze missing pselect6 support on kernel older than 3.15 the fallback is moved to its own function to the microblaze specific implementation can override it. Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15 kernel). Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* Remove internal usage of extensible stat functionsAdhemerval Zanella2020-09-111-0/+1
| | | | | | | | | | | | It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Add C2x BOOL_MAX and BOOL_WIDTH to limits.h.Joseph Myers2020-08-191-0/+12
| | | | | | | | C2x adds BOOL_MAX and BOOL_WIDTH macros to <limits.h>. This patch adds them to glibc's <limits.h> for the case when they aren't defined by GCC's <limits.h>. Tested for x86_64.
* Sync intprops.h from GnulibPaul Eggert2020-08-041-6/+11
| | | | | | * include/intprops.h: Sync from Gnulib. This improves performance of INT_MULTIPLY_WRAPV on recent GCC, which affects glibc only in the support library.
* Prepare for glibc 2.32 release. glibc-2.32Carlos O'Donell2020-08-041-1/+1
| | | | Update version.h, features.h, and ChangeLog.old/ChangeLog.21.
* libio: Remove __libc_readline_unlockedFlorian Weimer2020-07-211-13/+0
| | | | | | | | | | | __nss_readline supersedes it. This reverts part of commit 3f5e3f5d066dcffb80af48ae2cf35a01a85a8f10 ("libio: Implement internal function __libc_readline_unlocked"). The internal aliases __fseeko64 and __ftello64 are preserved because they are needed by __nss_readline as well. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nss: Add __nss_fgetent_rFlorian Weimer2020-07-211-0/+29
| | | | | | | | | | | | And helper functions __nss_readline, __nss_readline_seek, __nss_parse_line_result. This consolidates common code for handling overlong lines and parse files. Use the new functionality in internal_getent in nss/nss_files/files-XXX.c. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* libio: Add fseterr_unlocked for internal useFlorian Weimer2020-07-211-0/+7
| | | | | Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nss_files: Use generic result pointer in parse_lineFlorian Weimer2020-07-211-36/+12
| | | | | | | | | | | | | As a result, all parse_line functions have the same prototype, except for that producing struct hostent. This change is ABI-compatible, so it does not alter the internal GLIBC_PRIVATE ABI (otherwise we should probably have renamed the exported functions). A future change will use this to implement a generict fget*ent_r function. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nss_files: Consolidate line parse declarations in <nss_files.h>Florian Weimer2020-07-218-49/+51
| | | | | | | | These functions should eventually have the same type, so it makes sense to declare them together. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nss_files: Consolidate file opening in __nss_files_fopenFlorian Weimer2020-07-211-0/+28
| | | | | Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Move <rpc/netdb.h> from sunrpc to inetFlorian Weimer2020-07-171-1/+1
| | | | | | | | | | | Restore <rpc/netdb.h> as an installed header. Delete the dummy header resolv/rpc/netdb.h because inet is not an optional glibc component (so its <rpc/netdb.h> is always available). Fixes commit acb527929d0c2b3bb0798472c42ddb3203729708 ("Move non-deprecated RPC-related functions from sunrpc to inet") in combination with commit 5500cdba4018ddbda7909bc7f4f9718610b43cf0 ("Remove --enable-obsolete-rpc configure flag").
* Remove --enable-obsolete-rpc configure flagPetr Vorel2020-07-132-13/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* sysv: linux: Add 64-bit time_t variant for shmctlAdhemerval Zanella2020-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* sysv: linux: Add 64-bit time_t variant for msgctlAdhemerval Zanella2020-07-091-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* sysv: linux: Add 64-bit time_t variant for semctlAdhemerval Zanella2020-07-091-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Remove --enable-obsolete-nsl configure flagPetr Vorel2020-07-0812-101/+6
| | | | | | | | | | | | | | | | | | | this means that *always* libnsl is only built as shared library for backward compatibility and the NSS modules libnss_nis and libnss_nisplus are not built at all, libnsl's headers aren't installed. This compatibility is kept only for architectures and ABIs that have been added in or before version 2.28. Replacement implementations based on TIRPC, which additionally support IPv6, are available from <https://github.com/thkukuk/>. This change does not affect libnss_compat which does not depended on libnsl since 2.27 and thus can be used without NIS. libnsl code depends on Sun RPC, e.g. on --enable-obsolete-rpc (installed libnsl headers use installed Sun RPC headers), which will be removed in the following commit.
* sunrpc: Remove hidden aliases for global data symbols (bug 26210)Florian Weimer2020-07-082-5/+0
| | | | | | | | | | | | | It is generally not possible to add hidden aliases for global data symbols: If the main executable contains a copy relocation against the symbol, the hidden aliases keep pointing to the glibc-internal copy of the symbol, instead of the symbol actually used by the application. Fixes commit 89aacb513eb77549a29df2638913a0f8178cf3f5 ("sunrpc: Remove stray exports without --enable-obsolete-rpc [BZ #23166]"). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* string: Add strerrorname_np and strerrordesc_npAdhemerval Zanella2020-07-071-0/+1
| | | | | | | | | | | | | | | | | The strerrorname_np returns error number name (e.g. "EINVAL" for EINVAL) while strerrordesc_np returns string describing error number (e.g "Invalid argument" for EINVAL). Different than strerror, strerrordesc_np does not attempt to translate the return description, both functions return NULL for an invalid error number. They should be used instead of sys_errlist and sys_nerr, both are thread and async-signal safe. These functions are GNU extensions. Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, and s390x-linux-gnu. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* string: Add sigabbrev_np and sigdescr_npAdhemerval Zanella2020-07-072-1/+5
| | | | | | | | | | | | | | | | | | The sigabbrev_np returns the abbreviated signal name (e.g. "HUP" for SIGHUP) while sigdescr_np returns the string describing the error number (e.g "Hangup" for SIGHUP). Different than strsignal, sigdescr_np does not attempt to translate the return description and both functions return NULL for an invalid signal number. They should be used instead of sys_siglist or sys_sigabbrev and they are both thread and async-signal safe. They are added as GNU extensions on string.h header (same as strsignal). Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, and s390x-linux-gnu. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* string: Use tls-internal on strerror_lAdhemerval Zanella2020-07-071-3/+0
| | | | | | | | | | The buffer allocation uses the same strategy of strsignal. Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, and s390x-linux-gnu. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* string: Implement strerror in terms of strerror_lAdhemerval Zanella2020-07-071-0/+4
| | | | | | | | | | | | | | If the thread is terminated then __libc_thread_freeres will free the storage via __glibc_tls_internal_free. It is only within the calling thread that this matters. It makes strerror MT-safe. Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, and s390x-linux-gnu. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Fix __NSIG_WORDS and add __NSIG_BYTESAdhemerval Zanella2020-07-071-0/+2
| | | | | | | | | | | | | | The __NSIG_WORDS value is based on minimum number of words to hold the maximum number of signals supported by the architecture. This patch also adds __NSIG_BYTES, which is the number of bytes required to represent the supported number of signals. It is used in syscalls which takes a sigset_t. Checked on x86_64-linux-gnu and i686-linux-gnu. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* signal: Move sys_errlist to a compat symbolAdhemerval Zanella2020-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | The symbol is deprecated by strerror since its usage imposes some issues such as copy relocations. Its internal name is also changed to _sys_errlist_internal to avoid static linking usage. The compat code is also refactored by removing the over enginered errlist-compat.c generation from manual entried and extra comment token in linker script file. It disantangle the code generation from manual and simplify both Linux and Hurd compat code. The definitions from errlist.c are moved to errlist.h and a new test is added to avoid a new errno entry without an associated one in manual. Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi on all affected platforms. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* signal: Move sys_siglist to a compat symbolAdhemerval Zanella2020-07-071-1/+3
| | | | | | | | | | | | | | | | | | | The symbol was deprecated by strsignal and its usage imposes issues such as copy relocations. Its internal name is changed to __sys_siglist and __sys_sigabbrev to avoid static linking usage. The compat code is also refactored, since both Linux and Hurd usage the same strategy: export the same array with different object sizes. The libSegfault change avoids calling strsignal on the SIGFAULT signal handler (the current usage is already sketchy, adding a call that potentially issue locale internal function is even sketchier). Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi on all affected platforms. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Add the __libc_single_threaded variableFlorian Weimer2020-07-061-0/+1
| | | | | | | | | | | | | | The variable is placed in libc.so, and it can be true only in an outer libc, not libcs loaded via dlmopen or static dlopen. Since thread creation from inner namespaces does not work, pthread_create can update __libc_single_threaded directly. Using __libc_early_init and its initial flag, implementation of this variable is very straightforward. A future version may reset the flag during fork (but not in an inner namespace), or after joining all threads except one. Reviewed-by: DJ Delorie <dj@redhat.com>