summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-07-24nptl: Add abilist symbols for C11 threadsAdhemerval Zanella
This patch adds the required abilist symbols for C11 thread support. Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, and x86_64-linux-gnu). Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabhf, and powerpc64le-linux-gnu. [BZ #14092] * sysdeps/unix/sysv/linux/aarch64/libc.abilist [GLIBC_2.28] (thrd_current, thrd_equal, thrd_sleep, thrd_yield): Add C11 thread symbols. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/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/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/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/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/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/aarch64/libpthread.abilist [[GLIBC_2.28] (call_once, cnd_broadcast, cnd_destroy, cnd_init, cnd_signal, cnd_timedwait, cnd_wait, mtx_destroy, mtx_init, mtx_lock, mtx_timedlock, mtx_trylock, mtx_unlokc, thrd_create, thrd_detach, thrd_exit, thrd_join, tss_create, tss_delete, tss_get, tss_set): Likewise. * sysdeps/unix/sysv/linux/aarch64/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libpthread.abilist: Likewise. ikewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist: * sysdeps/unix/sysv/linux/powerpc/powerpc64/libpthread-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist: Likewise.
2018-07-24nptl: Add C11 threads tss_* functionsAdhemerval Zanella
This patch adds the tss_* definitions from C11 threads (ISO/IEC 9899:2011), more specifically tss_create, tss_delete, tss_get, tss_set, and required types. Mostly of the definitions are composed based on POSIX conterparts, including tss_t (pthread_key_t). Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, and x86_64-linux-gnu). Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabhf, and powerpc64le-linux-gnu. [BZ #14092] * conform/data/threads.h-data (thread_local): New macro. (TSS_DTOR_ITERATIONS): Likewise. (tss_t): New type. (tss_dtor_t): Likewise. (tss_create): New function. (tss_get): Likewise. (tss_set): Likewise. (tss_delete): Likewise. * nptl/Makefile (libpthread-routines): Add tss_create, tss_delete, tss_get, and tss_set objects. * nptl/Versions (libpthread) [GLIBC_2.28]: Likewise. * nptl/tss_create.c: New file. * nptl/tss_delete.c: Likewise. * nptl/tss_get.c: Likewise. * nptl/tss_set.c: Likewise. * sysdeps/nptl/threads.h (thread_local): New define. (TSS_DTOR_ITERATIONS): Likewise. (tss_t): New typedef. (tss_dtor_t): Likewise. (tss_create): New prototype. (tss_get): Likewise. (tss_set): Likewise. (tss_delete): Likewise.
2018-07-24nptl: Add C11 threads cnd_* functionsAdhemerval Zanella
This patch adds the cnd_* definitions from C11 threads (ISO/IEC 9899:2011), more specifically cnd_broadcast, cnd_destroy, cnd_init, cnd_signal, cnd_timedwait, cnd_wait, and required types. Mostly of the definitions are composed based on POSIX conterparts, and cnd_t is also based on internal pthreads fields, but with distinct internal layout to avoid possible issues with code interchange (such as trying to pass POSIX structure on C11 functions and to avoid inclusion of pthread.h). The idea is to make it possible to share POSIX internal implementation for mostly of the code making adjust where only required. Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, and x86_64-linux-gnu). Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabhf, and powerpc64le-linux-gnu. [BZ #14092] * conform/data/threads.h-data (cnd_t): New type. (cnd_init): New function. (cnd_signal): Likewise. (cnd_broadcast): Likewise. (cnd_wait): Likewise. (cnd_timedwait): Likewise. (cnd_destroy): Likewise. * nptl/Makefile (libpthread-routines): Add cnd_broadcast, cnd_destroy, cnd_init, cnd_signal, cnd_timedwait, and cnd_wait object. * nptl/Versions (libpthread) [GLIBC_2.28]: Likewise. * nptl/cnd_broadcast.c: New file. * nptl/cnd_destroy.c: Likewise. * nptl/cnd_init.c: Likewise. * nptl/cnd_signal.c: Likewise. * nptl/cnd_timedwait.c: Likewise. * nptl/cnd_wait.c: Likewise. * sysdeps/nptl/threads.h (cnd_t): New type. (cnd_init): New prototype. (cnd_signa): Likewise. (cnd_broadcast): Likewise. (cnd_wait): Likewise. (cnd_timedwait): Likewise. (cnd_destroy): Likewise.
2018-07-24nptl: Add C11 threads call_once functionsAdhemerval Zanella
This patch adds the call_* definitions from C11 threads (ISO/IEC 9899:2011), more specifically call_once and required types. Mostly of the definitions are composed based on POSIX conterparts,including once_flag (pthread_once_t). The idea is to make possible to share POSIX internal implementations for mostly of the code (and making adjustment only when required). Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, and x86_64-linux-gnu). Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabhf, and powerpc64le-linux-gnu. [BZ #14092] * conform/data/threads.h-data (ONCE_FLAG_INIT): New macro. (once_flag): New type. (call_once): New function. * nptl/Makefile (libpthread-routines): Add call_once object. * nptl/Versions (libphread) [GLIBC_2.28]: Add call_once symbol. * nptl/call_once.c: New file. * sysdeps/nptl/threads.h (ONCE_FLAG_INIT): New define. (once_flag): New type. (call_once): New prototype.
2018-07-24nptl: Add C11 threads mtx_* functionsAdhemerval Zanella
This patch adds the mtx_* definitions from C11 threads (ISO/IEC 9899:2011), more specifically mtx_init, mtx_destroy, mtx_lock, mtx_timedlock, mtx_trylock, mtx_unlock, and required types. Mostly of the definitions are composed based on POSIX conterparts, and mtx_t is also based on internal pthread fields, but with a distinct internal layout to avoid possible issues with code interchange (such as trying to pass POSIX structure on C11 functions and to avoid inclusion of pthread.h). The idea is to make possible to share POSIX internal implementations for mostly of the code (and making adjustment only when required). Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, and x86_64-linux-gnu). Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabhf, and powerpc64le-linux-gnu. [BZ #14092] * conform/data/threads.h-data (mtx_plain): New constant. (mtx_recursive): Likewise. (mtx_timed): Likewise. (mtx_t): New type. (mtx_init): New function. (mtx_lock): Likewise. (mtx_timedlock): Likewise. (mtx_trylock): Likewise. (mtx_unlock): Likewise. (mtx_destroy): Likewise. * nptl/Makefile (libpthread-routines): Add mtx_destroy, mtx_init, mtx_lock, mtx_timedlock, mtx_trylock, and mtx_unlock object. * nptl/Versions (libpthread) [GLIBC_2.28]): Add mtx_init, mtx_lock, mtx_timedlock, mtx_trylock, mtx_unlock, and mtx_destroy. * nptl/mtx_destroy.c: New file. * nptl/mtx_init.c: Likewise. * nptl/mtx_lock.c: Likewise. * nptl/mtx_timedlock.c: Likewise. * nptl/mtx_trylock.c: Likewise. * nptl/mtx_unlock.c: Likewise. * sysdeps/nptl/threads.h (mtx_plain): New enumeration. (mtx_recursive): Likewise. (mtx_timed): Likewise. (mtx_t): New type. (mtx_init): New prototype. (mtx_lock): Likewise. (mtx_timedlock): Likewise. (mtx_trylock): Likewise. (mtx_unlock): Likewise. (mtx_destroy): Likewise.
2018-07-24nptl: Add C11 threads thrd_* functionsAdhemerval Zanella
This patch adds the thrd_* definitions from C11 threads (ISO/IEC 9899:2011), more specifically thrd_create, thrd_curent, rhd_detach, thrd_equal, thrd_exit, thrd_join, thrd_sleep, thrd_yield, and required types. Mostly of the definitions are composed based on POSIX conterparts, such as thrd_t (using pthread_t). For thrd_* function internally direct POSIX pthread call are used with the exceptions: 1. thrd_start uses pthread_create internal implementation, but changes how to actually calls the start routine. This is due the difference in signature between POSIX and C11, where former return a 'void *' and latter 'int'. To avoid calling convention issues due 'void *' to int cast, routines from C11 threads are started slight different than default pthread one. Explicit cast to expected return are used internally on pthread_create and the result is stored back to void also with an explicit cast. 2. thrd_sleep uses nanosleep internal direct syscall to avoid clobbering errno and to handle expected standard return codes. It is a cancellation entrypoint to be consistent with both thrd_join and cnd_{timed}wait. 3. thrd_yield also uses internal direct syscall to avoid errno clobbering. Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, and x86_64-linux-gnu). Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabhf, and powerpc64le-linux-gnu. [BZ #14092] * conform/Makefile (conformtest-headers-ISO11): Add threads.h. (linknamespace-libs-ISO11): Add libpthread.a. * conform/data/threads.h-data: New file: add C11 thrd_* types and functions. * include/stdc-predef.h (__STDC_NO_THREADS__): Remove definition. * nptl/Makefile (headers): Add threads.h. (libpthread-routines): Add new C11 thread thrd_create, thrd_current, thrd_detach, thrd_equal, thrd_exit, thrd_join, thrd_sleep, and thrd_yield. * nptl/Versions (libpthread) [GLIBC_2.28]): Add new C11 thread thrd_create, thrd_current, thrd_detach, thrd_equal, thrd_exit, thrd_join, thrd_sleep, and thrd_yield symbols. * nptl/descr.h (struct pthread): Add c11 field. * nptl/pthreadP.h (ATTR_C11_THREAD): New define. * nptl/pthread_create.c (START_THREAD_DEFN): Call C11 thread start routine with expected function prototype. (__pthread_create_2_1): Add C11 threads check based on attribute value. * sysdeps/unix/sysdep.h (INTERNAL_SYSCALL_CANCEL): New macro. * nptl/thrd_create.c: New file. * nptl/thrd_current.c: Likewise. * nptl/thrd_detach.c: Likewise. * nptl/thrd_equal.c: Likewise. * nptl/thrd_exit.c: Likewise. * nptl/thrd_join.c: Likewise. * nptl/thrd_priv.h: Likewise. * nptl/thrd_sleep.c: Likewise. * nptl/thrd_yield.c: Likewise. * include/threads.h: Likewise.
2018-07-24Add <bits/indirect-return.h>H.J. Lu
Add <bits/indirect-return.h> and include it in <ucontext.h>. __INDIRECT_RETURN defined in <bits/indirect-return.h> indicates if swapcontext requires special compiler treatment. The default __INDIRECT_RETURN is empty. On x86, when shadow stack is enabled, __INDIRECT_RETURN is defined with indirect_return attribute, which has been added to GCC 9, to indicate that swapcontext returns via indirect branch. Otherwise __INDIRECT_RETURN is defined with returns_twice attribute. When shadow stack is enabled, remove always_inline attribute from prepare_test_buffer in string/tst-xbzero-opt.c to avoid: tst-xbzero-opt.c: In function ‘prepare_test_buffer’: tst-xbzero-opt.c:105:1: error: function ‘prepare_test_buffer’ can never be inlined because it uses setjmp prepare_test_buffer (unsigned char *buf) when indirect_return attribute isn't available. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * bits/indirect-return.h: New file. * misc/sys/cdefs.h (__glibc_has_attribute): New. * sysdeps/x86/bits/indirect-return.h: Likewise. * stdlib/Makefile (headers): Add bits/indirect-return.h. * stdlib/ucontext.h: Include <bits/indirect-return.h>. (swapcontext): Add __INDIRECT_RETURN. * string/tst-xbzero-opt.c (ALWAYS_INLINE): New. (prepare_test_buffer): Use it.
2018-07-24Fix out-of-bounds access in IBM-1390 converter (bug 23448)Andreas Schwab
The IBM-1390 converter can consume/produce two UCS4 characters in each loop.
2018-07-24x86: Update vfork to pop shadow stackH.J. Lu
The shadow stack prevents us from pushing the saved return PC onto the stack and returning normally. Instead we pop the shadow stack and return directly. This is the safest way to return and ensures any stack manipulations done by the vfork'd child doesn't cause the parent to terminate when CET is enabled. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/unix/sysv/linux/i386/vfork.S (SYSCALL_ERROR_HANDLER): Redefine if shadow stack is enabled. (SYSCALL_ERROR_LABEL): Likewise. (__vfork): Pop shadow stack and jump back to to caller directly when shadow stack is in use. * sysdeps/unix/sysv/linux/x86_64/vfork.S (SYSCALL_ERROR_HANDLER): Redefine if shadow stack is enabled. (SYSCALL_ERROR_LABEL): Likewise. (__vfork): Pop shadow stack and jump back to to caller directly when shadow stack is in use.
2018-07-24x86-64: Add endbr64 to tst-quadmod[12].SH.J. Lu
Add endbr64 to tst-quadmod1.S and tst-quadmod2.S so that func and foo can be called indirectly. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/x86_64/tst-quadmod1.S (func): Add endbr64 if IBT is enabled. (foo): Likewise. * sysdeps/x86_64/tst-quadmod2.S (func) : Likewise. (foo): Likewise.
2018-07-20Use binutils 2.31 branch in build-many-glibcs.py.Joseph Myers
* scripts/build-many-glibcs.py (Context.checkout): Default binutils version to 2.31 branch.
2018-07-20Change URL of gcc's tarballZong Li
After 7.1.0 version, there is no .bz2 format of gcc's tarball. * scripts/build-many-glibcs.py (Context.checkout_tar): Change the URL of gcc's tarball.
2018-07-20regcomp: Fix off-by-one bug in build_equiv_class [BZ #23396]Florian Weimer
This bug is very similar to bug 23036: The existing code assumed that the length count included the length byte itself. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-20check-execstack: Permit sysdeps to xfail some libsSamuel Thibault
* scripts/check-execstack.awk: Consider `xfail' variable containing a list of libraries whose stack executability is expected. * elf/Makefile ($(objpfx)check-execstack.out): Pass $(check-execstack-xfail) to check-execstack.awk through `xfail' variable. * sysdeps/mach/hurd/i386/Makefile (check-execstack-xfail): Set to ld.so libc.so libpthread.so.
2018-07-20hurd: Fix installed-headers testsSamuel Thibault
* sysdeps/mach/include/mach-shortcuts-hidden.h [!_ISOMAC]: Do not declare libc hidden prototypes. * sysdeps/mach/include/mach/mach_traps.h [!_ISOMAC]: Likewise.
2018-07-20Fix new file headerSamuel Thibault
2018-07-20hurd: Implement pipe2Thomas Schwinge
* sysdeps/mach/hurd/pipe2.c: New file, copy from pipe.c. Evolve it to implement __pipe2. * sysdeps/mach/hurd/pipe.c (__pipe): Reimplement using __pipe2.
2018-07-20hurd: SOCK_CLOEXEC and SOCK_NONBLOCK for socketpairThomas Schwinge
* sysdeps/mach/hurd/socketpair.c (__socketpair): Handle SOCK_CLOEXEC and SOCK_NONBLOCK.
2018-07-20hurd: SOCK_CLOEXEC and SOCK_NONBLOCK for socketThomas Schwinge
* sysdeps/mach/hurd/socket.c (__socket): Handle SOCK_CLOEXEC and SOCK_NONBLOCK.
2018-07-20hurd: Enable thread-safe i386 atomic instructionsSamuel Thibault
* sysdeps/mach/hurd/i386/tls.h (_hurd_tls_init): Set multiple_threads to 1.
2018-07-19benchtests: improve argument parsing through argparse libraryLeonardo Sandoval
The argparse library is used on compare_bench script to improve command line argument parsing. The 'schema validation file' is now optional, reducing by one the number of required parameters. * benchtests/scripts/compare_bench.py (__main__): use the argparse library to improve command line parsing. (__main__): make schema file as optional parameter (--schema), defaulting to benchtests/scripts/benchout.schema.json. (main): move out of the parsing stuff to __main_  and leave it only as caller of main comparison functions.
2018-07-19INSTALL: Add a note for Intel CET statusH.J. Lu
* NEWS: Add a note for Intel CET status. * manual/install.texi: Likewise. * INSTALL: Regenerated.
2018-07-18oc_FR locale: Multiple updates (bug 23140, bug 23422).Quentin PAGÈS
Multiple updates for Occitan language including alternative month names, update abday and abmon, fix typos in day, fix d_fmt, correct LC_NAME, and use “copy "ca_ES"” as LC_COLLATE. [BZ #23140] * localedata/locales/oc_FR (mon): Rename to... (alt_mon): This, then update October (typo fix). (mon): New content (genitive case, month names preceded by "de" or "d’"). [BZ #23422] * localedata/locales/oc_FR (abday): Update all items. (day): Update Wednesday and Saturday (typo fixes). (abmon): Update all items, except May. (d_fmt): Update "%d.%m.%Y" -> "%d/%m/%Y". (LC_IDENTIFICATION): Bump the revision number and date. Keep the "category" entries in alphabetic order. (LC_ADDRESS): Remove no longer needed comment. (LC_COLLATE): Use “copy "ca_ES"”. (LC_NAME): Set the correct values of "name_fmt", "name_mr", and "name_mrs". Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-18Avoid insecure usage of tmpnam in tests.Joseph Myers
Various glibc testcases use tmpnam in ways subject to race conditions (generate a temporary file name, then later open that file without O_EXCL). This patch fixes those tests to use mkstemp - generally a minimal local fix to use mkstemp instead of tmpnam, rather than a larger fix to use other testsuite infrastructure for temporary files. The unchanged use of tmpnam in posix/wordexp-test.c would fail safe in the event of a race (it's generating a name for use with mkdir rather than for a file to be opened for writing). Tested for x86_64. * grp/tst_fgetgrent.c: Include <unistd.h>. (main): Use mkstemp instead of tmpnam. * io/test-utime.c (main): Likewise. * posix/annexc.c (macrofile): Change to modifiable array. (get_null_defines): Use mkstemp instead of tmpnam. Do not remove macrofile here. * posix/bug-getopt1.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt2.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt3.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt4.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt5.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * stdio-common/bug7.c: Include <stdlib.h> and <unistd.h>. (main): Use mkstemp instead of tmpnam. * stdio-common/tst-fdopen.c: Include <stdlib.h>. (main): Use mkstemp instead of tmpnam. * stdio-common/tst-ungetc.c: Include <stdlib.h>. (main): use mkstemp instead of tmpnam. * stdlib/isomac.c (macrofile): Change to modifiable array. (get_null_defines): Use mkstemp instead of tmpnam. Do not remove macrofile here.
2018-07-18x86/CET: Document glibc.tune.x86_ibt and glibc.tune.x86_shstkH.J. Lu
* manual/tunables.texi: Document glibc.tune.x86_ibt and glibc.tune.x86_shstk.
2018-07-18Intel CET: Document --enable-cetH.J. Lu
* NEWS: Mention --enable-cet. * manual/install.texi: Document --enable-cet. * INSTALL: Regenerated.
2018-07-18x86-64: Use _CET_NOTRACK in memcmp-sse4.SH.J. Lu
* sysdeps/x86_64/multiarch/memcmp-sse4.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18i386: Use _CET_NOTRACK in memset-sse2-rep.SH.J. Lu
* sysdeps/i386/i686/multiarch/memset-sse2-rep.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18i386: Use _CET_NOTRACK in strcat-sse2.SH.J. Lu
* sysdeps/i386/i686/multiarch/strcat-sse2.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18i386: Use _CET_NOTRACK in strcpy-sse2.SH.J. Lu
* sysdeps/i386/i686/multiarch/strcpy-sse2.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18i386: Use _CET_NOTRACK in memcpy-ssse3.SH.J. Lu
* sysdeps/i386/i686/multiarch/memcpy-ssse3.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18i386: Use _CET_NOTRACK in memcpy-ssse3-rep.SH.J. Lu
* sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table. (BRANCH_TO_JMPTBL_ENTRY_TAIL): Likewise.
2018-07-18i386: Use _CET_NOTRACK in memcmp-sse4.SH.J. Lu
* sysdeps/i386/i686/multiarch/memcmp-sse4.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18i386: Use _CET_NOTRACK in memset-sse2.SH.J. Lu
* sysdeps/i386/i686/multiarch/memset-sse2.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18i386: Use _CET_NOTRACK in i686/memcmp.SH.J. Lu
* sysdeps/i386/i686/memcmp.S (memcmp): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18x86-64: Use _CET_NOTRACK in memcpy-ssse3.SH.J. Lu
* sysdeps/x86_64/multiarch/memcpy-ssse3.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table. (MEMCPY): Likewise.
2018-07-18x86-64: Use _CET_NOTRACK in memcpy-ssse3-back.SH.J. Lu
* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table. (MEMCPY): Likewise.
2018-07-18x86-64: Use _CET_NOTRACK in strcmp-sse42.SH.J. Lu
* sysdeps/x86_64/multiarch/strcmp-sse42.S (STRCMP_SSE42): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18x86-64: Use _CET_NOTRACK in strcpy-sse2-unaligned.SH.J. Lu
* sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18x86_64: Use _CET_NOTRACK in strcmp.SH.J. Lu
* sysdeps/x86_64/strcmp.S (STRCMP): Add _CET_NOTRACK before indirect jump to jump table.
2018-07-18New locale: Yakut (Sakha) for Russia (sah_RU) [BZ #22241]Valery Timiriliyev
* localedata/Makefile (test-input): Add sah_RU.UTF-8. (LOCALES): Likewise. * localedata/SUPPORTED (sah_RU/UTF-8): New entry. * localedata/locales/sah_RU: New file. * localedata/sah_RU.UTF-8.in: New file. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-17i386: Add _CET_ENDBR to indirect jump targets in add_n.S/sub_n.SH.J. Lu
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. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/i386/add_n.S: Include <sysdep.h>, instead of "sysdep.h". (__mpn_add_n): Save and restore %ebx if IBT is enabed. 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 enabed. 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 enabed. Add _CET_ENDBR to indirect jump targets and adjust jump destination for _CET_ENDBR.
2018-07-17x86-64: Add _CET_ENDBR to STRCMP_SSE42H.J. Lu
Add _CET_ENDBR to STRCMP_SSE42, which is called indirectly, to support IBT. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/x86_64/multiarch/strcmp-sse42.S (STRCMP_SSE42): Add _CET_ENDBR.
2018-07-17x86: Add _CET_ENDBR to functions in dl-tlsdesc.SH.J. Lu
Add _CET_ENDBR to functions in dl-tlsdesc.S, which are called indirectly, to support IBT. Tested on i686 and x86-64. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * 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.
2018-07-17x86: Add _CET_ENDBR to functions in crti.SH.J. Lu
Add _CET_ENDBR to functions in crti.S, which are called indirectly, to support IBT. Tested on i686 and x86-64. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/i386/crti.S (_init): Add _CET_ENDBR. (_fini): Likewise. * sysdeps/x86_64/crti.S (_init): Likewise. (_fini): Likewise.
2018-07-17os_RU: Add alternative month names (bug 23140).Rafal Luzynski
[BZ #23140] * localedata/locales/os_RU (mon): Rename to... (alt_mon): This. (mon): Import from CLDR (genitive case). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-07-17x86: Always include <dl-cet.h>/cet-tunables.h> for --enable-cetH.J. Lu
Always include <dl-cet.h> and cet-tunables.h> when CET is enabled. Otherwise, configure glibc with --enable-cet --disable-tunables will fail to build. * sysdeps/x86/cpu-features.c: Always include <dl-cet.h> and cet-tunables.h> when CET is enabled.
2018-07-16x86: Support IBT and SHSTK in Intel CET [BZ #21598]H.J. Lu
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. _dl_process_pt_note or _rtld_process_pt_note is called to process PT_NOTE segment for GNU program property and set l_cet. b. _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 run-time control can be changed via GLIBC_TUNABLES with $ export GLIBC_TUNABLES=glibc.tune.x86_shstk=[permissive|on|off] $ export GLIBC_TUNABLES=glibc.tune.x86_ibt=[permissive|on|off] 1. permissive: SHSTK is disabled when dlopening a legacy ELF module. 2. on: IBT or SHSTK are always enabled, regardless if there are IBT or SHSTK bits in GNU program property. 3. off: IBT or SHSTK are always disabled, regardless if there are IBT or SHSTK bits in GNU program property. <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. _CET_NOTRACK is used to insert NOTRACK prefix with indirect jump table to support IBT. It is defined as notrack when _CET_NOTRACK is defined in <cet.h>. [BZ #21598] * configure.ac: Add --enable-cet. * configure: Regenerated. * elf/Makefille (all-built-dso): Add a comment. * elf/dl-load.c (filebuf): Moved before "dynamic-link.h". Include <dl-prop.h>. (_dl_map_object_from_fd): Call _dl_process_pt_note on PT_NOTE segment. * elf/dl-open.c: Include <dl-prop.h>. (dl_open_worker): Call _dl_open_check. * elf/rtld.c: Include <dl-prop.h>. (dl_main): Call _rtld_process_pt_note on PT_NOTE segment. Call _rtld_main_check. * sysdeps/generic/dl-prop.h: New file. * sysdeps/i386/dl-cet.c: Likewise. * sysdeps/unix/sysv/linux/x86/cpu-features.c: Likewise. * sysdeps/unix/sysv/linux/x86/dl-cet.h: Likewise. * sysdeps/x86/cet-tunables.h: Likewise. * sysdeps/x86/check-cet.awk: Likewise. * sysdeps/x86/configure: Likewise. * sysdeps/x86/configure.ac: Likewise. * sysdeps/x86/dl-cet.c: Likewise. * sysdeps/x86/dl-procruntime.c: Likewise. * sysdeps/x86/dl-prop.h: Likewise. * sysdeps/x86/libc-start.h: Likewise. * sysdeps/x86/link_map.h: Likewise. * 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/linux/x86/Makefile (sysdep-dl-routines): Add dl-cet if CET is enabled. (CFLAGS-.o): Add -fcf-protection if CET is enabled. (CFLAGS-.os): Likewise. (CFLAGS-.op): Likewise. (CFLAGS-.oS): Likewise. (asm-CPPFLAGS): Add -fcf-protection -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/cpu-features.c: Include <dl-cet.h> and <cet-tunables.h>. (TUNABLE_CALLBACK (set_x86_ibt)): New prototype. (TUNABLE_CALLBACK (set_x86_shstk)): Likewise. (init_cpu_features): Call get_cet_status to check CET status and update dl_x86_feature_1 with CET status. Call TUNABLE_CALLBACK (set_x86_ibt) and TUNABLE_CALLBACK (set_x86_shstk). Disable and lock CET in libc.a. * sysdeps/x86/cpu-tunables.c: Include <cet-tunables.h>. (TUNABLE_CALLBACK (set_x86_ibt)): New function. (TUNABLE_CALLBACK (set_x86_shstk)): Likewise. * sysdeps/x86/sysdep.h (_CET_NOTRACK): New. (_CET_ENDBR): Define if not defined. (ENTRY): Add _CET_ENDBR. * sysdeps/x86/dl-tunables.list (glibc.tune): Add x86_ibt and x86_shstk. * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Add _CET_ENDBR. (_dl_runtime_profile): Likewise.
2018-07-16powerpc64: Always restore TOC on longjmp [BZ #21895]Rogerio Alves
This patch changes longjmp to always restore the TOC pointer (r2 register) to the caller frame on powerpc64 and powerpc64le. This is related to bug 21895 that reports a situation where you have a static longjmp to a shared object file. [BZ #21895] * sysdeps/powerpc/powerpc64/__longjmp-common.S: Remove condition code for restoring r2 in longjmp. * sysdeps/powerpc/powerpc64/Makefile: Added tst-setjmp-bug21895-static to test list. Added rules to build test tst-setjmp-bug21895-static. Added module setjmp-bug21895 and rules to build a shared object from it. * sysdeps/powerpc/powerpc64/setjmp-bug21895.c: New test file. * sysdeps/powerpc/powerpc64/tst-setjmp-bug21895-static.c: New test file. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-07-16Improve strstr performanceWilco Dijkstra
Improve strstr performance. Strstr tends to be slow because it uses many calls to memchr and a slow byte loop to scan for the next match. Performance is significantly improved by using strnlen on larger blocks and using strchr to search for the next matching character. strcasestr can also use strnlen to scan ahead, and memmem can use memchr to check for the next match. On the GLIBC bench tests the performance gains on Cortex-A72 are: strstr: +25% strcasestr: +4.3% memmem: +18% On a 256KB dataset strstr performance improves by 67%, strcasestr by 47%. Reviewd-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>