about summary refs log tree commit diff
path: root/sysdeps/unix
Commit message (Collapse)AuthorAgeFilesLines
* Define __STATFS_MATCHES_STATFS64Alistair Francis2019-10-247-2/+28
| | | | | | | | Add a new macro __STATFS_MATCHES_STATFS64 that specifies if fsblkcnt_t matches fsblkcnt64_t and if fsfilcnt_t matches fsfilcnt64_t. As we don't have the padding we also need to update the overflow checker to not access the undefined members.
* sysdeps/stat: Handle 64-bit ino_t types on 32-bit hostsAlistair Francis2019-10-234-2/+38
| | | | | | | On a 32-bit platform with a 64-bit ino_t type (__INO_T_MATCHES_INO64_T defined) we want to update the stat struct to remove the padding as it isn't required. As we don't have the padding we also need to update the overflow checker to not access the undefined members.
* S390: Remove not needed stack frame in syscall function.Stefan Liebler2019-10-232-44/+8
| | | | | | | | As an svc invocation does not clobber any user space registers despite of the return value r2 and it does not need a special stack frame. This patch gets rid of the extra frame. We just have to save and restore r6 and r7 as those are preserved across function calls.
* Include <kernel-features.h> explicitly in Linux clock_settime.cLukasz Majewski2019-10-201-0/+1
| | | | | | | | | | | The rewritten clock_settime code (which now supports 64 bit time on systems with __WORDSIZE == 32) for Linux now relies on the __ASSUME_TIME64_SYSCALLS flag set. Lets explicitly include the header file where it is defined to avoid any indirect inclusion (which may pose some unwanted API definitions). Tested with scripts/build-many-glibcs.py script.
* Add nocancel version of pread64()Leandro Pereira2019-10-184-2/+39
| | | | | | | This is in preparation for changes in the dynamic linker so that pread() is used instead of lseek()+read(). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update sysvipc kernel-features.h files for Linux 5.1Adhemerval Zanella2019-10-1811-27/+57
| | | | | | | | | | | | | | | | | | | | | | | | Linux 5.1 adds missing SySV IPC syscalls to the syscall table for remanining one that still uses the ipc syscall on glibc (m68k, mips-o32, powerpc, s390, sh, and sparc32). However the newly added direct ipc syscall are different than the old ones: 1. They do not expect IPC_64, meaning __IPC_64 should be set to zero when new syscalls are used. And new syscalls can not be used for compat functions like __old_semctl (to emulated old sysvipc it requires to use the old __NR_ipc syscall without __IPC_64). Thus IPC_64 is redefined for newer kernels on affected ABIs. 2. semtimedop and semop does not exist on 32-bit ABIs (only semtimedop_time64 is supplied). The provided syscall wrappers only uses the wire-up syscall if __NR_semtimedop and __NR_semop are also defined. Checked on x86_64-linux-gnu and i686-linux-gnu on both a 4.15 kernel configure with default options and sysvipc tests on a 5.3.0 kernel with --enable-kernel=5.1. Tested-by: Paul A. Clarke <pc@us.ibm.com>
* nptl: SIGCANCEL, SIGTIMER, SIGSETXID are always definedFlorian Weimer2019-10-181-54/+0
| | | | | | | | | | | All nptl targets have these signal definitions nowadays. This changes also replaces the nptl-generic version of pthread_sigmask with the Linux version. Tested on x86_64-linux-gnu and i686-linux-gnu. Built with build-many-glibcs.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysvipc: Implement semop based on semtimedopAdhemerval Zanella2019-10-172-7/+4
| | | | | | | | | | | | | | Besides semop being a subset of semtimedop, new 32-bit architectures on Linux are not expected to provide the syscall (only the 64-bit time semtimedop). Also, Linux 5.1 only wired-up semtimedop for the 64-bit architectures that missed it (powerpc, s390, and sparc). This simplifies the code to support it. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* ipc: Refactor sysvipc internal definitionsAdhemerval Zanella2019-10-1722-192/+56
| | | | | | | | | | | | | | | | | | | | | | | This patch refactor the internal sysvipc in two main points: 1. Add a new __ASSUME_SYSVIPC_DEFAULT_IPC_64 to infer the __IPC_64 value to be used along either the multiplexed __NR_ipc or wired-up syscall. The defaut value assumed for __IPC_64 is also changed from 0x100 to 0x0, aligning with Linux generic UAPI. The idea is to simplify the Linux 5.1 wire-up for sysvipc syscalls for some 32-bit ABIs (which expectes __IPC_64 being 0x0) and simplify new ports (which will no longer need to add ipc_priv.h). 2. It also removes some duplicated internal definition used on compat sysvipc symbols defined at ipc_priv.h (more specifically the __old_ipc_perm, SEMCTL_ARG_ADDRESS, MSGRCV_ARGS, and SEMTIMEDOP_IPC_ARGS). The idea is also to make it simpler to enable the new wire-up sysvipc syscall provided by Linux v5.1. There is no semantic change expected on any port. Checked with a build against all affected ABIs. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Add PTRACE_GET_SYSCALL_INFO from Linux 5.3 to sys/ptrace.h.Joseph Myers2019-10-149-7/+96
| | | | | | | | | | | | | Linux 5.3 adds a PTRACE_GET_SYSCALL_INFO constant, with an associated structure and PTRACE_SYSCALL_INFO_* constants. This patch adds these to sys/ptrace.h in glibc (PTRACE_GET_SYSCALL_INFO in each architecture version, the rest in bits/ptrace-shared.h). As with previous such constants and associated structures, the glibc version of the structure is named struct __ptrace_syscall_info. Tested for x86_64, and with build-many-glibcs.py.
* sysvipc: Set ipc_perm mode as mode_t (BZ#18231)Adhemerval Zanella2019-10-1032-419/+336
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch sets the mode field in ipc_perm as mode_t for all architectures, as POSIX specification [1]. The changes required are as follow: 1. It moves the ipc_perm definition out of ipc.h to its own header ipc_perm.h. It also allows consolidate the IPC_* definition on only one header. 2. The generic implementation follow the kernel ipc64_perm size so the syscall can be made directly without temporary buffer copy. However, since glibc defines the MODE field as mode_t, it omits the __PAD1 field (since glibc does not export mode_t as 16-bit for any architecture). It is a two-fold improvement: 2.1. New implementation which follow Linux UAPI will not need to provide an arch-specific ipc-perm.h header neither wrongly use the wrong 16-bit definition from previous default ipc.h (as csky did). 2.1. It allows consolidate ipc_perm definition for architectures that already provide mode_t as 32-bit. 3. All kernel ABIs for the supported architectures already provides the expected padding for mode type extension to 32-bit. However, some architectures the padding has the wrong placement, so it requires the ipc control routines (msgctl, semctl, and shmctl) to adjust the mode field accordingly. Currently they are armeb, microblaze, m68k, s390, and sheb. A new assume is added, __ASSUME_SYSVIPC_BROKEN_MODE_T, which the required ABIs define. 4. For the ABIs that define __ASSUME_SYSVIPC_BROKEN_MODE_T, it also require compat symbols that do not adjust the mode field. Checked on arm-linux-gnueabihf, aarch64-linux-gnu, powerpc64le-linux-gnu, and x86_64-linux-gnu. I also checked the sysvipc tests on hppa-linux-gnu, sh4-linux-gnu, s390x-linux-gnu, and s390-linux-gnu. I also did a sanity test against armeb qemu usermode for the sysvipc tests. [BZ #18231] * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/ipc-perm.h. * sysdeps/unix/sysv/linux/aarch64/bits/ipc.h: Remove file. * sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h [__BYTE_ORDER == __BIG_ENDIAN] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/sysv/linux/microblaze/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h [!__s390x__] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/bits/ipc-perm.h: New file. * sysdeps/unix/sysv/linux/powerpc/bits/ipc-perm.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/ipc-perm.h: Likewise. * sysdeps/unix/sysv/linux/bits/ipc.h (ipc_perm): Move to bits/ipc-perm.h. * sysdeps/unix/sysv/linux/hppa/bits/ipc-perm.h: New file. * sysdeps/unix/sysv/linux/kernel-features.h: Add comment about __ASSUME_SYSVIPC_BROKEN_MODE_T semantic. * sysdeps/unix/sysv/linux/msgctl.c (DEFAULT_VERSION): Define as 2.31 if __ASSUME_SYSVIPC_BROKEN_MODE_T is defined. (msgctl_syscall, __msgctl_mode16): New symbol. (__new_msgctl): Add bits for __ASSUME_SYSVIPC_BROKEN_MODE_T. * sysdeps/unix/sysv/linux/semctl.c: Likewise. * sysdeps/unix/sysv/linux/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/arm/be/libc.abilist (GLIBC_2.31): Add msgctl, semctl, and shmctl. * sysdeps/sysv/linux/microblaze/be/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/be/libc.abilist: Likewise. * conform/data/sys/ipc.h-data: Only xfail {struct ipc_perm} mode_t mode for Hurd. * sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_2.31]: Add msgctl, semctl, and shmctl. * sysdeps/unix/sysv/linux/arm/be/Versions: New file. * sysdeps/unix/sysv/linux/microblaze/be/Versions: Likewise. * sysdeps/unix/sysv/linux/sh/be/Versions: Likewise. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html
* syscall-names.list: fix typos in commentDmitry V. Levin2019-10-101-5/+4
| | | | | * sysdeps/unix/sysv/linux/syscall-names.list: Fix typos in comment, reformat the affected paragraph.
* y2038: linux: Provide __clock_settime64 implementationLukasz Majewski2019-10-101-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __clock_settime64 explicit 64 bit function for setting the time. Moreover, a 32 bit version - __clock_settime - has been refactored to internally use __clock_settime64. The __clock_settime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit struct timespec. The new clock_settime64 syscall available from Linux 5.1+ has been used, when applicable. In this patch the internal padding (tv_pad) of struct __timespec64 is left untouched (on systems with __WORDSIZE == 32) as Linux kernel ignores upper 32 bits of tv_nsec. 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 clock_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 __clock_settime64 syscalls. - Linux v4.19 (no clock_settime64 support) with default minimal kernel version for contemporary glibc This kernel doesn't support __clock_settime64 syscalls, so the fallback to clock_settime 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. * include/time.h (__clock_settime64): Add __clock_settime alias according to __TIMESIZE define * sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime): Refactor this function to be used only on 32 bit machines as a wrapper on __clock_settime64. * sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime64): Add * sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime64): Use clock_settime64 kernel syscall (available from 5.1+ Linux)
* mips: Do not malloc on getdents64 fallbackAdhemerval Zanella2019-10-091-59/+81
| | | | | | | | | | | | | | | | | | | | | This patch changes how the fallback getdents64 implementation calls non-LFS getdents by replacing the scratch_buffer with static buffer plus a loop on getdents calls. This avoids the potential malloc call on scratch_buffer_set_array_size for large input buffer size at the cost of more getdents syscalls. It also adds a small optimization for older kernels, where the first ENOSYS failure for getdents64 disable subsequent calls. Check the dirent tests on a mips64-linux-gnu with getdents64 code disabled. * sysdeps/unix/sysv/linux/mips/mips64/getdents64.c (__getdents64): Add small optimization for older kernel to avoid issuing __NR_getdents64 on each call and replace scratch_buffer usage with a static allocated buffer. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* nptl: Move pthread_attr_setschedparam implementation into libcFlorian Weimer2019-10-0727-27/+0
| | | | | | | | 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>
* riscv: Remove support for variable page sizesFlorian Weimer2019-10-073-120/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _dl_var_init is used to patch the read-only data section after relocation. Several architectures use this to update GLRO(page_size) with the correct value for the static dlopen case, where _rtld_global_ro has not been initialized by the dynamic loader. RISC-V does not need this. The RISC-V Instruction Set Manual, Volume II: Privileged Architecture, Document Version 20190608-Priv-MSU-Ratified says this: After much deliberation, we have settled on a conventional page size of 4 KiB for both RV32 and RV64. We expect this decision to ease the porting of low-level runtime software and device drivers. The TLB reach problem is ameliorated by transparent superpage support in modern operating systems [2]. Additionally, multi-level TLB hierarchies are quite inexpensive relative to the multi-level cache hierarchies whose address space they map. [2] Juan Navarro, Sitaram Iyer, Peter Druschel, and Alan Cox. Practical, transparent operating system support for superpages. SIGOPS Oper. Syst. Rev., 36(SI):89–104, December 2002. This means that the initialization of _rtld_global_ro._dl_page_size in elf/rtld.c with EXEC_PAGESIZE is sufficient for RISC-V.
* nptl: Move pthread_attr_getschedparam implementation into libcFlorian Weimer2019-10-0727-27/+0
| | | | | | | | 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_setinheritsched implementation into libc.Florian Weimer2019-10-0427-27/+0
| | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html>
* Split up endian.h to minimize exposure of BYTE_ORDER.Alistair Francis2019-10-016-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With only two exceptions (sys/types.h and sys/param.h, both of which historically might have defined BYTE_ORDER) the public headers that include <endian.h> only want to be able to test __BYTE_ORDER against __*_ENDIAN. This patch creates a new bits/endian.h that can be included by any header that wants to be able to test __BYTE_ORDER and/or __FLOAT_WORD_ORDER against the __*_ENDIAN constants, or needs __LONG_LONG_PAIR. It only defines macros in the implementation namespace. The existing bits/endian.h (which could not be included independently of endian.h, and only defines __BYTE_ORDER and maybe __FLOAT_WORD_ORDER) is renamed to bits/endianness.h. I also took the opportunity to canonicalize the form of this header, which we are stuck with having one copy of per architecture. Since they are so short, this means git doesn’t understand that they were renamed from existing headers, sigh. endian.h itself is a nonstandard header and its only remaining use from a standard header is guarded by __USE_MISC, so I dropped the __USE_MISC conditionals from around all of the public-namespace things it defines. (This means, an application that requests strict library conformance but includes endian.h will still see the definition of BYTE_ORDER.) A few changes to specific bits/endian(ness).h variants deserve mention: - sysdeps/unix/sysv/linux/ia64/bits/endian.h is moved to sysdeps/ia64/bits/endianness.h. If I remember correctly, ia64 did have selectable endianness, but we have assembly code in sysdeps/ia64 that assumes it’s little-endian, so there is no reason to treat the ia64 endianness.h as linux-specific. - The C-SKY port does not fully support big-endian mode, the compile will error out if __CSKYBE__ is defined. - The PowerPC port had extra logic in its bits/endian.h to detect a broken compiler, which strikes me as unnecessary, so I removed it. - The only files that defined __FLOAT_WORD_ORDER always defined it to the same value as __BYTE_ORDER, so I removed those definitions. The SH bits/endian(ness).h had comments inconsistent with the actual setting of __FLOAT_WORD_ORDER, which I also removed. - I *removed* copyright boilerplate from the few bits/endian(ness).h headers that had it; these files record a single fact in a fashion dictated by an external spec, so I do not think they are copyrightable. As long as I was changing every copy of ieee754.h in the tree, I noticed that only the MIPS variant includes float.h, because it uses LDBL_MANT_DIG to decide among three different versions of ieee854_long_double. This patch makes it not include float.h when GCC’s intrinsic __LDBL_MANT_DIG__ is available. * string/endian.h: Unconditionally define LITTLE_ENDIAN, BIG_ENDIAN, PDP_ENDIAN, and BYTE_ORDER. Condition byteswapping macros only on !__ASSEMBLER__. Move the definitions of __BIG_ENDIAN, __LITTLE_ENDIAN, __PDP_ENDIAN, __FLOAT_WORD_ORDER, and __LONG_LONG_PAIR to... * string/bits/endian.h: ...this new file, which includes the renamed header bits/endianness.h for the definition of __BYTE_ORDER and possibly __FLOAT_WORD_ORDER. * string/Makefile: Install bits/endianness.h. * include/bits/endian.h: New wrapper. * bits/endian.h: Rename to bits/endianness.h. Add multiple-include guard. Rewrite the comment explaining what the machine-specific variants of this file should do. * sysdeps/unix/sysv/linux/ia64/bits/endian.h: Move to sysdeps/ia64. * sysdeps/aarch64/bits/endian.h * sysdeps/alpha/bits/endian.h * sysdeps/arm/bits/endian.h * sysdeps/csky/bits/endian.h * sysdeps/hppa/bits/endian.h * sysdeps/ia64/bits/endian.h * sysdeps/m68k/bits/endian.h * sysdeps/microblaze/bits/endian.h * sysdeps/mips/bits/endian.h * sysdeps/nios2/bits/endian.h * sysdeps/powerpc/bits/endian.h * sysdeps/riscv/bits/endian.h * sysdeps/s390/bits/endian.h * sysdeps/sh/bits/endian.h * sysdeps/sparc/bits/endian.h * sysdeps/x86/bits/endian.h: Rename to endianness.h; canonicalize form of file; remove redundant definitions of __FLOAT_WORD_ORDER. * sysdeps/powerpc/bits/endianness.h: Remove logic to check for broken compilers. * ctype/ctype.h * sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h * sysdeps/arm/nptl/bits/pthreadtypes-arch.h * sysdeps/csky/nptl/bits/pthreadtypes-arch.h * sysdeps/ia64/ieee754.h * sysdeps/ieee754/ieee754.h * sysdeps/ieee754/ldbl-128/ieee754.h * sysdeps/ieee754/ldbl-128ibm/ieee754.h * sysdeps/m68k/nptl/bits/pthreadtypes-arch.h * sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h * sysdeps/mips/ieee754/ieee754.h * sysdeps/mips/nptl/bits/pthreadtypes-arch.h * sysdeps/nios2/nptl/bits/pthreadtypes-arch.h * sysdeps/nptl/pthread.h * sysdeps/riscv/nptl/bits/pthreadtypes-arch.h * sysdeps/sh/nptl/bits/pthreadtypes-arch.h * sysdeps/sparc/sparc32/ieee754.h * sysdeps/unix/sysv/linux/generic/bits/stat.h * sysdeps/unix/sysv/linux/generic/bits/statfs.h * sysdeps/unix/sysv/linux/sys/acct.h * wctype/bits/wctype-wchar.h: Include bits/endian.h, not endian.h. * sysdeps/unix/sysv/linux/hppa/pthread.h: Don’t include endian.h. * sysdeps/mips/ieee754/ieee754.h: Use __LDBL_MANT_DIG__ in ifdefs, instead of LDBL_MANT_DIG. Only include float.h when __LDBL_MANT_DIG__ is not predefined, in which case define __LDBL_MANT_DIG__ to equal LDBL_MANT_DIG.
* Update bits/mman.h constants and tst-mman-consts.py for Linux 5.3.Joseph Myers2019-09-303-1/+5
| | | | | | | | | | | | | | | | | | The Linux 5.3 uapi headers have some rearrangement relating to MAP_* constants, which includes the effect of adding definitions of MAP_SYNC on powerpc and sparc. This patch updates the corresponding glibc bits/mman.h headers accordingly, and updates the Linux kernel version number in tst-mman-consts.py to reflect that these constants are now current with that kernel version. Tested with build-many-glibcs.py. * sysdeps/unix/sysv/linux/powerpc/bits/mman.h [__USE_MISC] (MAP_SYNC): New macro. * sysdeps/unix/sysv/linux/sparc/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/tst-mman-consts.py (main): Update Linux kernel version number to 5.3.
* Fix tst-sigcontext-get_pc rule name from a43565ac447b1Adhemerval Zanella2019-09-251-1/+1
| | | | | | | | Checked on powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/Makefile (CFLAGS-tst-sigcontextinfo-get_pc.c): Rename to CFLAGS-tst-sigcontext-get_pc.c.
* Fix vDSO initialization on arm and mipsAndreas Schwab2019-09-242-4/+4
|
* Update syscall-names.list for Linux 5.3.Joseph Myers2019-09-181-2/+4
| | | | | | | | | | | | This patch updates syscall-names.list for Linux 5.3, adding two new syscalls. Tested with build-many-glibcs.py. * sysdeps/unix/sysv/linux/syscall-names.list: Update kernel version to 5.3. (clone3): New syscall. (pidfd_open): Likewise.
* Fix RISC-V vfork build with Linux 5.3 kernel headers.Joseph Myers2019-09-181-1/+4
| | | | | | | | | | | | | | | | | | | | | Building glibc for RISC-V with Linux 5.3 kernel headers fails because <linux/sched.h>, included in vfork.S for CLONE_* constants, contains a structure definition not safe for inclusion in assembly code. All other architectures already avoid use of that header in vfork.S, either defining the CLONE_* constants locally or embedding the required values directly in the relevant instruction, where they implement vfork using the clone syscall (see the implementations for aarch64, ia64, mips and nios2). This patch makes the RISC-V version define the constants locally like the other architectures. Tested build for all three RISC-V configurations in build-many-glibcs.py with Linux 5.3 headers. * sysdeps/unix/sysv/linux/riscv/vfork.S: Do not include <linux/sched.h>. (CLONE_VM): New macro. (CLONE_VFORK): Likewise.
* sparc64: Use linux generic time implementationAdhemerval Zanella2019-09-171-1/+0
| | | | | | | | | | There is no need to sparc64 provide an arch-specific implementation to route to POSIX one (which uses gettimeofday). Linux one already handles the case for architecture that does not have __NR_time. No semantic changes, checked against a build for sparc64-linux-gnu. * sysdeps/unix/sysv/linux/sparc/sparc64/time.c: Remove file.
* mips: Consolidate INTERNAL_VSYSCALL_CALLAdhemerval Zanella2019-09-174-36/+16
| | | | | | | | | | | | | | | | | This patch consolidates the mips, mips64, and mips64-n32 INTERNAL_VSYSCALL_CALL on a single implementation. No semantic changes. I checked against a build for mips-linux-gnu, mips64-linux-gnu, and mips64-n32-linux-gnu. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (INTERNAL_VSYSCALL_CALL): Remove. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (INTERNAL_VSYSCALL_CALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (INTERNAL_VSYSCALL_CALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h (INTERNAL_VSYSCALL_CALL): New macro.
* powerpc: Simplify vsyscall internal macrosAdhemerval Zanella2019-09-175-54/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch simplifies the powerpc internal macros for vDSO calls by: - Removing INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK, used solely on get_timebase_freq. - Adjust INTERNAL_VSYSCALL_CALL_TYPE powerpc32 to follow powerpc64 argument ordering. - Use HAVE_*_VSYSCALL instead of explicit strings. - Make powerpc libc-vdso.h include generic implementation. No semantic change expected, checked on powerpc-linux-gnu-power4, powerpc64-linux-gnu, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/libc-vdso.h (VDSO_IFUNC_RET): Define if not defined. * sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c (__get_timebase_freq): Remove use of INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK. (get_timebase_freq_fallback): New symbol. * sysdeps/unix/sysv/linux/powerpc/gettimeofday.c (time): Use HAVE_GETTIMEOFDAY_VSYSCALL. * sysdeps/unix/sysv/linux/powerpc/time.c (gettimeofday): Use HAVE_TIME_VSYSCALL. * sysdeps/unix/sysv/linux/powerpc/libc-vdso.h: Include generic implementation. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (INTERNAL_VSYSCALL_CALL_TYPE): Make calling convention similar to powerpc64. (INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Remove macro. * .../sysv/linux/powerpc/powerpc64/sysdep.h (INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.h (HAVE_GETTIMEOFDAY_VSYSCALL): Define.
* Refactor vDSO initialization codeAdhemerval Zanella2019-09-1732-647/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux vDSO initialization code the internal function pointers require a lot of duplicated boilerplate over different architectures. This patch aims to simplify not only the code but the required definition to enable a vDSO symbol. The changes are: 1. Consolidate all init-first.c on only one implementation and enable the symbol based on HAVE_*_VSYSCALL existence. 2. Set the HAVE_*_VSYSCALL to the architecture expected names string. 3. Add a new internal implementation, get_vdso_mangle_symbol, which returns a mangled function pointer. Currently the clock_gettime, clock_getres, gettimeofday, getcpu, and time are handled in an arch-independent way, powerpc still uses some arch-specific vDSO symbol handled in a specific init-first implementation. Checked on aarch64-linux-gnu, arm-linux-gnueabihf, i386-linux-gnu, mips64-linux-gnu, powerpc64le-linux-gnu, s390x-linux-gnu, sparc64-linux-gnu, and x86_64-linux-gnu. * sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address, is_sigtramp_address_rt): Use HAVE_SIGTRAMP_{RT}32 instead of SHARED. * sysdeps/powerpc/powerpc64/backtrace.c (is_sigtramp_address): Likewise. * sysdeps/unix/sysv/linux/aarch64/init-first.c: Remove file. * sysdeps/unix/sysv/linux/aarch64/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/arm/init-first.c: Likewise. * sysdeps/unix/sysv/linux/arm/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/mips/init-first.c: Likewise. * sysdeps/unix/sysv/linux/mips/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/i386/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/s390/init-first.c: Likewise. * sysdeps/unix/sysv/linux/s390/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sparc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/sparc/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Define value based on kernel exported name. * sysdeps/unix/sysv/linux/arm/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETCPU_VSYSCALL, HAVE_TIME_VSYSCALL, HAVE_GET_TBFREQ, HAVE_SIGTRAMP_RT64, HAVE_SIGTRAMP_32, HAVE_SIGTRAMP_RT32i, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/dl-vdso.h (VDSO_NAME, VDSO_HASH): Define to invalid names if architecture does not define them. (get_vdso_mangle_symbol): New symbol. * sysdeps/unix/sysv/linux/init-first.c: New file. * sysdeps/unix/sysv/linux/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/init-first.c (gettimeofday, clock_gettime, clock_getres, getcpu, time): Remove declaration. (__libc_vdso_platform_setup_arch): Likewise and use get_vdso_mangle_symbol to setup vDSO symbols. (sigtramp_rt64, sigtramp32, sigtramp_rt32, get_tbfreq): Add attribute_hidden. * sysdeps/unix/sysv/linux/powerpc/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sysdep-vdso.h (VDSO_SYMBOL): Remove definition.
* Remove PREPARE_VERSION and PREPARE_VERSION_KNOWAdhemerval Zanella2019-09-1733-157/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the PREPARE_VERSION and PREPARE_VERSION_KNOW macro and uses a static inline function instead, get_vdso_symbol. Each architecture that supports vDSO must define the Linux version and its hash for symbol resolution (VDSO_NAME and VDSO_HASH macro respectively). It also organizes the HAVE_*_VSYSCALL for mips, powerpc, and s390 to define them on a common header. The idea is to require less code to configure and enable vDSO support for newer ports. No semantic changes are expected. Checked with a build against all affected architectures. * sysdeps/unix/make-syscalls.sh: Make vDSO call use get_vdso_symbol. * sysdeps/unix/sysv/linux/aarch64/gettimeofday.c (__gettimeofday): Use get_vdso_symbol instead of _dl_vdso_vsym. * sysdeps/unix/sysv/linux/powerpc/time.c (time): Likewise. * sysdeps/unix/sysv/linux/riscv/flush-icache.c (__lookup_riscv_flush_icache): Likewise. * sysdeps/unix/sysv/linux/x86/gettimeofday.c (__gettimeofday): Likewise. * sysdeps/unix/sysv/linux/x86/time.c (time): Likewise. * sysdeps/unix/sysv/linux/powerpc/gettimeofday.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/arm/init-first.c: Likewise. * sysdeps/unix/sysv/linux/i386/init-first.c: Likewise. * sysdeps/unix/sysv/linux/mips/init-first.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise. * sysdeps/unix/sysv/linux/sparc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/s390/init-first.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (VDSO_NAME, VDSO_HASH): Define. * sysdeps/unix/sysv/linux/arm/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Remove definition. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h: New file. * sysdeps/unix/sysv/linux/powerpc/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION, PREPARE_VERSION_KNOWN, VDSO_NAME_LINUX_2_6, VDSO_HASH_LINUX_2_6, VDSO_NAME_LINUX_2_6_15, VDSO_HASH_LINUX_2_6_15, VDSO_NAME_LINUX_2_6_29, VDSO_HASH_LINUX_2_6_29, VDSO_NAME_LINUX_4_15, VDSO_HASH_LINUX_4_15): Remove defines. (get_vdso_symbol): New function.
* alpha: force old OSF1 syscalls for getegid, geteuid and getppid [BZ #24986]Aurelien Jarno2019-09-143-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On alpha, Linux kernel 5.1 added the standard getegid, geteuid and getppid syscalls (commit ecf7e0a4ad15287). Up to now alpha was using the corresponding OSF1 syscalls through: - sysdeps/unix/alpha/getegid.S - sysdeps/unix/alpha/geteuid.S - sysdeps/unix/alpha/getppid.S When building against kernel headers >= 5.1, the glibc now use the new syscalls through sysdeps/unix/sysv/linux/syscalls.list. When it is then used with an older kernel, the corresponding 3 functions fail. A quick fix is to move the OSF1 wrappers under the sysdeps/unix/sysv/linux/alpha directory so they override the standard linux ones. A better fix would be to try the new syscalls and fallback to the old OSF1 in case the new ones fail. This can be implemented in a later commit. Changelog: [BZ #24986] * sysdeps/unix/alpha/getegid.S: Move to ... * sysdeps/unix/sysv/linux/alpha/getegid.S: ... here. * sysdeps/unix/alpha/geteuid.S: Move to ... * sysdeps/unix/sysv/linux/alpha/geteuid.S: ... here. * sysdeps/unix/alpha/getppid.S: Move to ... * sysdeps/unix/sysv/linux/alpha/getppid.S: ... here
* Fix three GNU license URLs, along with trailing-newline issues.Paul Eggert2019-09-071-2/+1
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-071471-1471/+1471
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* y2038: Introduce the __ASSUME_TIME64_SYSCALLS defineLukasz Majewski2019-09-041-0/+59
| | | | | | | | | | | | | | | | | | | | Add a macro to linux/kernel-features.h, __ASSUME_TIME64_SYSCALLS, to indicate whether the kernel can be assumed to provide a set of system calls that process 64-bit time_t. __ASSUME_TIME64_SYSCALLS does not indicate whether time_t is actually 64 bits (that's __TIMEBITS) and also does not indicate whether the 64-bit time_t system calls have "time64" suffixes on their names. Code that uses __ASSUME_TIME64_SYSCALLS will be added in subsequent patches. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_TIME64_SYSCALLS): New macro. Reviewed-by: Alistair Francis <alistair23@gmail.com> Reviewed-by: Joseph Myers <joseph@codesourcery.com> Reviewed-by: Zack Weinberg <zackw@panix.com>
* Finish move of clock_* functions to libc. [BZ #24959]Zack Weinberg2019-09-0453-136/+191
| | | | | | | | | | | | | | | | In glibc 2.17, the functions clock_getcpuclockid, clock_getres, clock_gettime, clock_nanosleep, and clock_settime were moved from librt.so to libc.so, leaving compatibility stubs behind. Now that the dynamic linker no longer insists on finding versioned symbols in the same library that originally defined them, we do not need the stubs anymore, and this means we don't need GLIBC_PRIVATE __-prefix aliases for most of the functions anymore either. (clock_gettime still needs one.) For ports added before 2.17, libc.so needs to provide two symbol versions for each, the default at GLIBC_2.17 plus a compat version matching what librt had. While I'm at it, move the clock_*.c files and their tests from rt/ to time/.
* nptl: Move pthread_attr_getinheritsched implementation into libcFlorian Weimer2019-08-3027-27/+0
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* MIPS support for GNU hashMihailo Stojanovic2019-08-292-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is a reimplementation of [1], which was submitted back in 2015. Copyright issue has been sorted [2] last year. It proposed a new section (.gnu.xhash) and related dynamic tag (GT_GNU_XHASH). The new section would be virtually identical to the existing .gnu.hash except for the translation table (xlat) which would contain correct MIPS .dynsym indexes corresponding to the hashvals in chains. This is because MIPS ABI imposes a different ordering of the dynsyms than the one expected by the .gnu.hash section. Another addition would be a leading word at the beggining of the section, which would contain the number of entries in the translation table. In this patch, the new section name and dynamic tag are changed to reflect the fact that the section should be treated as MIPS specific (.MIPS.xhash and DT_MIPS_XHASH). This patch addresses the alignment issue reported in [3] which is caused by the leading word of the .MIPS.xhash section. Leading word is now removed in the corresponding binutils patch, and the number of entries in the translation table is computed using DT_MIPS_SYMTABNO dynamic tag. Since the MIPS specific dl-lookup.c file was removed following the initial patch submission, I opted for the definition of three new macros in the generic ldsodefs.h. ELF_MACHINE_GNU_HASH_ADDRIDX defines the index of the dynamic tag in the l_info array. ELF_MACHINE_HASH_SYMIDX is used to calculate the index of a symbol in GNU hash. On MIPS, it is defined to look up the symbol index in the translation table. ELF_MACHINE_XHASH_SETUP is defined for MIPS only. It initializes the .MIPS.xhash pointer in the link_map_machine struct. The other major change is bumping the highest EI_ABIVERSION value for MIPS to suggest that the dynamic linker now supports GNU hash. The patch was tested by running the glibc testsuite for the three MIPS ABIs (o32, n32 and n64) and for x86_64-linux-gnu. [1] https://sourceware.org/ml/binutils/2015-10/msg00057.html [2] https://sourceware.org/ml/binutils/2018-03/msg00025.html [3] https://sourceware.org/ml/binutils/2016-01/msg00006.html * elf/dl-addr.c (determine_info): Calculate the symbol index using the newly defined ELF_MACHINE_HASH_SYMIDX macro. * elf/dl-lookup.c (do_lookup_x): Ditto. (_dl_setup_hash): Initialize MIPS xhash translation table. * elf/elf.h (SHT_MIPS_XHASH): New define. (DT_MIPS_XHASH): New define. * sysdeps/generic/ldsodefs.h (ELF_MACHINE_GNU_HASH_ADDRIDX): New define. (ELF_MACHINE_HASH_SYMIDX): Ditto. (ELF_MACHINE_XHASH_SETUP): Ditto. * sysdeps/mips/ldsodefs.h (ELF_MACHINE_GNU_HASH_ADDRIDX): New define. (ELF_MACHINE_HASH_SYMIDX): Ditto. (ELF_MACHINE_XHASH_SETUP): Ditto. * sysdeps/mips/linkmap.h (struct link_map_machine): New member. * sysdeps/unix/sysv/linux/mips/ldsodefs.h: Increment valid ABI version. * sysdeps/unix/sysv/linux/mips/libc-abis: New ABI version.
* sh: Split BE/LE abilistAdhemerval Zanella2019-08-2930-0/+3564
| | | | | | | | | | | | | | | | | | | | The fix for BZ#18231 requires new symbols only for sh4eb. This patch adds the required folder and files for both BE and LE abilist. No semantic changes are expected. Checked with check-abi for sh4eb-linux-gnu and sh4-linux-gnu. * sysdeps/sh/preconfigure.ac: New file. * sysdeps/sh/preconfigure: Regenerate. * sysdeps/sh/be/sh3/Implies: New file. * sysdeps/sh/be/sh4/Implies: Likewise. * sysdeps/sh/le/sh3/Implies: Likewise. * sysdeps/sh/le/sh4/Implies: Likewise. * sysdeps/unix/sysv/linux/sh/le/sh3/Implies: Likewise. * sysdeps/unix/sysv/linux/sh/le/sh4/Implies: Likewise. * sysdeps/unix/sysv/linux/sh/*.abilist: Move to sysdeps/unix/sysv/linux/sh/le/*.abilist. * sysdeps/unix/sysv/linux/sh/be/*.abilist: New files.
* microblaze: Split BE/LE abilistAdhemerval Zanella2019-08-2926-0/+3486
| | | | | | | | | | | | | | | | | | | The fix for BZ#18231 requires new symbols only for microblaze. This patch adds the required folder and files for both BE and LE abilist. No semantic changes are expected. Checked with check-abi for microblaze-linux-gnueabihf and microblazeel-linux-gnueabihf. * sysdeps/microblaze/preconfigure.ac: New file. * sysdeps/microblaze/preconfigure: Regenerate. * sysdeps/microblaze/be/implies: New file. * sysdeps/microblaze/le/implies: Likewise. * sysdeps/unix/sysv/linux/microblaze/be/implies: Likewise. * sysdeps/unix/sysv/linux/microblaze/le/implies: Likewise. * sysdeps/unix/sysv/linux/microblaze/*.abilist. Move to sysdeps/unix/sysv/linux/microblaze/be/*.abilist. * sysdeps/unix/sysv/linux/microblaze/le/*.abilist: New files.
* arm: Split BE/LE abilistAdhemerval Zanella2019-08-2928-0/+3530
| | | | | | | | | | | | | | | | | | | | | The fix for BZ#18231 requires new symbols only for armeb. This patch adds the required folder and files for both BE and LE abilist. No semantic changes are expected. Checked with check-abi for arm-linux-gnueabihf and armeb-linux-gnueabihf. * sysdeps/arm/preconfigure.ac: Set machine based on endianness. * sysdeps/arm/preconfigure: Regenerate. * sysdeps/arm/be/Implies: New file. * sysdeps/arm/be/armv6/Implies: Likewise. * sysdeps/arm/be/armv6t2/Implies: Likewise. * sysdeps/arm/be/armv7/Implies: Likewise. * sysdeps/arm/le/Implies: Likewise. * sysdeps/unix/sysv/linux/arm/be/Implies: Likewise. * sysdeps/unix/sysv/linux/arm/le/Implies: Likewise. * sysdeps/unix/sysv/linux/arm/*.abilist: Move to sysdeps/unix/sysv/linux/arm/le/*.abilist. * sysdeps/unix/sysv/linux/arm/be/l*.abilist: New files.
* nptl: Move pthread_attr_setdetachstate implementation into libcFlorian Weimer2019-08-2824-24/+0
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Don't put non-ASCII into installed headersPaul Eggert2019-08-231-2/+2
| | | | | | | | Move non-ASCII contributor names from installed headers into contrib.texi when possible, and when it's not (the copyright notice in sysdeps/unix/sysv/linux/mips/sys/user.h) go back to ASCIIfied names. Problem reported by Joseph Myers in: https://www.sourceware.org/ml/libc-alpha/2019-08/msg00646.html
* Fix spellings of contributor names in comments and docPaul Eggert2019-08-233-4/+4
|
* [MIPS] Raise highest supported EI_ABIVERSION value [BZ #24916]Mihailo Stojanovic2019-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This bumps the highest valid EI_ABIVERSION value to ABSOLUTE ABI. New testcase loads the symbol from the GOT with the "lb" instruction so that the EI_ABIVERSION header field of the shared object is set to ABSOLUTE (it doesn't actually check the value of the symbol), and makes sure that the main executable is executed without "ABI version invalid" error. Tested for all three ABIs (o32, n32, n64) using both static linker which handles undefined weak symbols correctly [1] (and sets the EI_ABIVERSION of the test module) and the one that doesn't (EI_ABIVERSION left as 0). [1] https://sourceware.org/ml/binutils/2018-07/msg00268.html [BZ #24916] * sysdeps/mips/Makefile [$(subdir) = elf] (tests): Add tst-undefined-weak. [$(subdir) = elf] (modules-names): Add tst-undefined-weak-lib. [$(subdir) = elf] ($(objpfx)tst-undefined-weak): Add dependency. * sysdeps/mips/tst-undefined-weak-lib.S: New file. * sysdeps/mips/tst-undefined-weak.c: Likewise. * sysdeps/unix/sysv/linux/mips/ldsodefs.h (VALID_ELF_ABIVERSION): Increment highest valid ABIVERSION value.
* mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernelsDragan Mladjenovic2019-08-233-5/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | Linux/Mips kernels prior to 4.8 could potentially crash the user process when doing FPU emulation while running on non-executable user stack. Currently, gcc doesn't emit .note.GNU-stack for mips, but that will change in the future. To ensure that glibc can be used with such future gcc, without silently resulting in binaries that might crash in runtime, this patch forces RWX stack for all built objects if configured to run against minimum kernel version less than 4.8. * sysdeps/unix/sysv/linux/mips/Makefile (test-xfail-check-execstack): Move under mips-has-gnustack != yes. (CFLAGS-.o*, ASFLAGS-.o*): New rules. Apply -Wa,-execstack if mips-force-execstack == yes. * sysdeps/unix/sysv/linux/mips/configure: Regenerated. * sysdeps/unix/sysv/linux/mips/configure.ac (mips-force-execstack): New var. Set to yes for hard-float builds with minimum_kernel < 4.8.0 or minimum_kernel not set at all. (mips-has-gnustack): New var. Use value of libc_cv_as_noexecstack if mips-force-execstack != yes, otherwise set to no.
* linux: Make profil_counter a compat_symbol (BZ#17726)Adhemerval Zanella2019-08-232-2/+8
| | | | | | | | | | | | | | | As indicated by Joseph's comment on BZ#17726, this symbol is most likely a historical ABI accident. This patch make it on both arm and sparc ABIs a compat_symbol. Checked against a build arm-linux-gnueabihf, sparcv9-linux-gnu, adn sparc64-linux-gnu to see if the symbol is still present. * gmon/Versions (libc) [GLIBC_2.31]: New entry. * sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter): Make a compat_symbol. * sysdeps/unix/sysv/linux/sparc/profil-counter.h (__profil_counter_global): Likewise.
* Refactor sigcontextinfo.hAdhemerval Zanella2019-08-2345-945/+832
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch refactor sigcontextinfo.h header to use SA_SIGINFO as default for both gmon and debug implementations. This allows simplify profil-counter.h on Linux to use a single implementation and remove the requirements for newer ports to redefine __sigaction/sigaction to use SA_SIGINFO. The GET_PC macro is also replaced with a function sigcontext_get_pc that returns an uintptr_t instead of a void pointer. It allows easier convertion to integer on ILP32 architecture, such as x32, without the need to suppress compiler warnings. The patch also requires some refactor of register-dump.h file for some architectures (to reflect it is now called from a sa_sigaction instead of sa_handler signal context). - Alpha, i386, and s390 are straighfoward to take in consideration the new argument type. - ia64 takes in consideration the kernel pass a struct sigcontextt as third argument for sa_sigaction. - sparc take in consideration the kernel pass a pt_regs struct as third argument for sa_sigaction. - m68k dummy function is removed and the FP state is dumped on register_dump itself. - For SH the register-dump.h file is consolidate on a common implementation and the floating-point state is checked based on ownedfp field. The register_dump does not change its output format in any affected architecture. I checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf, sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu, powerpc64-linux-gnu, and powerpc64le-linux-gnu. I also checked the libSegFault.so through catchsegv on alpha-linux-gnu, m68k-linux-gnu and sh4-linux-gnu to confirm the output has not changed. Adhemerval Zanella <adhemerval.zanella@linaro.org> Florian Weimer <fweimer@redhat.com> * debug/segfault.c (install_handler): Use SA_SIGINFO if defined. * sysdeps/generic/profil-counter.h (__profil_counter): Cast to uintptr_t. * sysdeps/generic/sigcontextinfo.h (GET_PC): Rename to sigcontext_get_pc and return aligned cast to uintptr_t. * sysdeps/mach/hurd/i386/sigcontextinfo.h (GET_PC): Likewise. * sysdeps/posix/profil.c (profil_count): Change PC argument to uintptr_t. (__profil): Use SA_SIGINFO. * sysdeps/posix/sprofil.c (profil_count): Change PCP argument to uintptr_t. (__sprofil): Use SA_SIGINFO. * sysdeps/unix/sysv/linux/profil-counter.h: New file. * sysdeps/unix/sysv/linux/aarch64/profil-counter.h: Remove file. * sysdeps/unix/sysv/linux/csky/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/hppa/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/i386/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/ia64/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/mips/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/nios2/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/riscv/profil-counter.h: Likewise. * sysdeps/sysv/linux/s390/s390-32/profil-counter.h: Likewise. * sysdeps/sysv/linux/s390/s390-64/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/sh/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/arm/profil-counter.h (__profil_counter): Assume SA_SIGINFO and use sigcontext_get_pc instead of GET_PC. * sysdeps/unix/sysv/linux/sparc/profil-counter.h: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/profil-counter.h: Remove file. * sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h: Likewise. * sysdpes/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT, GET_PC, __sigaction, sigaction): Remove defines. (sigcontext_get_pc): New function. * sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/csky/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/i386/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/s390/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/sh/sigcontextinfo.h: Likewise. * sysdeps/sysv/linux/sparc/sparc32/sigcontextinfo.h: Likewise. * sysdeps/sysv/linux/sparc/sparc64/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/alpha/register-dump.h (register_dump): Handle CTX argument as ucontext_t. * sysdeps/unix/sysv/linux/i386/register-dump.h: Likewise. Likewise. * sysdeps/unix/sysv/linux/m68k/register-dump.h: Likewise. * sysdeps/sysv/linux/s390/s390-32/register-dump.h: Likewise. * sysdeps/sysv/linux/s390/s390-64/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/sh/register-dump.h: New file. * sysdeps/unix/sysv/linux/sh/sh4/register-dump.h: Remove File. * sysdeps/unix/sysv/linux/sh/sh3/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/Makefile (tests-internal): Add tst-sigcontextinfo-get_pc. * sysdeps/unix/sysv/linux/tst-sigcontextinfo-get_pc.c: New file. (CFLAGS-tst-sigcontextinfo-get_pc.c): New rule.
* powerpc: Fix typos and field name in commentsGustavo Romero2019-08-221-4/+4
| | | | | | | | | Fix a couple of typos and v_regs field name in mcontext_t. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Fix typos and field name in mcontext_t struct. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* Do not print backtraces on fatal glibc errorsFlorian Weimer2019-08-191-33/+0
| | | | | | | | | | | | | | | | | | | | If the process is in a bad state, we used to print backtraces in many cases. This is problematic because doing so could involve a lot of work, like loading libgcc_s using the dynamic linker, and this could itself be targeted by exploit writers. For example, if the crashing process was forked from a long-lived process, the addresses in the error message could be used to bypass ASLR. Commit ed421fca42fd9b4cab7c66e77894b8dd7ca57ed0 ("Avoid backtrace from __stack_chk_fail [BZ #12189]"), backtraces where no longer printed because backtrace_and_maps was always called with do_abort == 1. Rather than fixing this logic error, this change removes the backtrace functionality from the sources. With the prevalence of external crash handlers, it does not appear to be particularly useful. The crash handler may also destroy useful information for debugging. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Move pthread_attr_getdetachstate implementation into libcFlorian Weimer2019-08-1624-24/+0
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_init implementation into libcFlorian Weimer2019-08-1524-32/+0
| | | | | Both the original GLIB_2.0 version and the current GLIBC_2.1 version need to be moved.