1. Dec 30, 2017
    • Dmitry V. Levin's avatar
      linux/x86: sync sys/ptrace.h with Linux 4.14 [BZ #22433] · c48831d0
      Dmitry V. Levin authored
      Clone generic linux/sys/ptrace.h, add the following x86-specific
      __ptrace_request constants: PTRACE_GET_THREAD_AREA,
      PTRACE_SET_THREAD_AREA, PTRACE_ARCH_PRCTL, PTRACE_SYSEMU,
      PTRACE_SYSEMU_SINGLESTEP, and PTRACE_SINGLEBLOCK.
      
      [BZ #22433]
      * sysdeps/unix/sysv/linux/x86/sys/ptrace.h: New file.
      c48831d0
    • Dmitry V. Levin's avatar
      linux: update sys/ptrace.h comments · ac583f50
      Dmitry V. Levin authored
      * sysdeps/unix/sysv/linux/sys/ptrace.h (__ptrace_request): Add comments
      about PTRACE_PEEKSIGINFO, PTRACE_GETSIGMASK, PTRACE_SETSIGMASK, and
      PTRACE_SECCOMP_GET_FILTER.  Update comments about PTRACE_SINGLESTEP
      and PTRACE_SYSCALL.
      * sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/s390/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/sparc/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/tile/sys/ptrace.h: Likewise.
      ac583f50
    • Dmitry V. Levin's avatar
      linux: move a shared part of sys/ptrace.h to bits/ptrace-shared.h · 7e21972b
      Dmitry V. Levin authored
      Move a shared part of sys/ptrace.h which is the same on all
      architectures to a separate file.
      
      * sysdeps/unix/sysv/linux/sys/ptrace.h: Include <bits/ptrace-shared.h>.
      (__ptrace_setoptions, __ptrace_eventcodes, __ptrace_peeksiginfo_args,
      __ptrace_peeksiginfo_flags, ptrace): Move to ...
      * sysdeps/unix/sysv/linux/bits/ptrace-shared.h: ... new file.
      * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
      bits/ptrace-shared.h.
      * sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h: Include
      <bits/ptrace-shared.h>.
      (__ptrace_setoptions, __ptrace_eventcodes, __ptrace_peeksiginfo_args,
      __ptrace_peeksiginfo_flags, ptrace): Remove.
      * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/s390/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/sparc/sys/ptrace.h: Likewise.
      * sysdeps/unix/sysv/linux/tile/sys/ptrace.h: Likewise.
      7e21972b
  2. Dec 29, 2017
    • Aurelien Jarno's avatar
      scandir: fix wrong assumption about errno [BZ #17804] · 72f29e3a
      Aurelien Jarno authored
      malloc and realloc may set errno to ENOMEM even if they are successful.
      The scandir code wrongly assume that they do not change errno, this
      causes scandir to fail with ENOMEM even if malloc succeed.
      
      The code already handles that readdir might set errno by calling
      __set_errno (0) to clear the error. Move that part at the end of the
      loop to also take malloc and realloc into account.
      
      Changelog:
      	[BZ #17804]
      	* dirent/scandir-tail.c (SCANDIR_TAIL): Move __set_errno (0) at the
      	end of the loop. Improve comments.
      72f29e3a
    • Aurelien Jarno's avatar
      manual: clarify errno value on success [BZ #22615] · 54e4efc2
      Aurelien Jarno authored
      The current glibc manual is ambiguous about the errno value on success
      and suggests that it is left unchanged. Some functions might and
      sometimes do change the errno value, however they never set it to 0.
      
      This patch from Zack Weinberg clarifies this section of the manual.
      
      Changelog:
      	[BZ #22615]
      	* manual/errno.texi (Checking for Errors): Explicitly say that errno
      	might be set on success.
      54e4efc2
    • Aurelien Jarno's avatar
      tst-realloc: do not check for errno on success [BZ #22611] · f8aa69be
      Aurelien Jarno authored
      POSIX explicitly says that applications should check errno only after
      failure, so the errno value can be clobbered on success as long as it
      is not set to zero.
      
      Changelog:
      	[BZ #22611]
      	* malloc/tst-realloc.c (do_test): Remove the test checking that errno
      	is unchanged on success.
      f8aa69be
  3. Dec 28, 2017
    • Dmitry V. Levin's avatar
      elf: remove redundant is_path argument · 2bd86632
      Dmitry V. Levin authored
      is_path argument is no longer used and could be safely removed.
      
      * elf/dl-dst.h (DL_DST_COUNT): Remove is_path argument, all callers
      updated.
      * elf/dl-load.c (is_dst, _dl_dst_count, _dl_dst_substitute,
      expand_dynamic_string_token): Likewise.
      * sysdeps/generic/ldsodefs.h (_dl_dst_count, _dl_dst_substitute): Remove
      is_path argument.
      2bd86632
    • Dmitry V. Levin's avatar
      elf: remove redundant code from is_dst · 1c36e1e6
      Dmitry V. Levin authored
      is_dst is called either by _dl_dst_count or by _dl_dst_substitute.
      _dl_dst_count is called by DL_DST_COUNT only.
      DL_DST_COUNT is called either by expand_dst with is_path == 0
      or by expand_dynamic_string_token.
      _dl_dst_substitute is called either from expand_dst with is_path == 0
      or from expand_dynamic_string_token.
      The latter function is called either from _dl_map_object with is_path == 0
      or from fillin_rpath with is_path == 1 and name containing no ':'.
      
      In any case (is_path && name[i] == ':') is always false and all code
      depending on it can be safely removed.
      
      * elf/dl-load.c (is_dst): Remove checks that is_path is set and name
      contains ':', and all code depending on these checks.
      1c36e1e6
    • Dmitry V. Levin's avatar
      elf: remove redundant code from _dl_dst_substitute · 97f13188
      Dmitry V. Levin authored
      There are just two users of _dl_dst_substitute: one is expand_dst that
      sets is_path argument to 0, another one is expand_dynamic_string_token.
      The latter function also has just two users: one is _dl_map_object that
      sets is_path argument to 0, another one is fillin_rpath that sets
      is_path argument to 1 and name argument contains no ':'.
      
      In any case (is_path && name[i] == ':') is always false and all code
      depending on it can be safely removed.
      
      * elf/dl-load.c (_dl_dst_substitute): Remove checks that is_path
      is set and name contains ':', and all code depending on these checks.
      97f13188
  4. Dec 25, 2017
    • Zack Weinberg's avatar
      Deprecate external use of libio.h and _G_config.h. · 48a8f832
      Zack Weinberg authored
      libio.h was originally the header for a set of supported GNU
      extensions, but they have not been maintained as such in many years,
      they are now standing in the way of improvements to stdio, and we
      don't think there are any remaining external users.  _G_config.h was
      never intended for public use, but predates the bits convention.
      Move both of these headers into the bits directory and provide stubs
      at top level which issue deprecation warnings.
      
      The contents of (bits/)libio.h and (bits/)_G_config.h are still
      exposed to external software via stdio.h; changing that requires more
      complex surgery than I have time to attempt right now.
      
      	* libio/libio.h, libio/_G_config.h: New stub headers which issue a
      	deprecation warning and then include <bits/libio.h>, <bits/_G_config.h>
      	respectively.
      	* libio/libio.h: Rename the original version of this file to
      	libio/bits/libio.h.  Error out if not included by stdio.h or the
      	stub libio.h.
      	* include/libio.h: Move to include/bits.  Forward to libio/bits/libio.h.
      	* sysdeps/generic/_G_config.h: Move to top-level bits/.  Error out
      	if not included by bits/libio.h or the stub _G_config.h.
      	* sysdeps/unix/sysv/linux/_G_config.h: Move to
      	sysdeps/unix/sysv/linux/bits.  Error out if not included by
      	bits/libio.h or the stub _G_config.h.
      	* libio/stdio.h: Include bits/libio.h, not libio.h.
      	* libio/Makefile: Install bits/libio.h and bits/_G_config.h as
      	well as libio.h and _G_config.h.
      
      	* csu/init.c, libio/fmemopen.c, libio/iolibio.h, libio/oldfmemopen.c
      	* libio/strfile.h, stdio-common/vfscanf.c
      	* sysdeps/pthread/flockfile.c, sysdeps/pthread/funlockfile.c
      	Include stdio.h, not _G_config.h nor libio.h.
      	* libio/iofgetpos.c: Also rename fgetpos64 out of the way.
      	* libio/iofsetpos.c: Also rename fsetpos64 out of the way.
      
      	* scripts/check-installed-headers.sh: Skip libio.h and _G_config.h.
      48a8f832
  5. Dec 23, 2017
  6. Dec 22, 2017
  7. Dec 21, 2017
    • Szabolcs Nagy's avatar
      Add aarch64 disable-multi-arch variant to build-many-glibcs.py · 6cb86fd2
      Szabolcs Nagy authored
      aarch64 has several ifuncs now so test it without multiarch support separately.
      
      	* scripts/build-many-glibcs.py (Context.add_all_configs): Add
      	disable-multi-arch variant to aarch64-linux-gnu.
      6cb86fd2
    • Joseph Myers's avatar
      Update miscellaneous files from upstream sources. · 41d11b15
      Joseph Myers authored
      This patch updates various miscellaneous files from their upstream
      sources.
      
      Tested for x86_64, including "make pdf".
      
      	* manual/texinfo.tex: Update to version 2017-12-18.20 with
      	trailing whitespace removed.
      	* scripts/config.guess: Update to version 2017-12-17.
      	* scripts/config.sub: Update to version 2017-11-23.
      	* scripts/install-sh: Update to version 2017-09-23.17.
      	* scripts/move-if-change: Update to version 2017-09-13 06:45.
      41d11b15
    • Adhemerval Zanella's avatar
      Simplify tile assembly definitions · 8d2d239c
      Adhemerval Zanella authored
      With tilepro removal, the uppercase instruction are not anymore
      required to be defines as potentially macros.  This is a
      mechanical change done by the following shell script:
      
      ---
      INSNS="LD LD4U ST ST4 BNEZ BEQZ BEQZT BGTZ CMPEQI CMPEQ CMOVEQZ CMOVNEZ"
      
      FILES=$(find sysdeps/tile sysdeps/unix/sysv/linux/tile -iname *.S)
      
      for insn in $INSNS; do
        repl=$(echo $insn | tr '[:upper:]' '[:lower:]')
        sed -i 's/\b'$insn'\b/'$repl'/g' $FILES
      done
      ---
      
      Checked with a build for tilegx-linux-gnu and tilegx-linux-gnu-32 with
      and without the patch, there is no difference in generated binary with
      a dissassemble.
      
      	* sysdeps/tile/__longjmp.S (__longjmp): Use lowercase instructions.
      	* sysdeps/tile/__tls_get_addr.S (__tls_get_addr): Likewise.
      	* sysdeps/tile/_mcount.S (__mcount): Likewise.
      	* sysdeps/tile/crti.S (_init, _fini): Likewise.
      	* sysdeps/tile/crtn.S: Likewise.
      	* sysdeps/tile/dl-start.S (_start): Likewise.
      	* sysdeps/tile/dl-trampoline.S: Likewise.
      	* sysdeps/tile/setjmp.S (__sigsetjmp): Likewise.
      	* sysdeps/tile/start.S (_start): Likewise.
      	* sysdeps/unix/sysv/linux/tile/clone.S (_clone): Likewise.
      	* sysdeps/unix/sysv/linux/tile/getcontext.S (__getcontext): Likewise.
      	* sysdeps/unix/sysv/linux/tile/ioctl.S (__ioctl): Likewise.
      	* sysdeps/unix/sysv/linux/tile/setcontext.S (__setcontext): Likewise.
      	* sysdeps/unix/sysv/linux/tile/swapcontext.S (__swapcontext): Likewise.
      	* sysdeps/unix/sysv/linux/tile/syscall.S (syscall): Likewise.
      	* sysdeps/unix/sysv/linux/tile/vfork.S (__vfork): Likewise.
      8d2d239c
    • Adhemerval Zanella's avatar
      Simplify tilegx sysdeps folder · 24d1d8ec
      Adhemerval Zanella authored
      With tilepro support removal we can now simplify internal tile support by
      moving the directory structure to avoid the unnecessary directory levels
      in tile/tilegx both on generic and linux folders.
      
      Checked with a build for tilegx-linux-gnu and tilegx-linux-gnu-32 with
      and without the patch, there is no difference in generated binary with
      a dissassemble.
      
      	* stdlib/bug-getcontext.c (do_test): Remove tilepro mention in
      	comment.
      	* sysdeps/tile/preconfigure: Remove tilegx folder.
      	* sysdeps/tile/tilegx/Implies: Move definitions to ...
      	* sysdeps/tile/Implies: ... here.
      	* sysdeps/tile/tilegx/Makefile: Move rules to ...
      	* sysdeps/tile/Makefile: ... here.
      	* sysdeps/tile/tilegx/atomic-machine.h: Move definitions to ...
      	* sysdeps/tile/atomic-machine.h: ... here.  Add include guards.
      	* sysdeps/tile/tilegx/bits/wordsize.h: Move to ...
      	* sysdeps/tile/bits/wordsize.h: ... here.
      	* sysdeps/tile/tilegx/*: Move to ...
      	* sysdeps/tile/*: ... here.
      	* sysdeps/tile/tilegx/tilegx32/Implies: Move to ...
      	* sysdeps/tile/tilegx32/Implies: ... here.
      	* sysdeps/tile/tilegx/tilegx64/Implies: Move to ...
      	* sysdeps/tile/tilegx64/Implies: ... here.
      	* sysdeps/unix/sysv/linux/tile/tilegx/Makefile: Move definitions
      	to ...
      	* sysdeps/unix/sysv/linux/tile/Makefile: ... here.
      	* sysdeps/unix/sysv/linux/tile/tilegx/*: Move to ...
      	* sysdeps/unix/sysv/linux/tile/*: ... here.
      	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/*: Move to ...
      	* sysdeps/unix/sysv/linux/tile/tilegx32/*: ... here.
      	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/*: Move to ...
      	* sysdeps/unix/sysv/linux/tile/tilegx64/*: ... here.
      24d1d8ec
    • Adhemerval Zanella's avatar
      Remove tilepro-*-linux-gnu support · ed95f611
      Adhemerval Zanella authored
      As from previous discussions [1] this patch removes tileprox-*-linux-gnu
      support from GLIBC.  This patch is a straigthfoward one, which just remove
      tilepro specific implementation and configurations (no sysdep simplfication
      or reorganization is done).
      
      	* README: Remove tilepro-*-linux-gnu from supported architecture.
      	* scripts/build-many-glibcs.py: Likewise.
      	* sysdeps/tile/__tls_get_addr.S (__tls_get_addr): Likewise.
      	* sysdeps/tile/crti.S (PREINIT_FUNCTION): Likewise.
      	* sysdeps/tile/dl-machine.h (ELF_MACHINE_NAME,
      	elf_machine_matches_host, elf_machine_dynamic,
      	elf_machine_load_address, elf_machine_runtime_setup, reloc_howto
      	howto, elf_machine_rela): Likewise
      	* sysdeps/tile/dl-start.S (_start): Likewise.
      	* sysdeps/tile/memcmp.c (DBLALIGN, REVBYTES): Likewise.
      	* sysdeps/tile/memcopy.h (MEMCPY_OK_FOR_FWD_MEMMOVE,
      	MEMCPY_OK_FOR_FWD_MEMMOVE, op_t): Likewise.
      	* sysdeps/tile/nptl/pthread_spin_lock.c (TNS, CMPTNS): Likewise.
      	* sysdeps/tile/nptl/pthread_spin_trylock.c (TNS): Likewise.
      	* sysdeps/tile/nptl/pthread_spin_unlock.c (pthread_spin_unlock):
      	Likewise.
      	* sysdeps/tile/nptl/tls.h (DB_THREAD_SELF): Likewise.
      	* sysdeps/tile/preconfigure: Likewise.
      	* sysdeps/tile/stackguard-macros.h (STACK_CHK_GUARD,
      	POINTER_CHK_GUARD): Likewise.
      	* sysdeps/tile/stackinfo.h (__stackinfo_sub): Likewise.
      	* sysdeps/tile/start.S (_start): Likewise.
      	* sysdeps/tile/tls-macros.h (TLS_GD_OFFSET, TLS_IE_OFFSET, _TLS_LE):
      	Likewise.
      	* sysdeps/tile/sysdep.h (REGSIZE): Likewise.
      	(LD, LD4U, ST, ST4, BNEZ, BEQZ, BEQZT, BGTZ, CMPEQI, CMPEQ, CMOVEQZ,
      	CMOVNEZ): Remove.
      	* sysdeps/unix/sysv/linux/tile/bits/environments.h
      	(__ILP32_OFF32_CFLAGS, __ILP32_OFFBIG_CFLAGS, __ILP32_OFF32_LDFLAGS,
      	__ILP32_OFFBIG_LDFLAGS, __LP64_OFF64_CFLAGS, __LP64_OFF64_LDFLAGS):
      	Likewise.
      	* sysdeps/tile/wordcopy.c (DBLALIGN): Likewise.
      	* sysdeps/tile/tilepro/Implies: Remove file.
      	* sysdeps/tile/tilepro/atomic-machine.h: Likewise.
      	* sysdeps/tile/tilepro/bits/wordsize.h: Likewise.
      	* sysdeps/tile/tilepro/memchr.c: Likewise.
      	* sysdeps/tile/tilepro/memcpy.S: Likewise.
      	* sysdeps/tile/tilepro/memset.c: Likewise.
      	* sysdeps/tile/tilepro/memusage.h: Likewise.
      	* sysdeps/tile/tilepro/rawmemchr.c: Likewise.
      	* sysdeps/tile/tilepro/strchr.c: Likewise.
      	* sysdeps/tile/tilepro/strchrnul.c: Likewise.
      	* sysdeps/tile/tilepro/strlen.c: Likewise.
      	* sysdeps/tile/tilepro/strrchr.c: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/Implies: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/c++-types.data: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/jmp_buf-macros.h: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/ld.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/ldconfig.h: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libBrokenLocale.abilist:
      	Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libanl.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libcrypt.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libdl.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libnsl.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libpthread.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libresolv.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/librt.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libthread_db.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/libutil.abilist: Likewise.
      	* sysdeps/unix/sysv/linux/tile/tilepro/register-dump.h: Likewise.
      	* sysdeps/unix/sysv/linux/tile/sysconf.c (linux_sysconf): Remove
      	tilepro mention in comment.
      
      [1] https://sourceware.org/ml/libc-alpha/2017-12/msg00038.html
      ed95f611
  8. Dec 20, 2017
    • Adhemerval Zanella's avatar
      nptl: Consolidate pthread_{timed,try}join{_np} · 4735850f
      Adhemerval Zanella authored
      
      
      This patch consolidates the pthread_join and gnu extensions to avoid
      code duplication.  The function pthread_join, pthread_tryjoin_np, and
      pthread_timedjoin_np are now based on pthread_timedjoin_ex.
      
      It also fixes some inconsistencies on ESRCH, EINVAL, EDEADLK handling
      (where each implementation differs from each other) and also on
      clenup handler (which now always use a CAS).
      
      Checked on i686-linux-gnu and x86_64-linux-gnu.
      
      	* nptl/pthreadP.h (__pthread_timedjoin_np): Define.
      	* nptl/pthread_join.c (pthread_join): Use __pthread_timedjoin_np.
      	* nptl/pthread_tryjoin.c (pthread_tryjoin): Likewise.
      	* nptl/pthread_timedjoin.c (cleanup): Use CAS on argument setting.
      	(pthread_timedjoin_np): Define internal symbol and common code from
      	pthread_join.
      	* sysdeps/unix/sysv/linux/i386/lowlevellock.h (__lll_timedwait_tid):
      	Remove superflous checks.
      	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (__lll_timedwait_tid):
      	Likewise.
      
      Signed-off-by: default avatarAdhemerval Zanella <adhemerval.zanella@linaro.org>
      Reviewed-by: default avatarCarlos O'Donell <carlos@redhat.com>
      4735850f
    • Szabolcs Nagy's avatar
      aarch64: update libm-test-ulps · 8bfb461e
      Szabolcs Nagy authored
      	* sysdeps/aarch64/libm-test-ulps: Update.
      8bfb461e
    • Adhemerval Zanella's avatar
      aarch64: fix memset with --disable-multi-arch · 4e001969
      Adhemerval Zanella authored
      	* sysdeps/aarch64/memset.S (MEMSET): Define.
      4e001969
    • Florian Weimer's avatar
      nptl: Implement pthread_self in libc.so [BZ #22635] · 8a26ad2a
      Florian Weimer authored
      All binaries use TLS and thus need a properly set up TCB, so we can
      simply return its address directly, instead of forwarding to the
      libpthread implementation from libc.
      
      For versioned symbols, the dynamic linker checks that the soname matches
      the name supplied by the link editor, so a compatibility symbol in
      libpthread is needed.
      
      To avoid linking against the libpthread function in all cases, we would
      have to bump the symbol version of libpthread in libc.so and supply a
      compat symbol.  This commit does not do that because the function
      implementation is so small, so the overhead by two active copies of the
      same function might well be smaller than the increase in symbol table
      size.
      8a26ad2a
    • Arnold Robbins's avatar
      regex: Fix spelling in comments. · 5069ff32
      Arnold Robbins authored
      Fix the spelling in various comments throughout the
      regex implementation. These changes are also present
      in gnulib and will be integrated there also, see:
      https://sourceware.org/ml/libc-alpha/2017-12/msg00688.html
      5069ff32
    • Gabriel F. T. Gomes's avatar
      Provide a C++ version of iseqsig (bug 22377) · c85e54ac
      Gabriel F. T. Gomes authored
      In C++ mode, __MATH_TG cannot be used for defining iseqsig, because
      __MATH_TG relies on __builtin_types_compatible_p, which is a C-only
      builtin.  This is true when float128 is provided as an ABI-distinct type
      from long double.
      
      Moreover, the comparison macros from ISO C take two floating-point
      arguments, which need not have the same type.  Choosing what underlying
      function to call requires evaluating the formats of the arguments, then
      selecting which is wider.  The macro __MATH_EVAL_FMT2 provides this
      information, however, only the type of the macro expansion is relevant
      (actually evaluating the expression would be incorrect).
      
      This patch provides a C++ version of iseqsig, in which only the type of
      __MATH_EVAL_FMT2 (__typeof or decltype) is used as a template parameter
      for __iseqsig_type.  This function calls the appropriate underlying
      function.
      
      Tested for powerpc64le and x86_64.
      
      	[BZ #22377]
      	* math/Makefile [C++] (tests): Add test for iseqsig.
      	* math/math.h [C++] (iseqsig): New implementation, which does
      	not rely on __MATH_TG/__builtin_types_compatible_p.
      	* math/test-math-iseqsig.cc: New file.
      	* sysdeps/powerpc/powerpc64le/Makefile
      	(CFLAGS-test-math-iseqsig.cc): New variable.
      c85e54ac
    • Dmitry V. Levin's avatar
      elf: remove redundant __libc_enable_secure check from fillin_rpath · 10e93d96
      Dmitry V. Levin authored
      There are just two users of fillin_rpath: one is decompose_rpath that
      sets check_trusted argument to 0, another one is _dl_init_paths that
      sets check_trusted argument to __libc_enable_secure and invokes
      fillin_rpath only when LD_LIBRARY_PATH is non-empty.
      
      Starting with commit
      glibc-2.25.90-512-gf6110a8f,
      LD_LIBRARY_PATH is ignored for __libc_enable_secure executables,
      so check_trusted argument of fillin_rpath is always zero.
      
      * elf/dl-load.c (is_trusted_path): Remove.
      (fillin_rpath): Remove check_trusted argument and its use,
      all callers changed.
      10e93d96
    • H.J. Lu's avatar
      Replece LDFLAGS-* = $(no-pie-ldflag) with tst-*-no-pie = yes [BZ #22630] · ce16eb52
      H.J. Lu authored
      After
      
      commit 9d7a3741
      Author: H.J. Lu <hjl.tools@gmail.com>
      Date:   Fri Dec 15 16:59:33 2017 -0800
      
          Add --enable-static-pie configure option to build static PIE [BZ #19574]
      
      and
      
      commit 00c714df
      Author: H.J. Lu <hjl.tools@gmail.com>
      Date:   Mon Dec 18 12:24:26 2017 -0800
      
          Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614]
      
      $(no-pie-ldflag) is no longer effective since no-pie-ldflag is defined
      to -no-pie only if GCC defaults to PIE.  When --enable-static-pie is
      used to configure glibc build and GCC doesn't default to PIE. no-pie-ldflag
      is undefined and these tests:
      
      elf/Makefile:LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
      elf/Makefile:LDFLAGS-tst-prelink = $(no-pie-ldflag)
      elf/Makefile:LDFLAGS-tst-main1 = $(no-pie-ldflag)
      gmon/Makefile:LDFLAGS-tst-gmon := $(no-pie-ldflag)
      
      may fail to link.  This patch replaces "-pie" with
      
      $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie)
      
      and repleces
      
      LDFLAGS-* = $(no-pie-ldflag)
      
      with
      
      tst-*-no-pie = yes
      
      so that tst-dlopen-aout, tst-prelink, tst-main1 and tst-gmon are always
      built as non-PIE, with and without --enable-static-pie, regardless if
      GCC defaults to PIE or non-PIE.
      
      Tested with build-many-glibcs.py without --enable-static-pie as well as
      with --enable-static-pie for x86_64, x32 and i686.
      
      	[BZ #22630]
      	* Makeconfig (link-pie-before-libc): Replace -pie with
      	$(if $($(@F)-no-pie),$(no-pie-ldflag),-pie).
      	* elf/Makefile (LDFLAGS-tst-dlopen-aout): Removed.
      	(tst-dlopen-aout-no-pie): New.
      	(LDFLAGS-tst-prelink): Removed.
      	(tst-prelink-no-pie): New.
      	(LDFLAGS-tst-main1): Removed.
      	(tst-main1-no-pie): New.
      	* gmon/Makefile (LDFLAGS-tst-gmon): Removed.
      	(tst-gmon-no-pie): New.
      ce16eb52
    • H.J. Lu's avatar
      Document that --enable-static-pie implies PIE · 126adc89
      H.J. Lu authored
      
      
      To build static PIE, all .o files are compiled with -fPIE.  Since
      --enable-static-pie is designed to provide additional security hardening
      benefits, it also implies that glibc programs and tests are created as
      dynamic position independent executables (PIE) by default for better
      security hardening.
      
      Reviewed-by: default avatarJonathan Nieder <jrnieder@gmail.com>
      
      	* manual/install.texi: Document that --enable-static-pie
      	implies PIE.
      	* INSTALL: Regenerated.
      126adc89
    • Bernd Edlinger's avatar
      Avoid signed shift overflow in pow (bug 21309). · 648615e1
      Bernd Edlinger authored
      As noted in bug 21309, dbl-64/e_pow.c contains signed int shifts that,
      although the shift count is in the range [0, 31], shift bits into and
      beyond the sign bit and so are undefined in ISO C.  Although this is
      defined in GNU C, this patch from the bug cleans up the code to avoid
      those shifts.
      
      Tested for x86_64.
      
      	[BZ #21309]
      	* sysdeps/ieee754/dbl-64/e_pow.c (checkint): Make m and n
      	unsigned.
      648615e1
    • Joseph Myers's avatar
      Revert exp reimplementation (causes test failures). · f1e00502
      Joseph Myers authored
      	Revert:
      
      	2017-12-19  Joseph Myers  <joseph@codesourcery.com>
      
      	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
      
      	2017-12-19  Patrick McGehearty  <patrick.mcgehearty@oracle.com>
      
      	* sysdeps/ieee754/dbl-64/e_exp.c: Include <math-svid-compat.h> and
      	<errno.h>.  Include "eexp.tbl".
      	(half): New constant.
      	(one): Likewise.
      	(__ieee754_exp): Rewrite.
      	(__slowexp): Remove prototype.
      	* sysdeps/ieee754/dbl-64/eexp.tbl: New file.
      	* sysdeps/ieee754/dbl-64/slowexp.c: Remove file.
      	* sysdeps/i386/fpu/slowexp.c: Likewise.
      	* sysdeps/ia64/fpu/slowexp.c: Likewise.
      	* sysdeps/m68k/m680x0/fpu/slowexp.c: Likewise.
      	* sysdeps/x86_64/fpu/multiarch/slowexp-avx.c: Likewise.
      	* sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Likewise.
      	* sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c: Likewise.
      	* sysdeps/generic/math_private.h (__slowexp): Remove prototype.
      	* sysdeps/ieee754/dbl-64/e_pow.c: Remove mention of slowexp.c in
      	comment.
      	* sysdeps/powerpc/power4/fpu/Makefile [$(subdir) = math]
      	(CPPFLAGS-slowexp.c): Remove variable.
      	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
      	Remove slowexp-fma, slowexp-fma4 and slowexp-avx.
      	(CFLAGS-slowexp-fma.c): Remove variable.
      	(CFLAGS-slowexp-fma4.c): Likewise.
      	(CFLAGS-slowexp-avx.c): Likewise.
      	* sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__slowexp): Do not
      	define as macro.
      	* sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__slowexp): Likewise.
      	* sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__slowexp): Likewise.
      	* math/Makefile (type-double-routines): Remove slowexp.
      	* manual/probes.texi (slowexp_p6): Remove.
      	(slowexp_p32): Likewise.
      f1e00502
    • Adhemerval Zanella's avatar
      glob: Silence warning about void pointer arithmetic · e184ac3a
      Adhemerval Zanella authored
      
      
      Sync with gnulib 0e14f025d2.
      
      Checked on x86_64-linux-gnu.
      
      	* lib/glob.c (glob): Use a 'char *', not a 'void *', in pointer
      	arithmetic.
      
      Signed-off-by: default avatarAdhemerval Zanella <adhemerval.zanella@linaro.org>
      e184ac3a
    • Adhemerval Zanella's avatar
      glob: pacify fuzzer for mempcpy · d711a00f
      Adhemerval Zanella authored
      Problem reported by Tim Rühsen [1].  Sync with gnulib 0e14f025d2.
      
      [1] https://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00054.html
      
      
      
      Checked on x86_64-linux-gnu.
      
          * lib/glob.c (glob): Do not pass NULL to mempcpy.
      
      Signed-off-by: default avatarAdhemerval Zanella <adhemerval.zanella@linaro.org>
      d711a00f
    • Joseph Myers's avatar
      Update x86_64 libm-test-ulps. · 6f58c10d
      Joseph Myers authored
      	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
      6f58c10d
    • Patrick McGehearty's avatar
      Improve __ieee754_exp() performance by greater than 5x on sparc/x86. · 6fd0a3c6
      Patrick McGehearty authored
      These changes will be active for all platforms that don't provide
      their own exp() routines. They will also be active for ieee754
      versions of ccos, ccosh, cosh, csin, csinh, sinh, exp10, gamma, and
      erf.
      
      Typical performance gains is typically around 5x when measured on
      Sparc s7 for common values between exp(1) and exp(40).
      
      Using the glibc perf tests on sparc,
            sparc (nsec)    x86 (nsec)
            old     new     old     new
      max   17629   395    5173     144
      min     399    54      15      13
      mean   5317   200    1349      23
      
      The extreme max times for the old (ieee754) exp are due to the
      multiprecision computation in the old algorithm when the true value is
      very near 0.5 ulp away from an value representable in double
      precision. The new algorithm does not take special measures for those
      cases. The current glibc exp perf tests overrepresent those values.
      Informal testing suggests approximately one in 200 cases might
      invoke the high cost computation. The performance advantage of the new
      algorithm for other values is still large but not as large as indicated
      by the chart above.
      
      Glibc correctness tests for exp() and expf() were run. Within the
      test suite 3 input values were found to cause 1 bit differences (ulp)
      when "FE_TONEAREST" rounding mode is set. No differences in exp() were
      seen for the tested values for the other rounding modes.
      Typical example:
      exp(-0x1.760cd2p+0)  (-1.46113312244415283203125)
       new code:    2.31973271630014299393707e-01   0x1.db14cd799387ap-3
       old code:    2.31973271630014271638132e-01   0x1.db14cd7993879p-3
          exp    =  2.31973271630014285508337 (high precision)
      Old delta: off by 0.49 ulp
      New delta: off by 0.51 ulp
      
      In addition, because ieee754_exp() is used by other routines, cexp()
      showed test results with very small imaginary input values where the
      imaginary portion of the result was off by 3 ulp when in upward
      rounding mode, but not in the other rounding modes.  For x86, tgamma
      showed a few values where the ulp increased to 6 (max ulp for tgamma
      is 5). Sparc tgamma did not show these failures.  I presume the tgamma
      differences are due to compiler optimization differences within the
      gamma function.The gamma function is known to be difficult to compute
      accurately.
      
      	* sysdeps/ieee754/dbl-64/e_exp.c: Include <math-svid-compat.h> and
      	<errno.h>.  Include "eexp.tbl".
      	(half): New constant.
      	(one): Likewise.
      	(__ieee754_exp): Rewrite.
      	(__slowexp): Remove prototype.
      	* sysdeps/ieee754/dbl-64/eexp.tbl: New file.
      	* sysdeps/ieee754/dbl-64/slowexp.c: Remove file.
      	* sysdeps/i386/fpu/slowexp.c: Likewise.
      	* sysdeps/ia64/fpu/slowexp.c: Likewise.
      	* sysdeps/m68k/m680x0/fpu/slowexp.c: Likewise.
      	* sysdeps/x86_64/fpu/multiarch/slowexp-avx.c: Likewise.
      	* sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Likewise.
      	* sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c: Likewise.
      	* sysdeps/generic/math_private.h (__slowexp): Remove prototype.
      	* sysdeps/ieee754/dbl-64/e_pow.c: Remove mention of slowexp.c in
      	comment.
      	* sysdeps/powerpc/power4/fpu/Makefile [$(subdir) = math]
      	(CPPFLAGS-slowexp.c): Remove variable.
      	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
      	Remove slowexp-fma, slowexp-fma4 and slowexp-avx.
      	(CFLAGS-slowexp-fma.c): Remove variable.
      	(CFLAGS-slowexp-fma4.c): Likewise.
      	(CFLAGS-slowexp-avx.c): Likewise.
      	* sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__slowexp): Do not
      	define as macro.
      	* sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__slowexp): Likewise.
      	* sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__slowexp): Likewise.
      	* math/Makefile (type-double-routines): Remove slowexp.
      	* manual/probes.texi (slowexp_p6): Remove.
      	(slowexp_p32): Likewise.
      6fd0a3c6
  9. Dec 19, 2017
    • Adhemerval Zanella's avatar
      ia64: Fix memchr for large input sizes (BZ #22603) · 3bb1ef58
      Adhemerval Zanella authored
      Current optimized ia64 memchr uses a strategy to check for last address
      by adding the input one with expected size.  However it does not take
      care for possible overflow.
      
      It was triggered by 3038145c where default rawmemchr now uses memchr
      (p, c, (size_t)-1).
      
      This patch fixes it by implement a satured addition where overflows
      sets the maximum pointer size to UINTPTR_MAX.
      
      Checked on ia64-linux-gnu where it fixes both stratcliff and
      test-rawmemchr failures.
      
      	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
      	James Clarke <jrtc27@jrtc27.com>
      
      	[BZ #22603]
      	* sysdeps/ia64/memchr.S (__memchr): Avoid overflow in pointer
      	addition.
      3bb1ef58
    • Adhemerval Zanella's avatar
      sh: Fix clone exit return code (BZ #22605) · 554e3d51
      Adhemerval Zanella authored
      Since 3f823e87
      
       (Call exit directly in clone (BZ #21512)) SH clone
      implementation fails to set the exit code resulting in the failures:
      
      FAIL: nptl/tst-align-clone
      FAIL: nptl/tst-getpid1
      
      This patch fixes the both testcases.
      
      	[BZ #22605]
      	* sysdeps/unix/sysv/linux/sh/clone.S (__clone): Fix exit return
      	code.
      
      Signed-off-by: default avatarAdhemerval Zanella <adhemerval.zanella@linaro.org>
      554e3d51
    • H.J. Lu's avatar
      x86: Add feature_1 to tcbhead_t [BZ #22563] · cba595c3
      H.J. Lu authored
      On x86, padding in struct __jmp_buf_tag is used for shadow stack pointer
      to support Shadow Stack in Intel Control-flow Enforcemen Technology.
      cancel_jmp_buf has been updated to include saved_mask so that it is as
      large as struct __jmp_buf_tag.  We must suport the old cancel_jmp_buf
      in existing binaries.  Since symbol versioning doesn't work on
      cancel_jmp_buf, feature_1 is added to tcbhead_t so that setjmp and
      longjmp can check if shadow stack is enabled.  NB: Shadow stack is
      enabled only if all modules are shadow stack enabled.
      
      	[BZ #22563]
      	* sysdeps/i386/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
      	* sysdeps/i386/nptl/tls.h (tcbhead_t): Add feature_1.
      	* sysdeps/x86_64/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
      	* sysdeps/x86_64/nptl/tls.h (tcbhead_t): Rename __glibc_unused1
      	to feature_1.
      cba595c3
    • H.J. Lu's avatar
      Linux/x86: Update cancel_jmp_buf to match __jmp_buf_tag [BZ #22563] · f81ddabf
      H.J. Lu authored
      On x86, padding in struct __jmp_buf_tag is used for shadow stack pointer
      to support shadow stack in Intel Control-flow Enforcemen Technology.
      Since the cancel_jmp_buf array is passed to setjmp and longjmp by
      casting it to pointer to struct __jmp_buf_tag, it should be as large
      as struct __jmp_buf_tag.  Otherwise when shadow stack is enabled,
      setjmp and longjmp will write and read beyond cancel_jmp_buf when saving
      and restoring shadow stack pointer.
      
      This patch adds bits/types/__cancel_jmp_buf_tag.h to define struct
      __cancel_jmp_buf_tag so that Linux/x86 can add saved_mask to
      cancel_jmp_buf.
      
      Tested natively on i386, x86_64 and x32.  Tested hppa-linux-gnu with
      build-many-glibcs.py.
      
      	[BZ #22563]
      	* bits/types/__cancel_jmp_buf_tag.h: New file.
      	* sysdeps/unix/sysv/linux/x86/bits/types/__cancel_jmp_buf_tag.h
      	* sysdeps/unix/sysv/linux/x86/pthreaddef.h: Likewise.
      	* sysdeps/unix/sysv/linux/x86/nptl/pthreadP.h: Likewise.
      	* nptl/Makefile (headers): Add
      	bits/types/__cancel_jmp_buf_tag.h.
      	* nptl/descr.h [NEED_SAVED_MASK_IN_CANCEL_JMP_BUF]
      	(pthread_unwind_buf): Add saved_mask to cancel_jmp_buf.
      	* sysdeps/nptl/pthread.h: Include
      	<bits/types/__cancel_jmp_buf_tag.h>.
      	(__pthread_unwind_buf_t): Use struct __cancel_jmp_buf_tag with
      	__cancel_jmp_buf.
      	* sysdeps/unix/sysv/linux/hppa/pthread.h: Likewise.
      f81ddabf
    • H.J. Lu's avatar
      Add --enable-static-pie variants to x86_64, x32 and i686 · 1a49fc59
      H.J. Lu authored
      Since the default GCC and binutils versions used by build-many-glibcs.py,
      which are GCC 7 branch and binutils 2.29 branch, support static PIE on
      x86_64, x32 and i686, this patch adds --enable-static-pie glibc variants
      to x86_64, x32 and i686 to get some coverage for static PIE.
      
      Tested with build-many-glibcs.py.
      
      	* scripts/build-many-glibcs.py (Context.add_all_configs): Add
      	--enable-static-pie variants to x86_64, x32 and i686.
      1a49fc59