about summary refs log tree commit diff
path: root/sysdeps/unix
Commit message (Collapse)AuthorAgeFilesLines
* x86_64: Do not define __NR_semtimedop in <sysdep.h>Florian Weimer2020-03-031-7/+0
| | | | | | The definition is always available from the built-in system call table. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ia64: Do not define __NR_semtimedop in <sysdep.h>Florian Weimer2020-03-031-6/+0
| | | | | | The definition is always available from the built-in system call table. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: open_by_handle_at syscall number is always availableFlorian Weimer2020-03-031-9/+0
| | | | | | Due to the built-in tables, __NR_open_by_handle_at is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: pciconfig_iobase syscall number is always available on alphaFlorian Weimer2020-03-031-2/+0
| | | | | | Due to the built-in tables, __NR_pciconfig_iobase is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: getdents64 syscall number is always available on MIPSFlorian Weimer2020-03-031-2/+0
| | | | | | | Due to the built-in tables, __NR_getdents64 is always defined, although it may not be supported at run time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Clean up preadv2, pwritev2 system call namesFlorian Weimer2020-03-034-22/+7
| | | | | | | | | | | With the built-in tables __NR_preadv2 and __NR_pwritev2 are always defined. The kernel has never defined __NR_preadv64v2 and __NR_pwritev64v2 and is unlikely to do so, given that the preadv2 and pwritev2 system calls themselves are 64-bit. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: exit_group syscall number is always availableFlorian Weimer2020-03-031-2/+0
| | | | | | Due to the built-in tables, __NR_exit_group is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: set_tid_address syscall number is always availableFlorian Weimer2020-03-031-2/+0
| | | | | | Due to the built-in tables, __NR_set_tid_address is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: pkey_mprotect syscall number is always availableFlorian Weimer2020-03-031-5/+0
| | | | | | Due to the built-in tables, __NR_pkey_mprotect is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: rt_sigqueueinfo syscall number is always availableFlorian Weimer2020-03-032-10/+0
| | | | | | | | | Due to the built-in tables, __NR_rt_sigqueueinfo is always defined. sysdeps/pthread/time_routines.c is not updated because it is shared with Hurd. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: getrandom syscall number is always availableFlorian Weimer2020-03-032-22/+0
| | | | | | Due to the built-in tables, __NR_getrandom is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Clean up preadv, pwritev system call namesFlorian Weimer2020-03-034-28/+4
| | | | | | | The names __NR_preadv64, __NR_pwritev64 appear to be a glibc invention. With the built-in tables, __NR_preadv and __NR_pwritev are always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Clean up pread64/pwrite64 system call namesFlorian Weimer2020-03-037-40/+4
| | | | | | | | | Linux removed the last definitions of __NR_pread and __NR_pwrite in commit 4ba66a9760722ccbb691b8f7116cad2f791cca7b, the removal of the blackfin port. All architectures now define __NR_pread64 and __NR_pwrite64 only. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: sigaltstack syscall number is always availableFlorian Weimer2020-03-031-4/+0
| | | | | | Due to the built-in tables, __NR_sigaltstack is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: sched_getaffinity syscall number is always availableFlorian Weimer2020-03-031-7/+3
| | | | | | Due to the built-in tables, __NR_sched_getaffinity is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: sched_setaffinity syscall number is always availableFlorian Weimer2020-03-031-6/+1
| | | | | | Due to the built-in tables, __NR_sched_setaffinity is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: statx syscall number is always availableFlorian Weimer2020-03-031-7/+4
| | | | | | Due to the built-in tables, __NR_statx is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: mq_* syscall numbers are always availableFlorian Weimer2020-03-037-41/+0
| | | | | | | | Due to the built-in tables, __NR_mq_getsetattr, __NR_mq_notify, __NR_mq_open, __NR_mq_timedreceive, __NR_mq_timedsend, __NR_mq_unlink are always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: mlock2 syscall number is always availableFlorian Weimer2020-03-031-2/+0
| | | | | | Due to the built-in tables, __NR_mlock2 is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: copy_file_range syscall number is always availableFlorian Weimer2020-03-031-5/+0
| | | | | | Due to the built-in tables, __NR_copy_file_range is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: renameat2 syscall number is always availableFlorian Weimer2020-03-031-4/+3
| | | | | | Due to the built-in tables, __NR_renameat2 is always defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add missing libc_hidden_def for __utimensat64Andreas Schwab2020-03-021-0/+2
|
* elf: Add elf/check-wx-segment, a test for the presence of WX segmentsFlorian Weimer2020-03-021-2/+7
| | | | | | | Writable, executable segments defeat security hardening. The existing check for DT_TEXTREL does not catch this. hppa and SPARC currently keep the PLT in an RWX load segment.
* nios2: Fix Linux kABI for syscall returnAdhemerval Zanella2020-02-201-1/+1
| | | | From the type introduced at 861be5fd66.
* nptl: Move pthread_setschedparam implementation into libcFlorian Weimer2020-02-2027-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_getschedparam implementation into libcFlorian Weimer2020-02-2027-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_cond_init implementation into libcFlorian Weimer2020-02-2027-43/+0
| | | | | | | | | | | It is necessary to export __pthread_cond_init from libc because the C11 condition variable needs it and is still left in libpthread. This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_cond_destroy implementation into libcFlorian Weimer2020-02-2027-43/+0
| | | | | | | | | | | It is necessary to export __pthread_cond_destroy from libc because the C11 condition variable needs it and is still left in libpthread. This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_condattr_init implementation into libcFlorian Weimer2020-02-2027-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_condattr_destroy implementation into libcFlorian Weimer2020-02-2027-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_setscope implementation into libcFlorian Weimer2020-02-2027-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_getscope implementation into libcFlorian Weimer2020-02-2027-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_setschedpolicy implementation into libcFlorian Weimer2020-02-2027-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_getschedpolicy implementation into libcFlorian Weimer2020-02-2027-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>
* Block all signals on timer_create thread (BZ#10815)Adhemerval Zanella2020-02-192-60/+55
| | | | | | | | | | | | | | | | | | | | The behavior of the signal mask on threads created by timer_create for SIGEV_THREAD timers are implementation-defined and glibc explicit unblocks all signals before calling the user-defined function. This behavior, although not incorrect standard-wise, opens a race if a program using a blocked rt-signal plus sigwaitinfo (and without an installed signal handler for the rt-signal) receives a signal while executing the used-defined function for SIGEV_THREAD. A better alternative discussed in bug report is to rather block all signals (besides the internal ones not available to application usage). This patch fixes this issue by only unblocking SIGSETXID (used on set*uid function) and SIGCANCEL (used for thread cancellation). Checked on x86_64-linux-gnu and i686-linux-gnu.
* Fix tst-pkey expectations on pkey_get [BZ #23202]Lucas A. M. Magalhaes2020-02-191-4/+6
| | | | | | | | | | | | | | | | From the GNU C Library manual, the pkey_set can receive a combination of PKEY_DISABLE_WRITE and PKEY_DISABLE_ACCESS. However PKEY_DISABLE_ACCESS is more restrictive than PKEY_DISABLE_WRITE and includes its behavior. The test expects that after setting (PKEY_DISABLE_WRITE|PKEY_DISABLE_ACCESS) pkey_get should return the same. This may not be true as PKEY_DISABLE_ACCESS will succeed in describing the state of the key in this case. The pkey behavior during signal handling is different between x86 and POWER. This change make the test compatible with both architectures. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* y2038: linux: Provide __gettimeofday64 implementationLukasz Majewski2020-02-183-3/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the glibc the gettimeofday can use vDSO (on power and x86 the USE_IFUNC_GETTIMEOFDAY is defined), gettimeofday syscall or 'default' ___gettimeofday() from ./time/gettime.c (as a fallback). In this patch the last function (___gettimeofday) has been refactored and moved to ./sysdeps/unix/sysv/linux/gettimeofday.c to be Linux specific. The new __gettimeofday64 explicit 64 bit function for getting 64 bit time from the kernel (by internally calling __clock_gettime64) has been introduced. Moreover, a 32 bit version - __gettimeofday has been refactored to internally use __gettimeofday64. The __gettimeofday is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary check for time_t potential overflow and conversion of struct __timeval64 to 32 bit struct timespec. The iFUNC vDSO direct call optimization has been removed from both i686 and powerpc32 (USE_IFUNC_GETTIMEOFDAY is not defined for those architectures anymore). The Linux kernel does not provide a y2038 safe implementation of gettimeofday neither it plans to provide it in the future, clock_gettime64 should be used instead. Keeping support for this optimization would require to handle another build permutation (!__ASSUME_TIME64_SYSCALLS && USE_IFUNC_GETTIMEOFDAY) which adds more complexity and has limited use (since the idea is to eventually have a y2038 safe glibc build). Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test proper usage of both __gettimeofday64 and __gettimeofday. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> [Including some commit message improvement]
* Linux: Work around kernel bugs in chmod on /proc/self/fd paths [BZ #14578]Florian Weimer2020-02-181-4/+24
| | | | | | | | | | It appears that the ability to change symbolic link modes through such paths is unintended. On several file systems, the operation fails with EOPNOTSUPP, even though the symbolic link permissions are updated. The expected behavior is a failure to update the permissions, without file system changes. Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
* mips: Fix bracktrace result for signal framesAdhemerval Zanella2020-02-181-0/+67
| | | | | | | | | | | | | | | | MIPS fallback code handle a frame where its FDE can not be obtained (for instance a signal frame) by reading the kernel allocated signal frame and adding '2' to the value of 'sc_pc' [1]. The added value is used to recognize an end of an EH region on mips16 [2]. The fix adjust the obtained signal frame value and remove the libgcc added value by checking if the previous frame is a signal frame one. Checked with backtrace and tst-sigcontext-get_pc tests on mips-linux-gnu and mips64-linux-gnu. [1] libgcc/config/mips/linux-unwind.h from gcc code. [2] gcc/config/mips/mips.h from gcc code. */
* <fd_to_filename.h>: Add type safety and port to HurdFlorian Weimer2020-02-181-20/+2
| | | | | | | | | The new type struct fd_to_filename makes the allocation of the backing storage explicit. Hurd uses /dev/fd, not /proc/self/fd. Co-Authored-By: Paul Eggert <eggert@cs.ucla.edu>
* ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]Florian Weimer2020-02-1546-222/+0
| | | | | | | | | | | | | | | | | | | 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>
* arm: fix use of INTERNAL_SYSCALL_CALLAndreas Schwab2020-02-151-1/+1
| | | | | Remove extra argument from INTERNAL_SYSCALL_CALL macro call. Fixes commit bc2eb9321e ("linux: Remove INTERNAL_SYSCALL_DECL").
* linux: Remove INTERNAL_SYSCALL_DECLAdhemerval Zanella2020-02-1494-475/+378
| | | | | | | | | | | With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, the INTERNAL_SYSCALL_DECL is an empty declaration on all ports. This patch removes the 'err' argument on INTERNAL_SYSCALL* macro and remove the INTERNAL_SYSCALL_DECL usage. Checked with a build against all affected ABIs.
* linux: Consolidate INLINE_SYSCALLAdhemerval Zanella2020-02-1427-480/+54
| | | | | | | | | | | With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, there is no need to replicate the INLINE_SYSCALL. The generic Linux sysdep.h includes errno.h even for !__ASSEMBLER__, which is ok now and it allows cleanup some archaic code that assume otherwise. Checked with a build against all affected ABIs.
* s390: Consolidate Linux syscall definitionAdhemerval Zanella2020-02-143-192/+103
| | | | | | The {INTERNAL,INLINE}_SYSCALL are defined only on s390 sysdep.h. Checked on s390x-linux-gnu and s390-linux-gnu.
* riscv: Avoid clobbering register parameters in syscallAdhemerval Zanella2020-02-141-28/+56
| | | | | | | | | | | | | | The riscv INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (bug 25523). Checked with riscv64-linux-gnu-rv64imafdc-lp64d build.
* microblaze: Avoid clobbering register parameters in syscallAdhemerval Zanella2020-02-141-35/+56
| | | | | | | | | | | | | | The microblaze INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (bug 25523). Checked with microblaze-linux-gnu and microblazeel-linux-gnu build.
* nios2: Use Linux kABI for syscall returnAdhemerval Zanella2020-02-141-5/+5
| | | | | | | | | | It changes the nios INTERNAL_SYSCALL_RAW macro to return a negative value instead of the 'r2' register value on the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked with a build against nios2-linux-gnu.
* mips: Use Linux kABI for syscall returnAdhemerval Zanella2020-02-143-53/+23
| | | | | | | | | | | | | It changes the mips INTERNAL_SYSCALL* and internal_syscall* macros to return a negative value instead of the 'a3' register value on then 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. The redefinition of INTERNAL_VSYSCALL_CALL is also no longer required. Checked on mips64-linux-gnu, mips64n32-linux-gnu, and mips-linux-gnu.
* mips64: Consolidate Linux sysdep.hAdhemerval Zanella2020-02-144-455/+70
| | | | | | | | | | | | | The mips64 Linux syscall macros only differs argument type and the requirement of sign-extending values on n32. The headers are consolidate by parameterizing the arguments with a new type, __syscall_arg_t, and by defining the ARGIFY for n64. Also, the generic unix mips64 sysdep is essentially the same, only the load instruction need to be adjusted depending of the ABI. Checked on mips64-linux-gnu and mips64n32-linux-gnu.