summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* i386: Use INDIRECT_JUMP_ENTRY in memset-sse2-rep.Shjl/cet/masterH.J. Lu2018-01-091-160/+160
| | | | | * sysdeps/i386/i686/multiarch/memset-sse2-rep.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* i386: Use INDIRECT_JUMP_ENTRY in strcat-sse2.SH.J. Lu2018-01-091-65/+65
| | | | | * sysdeps/i386/i686/multiarch/strcat-sse2.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* i386: Use INDIRECT_JUMP_ENTRY in strcpy-sse2.SH.J. Lu2018-01-091-97/+97
| | | | | * sysdeps/i386/i686/multiarch/strcpy-sse2.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* i386: Use INDIRECT_JUMP_ENTRY in memcpy-ssse3.SH.J. Lu2018-01-091-160/+160
| | | | | * sysdeps/i386/i686/multiarch/memcpy-ssse3.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* i386: Use INDIRECT_JUMP_ENTRY in memcpy-ssse3-rep.SH.J. Lu2018-01-091-113/+119
| | | | | | | * sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S (BRANCH_TO_JMPTBL_ENTRY_VALUE): Add 4 bytes for 4-byte endbr32. Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* i386: Use INDIRECT_JUMP_ENTRY in memcmp-sse4.SH.J. Lu2018-01-091-70/+70
| | | | | * sysdeps/i386/i686/multiarch/memcmp-sse4.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* i386: Use INDIRECT_JUMP_ENTRY in memset-sse2.SH.J. Lu2018-01-091-160/+160
| | | | | * sysdeps/i386/i686/multiarch/memset-sse2.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* i386: Use INDIRECT_JUMP_ENTRY in i686/memcmp.SH.J. Lu2018-01-091-32/+32
| | | | | * sysdeps/i386/i686/memcmp.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* i386: Add _CET_ENDBR to indirect jump targets in add_n.S/sub_n.SH.J. Lu2018-01-093-3/+77
| | | | | | | | | | | | | | | | | | | | | | | | i386 add_n.S and sub_n.S use a trick to implment jump tables with LEA. We can't use conditional branches nor normal jump tables since jump table entries use EFLAGS set by jump table index. This patch adds _CET_ENDBR to indirect jump targets and adjust destination for _CET_ENDBR. * sysdeps/i386/add_n.S: Include <sysdep.h>, instead of "sysdep.h". (__mpn_add_n): Save and restore %ebx if __IBT__ is defined. Add _CET_ENDBR to indirect jump targets and adjust jump destination for _CET_ENDBR. * sysdeps/i386/i686/add_n.S: Include <sysdep.h>, instead of "sysdep.h". (__mpn_add_n): Save and restore %ebx if __IBT__ is defined. Add _CET_ENDBR to indirect jump targets and adjust jump destination for _CET_ENDBR. * sysdeps/i386/sub_n.S: Include <sysdep.h>, instead of "sysdep.h". (__mpn_sub_n): Save and restore %ebx if __IBT__ is defined. Add _CET_ENDBR to indirect jump targets and adjust jump destination for _CET_ENDBR.
* x86-64: Use INDIRECT_JUMP_ENTRY in memcpy-ssse3.SH.J. Lu2018-01-091-112/+112
| | | | | * sysdeps/x86_64/multiarch/memcpy-ssse3.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* x86-64: Use INDIRECT_JUMP_ENTRY in memcmp-sse4.SH.J. Lu2018-01-091-81/+81
| | | | | * sysdeps/x86_64/multiarch/memcmp-sse4.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* x86-64: Use INDIRECT_JUMP_ENTRY in memcpy-ssse3-back.SH.J. Lu2018-01-091-320/+320
| | | | | * sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* x86-64: Use INDIRECT_JUMP_ENTRY in strcmp-sse42.SH.J. Lu2018-01-091-7/+7
| | | | | * sysdeps/x86_64/multiarch/strcmp-sse42.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* x86-64: Use INDIRECT_JUMP_ENTRY in strcpy-sse2-unaligned.SH.J. Lu2018-01-091-83/+83
| | | | | * sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* x86_64: Use INDIRECT_JUMP_ENTRY in strcmp.SH.J. Lu2018-01-091-16/+16
| | | | | * sysdeps/x86_64/strcmp.S: Use INDIRECT_JUMP_ENTRY with indirect jump targets to add _CET_ENDBR.
* x86: Add INDIRECT_JUMP_ENTRYH.J. Lu2018-01-091-0/+4
| | | | | | | Add INDIRECT_JUMP_ENTRY to define a label with _CET_ENDBR for indirect jump target to support IBT. * sysdeps/x86/sysdep.h (INDIRECT_JUMP_ENTRY): New.
* x86: Add _CET_ENDBR to functions in dl-tlsdesc.SH.J. Lu2018-01-092-0/+12
| | | | | | | | | | | | | | | | | | | | | Add _CET_ENDBR to functions in dl-tlsdesc.S, which are called indirectly, to support IBT. Tested on i686 and x86-64. * sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_return): Add _CET_ENDBR. (_dl_tlsdesc_undefweak): Likewise. (_dl_tlsdesc_dynamic): Likewise. (_dl_tlsdesc_resolve_abs_plus_addend): Likewise. (_dl_tlsdesc_resolve_rel): Likewise. (_dl_tlsdesc_resolve_rela): Likewise. (_dl_tlsdesc_resolve_hold): Likewise. * sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_return): Likewise. (_dl_tlsdesc_undefweak): Likewise. (_dl_tlsdesc_dynamic): Likewise. (_dl_tlsdesc_resolve_rela): Likewise. (_dl_tlsdesc_resolve_hold): Likewise.
* x86: Support IBT and SHSTK in Intel CET [BZ #21598]H.J. Lu2018-01-0825-28/+851
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intel Control-flow Enforcement Technology (CET) instructions: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-en forcement-technology-preview.pdf includes Indirect Branch Tracking (IBT) and Shadow Stack (SHSTK). GNU_PROPERTY_X86_FEATURE_1_IBT is added to GNU program property to indicate that all executable sections are compatible with IBT when ENDBR instruction starts each valid target where an indirect branch instruction can land. Linker sets GNU_PROPERTY_X86_FEATURE_1_IBT on output only if it is set on all relocatable inputs. On an IBT capable processor, the following steps should be taken: 1. When loading an executable without an interpreter, enable IBT and lock IBT if GNU_PROPERTY_X86_FEATURE_1_IBT is set on the executable. 2. When loading an executable with an interpreter, enable IBT if GNU_PROPERTY_X86_FEATURE_1_IBT is set on the interpreter. a. If GNU_PROPERTY_X86_FEATURE_1_IBT isn't set on the executable, disable IBT. b. Lock IBT. 3. If IBT is enabled, when loading a shared object without GNU_PROPERTY_X86_FEATURE_1_IBT: a. If legacy interwork is allowed, then mark all pages in executable PT_LOAD segments in legacy code page bitmap. Failure of legacy code page bitmap allocation causes an error. b. If legacy interwork isn't allowed, it causes an error. GNU_PROPERTY_X86_FEATURE_1_SHSTK is added to GNU program property to indicate that all executable sections are compatible with SHSTK where return address popped from shadow stack always matches return address popped from normal stack. Linker sets GNU_PROPERTY_X86_FEATURE_1_SHSTK on output only if it is set on all relocatable inputs. On a SHSTK capable processor, the following steps should be taken: 1. When loading an executable without an interpreter, enable SHSTK if GNU_PROPERTY_X86_FEATURE_1_SHSTK is set on the executable. 2. When loading an executable with an interpreter, enable SHSTK if GNU_PROPERTY_X86_FEATURE_1_SHSTK is set on interpreter. a. If GNU_PROPERTY_X86_FEATURE_1_SHSTK isn't set on the executable or any shared objects loaded via the DT_NEEDED tag, disable SHSTK. b. Otherwise lock SHSTK. 3. After SHSTK is enabled, it is an error to load a shared object without GNU_PROPERTY_X86_FEATURE_1_SHSTK. To enable CET support in glibc, --enable-cet is required to configure glibc. When CET is enabled, both compiler and assembler must support CET. Otherwise, it is a configure-time error. To support CET run-time control, 1. _dl_x86_feature_1 is added to the writable ld.so namespace to indicate if IBT or SHSTK are enabled at run-time. It should be initialized by init_cpu_features. 2. For dynamic executables: a. A l_cet field is added to struct link_map to indicate if IBT or SHSTK is enabled in an ELF module. The optional DL_PROCESS_PT_NOTE is called to process PT_NOTE segment for GNU program property and set l_cet. b. _dl_start_user calls _dl_cet_init, instead of _dl_init, which sets up IBT and SHSTK. c. DL_OPEN_CHECK is added to check IBT and SHSTK compatibilty when dlopening a shared object. 3. Replace i386 _dl_runtime_resolve and _dl_runtime_profile with _dl_runtime_resolve_shstk and _dl_runtime_profile_shstk, respectively if SHSTK is enabled. <cet.h> from CET-enabled GCC is automatically included by assembly codes to add GNU_PROPERTY_X86_FEATURE_1_IBT and GNU_PROPERTY_X86_FEATURE_1_SHSTK to GNU program property. _CET_ENDBR is added at the entrance of all assembly functions whose address may be taken. [BZ #21598] * config.h.in (ENABLE_CET): New #undef. * configure.ac: Add --enable-cet. * configure: Regenerated. * elf/dl-load.c (filebuf): Moved before "dynamic-link.h". (_dl_map_object_from_fd): Call DL_PROCESS_PT_NOTE on PT_NOTE segment if DL_PROCESS_PT_NOTE is defined. * elf/rtld.c (dl_main): Likewise. * elf/dl-open.c (dl_open_worker): Call DL_OPEN_CHECK if it is defined. * sysdeps/unix/sysv/linux/i386/dl-cet.c: New file. * sysdeps/unix/sysv/linux/i386/dl-machine.h: Likewise. * sysdeps/unix/sysv/linux/x86/check-cet.awk: Likewise. * sysdeps/unix/sysv/linux/x86/configure: Likewise. * sysdeps/unix/sysv/linux/x86/configure.ac: Likewise. * sysdeps/unix/sysv/linux/x86/dl-cet.c: Likewise. * sysdeps/unix/sysv/linux/x86/dl-cet.h: Likewise. * sysdeps/unix/sysv/linux/x86/dl-procruntime.c: Likewise. * sysdeps/unix/sysv/linux/x86/ldsodefs.h: Likewise. * sysdeps/unix/sysv/linux/x86/link_map.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/dl-machine.h: Likewise. * sysdeps/i386/dl-machine.h (DL_INIT): New. (_dl_start_user): Replace _dl_init with DL_INIT. * sysdeps/i386/dl-trampoline.S (_dl_runtime_resolve): Add _CET_ENDBR. (_dl_runtime_profile): Likewise. (_dl_runtime_resolve_shstk): New. (_dl_runtime_profile_shstk): Likewise. * sysdeps/unix/sysv/linux/x86/Makefile (sysdep-dl-routines): Add dl-cet if CET is enabled. (CFLAGS-.o): Add -fcf-protection -mcet if CET is enabled. (CFLAGS-.os): Likewise. (CFLAGS-.op): Likewise. (CFLAGS-.oS): Likewise. (asm-CPPFLAGS): Add -fcf-protection -mcet -include cet.h if CET is enabled. (tests-special): Add $(objpfx)check-cet.out. (cet-built-dso): New. (+$(cet-built-dso:=.note)): Likewise. (common-generated): Add $(cet-built-dso:$(common-objpfx)%=%.note). ($(objpfx)check-cet.out): New. (generated): Add check-cet.out. * sysdeps/x86/sysdep.h (_CET_ENDBR): Define if not defined. (ENTRY): Add _CET_ENDBR. * sysdeps/x86_64/dl-machine.h (DL_INIT): New. (_dl_start_user): Replace _dl_init with DL_INIT. * sysdeps/x86_64/x32/dl-machine.h (_dl_start_user): Likewise. * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Add _CET_ENDBR. (_dl_runtime_profile): Likewise.
* x86: Support shadow stack pointer in setjmp/longjmpH.J. Lu2018-01-0811-1/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Save and restore shadow stack pointer in setjmp and longjmp to support shadow stack in Intel CET. Use feature_1 in tcbhead_t to check if shadow stack is enabled before saving and restoring shadow stack pointer so that it works with the old smaller cancel_jmp_buf which doesn't have space for shadow stack pointer. 2017-12-07 Igor Tsimbalist <igor.v.tsimbalist@intel.com> H.J. Lu <hongjiu.lu@intel.com> * sysdeps/i386/__longjmp.S: Include <jmp_buf-ssp.h>. Restore shadow stack pointer if shadow stack is enabled and SHADOW_STACK_POINTER_OFFSET is defined. * sysdeps/i386/bsd-_setjmp.S: Likewise. * sysdeps/i386/bsd-setjmp.S: Likewise. * sysdeps/i386/setjmp.S: Likewise. * sysdeps/x86_64/__longjmp.S: Likewise. * sysdeps/x86_64/setjmp.S: Likewise. * sysdeps/unix/sysv/linux/i386/____longjmp_chk.S: Include shadow stack pointer if shadow stack is enabled. * sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Likewise. * sysdeps/unix/sysv/linux/x86/Makefile (gen-as-const-headers): Remove jmp_buf-ssp.sym. * sysdeps/x86/Makefile (gen-as-const-headers): Add jmp_buf-ssp.sym. * sysdeps/x86/jmp_buf-ssp.sym: New dummy file.
* x86-64: Add sincosf with vector FMAH.J. Lu2018-01-087-4/+288
| | | | | | | | | | | | | | | | | | | | | | | Since the x86-64 assembly version of sincosf is higly optimized with vector instructions, there isn't much room for improvement. However s_sincosf.c written in C with vector math and intrinsics can be optimized by GCC with FMA. On Skylake, bench-sincosf reports performance improvement: Assembly FMA improvement max 104.042 101.008 3% min 9.426 8.586 10% mean 20.6209 18.2238 13% * sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_sincosf-sse2 and s_sincosf-fma. (CFLAGS-s_sincosf-fma.c): New. * sysdeps/x86_64/fpu/multiarch/s_sincosf-fma.c: New file. * sysdeps/x86_64/fpu/multiarch/s_sincosf-sse2.S: Likewise. * sysdeps/x86_64/fpu/multiarch/s_sincosf.c: Likewise. * sysdeps/x86_64/fpu/s_sincosf.S: Don't add alias if __sincosf is defined.
* nptl: Add test for callee-saved register restore in pthread_exitFlorian Weimer2018-01-083-2/+257
| | | | | | | | | | | | | | | | GCC PR 83641 results in a miscompilation of libpthread, which causes pthread_exit not to restore callee-saved registers before running destructors for objects on the stack. This test detects this situation: info: unsigned int, direct pthread_exit call tst-thread-exit-clobber.cc:80: numeric comparison failure left: 4148288912 (0xf741dd90); from: value right: 1600833940 (0x5f6ac994); from: magic_values.v2 info: double, direct pthread_exit call info: unsigned int, indirect pthread_exit call info: double, indirect pthread_exit call error: 1 test failures
* support: Define support_static_assert for use with C and C++Florian Weimer2018-01-082-9/+21
| | | | And update TEST_COMPARE to use it, to make it usable from C++.
* getrlimit64: fix for 32-bit configurations with default version >= 2.2Aurelien Jarno2018-01-072-0/+10
| | | | | | | | | | | | | | Commit 24731685 ("prlimit: Translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY") broken the getrlimit64 for 32-bit configurations which do no need the 2GiB limited compat getrlimit (default version >= 2.2). This patch fixes that by restoring the weak alias in that case. Changelog: * sysdeps/unix/sysv/linux/getrlimit64 (getrlimit64) [!__RLIM_T_MATCHES_RLIM64_T] [!SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_2)]: Define as weak alias of __getrlimit64. Add libc_hidden_weak.
* hurd: Fix pwritev*Samuel Thibault2018-01-072-1/+2
| | | | | | | | | This follows c45d78aac ('posix: Fix generic p{read,write}v buffer allocation (BZ#22457)'), which made pwritev to use __mmap instead of __posix_memalign, but didn't pass PROT_READ to it, while the pwrite() call does need to read the data we have just copied over. * sysdeps/posix/pwritev_common.c: Add PROT_READ to __mmap prot.
* Avoid race conditions when rebuilding librt.soPalmer Dabbelt2018-01-062-0/+6
| | | | | | | | | | | | `make check' sometimes triggers a rebuild of librt.so using nptl/Makefile, which ignores librt's dependence on libpthread. This causes the build to blow up when we attempt to run the test suite on RISC-V. 2018-01-06 Palmer Dabbelt <palmer@sifive.com> * nptl/Makefile (/librt.so): Always depend on "$(shared-thread-library)".
* Strip shared objects in subdirectories of libPalmer Dabbelt2018-01-062-1/+3
| | | | | | | | | | | The RISC-V port will have libraries in subdirectories of lib, like "lib64/lp64d". This adds support for stripping these installed libraries. 2018-01-06 Palmer Dabbelt <palmer@sifive.com> * scripts/build-many-glibcs.py (class Glibc): Strip shared objects in subdirectories of lib.
* Add linux-4.15 VDSO hash for RISC-VPalmer Dabbelt2018-01-062-0/+5
| | | | | | | | | | The RISC-V Linux port defines VDSO symbols 2018-01-06 Palmer Dabbelt <palmer@sifive.com> * sysdeps/unix/sysv/linux/dl-vdso.h (VDSO_NAME_LINUX_4_15): New define. (VDSO_HASH_LINUX_4_15): Likewise.
* Allow make-link-multidir to make subdirectoriesPalmer Dabbelt2018-01-062-0/+3
| | | | | | | | | | | | | | | The RISC-V Linux ABI doesn't define any libraries that go directly in lib, instead they go into lib32/ilp32 or lib64/lp64. This casuse make-link-multidir to fail when attempting to make library directories when building a static libc on multilib RISC-V systems. This patch uses scripts/mkinstalldirs to make the base directory of the target symlink of make-link-multidir. 2018-01-06 Palmer Dabbelt <palmer@sifive.com> * Makerules (make-link-multidir): Make directories before linking into them.
* Add RISC-V dynamic relocations to elf.hPalmer Dabbelt2018-01-062-0/+29
| | | | | | | | | | | | | | | | | | | These relocations can appear in shared objects on RISC-V ELF systems. 2018-01-06 Palmer Dabbelt <palmer@sifive.com> * elf/elf.h (R_RISCV_NONE): New define. (R_RISCV_32): Likewise. (R_RISCV_64): Likewise. (R_RISCV_RELATIVE): Likewise. (R_RISCV_COPY): Likewise. (R_RISCV_JUMP_SLOT): Likewise. (R_RISCV_TLS_DTPMOD32): Likewise. (R_RISCV_TLS_DTPMOD64): Likewise. (R_RISCV_TLS_DTPREL32): Likewise. (R_RISCV_TLS_DTPREL64): Likewise. (R_RISCV_TLS_TPREL32): Likewise. (R_RISCV_TLS_TPREL64): Likewise.
* hurd: Fix glob64 compatibility symbolsSamuel Thibault2018-01-064-3/+94
| | | | | | | | | | This follows ccf970c7a ('posix: Add compat glob symbol to not follow dangling symbols') by adding to gnu/ the same compatibility as for Linux. * sysdeps/gnu/glob64.c (__glob): Define macro instead of glob macro. (__glob64): Define GLIBC_2_27 versioned symbol instead of glob64. * sysdeps/gnu/glob-lstat-compat.c: New file. * sysdeps/gnu/glob64-lstat-compat.c: New file.
* hurd: Fix posix glob testSamuel Thibault2018-01-062-0/+4
| | | | * posix/tst-glob_symlinks.c [!PATH_MAX]: Define PATH_MAX macro.
* i386: Regenerate libm-test-ulps for for gcc 7 on i686Samuel Thibault2018-01-062-12/+14
| | | | | * sysdeps/i386/fpu/libm-test-ulps: Regenerated for GCC 7 with "-O2 -march=i686".
* hurd: Fix build without NO_HIDDENSamuel Thibault2018-01-063-0/+12
| | | | | | * sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_dynamic) [NO_RTLD_HIDDEN]: Call JUMPTARGET (___tls_get_addr) instead of HIDDEN_JUMPTARGET (___tls_get_addr). * sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Likewise.
* hurd: Add jmp_buf-macros.hSamuel Thibault2018-01-062-0/+10
| | | | * sysdeps/mach/hurd/i386/jmp_buf-macros.h: New file.
* powerpc: Fix error message during relocation overflowTulio Magno Quites Machado Filho2018-01-052-1/+9
| | | | | | | | | | | | The function _itoa_word() writes characters from the higher address to the lower address, requiring the destination string to reserve that size before calling it. * sysdeps/powerpc/powerpc64/dl-machine.c (_dl_reloc_overflow): Reserve 16 chars to reloc_addr before calling _itoa_word. Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* resource/tst-getrlimit.c: Add copyright headerAurelien Jarno2018-01-052-0/+19
| | | | | The initial year is based on the date in the original ChangeLog entry (2005-06-21).
* Add test for getrlimit/setrlimit/prlimit with infinity valueAurelien Jarno2018-01-053-1/+178
| | | | | | | | | | | | | | | | | | Add a test to check that the getrlimit, setrlimit and prlimit functions and their 64-bit equivalent behave correctly with RLIM_INFINITY and RLIM64_INFINITY. For that it assumes that the prlimit64 function calls the syscall directly without translating the value and that the kernel uses the -1 value to represent infinity. It first finds a resource with the hard limit set to infinity so the soft limit can be manipulated easily and check for the consistency between the value set or get by the prlimit64 and the other functions. It is Linux specific add it uses the prlimit and prlimit64 functions. Changelog: * sysdeps/unix/sysv/linux/tst-rlimit-infinity.c: New file. * sysdeps/unix/sysv/linux/Makefile (tests): Add tst-rlimit-infinity.
* prlimit: Translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY [BZ #22678]Aurelien Jarno2018-01-052-6/+15
| | | | | | | | | | | | | | | | | prlimit called without a new value fails on 32-bit machines if any of the soft or hard limits are infinity. This is because prlimit does not translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY, but checks that the value returned by the prlimit64 syscall fits into a 32-bit value, like it is done for example in getrlimit. Note that on the other hand new_rlimit is correctly translated from RLIM_INFINITY to RLIM64_INFINITY before calling the syscall. This patch fixes that. Changelog: [BZ #22678] * sysdeps/unix/sysv/linux/prlimit.c (prlimit): Translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY.
* Alpha: Fix the RLIM_INFINITY and RLIM64_INFINITY constantsAurelien Jarno2018-01-058-63/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the RLIM_INFINITY and RLIM64_INFINITY constants on alpha to match the kernel one and all other architectures. Change the getrlimit, getrlimit64, setrlimit, setrlimit64 into old compat symbols, and provide the Linux generic functions as GLIBC_2_27 version. Changelog: * sysdeps/unix/sysv/linux/getrlimit64.c [USE_VERSIONED_RLIMIT]: Do not define getrlimit and getrlimit64 as weak aliases of __getrlimit64. Define __GI_getrlimit64 as weak alias of __getrlimit64. [__RLIM_T_MATCHES_RLIM64_T]: Do not redefine SHLIB_COMPAT, use #elif instead. * sysdeps/unix/sysv/linux/setrlimit64.c [USE_VERSIONED_RLIMIT]: Do not define setrlimit and setrlimit64 as weak aliases of __setrlimit64. * sysdeps/unix/sysv/linux/alpha/bits/resource.h (RLIM_INFINITY, RLIM64_INFINITY): Fix values to match the kernel ones. * sysdeps/unix/sysv/linux/alpha/getrlimit64.c: Define USE_VERSIONED_RLIMIT. Rename __getrlimit64 into __old_getrlimit64 and provide it as getrlimit@@GLIBC_2_0 and getrlimit64@@GLIBC_2_1. Add a __getrlimit64 function and provide it as getrlimit@@GLIBC_2_27 and getrlimit64@@GLIBC_2_27. * sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Ditto with setrlimit and setrlimit64. * sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.27): Add getrlimit, setrlimit, getrlimit64 and setrlimit64. * sysdeps/unix/sysv/linux/alpha/Versions (libc): Add getrlimit, setrlimit, getrlimit64 and setrlimit64.
* Alpha: Add wrappers to get/setrlimit64 to fix RLIM64_INFINITY constant [BZ ↵Aurelien Jarno2018-01-053-0/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #22648] RLIM64_INFINITY was supposed to be a glibc convention rather than anything seen by the kernel, but it ended being passed to the kernel through the prlimit64 syscall. * On the kernel side, the value is defined for the prlimit64 syscall for all architectures in include/uapi/linux/resource.h: #define RLIM64_INFINITY (~0ULL) * On the kernel side, the value is defined for getrlimit and setrlimit in arch/alpha/include/uapi/asm/resource.h #define RLIM_INFINITY 0x7ffffffffffffffful * On the GNU libc side, the value is defined in sysdeps/unix/sysv/linux/alpha/bits/resource.h: # define RLIM64_INFINITY 0x7fffffffffffffffLL This was not an issue until the getrlimit and setrlimit glibc functions have been changed in commit 045c13d185 ("Consolidate Linux setrlimit and getrlimit implementation") to use the prlimit64 syscall instead of the getrlimit and setrlimit ones. This patch fixes that by adding a wrapper to fix the value passed to or received from the kernel, before or after calling the prlimit64 syscall. Changelog: [BZ #22648] * sysdeps/unix/sysv/linux/alpha/getrlimit64.c: New file. * sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Ditto.
* NEWS: Deprecate static dlopenFlorian Weimer2018-01-051-0/+4
|
* NEWS: Deprecate direct access libio internalsFlorian Weimer2018-01-051-0/+27
|
* Increase some test timeouts.Joseph Myers2018-01-044-0/+9
| | | | | | | | | This patch increases timeouts on three tests I observed timing out on slow systems. * malloc/tst-malloc-tcache-leak.c (TIMEOUT): Define to 50. * posix/tst-glob-tilde.c (TIMEOUT): Define to 200. * resolv/tst-resolv-res_ninit.c (TIMEOUT): Define to 50.
* alpha: Remove s_trunc{f} implementation (BZ#22666)Adhemerval Zanella2018-01-043-89/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in libc-alpha [1], alpha trunc{f} implementation uses addt/suc and subt/suc and although the Alpha Architecture Handbook version 3 states that that ADDx SUBx OUTPUT Exceptions (B.3 Mapping to IEEE Standard) should not generate Inexact if INE bit is set, the Alpha 21264 [2] chip manual (A.8 IEEE Floating-Point Conformance) states that ADDx SUBx OUTPUT does generate inexact exception for inexact result regardless. As Joseph noted [3] to correctly fix it on alpha we need to either avoid the instruction or avoid any inexact bit from it being set on return from the function (while preserving the inexact bit that might be set on the entry to the function). The later will result mf_fpcr followed by a mt_fpcr to get and set the fpcr which will defeat the optimization itself. So the patch just remove the alpha optimized and rely on generic implementation. It fixes the math/test-*-{trunc} on alpha. [BZ #15479] [BZ #22666] * sysdeps/alpha/fpu/s_trunc.c: Remove file. * sysdeps/alpha/fpu/s_truncf.c: Likewise. [1] https://sourceware.org/ml/libc-alpha/2018-01/msg00114.html [2] https://www.star.bnl.gov/public/daq/HARDWARE/21264_data_sheet.pdf [3] https://sourceware.org/ml/libc-alpha/2018-01/msg00086.html Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* alpha: Remove s_ceil{f} and s_floor{f} implementation (BZ#22665)Adhemerval Zanella2018-01-045-210/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in libc-alpha [1], alpha ceil{f} and floor{f} implementation uses cvttq/svm and although the Alpha Architecture Handbook version 3 states that that CVTfi OUTPUT Exceptions (B.3 Mapping to IEEE Standard) should not generate Inexact if INE bit is set on fpcr, the Alpha 21264 [1] chip manual (A.8 IEEE Floating-Point Conformance) states that CVTfi and CVTif OUTPUT does generate inexact exception for inexact result regardless. As Joseph noted [2] to correctly fix it on alpha we need to either avoid the instruction or avoid any inexact bit from it being set on return from the function (while preserving the inexact bit that might be set on the entry to the function). The later will result mf_fpcr followed by a mt_fpcr to get and set the fpcr which will defeat the optimization itself. So the patch just remove the alpha optimized and rely on generic implementation. It fixes the math/test-*-{ceil,floor} on alpha. [BZ #15479] [BZ #22665] * sysdeps/alpha/fpu/s_ceil.c: Remove file. * sysdeps/alpha/fpu/s_ceilf.c: Likewise. * sysdeps/alpha/fpu/s_floor.c: Likewise. * sysdeps/alpha/fpu/s_floorf.c: Likewise. [1] https://www.star.bnl.gov/public/daq/HARDWARE/21264_data_sheet.pdf [2] https://sourceware.org/ml/libc-alpha/2018-01/msg00086.html Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* i386: In makecontext, align the stack before calling exit [BZ #22667]Florian Weimer2018-01-044-3/+263
| | | | | | Before this change, if glibc was compiled with SSE instructions and a sufficiently recent GCC, an unaligned stack access in __run_exit_handlers would cause stdlib/tst-makecontext to crash.
* elf: Support dlvsym within libc.soFlorian Weimer2018-01-049-6/+330
| | | | | | | | | | This commit adds a new _dl_open_hook entry for dlvsym and implements the function using the existing dl_lookup_symbol_x function supplied by the dynamic loader. A new hook variable, _dl_open_hook2, is introduced, which should make this change suitable for backporting: For old statically linked binaries, __libc_dlvsym will always return NULL.
* support_enter_mount_namespace: Fix indentationSamuel Thibault2018-01-041-1/+1
| | | | * support/support_enter_mount_namespace.c: Fix indentation.
* Mention CVE-2017-16997 in ChangeLogFlorian Weimer2018-01-041-0/+1
|
* hurd: Fix support/support_enter_mount_namespace.c buildSamuel Thibault2018-01-042-0/+7
| | | | | * support/support_enter_mount_namespace.c [!CLONE_NEWNS]: Do not include <sys/mount.h>.