about summary refs log tree commit diff
path: root/sysdeps/unix
Commit message (Collapse)AuthorAgeFilesLines
* Hide internal signal functions [BZ #18822]H.J. Lu2017-10-016-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hide internal signal functions to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___kill and __GI___sigaltstack are defined when syscalls.list is used to generate them. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/signal.h (__kill): Add libc_hidden_proto. (__sigblock): Likewise. (__sigprocmask): Likewise. (__sigaltstack): Likewise. * signal/kill.c (__kill): Add libc_hidden_def. * signal/sigblock.c (__sigblock): Likewise. * signal/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/mach/hurd/kill.c (__kill): Likewise. * sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise. * sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/posix/sigblock.c (__sigblock): Likewise. * sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask): Likewise. * /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask): Likewise.
* Hide internal __mremap function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | | | | Hide internal __mremap function to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___mremap is defined when sysdeps/unix/syscalls.list is used to generate mremap. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/sys/mman.h (__mremap): Add libc_hidden_proto. * sysdeps/unix/sysv/linux/m68k/mremap.S (__mremap): Add libc_hidden_def.
* Hide internal __ioctl function [BZ #18822]H.J. Lu2017-10-014-0/+4
| | | | | | | | | | | | | | | | | | Hide internal __ioctl function to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___ioctl is defined when sysdeps/unix/syscalls.list is used to generate ioctl. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/sys/ioctl.h (__ioctl): Add libc_hidden_proto. * misc/ioctl.c (__ioctl): Add libc_hidden_def. * sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise. * sysdeps/unix/sysv/linux/aarch64/ioctl.S (__ioctl): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl): Likewise. * sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S (__ioctl): Likewise.
* Hide internal sysinfo functions [BZ #18822]H.J. Lu2017-10-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Hide internal sysinfo functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/sysinfo.h (__get_nprocs_conf): Add libc_hidden_proto. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. (__get_child_max): Add attribute_hidden. * misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. * sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add libc_hidden_def. (__get_nprocs_conf): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise.
* Mark internal netlink functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-4/+6
| | | | | | | | | | | | Mark internal netlink functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_open): Add attribute_hidden. (__netlink_close): Likewise. (__netlink_free_handle): Likewise. (__netlink_request): Likewise.
* Hide __readv and __writev [BZ #18822]H.J. Lu2017-10-012-0/+4
| | | | | | | | | | | | | | | | | Hide internal __readv and __writev functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/uio.h (__readv): Add libc_hidden_proto. (__writev): Likewise. * misc/readv.c (__readv): Add libc_hidden_def. * misc/writev.c (__writev): Likewise. * sysdeps/posix/readv.c (__readv): Likewise. * sysdeps/posix/writev.c (__writev): Likewise. * sysdeps/unix/sysv/linux/readv.c: Include <sys/uio.h>. (__readv): Likewise. * sysdeps/unix/sysv/linux/writev.c: Include <sys/uio.h>. (__writev): Likewise.
* Mark internal dirent functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-013-0/+3
| | | | | | | | | | | | | | | | | | | Mark internal dirent functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. __readdir64 is hidden with libc_hidden_proto and libc_hidden_def since the exported readdir64 is an alias of __readdir64. [BZ #18822] * include/dirent.h (__opendir): Always add attribute_hidden. (__fdopendir): Likewise. (__closedir): Likewise. (__readdir): Likewise. (__readdir64): Add libc_hidden_proto. * sysdeps/mach/hurd/readdir64.c (__readdir64): Add libc_hidden_def. * sysdeps/unix/sysv/linux/i386/readdir64.c (__readdir64): Likewise. * sysdeps/unix/sysv/linux/readdir64.c (__readdir64): Likewise. * sysdeps/unix/sysv/linux/wordsize-64/readdir.c (__GI___readdir64): New alias.
* Mark internal statfs functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-4/+8
| | | | | | | | | | | | | | | | Mark internal statfs functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/statfs.h (__fstatfs): Add attribute_hidden. (__statfs64): Likewise. (__fstatfs64): Likewise. * include/sys/statvfs.h (__statvfs64): Likewise. (__fstatvfs64): Likewise. * sysdeps/unix/sysv/linux/pathconf.h (__statfs_link_max): Likewise. (__statfs_filesize_max): Likewise. (__statfs_symlinks): Likewise. (__statfs_chown_restricted): Likewise.
* Mark __internal_statvfs[64] with attribute_hidden [BZ #18822]H.J. Lu2017-10-016-23/+31
| | | | | | | | | | | | | | | | | | | | | | Mark __internal_statvfs[64] with attribute_hidden to allow direct access to them within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * sysdeps/unix/sysv/linux/fstatvfs.c: Include "internal_statvfs.h" instead of <sys/statvfs.h>. (__internal_statvfs): Removed. * sysdeps/unix/sysv/linux/fstatvfs64.c Include "internal_statvfs.h" instead of <sys/statvfs.h>. (__internal_statvfs64): Removed. * sysdeps/unix/sysv/linux/internal_statvfs.c: Include "internal_statvfs.h" instead of <sys/statvfs.h>. * sysdeps/unix/sysv/linux/internal_statvfs.h: New file. * sysdeps/unix/sysv/linux/statvfs.c Include "internal_statvfs.h" instead of <sys/statvfs.h>. (__internal_statvfs): Removed. * sysdeps/unix/sysv/linux/statvfs64.c Include "internal_statvfs.h" instead of <sys/statvfs.h>. (__internal_statvfs64): Removed.
* Mark internal functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark internal functions with attribute_hidden to allow direct access to internal functions within libc.so and libc.a without using GOT nor PLT. Size comparison of libc.so: On x86-64: text data bss dec hex Before: 1728577 20584 17088 1766249 1af369 After : 1728593 20584 17088 1766265 1af379 The only change is __gconv_release_shlib in iconv/gconv_dl.c is inlined since it is hidden, which increases the code size of gconv_dl.os by 18 bytes. On i686: text data bss dec hex Before: 1869039 11444 11112 1891595 1cdd0b After : 1868635 11444 11112 1891191 1cdb77 The code size is decreased by avoiding GOT/PLT for hidden functions. [BZ #18822] * iconv/gconv_int.h (__gconv_open): Add attribute_hidden. (__gconv_close): Likewise. (__gconv): Likewise. (__gconv_find_transform): Likewise. (__gconv_lookup_cache): Likewise. (__gconv_compare_alias_cache): Likewise. (__gconv_load_cache): Likewise. (__gconv_get_path): Likewise. (__gconv_close_transform): Likewise. (__gconv_release_cache): Likewise. (__gconv_find_shlib): Likewise. (__gconv_release_shlib): Likewise. (__gconv_get_builtin_trans): Likewise. (__gconv_compare_alias): Likewise. * include/dlfcn.h (_dlerror_run): Likewise. * include/stdio.h (__fortify_fail_abort): Likewise. * include/time.h (__tz_compute): Likewise. (__strptime_internal): Likewise. * intl/gettextP.h (_nl_find_domain): Likewise. (_nl_load_domain): Likewise. (_nl_find_msg): Likewise. * intl/plural-exp.h (FREE_EXPRESSION): Likewise. (EXTRACT_PLURAL_EXPRESSION): Likewise. * locale/coll-lookup.h (__collidx_table_lookup): Likewise. * resolv/gai_misc.h (__gai_enqueue_request): Likewise. (__gai_find_request): Likewise. (__gai_remove_request): Likewise. (__gai_notify): Likewise. (__gai_notify_only): Likewise. * sysdeps/generic/aio_misc.h (__aio_sigqueue): Likewise. * sysdeps/generic/ldsodefs.h (_dl_fini): Likewise. (_dl_non_dynamic_init): Likewise. (_dl_aux_init): Likewise. * sysdeps/i386/machine-gmon.h (mcount_internal): Likewise. * sysdeps/unix/sysv/linux/i386/olddirent.h (__old_getdents64): Likewise. * wcsmbs/wcsmbsload.h (__wcsmbs_load_conv): Likewise. (__wcsmbs_clone_conv): Likewise. (__wcsmbs_named_conv): Likewise.
* Fix return pointer save and PIC register restore in __getcontext andJohn David Anglin2017-10-012-1/+5
| | | | | | | | | __setcontext on hppa. * sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Save return pointer in frame. * sysdeps/unix/sysv/linux/hppa/setcontext.S (__setcontext): Likewise. Correct offset used to restore PIC register.
* Fix hppa text relocations in libc.soJohn David Anglin2017-09-301-0/+5
| | | | | | [BZ libc/22165] * sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Use PIC code to load address of __getcontext_ret when generating PIC code.
* Update sysdeps/unix/sysv/linux/ifaddrs.cH.J. Lu2017-09-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | Fix ../sysdeps/unix/sysv/linux/ifaddrs.c:835:27: error: ‘getifaddrs’ aliased to undefined symbol ‘__getifaddrs’ weak_alias (__getifaddrs, getifaddrs) ^ ../sysdeps/unix/sysv/linux/ifaddrs.c:844:28: error: ‘freeifaddrs’ aliased to undefined symbol ‘__freeifaddrs’ weak_alias (__freeifaddrs, freeifaddrs) caused by commit 4009ddc69225d571772aaea597615a0c032e14ab Author: Samuel Thibault <samuel.thibault@ens-lyon.org> Date: Thu Sep 28 00:19:18 2017 +0200 hurd: Fix `getifaddrs' and `freeifaddrs' symbol exposition * sysdeps/unix/sysv/linux/ifaddrs.c (__getifaddrs): Add libc_hidden_def. (__freeifaddrs): Likewise.
* hurd: Fix `revoke' symbol exposition from `unlockpt'Samuel Thibault2017-09-281-1/+1
| | | | | | | | | | | | `revoke' is MISC only, it should not be exposed along `unlockpt' which is XOPEN. * include/unistd.h (__revoke): New declaration. * misc/revoke.c (revoke): Rename to __revoke, and redefine as weak alias. * sysdeps/mach/hurd/revoke.c (revoke): Likewise. * sysdeps/unix/bsd/unlockpt.c (unlockpt): Use __revoke instead of revoke.
* Fix make-syscalls.sh VDSO support for GCC 8.Joseph Myers2017-09-261-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | sysdeps/unix/make-syscalls.sh has support, used only by x32, for generating IFUNCs for kernel VDSO symbols. This support creates IFUNCs by setting symbol types manually, which is bad for debug info and does not work with current GCC mainline because it results in errors from the checks on types of function aliases. This patch fixes it to use the common __ifunc macro, which uses the ifunc attribute when available and so works with GCC mainline. Note however that the original error resulted from an indirect inclusion of a header declaring __gettimeofday from the generated sources, and using __ifunc now relies on such an indirect inclusion remaining as it means use of __typeof to determine the correct types. If glibc's headers change in such a way as to remove that indirect inclusion, it will become necessary to change the syscalls.list syntax for VDSO syscalls so the name of the header to include can be specified. Tested (compilation only) with build-many-glibcs.py that this fixes the build for x32 with GCC mainline. * sysdeps/unix/make-syscalls.sh: Use __ifunc to define symbols using VDSO.
* posix: Add compat glob symbol to not follow dangling symbolsAdhemerval Zanella2017-09-2537-35/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch follows commit 5554304f0 (posix: Allow glob to match dangling symlinks [BZ #866]) by adding a compat symbol that follow previous semantic of not following dangling symlinks and thus avoiding call gl_lstat with GLOB_ALTDIRFUNC. It avoids failure with old binaries that not set the alternate function pointer for lstat (GNUmake for instance). The following scenario, for instance, fails with current GNUmake because glibc will access unitialized memory when calling gl_lstat: $ cat src/t/t.c int main () { return 0; } $ cat Makefile SRC = $(wildcard src/*/t.c) OBJ = $(patsubst src/%.c, obj/%.o, $(SRC)) prog: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o prog obj/%.o: src/%.c $(CC) $(CFLAGS) -c $< -o $@ $ make This works as expected with the patch applied. Since it is for generic ABI, default compat symbols are added with override for Linux due LFS. Now we have two compat symbols for glob on Linux: 1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with the old dirent layout. For this implementation I also set it to not follow dangling symlinks (which is the safest path). 2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements the compat symbol for dangling symlinks. As for generic glob, the implementation uses XSTAT_IS_XSTAT64 to define whether both __glob_lstat_compat and __glob64_lstat_compat should be different implementations. For archictures that define XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to __glob64_lstat_compat. 3. sysdeps/unix/sysv/linux/alpha/oldglob.c with a different glob_t layout. As for 1. this patch changes it to not follow dangling symlinks. The patch also bumps _GNU_GLOB_INTERFACE_VERSION to 2 to advertise the new semantic. On GNUmake, for instance, it will force to it use its internal glob implementation instead and avoiding triggering the same failure on builds against newer GLIBCs. Checked on x86_64-linux-gnu and i686-linux-gnu. I also checked with a build against the major ABIs required to check for the abilist. The changes should also work on gnulib (I run gnulib-tool.py check glob and it shown no regressions). [BZ #22183] * include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase version to 2. * posix/Makefile (routines): Add glob-lstat-compat and glob64-lstat-compat. * posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version. * posix/glob-lstat-compat.c: New file. * posix/glob64-lstat-compat.c: Likewise. * posix/tst-glob_lstat_compat.c: Likewise. * sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob.c: Remove file. * posix/glob.c (glob_lstat): New function. (glob): Rename to __glob and add versioned symbol to 2.27. (glob_in_dir): Use glob_lstat. * posix/glob64.c (glob64): Add GLOB_ATTRIBUTE. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for 2.27. * sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise. * sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define. * sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use gl_lstat on glob call. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob and glob64 symbols. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/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/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* New expf and exp2f version without SVID compat wrapperSzabolcs Nagy2017-09-2526-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the expf and exp2f error handling semantics to only set errno accoring to POSIX rules. New symbol version is introduced at GLIBC_2.27. The old wrappers are kept for compat symbols. Internal calls to __expf now get the new error semantics, this seems to only affect sysdeps/i386/fpu/s_expm1f.S where the errno-only behaviour should be correct. ia64 needed assembly change to have the new and compat versioned symbol map to the same function. All linux libm abilists are updated. * math/Versions (expf): New libm symbol at GLIBC_2.27. (exp2f): Likewise. * math/w_exp2f.c: New file. * math/w_expf.c: New file. * math/w_exp2f_compat.c (__exp2f_compat): For compat symbol only. * math/w_expf_compat.c (__expf_compat): Likewise. * sysdeps/ia64/fpu/e_exp2f.S: Add versioned symbols. * sysdeps/ia64/fpu/e_expf.S: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* hurd: Fix exposition of s/gettimeofday through timespec_s/getSamuel Thibault2017-09-252-3/+3
| | | | | | | | | | | | | conform/ISO11/time.h/linknamespace complains that using timespec_get exposes gettimeofday. conform/POSIX/time.h/linknamespace complains that using clock_settime exposes settimeofday. * sysdeps/unix/clock_gettime.c (realtime_gettime, __clock_gettime): Use __gettimeofday instead of gettimeofday. * sysdeps/unix/clock_settime.c (__clock_settime): Use __settimeofday instead of settimeofday.
* Fix fexecve build where syscall macros call sizeof.Joseph Myers2017-09-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent fexecve changes broke the build on (at least) alpha (maybe other configurations, that was the first breakage I saw in my build-many-glibcs.py run): In file included from ../sysdeps/unix/sysv/linux/alpha/sysdep.h:29:0, from ../sysdeps/alpha/nptl/tls.h:31, from ../include/errno.h:25, from ../sysdeps/unix/sysv/linux/fexecve.c:18: ../sysdeps/unix/sysv/linux/fexecve.c: In function 'fexecve': ../sysdeps/unix/alpha/sysdep.h:203:10: error: 'sizeof' on array function parameter 'argv' will return size of 'char * const*' [-Werror=sizeof-array-argument] (sizeof(arg) == 4 ? (long)(int)(long)(arg) : (long)(arg)) ^ ../sysdeps/unix/alpha/sysdep.h:302:26: note: in expansion of macro 'syscall_promote' register long _tmp_18 = syscall_promote (arg3); \ ^~~~~~~~~~~~~~~ ../sysdeps/unix/alpha/sysdep.h:173:2: note: in expansion of macro 'inline_syscall5' inline_syscall##nr(__NR_##name, args); \ ^~~~~~~~~~~~~~ ../sysdeps/unix/sysv/linux/alpha/sysdep.h:85:2: note: in expansion of macro 'INLINE_SYSCALL1' INLINE_SYSCALL1(name, nr, args); \ ^~~~~~~~~~~~~~~ ../sysdeps/unix/sysv/linux/fexecve.c:42:3: note: in expansion of macro 'INLINE_SYSCALL' INLINE_SYSCALL (execveat, 5, fd, "", argv, envp, AT_EMPTY_PATH); ^~~~~~~~~~~~~~ ../sysdeps/unix/sysv/linux/fexecve.c:33:30: note: declared here fexecve (int fd, char *const argv[], char *const envp[]) ^~~~ This patch fixes this similarly to previous fixes for such issues: use &argv[0] and &envp[0] as the syscall macro arguments. Tested (compilation only) for alpha-linux-gnu with build-many-glibcs.py. * sysdeps/unix/sysv/linux/fexecve.c (fexecve) [__NR_execveat]: Explicitly take address of first element of array arguments in call to INLINE_SYSCALL.
* Use execveat syscall in fexecve (bug 22134)Andreas Schwab2017-09-195-0/+35
| | | | | By using execveat we no longer depend on /proc. The execveat syscall was introduced in 3.19, except for a few late comers.
* posix: Fix compat glob code on s390 and alphaAdhemerval Zanella2017-09-132-4/+2
| | | | | | | | | | | | | | | | | This patch fixes the compat glob implementation consolidation from commit 116f1c64d with the following changes: - Add a compat implementation on s390 to avoid the architecture to build the symbols on default linux oldglob.c by setting GLOB_NO_OLD_VERSION. - Remove the duplicate rule to build oldglob on alpha. Checked on s390-linux-gnu and alpha-linux-gnu using build-many-glibc.py. * sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c: New file. * sysdeps/unix/sysv/linux/alpha/Makefile [$(subdir) = csu] (sysdep_routines): Remove rule.
* Add thunderx2t99 and thunderx2t99p1 CPU names to tunables listSteve Ellcey2017-09-081-3/+5
| | | | | | | * manual/tunables.texi (glibc.tune.cpu): Add thunderx2t99 and thunderx2t99p1 to list of cpu names. * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list): Add thunderx2t99 and thunderx2t99p1 entries to cpu_list.
* Fix glibc.tune.cpu tunable handlingSteve Ellcey2017-09-081-1/+1
| | | | | * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (get_midr_from_mcpu): Use strcmp instead of tunable_is_name.
* Add Linux 4.13 constants to bits/fcntl-linux.h.Joseph Myers2017-09-081-0/+15
| | | | | | | | | | | | | | | | | | | | This patch adds new interfaces (F_GET_RW_HINT etc., and associated RW[FH]_WRITE_LIFE_*) from Linux 4.13 to bits/fcntl-linux.h (conditional on __USE_GNU). Tested for x86_64. * sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU] (F_GET_RW_HINT): New macro. [__USE_GNU] (F_SET_RW_HINT): Likewise. [__USE_GNU] (F_GET_FILE_RW_HINT): Likewise. [__USE_GNU] (F_SET_FILE_RW_HINT): Likewise. [__USE_GNU] (RWF_WRITE_LIFE_NOT_SET): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_NONE): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_SHORT): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_MEDIUM): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_LONG): Likewise. [__USE_GNU] (RWH_WRITE_LIFE_EXTREME): Likewise.
* Add fcntl sealing interfaces from Linux 3.17 to bits/fcntl-linux.h.Joseph Myers2017-09-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While reviewing Linux 4.13 for glibc header changes needed, I noticed that bits/fcntl-linux.h was missing F_ADD_SEALS etc. from Linux 3.17. I didn't find any discussion indicating this omission is deliberate. Now, these interfaces can only be used with file descriptors created with memfd_create, and we don't have a memfd_create wrapper in glibc (a patch was submitted in October 2014, albeit without documentation / tests, and discussions continued over the next few months, but without consensus on whether to add the interface - and we still lack any general consensus on syscall wrappers), but I don't think that's a reason to exclude the constants from bits/fcntl-linux.h (especially as the header does not look compatible with simultaneously including linux/fcntl.h). (Some of those 2014/2015 discussions raised concerns about difficulty using the memfd_create / sealing interface, but those seem to me more like a question of whether it should be part of the OS-independent GNU API - in my view, even fairly specialized syscalls ought to have wrappers added to glibc if not obsolescent, but there may be cases where we only want to include them in the Linux-specific API and anything in the OS-independent GNU API should be different - rather than being relevant to whether constants for use with fcntl should appear in headers.) * sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU] (F_ADD_SEALS): New macro. [__USE_GNU] (F_GET_SEALS): Likewise. [__USE_GNU] (F_SEAL_SEAL): Likewise. [__USE_GNU] (F_SEAL_SHRINK): Likewise. [__USE_GNU] (F_SEAL_GROW): Likewise. [__USE_GNU] (F_SEAL_WRITE): Likewise.
* posix: Consolidate Linux glob implementationAdhemerval Zanella2017-09-0822-35/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the glob implementation. The main changes are: * On Linux all implementation now uses the default one at sysdeps/unix/sysv/linux/glob{free}{64}.c with the exception of alpha (which requires specific versioning) and s390-32 (which different than other 32 bits ports it does not add a compat one symbol for 2.1 version). * The default implementation uses XSTAT_IS_XSTAT64 to define whether both glob{free} and glob{free}64 should be different implementations. For archictures that define XSTAT_IS_XSTAT64, glob{free} is an alias to glob{free}64. * Move i386 olddirent.h header to Linux default directory, since it is the only header with this name and it is shared among different architectures (and used on compat glob symbol as well). Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. * sysdeps/unix/sysv/linux/arm/glob64.c: Remove file. * sysdeps/unix/sysv/linux/i386/glob64.c: Likewise. * sysdeps/unix/sysv/linux/m68k/glob64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/glob64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/glob64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/glob.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/globfree.c: Likewise. * sysdeps/wordsize-64/glob.c: Likewise. * sysdeps/wordsize-64/glob64.c: Likewise. * sysdeps/wordsize-64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/glob.c: New file. * sysdeps/unix/sysv/linux/glob64.c: Likewise. * sysdeps/unix/sysv/linux/globfree.c: Likewise. * sysdeps/unix/sysv/linux/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/glob64.c: Likewise. * sysdeps/unix/sysv/linux/oldglob.c [SHLIB_COMPAT]: Also adds !GLOB_NO_OLD_VERSION as an extra condition. * sysdeps/unix/sysv/linux/i386/alphasort64.c: Include olddirent.h using relative path instead of absolute one. * sysdeps/unix/sysv/linux/i386/getdents64.c: Likewise. * sysdeps/unix/sysv/linux/i386/readdir64.c: Likewise. * sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/i386/versionsort64.c: Likewise. * sysdeps/unix/sysv/linux/i386/olddirent.h: Move to ... * sysdeps/unix/sysv/linux//olddirent.h: ... here.
* posix: Sync glob with gnulib [BZ #1062]Adhemerval Zanella2017-09-088-43/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch syncs posix/glob.c implementation with gnulib version b5ec983 (glob: simplify symlink detection). The only difference to gnulib code is * DT_UNKNOWN, DT_DIR, and DT_LNK definition in the case there were not already defined. Gnulib code which uses HAVE_STRUCT_DIRENT_D_TYPE will redefine them wrongly because GLIBC does not define HAVE_STRUCT_DIRENT_D_TYPE. Instead the patch check for each definition instead. Also, the patch requires additional globfree and globfree64 files for compatibility version on some architectures. Also the code simplification leads to not macro simplification (not need for NO_GLOB_PATTERN_P anymore). Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. [BZ #1062] * posix/Makefile (routines): Add globfree, globfree64, and glob_pattern_p. * posix/flexmember.h: New file. * posix/glob_internal.h: Likewise. * posix/glob_pattern_p.c: Likewise. * posix/globfree.c: Likewise. * posix/globfree64.c: Likewise. * sysdeps/gnu/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/alpha/globfree.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/oldglob.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/globfree64.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/globfree.c: Likewise. * sysdeps/wordsize-64/globfree.c: Likewise. * sysdeps/wordsize-64/globfree64.c: Likewise. * posix/glob.c (HAVE_CONFIG_H): Use !_LIBC instead. [NDEBUG): Remove comments. (GLOB_ONLY_P, _AMIGA, VMS): Remove define. (dirent_type): New type. Use uint_fast8_t not uint8_t, as C99 does not require uint8_t. (DT_UNKNOWN, DT_DIR, DT_LNK): New macros. (struct readdir_result): Use dirent_type. Do not define skip_entry unless it is needed; this saves a byte on platforms lacking d_ino. (readdir_result_type, readdir_result_skip_entry): New functions, replacing ... (readdir_result_might_be_symlink, readdir_result_might_be_dir): these functions, which were removed. This makes the callers easier to read. All callers changed. (D_INO_TO_RESULT): Now empty if there is no d_ino. (size_add_wrapv, glob_use_alloca): New static functions. (glob, glob_in_dir): Check for size_t overflow in several places, and fix some size_t checks that were not quite right. Remove old code using SHELL since Bash no longer uses this. (glob, prefix_array): Separate MS code better. (glob_in_dir): Remove old Amiga and VMS code. (globfree, __glob_pattern_type, __glob_pattern_p): Move to separate files. (glob_in_dir): Do not rely on undefined behavior in accessing struct members beyond their bounds. Use a flexible array member instead (link_stat): Rename from link_exists2_p and return -1/0 instead of 0/1. Caller changed. (glob): Fix memory leaks. * posix/glob64 (globfree64): Move to separate file. * sysdeps/gnu/glob64.c (NO_GLOB_PATTERN_P): Remove define. (globfree64): Remove hidden alias. * sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Add oldglob. * sysdeps/unix/sysv/linux/alpha/glob.c (__new_globfree): Move to separate file. * sysdeps/unix/sysv/linux/i386/glob64.c (NO_GLOB_PATTERN_P): Remove define. Move compat code to separate file. * sysdeps/wordsize-64/glob.c (globfree): Move definitions to separate file.
* Add SOL_TLS definition from Linux 4.13.Joseph Myers2017-09-071-0/+1
| | | | | | | | | This patch adds the new SOL_TLS constant from Linux 4.13 to the Linux bits/socket.h. Tested for x86_64. * sysdeps/unix/sysv/linux/bits/socket.h (SOL_TLS): New macro.
* Hide __chmod and __mkdir [BZ #18822]H.J. Lu2017-09-042-0/+4
| | | | | | | | | | | | | | | Hide internal __chmod and __mkdir functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/stat.h (__chmod): Add libc_hidden_proto. (__mkdir): Likewise. * io/chmod.c (__chmod): Add libc_hidden_def. * io/mkdir.c (__mkdir): Likewise. * sysdeps/mach/hurd/chmod.c (__chmod): Likewise. * sysdeps/mach/hurd/mkdir.c (__mkdir): Likewise. * sysdeps/unix/sysv/linux/generic/chmod.c (__chmod): Likewise. * sysdeps/unix/sysv/linux/generic/mkdir.c (__mkdir): Likewise.
* Update kernel version in syscall-names.list to 4.13.Joseph Myers2017-09-041-2/+2
| | | | | | | | | As far as I can tell Linux 4.13 does not add any new syscalls not included in syscall-names.list. This patch updates the version number in that file accordingly. * sysdeps/unix/sysv/linux/syscall-names.list: Update kernel version to 4.13.
* Include <string.h> for strcmp call from sysdeps/unix/sysv/linux/gentempfd.c.Joseph Myers2017-09-011-0/+1
| | | | * sysdeps/unix/sysv/linux/gentempfd.c: Include <string.h>.
* linux: Implement tmpfile with O_TMPFILE (BZ#21530)Adhemerval Zanella2017-09-011-0/+34
| | | | | | | | | | | | | | | | | | | | | | This patch adds O_TMPFILE support to tmpfile on Linux. This is similar to the previous suggestion by Andreas Schwab [1] with the difference the file descriptor creation is parameterized to compartmentalize Linux only open flags (O_TMPFILE) on sysdeps. Checked on x86_64-linux-gnu. Adhemerval Zanella <adhemerval.zanella@linaro.org> Andreas Schwab <schwab@suse.de> [BZ #21530] * include/stdio.h (__gen_tempfd): New function. * stdio-common/Makefile (routines): Add gentempfd. * stdio-common/gentempfd.c: New file. * sysdeps/unix/sysv/linux/gentempfd.c: Likewise. * stdio-common/tmpfile.c (tmpfile): First try to use a system specific unnamed file first. [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01293.html
* Remove NO_CANCELLATION macroAdhemerval Zanella2017-08-3119-28/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NO_CANCELLATION macro is used currently on generic headers to define non cancellable syscalls and on Linux fcntl to implement the non cancellable variation. Former should be single-handled by not-cancel.h header and former could be simplified build both cancellable and non cancellable for default objects and alias the non-cancellable to default one for rtld ones (since Linux already support cancellation as default). This patch thus removes the NO_CANCELLATION macro and its usage. The generic non cancellable fcntl is route to internal fcntl. Checked on x86_64-linux-gnu and i686-linux-gnu. Also checked with a build again major ABIs. * sysdeps/generic/not-cancel.h (NO_CANCELLATION): Remove macro. * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (NO_CANCELLATION): Likewise * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (NO_CANCELLATION): Likewise. * sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): Add hidden prototype. * sysdeps/unix/sysv/linux/fcntl.c (__fcntl_nocancel): Define only for !IS_IN (rtld) and remove NO_CANCELLATION usage.
* posix: Remove internal_function attributeFlorian Weimer2017-08-316-14/+12
|
* inet: Remove internal_function attributeFlorian Weimer2017-08-311-1/+0
|
* elf: Remove internal_function attributeFlorian Weimer2017-08-312-2/+1
|
* resolv: Remove internal_function attributeFlorian Weimer2017-08-311-1/+0
|
* dirent: Remove internal_function attributeFlorian Weimer2017-08-312-3/+1
|
* Linux getcwd: Remove internal_function attributeFlorian Weimer2017-08-311-2/+2
|
* aio: Remove internal_function function attributeFlorian Weimer2017-08-311-1/+0
|
* Fix mcontext_t sigcontext namespace (bug 21457).Joseph Myers2017-08-3021-76/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch completes the ucontext.h namespace fixes by fixing issues related to the use of struct sigcontext as mcontext_t, and inclusion of <bits/sigcontext.h> even when struct sigcontext is not so used. Inclusion of <bits/sigcontext.h> by <sys/ucontext.h> is removed; the way to get the sigcontext structure is by including <signal.h> (in a context where __USE_MISC is defined); the sysdeps/generic version of sys/ucontext.h keeps the inclusion by necessity, with a comment about how this is not namespace-clean, but the only configuration that used it, MicroBlaze, gets its own version of the header in this patch. Where mcontext_t was typedefed to struct sigcontext, the contents of struct sigcontext are inserted (with appropriate namespace handling to prefix fields with __ when __USE_MISC is not defined); review should check that this has been done correctly in each case, whether the definition of struct sigcontext comes from glibc headers or from the Linux kernel. This changes C++ name mangling on affected architectures (which do not include x86_64/x86). Tested for x86_64, and with build-many-glibcs.py. 2017-08-14 Joseph Myers <joseph@codesourcery.com> [BZ #21457] * sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/generic/sys/ucontext.h: Add comment about use of struct sigcontext and namespace requirements. * sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/m68k/sys/ucontext.h: Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. Include <bits/types.h>. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use __glibc_reserved1 instead of __reserved. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use mcontext_t instead of struct sigcontext. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): New macro. (struct __ia64_fpreg_mcontext): New type. (mcontext_t): Define structure contents rather than using struct sigcontext. (_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext. (uc_sigmask): Define using __ctx. (uc_stack): Likewise. * sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include <bits/sigcontext.h>. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include <bits/sigcontext.h>. (__ctx): Define earlier. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include <bits/sigcontext.h>. Include <bits/types.h>. * conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove. (test-xfail-XPG42/sys/wait.h/conform): Likewise. (test-xfail-XPG42/ucontext.h/conform): Likewise. (test-xfail-UNIX98/signal.h/conform): Likewise. (test-xfail-UNIX98/sys/wait.h/conform): Likewise. (test-xfail-UNIX98/ucontext.h/conform): Likewise. (test-xfail-XOPEN2K/signal.h/conform): Likewise. (test-xfail-XOPEN2K/sys/wait.h/conform): Likewise. (test-xfail-XOPEN2K/ucontext.h/conform): Likewise. (test-xfail-POSIX2008/signal.h/conform): Likewise. (test-xfail-POSIX2008/sys/wait.h/conform): Likewise. (test-xfail-XOPEN2K8/signal.h/conform): Likewise. (test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.
* aarch64: Fix tst-makecontext3 in ILP32 mode.Steve Ellcey2017-08-301-5/+5
| | | | | * sysdeps/unix/sysv/linux/aarch64/makecontext.c (__makecontext): Use pointer to uint64_t instead of long int for sp.
* MIPS/o32: Fix internal_syscall5/6/7Adhemerval Zanella2017-08-2914-186/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a commit cc25c8b4c119 ("New pthread rwlock that is more scalable.") regression and prevent uncontrolled stack space usage from happening when a 5-, 6- or 7-argument syscall wrapper is placed in a loop. The cause of the problem is the use of `alloca' in regular MIPS/Linux wrappers to force the use of the frame pointer register in any function using one or more of these wrappers. Using the frame pointer register is required so as not to break frame unwinding as the the stack pointer is lowered within the inline asm used by these wrappers to make room for the stack arguments, which 5-, 6- and 7-argument syscalls use with the o32 ABI. The regular MIPS/Linux wrappers are macros however, expanded inline, and stack allocations made with `alloca' are not discarded until the return of the function they are made in. Consequently if called in a loop, then virtual memory is wasted, and if the loop goes through enough iterations, then ultimately available memory can get exhausted causing the program to crash. Address the issue by replacing the inline code with standalone assembly functions, which rely on the compiler arranging syscall arguments according to the o32 function calling convention, which MIPS/Linux syscalls also use, except for the syscall number passed and the error flag returned. This way there is no need to fiddle with the stack pointer anymore and all that has to be handled in the new standalone functions is the special handling of the syscall number and the error flag. Redirect 5-, 6- or 7-argument MIPS16/Linux syscall wrappers to these new functions as well, so as to avoid an unnecessary double call the existing wrappers would cause with the new arrangement. [BZ #21956] * sysdeps/unix/sysv/linux/mips/mips32/mips16/Makefile [subdir = misc] (sysdep_routines): Remove `mips16-syscall5', `mips16-syscall6' and `mips16-syscall7'. (CFLAGS-mips16-syscall5.c, CFLAGS-mips16-syscall6.c) (CFLAGS-mips16-syscall7.c): Remove. * sysdeps/unix/sysv/linux/mips/mips32/mips16/Versions (libc): Remove `__mips16_syscall5', `__mips16_syscall6' and `__mips16_syscall7'. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall0.c (__mips16_syscall0): Rename `__mips16_syscall_return' to `__mips_syscall_return'. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall1.c (__mips16_syscall1): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall2.c (__mips16_syscall2): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall3.c (__mips16_syscall3): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall4.c (__mips16_syscall4): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall5.c: Remove. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall6.c: Remove. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall7.c: Remove. * sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall.h (__mips16_syscall5): Expand to `__mips_syscall5' rather than `__mips16_syscall5'. Remove prototype. (__mips16_syscall6): Expand to `__mips_syscall6' rather than `__mips16_syscall6'. Remove prototype. (__mips16_syscall7): Expand to `__mips_syscall7' rather than `__mips16_syscall7'. Remove prototype. (__nomips16, __mips16_syscall_return): Move to... * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (__nomips16, __mips_syscall_return): ... here. [__mips16] (INTERNAL_SYSCALL_NCS): Rename `__mips16_syscall_return' to `__mips_syscall_return'. [__mips16] (INTERNAL_SYSCALL_MIPS16): Pass `number' to `internal_syscall##nr'. [!__mips16] (INTERNAL_SYSCALL): Pass `SYS_ify (name)' to `internal_syscall##nr'. (FORCE_FRAME_POINTER): Remove. (__mips_syscall5): New prototype. (internal_syscall5): Rewrite to call `__mips_syscall5'. (__mips_syscall6): New prototype. (internal_syscall6): Rewrite to call `__mips_syscall6'. (__mips_syscall7): New prototype. (internal_syscall7): Rewrite to call `__mips_syscall7'. * sysdeps/unix/sysv/linux/mips/mips32/mips-syscall5.S: New file. * sysdeps/unix/sysv/linux/mips/mips32/mips-syscall6.S: New file. * sysdeps/unix/sysv/linux/mips/mips32/mips-syscall7.S: New file. * sysdeps/unix/sysv/linux/mips/mips32/Makefile [subdir = misc] (sysdep_routines): Add libc-do-syscall. * sysdeps/unix/sysv/linux/mips/mips32/Versions (libc): Add `__mips_syscall5', `__mips_syscall6' and `__mips_syscall7'.
* [AArch64] Fix procfs.h not to expose stdint.h typesSzabolcs Nagy2017-08-291-2/+1
| | | | | | | Commit 39e7a5a66828a60008543db5f03f46dc7081668b added stdint.h to sys/procfs.h, but it is included into signal.h by default and there is code that does not expect stdint.h to be visible there, so use __uint64_t instead of uint64_t.
* Remove abi-*-options compiler flagsFlorian Weimer2017-08-288-53/+0
| | | | | | These options are no longer needed since commit 2dba5ce7b8115d6a2789bf279892263621088e74 (<bits/syscall.h>: Use an arch-independent system call list on Linux).
* <bits/syscall.h>: Use an arch-independent system call list on LinuxFlorian Weimer2017-08-285-68/+859
| | | | | | | | | | | | | This commit changes the way the list of SYS_* system call macros is created on Linux. glibc now contains a list of all known system calls, and the generated <bits/syscall.h> file defines the SYS_ macro only if the correspnding __NR_ macro is defined by the kernel headers. As a result, glibc does not have to be rebuilt to pick up system calls if the glibc sources already know about them. This means that glibc can be built with older kernel headers, and if the installed kernel headers are upgraded afterwards, additional SYS_ macros become available as long as glibc has a record for those system calls.
* [AArch64] Fix elf_greg_t on ILP32Szabolcs Nagy2017-08-251-1/+2
| | | | Use uint64_t instead of unsigned long.
* Remove cancellation support for syscall generationAdhemerval Zanella2017-08-2424-2766/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the cancellation mark from the auto-generation syscall script. Now all the cancellable syscalls are done throught C code using the SYSCALL_CANCEL macro. It simplifies the assembly required to each architecture port, since the SYSCALL_CANCEL uses the already defined INLINE_SYSCALL macros, and allows a more straigh fix on cancellation machanism (since no more specific assembly fixes will be required). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.A Also with build-many-glibc.py with remaning touched architectures. * sysdeps/unix/make-syscalls.sh: Remove cancellable tagging for syscall definitions. * sysdeps/unix/syscall-template.S (SYSCALL_CANCELLABLE): Remove definition. * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (__local_enable_asynccancel): Likewise. [IS_IN (libpthread)] (__local_disable_asynccancel): Likewise. [IS_IN (libc)] (__local_enable_asynccancel): Likewise. [IS_IN (libc)] (__local_enable_asynccancel): Likewise. [IS_IN (librt)] (__local_disable_asynccancel): Likewise. [IS_IN (librt)] (__local_disable_asynccancel): Likewise. (CENABLE): Likewise. (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (PSEUDO): Remove defintion. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Remove file. * sysdeps/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: New file. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Remove file. * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: New file. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (PSEUDO): Remove definition. (PSEUDO_END): Likewise. [IS_IN (libpthread)] (CENABLE): Likewise. [IS_IN (libpthread)] (CDISABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (libc)] (CENABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [IS_IN (librt)] (CDISABLE): Likewise. [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* Consolidate remaning non cancellable definitionsAdhemerval Zanella2017-08-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidate the remaning non cancellable syscall definitions on not-cancel.h header. They are: * __fcntl_nocancel: Moved from fcntl.h to not-cancel.h. * __sigsuspend_nocancel: Removed since 988f991b50 it is not used or defined anymore. * __nanosleep_nocancel: Removed since 6f33fd046b it is defined on not-cancel.h. Now all non-cancellable syscall definition are defined on not-cancel (the only exceptions is the stdio symbol __fxprintf_nocancel which uses non cancellable open and it is used on getopt implementation). Checked on x86_64-linux-gnu and with build-many-glibc.py. * include/fcntl.h (__fcntl_nocancel): Remove definition. * include/signal.h (__sigsuspend_nocancel): Likewise. * include/time.h (__nanosleep_nocancel): Likewise. * sysdeps/generic/not-cancel.h (__fcntl_nocancel): New macro. * login/utmp_file.c: Include non cancellable syscall header. * sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): New prototype.
* Remove p{read,write}{v} and fallocate from x86 auto-generation listAdhemerval Zanella2017-08-222-5/+0
| | | | | | | | | | | | With {INLINE,INTERNAL}_SYSCALL macros fixed for 64-bits arguments on x32, we can remove the p{read,write}{v} from auto-generation list. Tested on x86_64 and x32. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (pread64): Remove. (preadv64): Likewise. (pwrite64(: Likewise. (pwritev64): Likewise.