From e62008a86e289d945a91428db436c5a90d836004 Mon Sep 17 00:00:00 2001 From: Fredrik Rinnestam Date: Sun, 22 Oct 2017 16:38:18 +0200 Subject: [PATCH] [notify] glibc-32: updated to 2.24-9. Syncs with upstream. Fixes: CVE-2017-15670 CVE-2017-1000366 CVE-2015-5180 --- glibc-32/.md5sum | 3 +- glibc-32/.signature | 7 +- ...-glob-Fix-one-byte-overflow-BZ-22320.patch | 765 ++++++++ glibc-32/Pkgfile | 10 +- ...-2.24-updates.patch => glibc-2.24.8.patch} | 1616 ++++++++++++++++- 5 files changed, 2377 insertions(+), 24 deletions(-) create mode 100644 glibc-32/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch rename glibc-32/{glibc-2.24-updates.patch => glibc-2.24.8.patch} (90%) diff --git a/glibc-32/.md5sum b/glibc-32/.md5sum index 2177e3e8..8d31067f 100644 --- a/glibc-32/.md5sum +++ b/glibc-32/.md5sum @@ -1,4 +1,5 @@ -052018e4621ea8e3d7d8f1b711fcdaa3 glibc-2.24-updates.patch +bcfb2cb7f1cb0b4ecce27fcd5d5d2b21 0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch +cb9c54c9d22b3ab597a69d05420b5e80 glibc-2.24.8.patch 97dc5517f92016f3d70d83e3162ad318 glibc-2.24.tar.xz ac19b5dac0b160aa59a2e265998c3e91 kernel-headers-4.9.5.tar.xz a8f4549c716cd37244fbf1ed059497f8 lib32.conf diff --git a/glibc-32/.signature b/glibc-32/.signature index 184f37fc..6b94ce07 100644 --- a/glibc-32/.signature +++ b/glibc-32/.signature @@ -1,8 +1,9 @@ untrusted comment: verify with /etc/ports/core.pub -RWRJc1FUaeVeqgHIVZCdS2I9jSvM+uPwpamx0V9TvLkWLquTugBPkS5Fhy+AuARhAk2tuHHyo1P8446Ui+0G5BLJ/LqNyLC5QA0= -SHA256 (Pkgfile) = 62d282b0fe37b75aaf5ba15e589eb11f499de60bc9b265a8891e4f77711cec63 +RWRJc1FUaeVeqjeyptGRCBcjcyr/ot+fF8dm4Kc50exfkG6Dh1ByVtDUMJHkKHGfkRAeiq/6S6qY0oYbewnOS8I7fQ3Vjzj3xw0= +SHA256 (Pkgfile) = e3f3c583e8e6da48eb296cab0aee6bae04c9def714432f8b81fe749c1b08adec SHA256 (.footprint) = 0af47db3e8a5ea832d1f971ca56f7718a59167c0214375307a508ff46b327119 SHA256 (glibc-2.24.tar.xz) = 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 SHA256 (kernel-headers-4.9.5.tar.xz) = 5783ad8f668ee71561fae370fbcdc477aaa6df249bd85635b87a8c204aeb4aa9 -SHA256 (glibc-2.24-updates.patch) = 11839138c7d82544894df8fb6b505aa7afa1a07e79965a64b2a0dac7a1b0aa64 +SHA256 (glibc-2.24.8.patch) = 314fe8ec41042a85991e830a002abf2ff0b98dc4467afa238d8bb369d3be7cca +SHA256 (0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch) = 3f634bf301eb8bab57e5ea552de3f694fb063ab45af3cc91990e1bc24f280ddd SHA256 (lib32.conf) = 2f174d2bcefe1c29327690514f34d6970fffdd54398320ca23a11b5f1e3c9b2d diff --git a/glibc-32/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch b/glibc-32/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch new file mode 100644 index 00000000..bc410b26 --- /dev/null +++ b/glibc-32/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch @@ -0,0 +1,765 @@ +From b9911eb529e51ebe7c5daa3b4f17e2caf7ddb9a4 Mon Sep 17 00:00:00 2001 +From: Fredrik Rinnestam +Date: Sun, 22 Oct 2017 16:18:40 +0200 +Subject: [PATCH] CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] + +--- + ChangeLog | 10 + + NEWS | 701 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + posix/glob.c | 2 +- + 3 files changed, 712 insertions(+), 1 deletion(-) + +diff --git a/ChangeLog b/ChangeLog +index 84189ec762..1fb38cb7ee 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,4 @@ ++<<<<<<< HEAD + 2017-10-19 H.J. Lu + + * sysdeps/x86_64/Makefile (tests): Add tst-sse, tst-avx and +@@ -20,6 +21,15 @@ + * sysdeps/x86_64/tst-avxmod.c: Likewise. + * sysdeps/x86_64/tst-sse.c: Likewise. + * sysdeps/x86_64/tst-ssemod.c: Likewise. ++======= ++2017-10-20 Paul Eggert ++ ++ [BZ #22320] ++ CVE-2017-15670 ++ * posix/glob.c (__glob): Fix one-byte overflow. ++ ++2017-10-20 Wilco Dijkstra ++>>>>>>> c369d66e54... CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] + + 2017-10-19 H.J. Lu + +diff --git a/NEWS b/NEWS +index 4831542023..90cae42eee 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,7 +5,708 @@ See the end for copying conditions. + Please send GNU C library bug reports via + using `glibc' in the "product" field. + ++<<<<<<< HEAD + Version 2.24.1 ++======= ++Version 2.27 ++ ++Major new features: ++ ++* Optimized x86-64 asin, atan2, exp, expf, log, pow, atan, sin and tan ++ with FMA, contributed by Arjan van de Ven and H.J. Lu from Intel. ++ ++* Optimized x86-64 trunc and truncf for processors with SSE4.1. ++ ++* Optimized generic expf, exp2f, logf, log2f and powf. ++ ++* In order to support faster and safer process termination the malloc API ++ family of functions will no longer print a failure address and stack ++ backtrace after detecting heap corruption. The goal is to minimize the ++ amount of work done after corruption is detected and to avoid potential ++ security issues in continued process execution. Reducing shutdown time ++ leads to lower overall process restart latency, so there is benefit both ++ from a security and performance perspective. ++ ++* The abort function terminates the process immediately, without flushing ++ stdio streams. Previous glibc versions used to flush streams, resulting ++ in deadlocks and further data corruption. This change also affects ++ process aborts as the result of assertion failures. ++ ++* On platforms where long double has the IEEE binary128 format (aarch64, ++ alpha, mips64, s390 and sparc), the math library now implements _Float128 ++ interfaces for that type, as defined by ISO/IEC TS 18661-3:2015. These ++ are the same interfaces added in version 2.26 for some platforms where ++ this format is supported but is not the format of long double. ++ ++Deprecated and removed features, and other changes affecting compatibility: ++ ++* On GNU/Linux, the obsolete Linux constant PTRACE_SEIZE_DEVEL is no longer ++ defined by . ++ ++* libm no longer supports SVID error handling (calling a user-provided ++ matherr function on error) or the _LIB_VERSION variable to control error ++ handling. (SVID error handling and the _LIB_VERSION variable still work ++ for binaries linked against older versions of the GNU C Library.) The ++ libieee.a library is no longer provided. math.h no longer defines struct ++ exception, or the macros X_TLOSS, DOMAIN, SING, OVERFLOW, UNDERFLOW, ++ TLOSS, PLOSS and HUGE. ++ ++* The libm functions pow10, pow10f and pow10l are no longer supported for ++ new programs. Programs should use the standard names exp10, exp10f and ++ exp10l for these functions instead. ++ ++* The mcontext_t type is no longer the same as struct sigcontext. On ++ platforms where it was previously the same, this changes the C++ name ++ mangling for interfaces involving this type. ++ ++* The add-ons mechanism for building additional packages at the same time as ++ glibc has been removed. The --enable-add-ons configure option is now ++ ignored. ++ ++Changes to build and runtime requirements: ++ ++ [Add changes to build and runtime requirements here] ++ ++Security related changes: ++ ++ CVE-2009-5064: The ldd script would sometimes run the program under ++ examination directly, without preventing code execution through the ++ dynamic linker. (The glibc project disputes that this is a security ++ vulnerability; only trusted binaries must be examined using the ldd ++ script.) ++ ++ CVE-2017-15670: The glob function, when invoked with GLOB_TILDE, suffered ++ from a one-byte overflow during ~ operator processing (either on the stack ++ or the heap, depending on the length of the user name). ++ ++The following bugs are resolved with this release: ++ ++ [The release manager will add the list generated by ++ scripts/list-fixed-bugs.py just before the release.] ++ ++ ++Version 2.26 ++ ++Major new features: ++ ++* A per-thread cache has been added to malloc. Access to the cache requires ++ no locks and therefore significantly accelerates the fast path to allocate ++ and free small amounts of memory. Refilling an empty cache requires locking ++ the underlying arena. Performance measurements show significant gains in a ++ wide variety of user workloads. Workloads were captured using a special ++ instrumented malloc and analyzed with a malloc simulator. Contributed by ++ DJ Delorie with the help of Florian Weimer, and Carlos O'Donell. ++ ++* Unicode 10.0.0 Support: Character encoding, character type info, and ++ transliteration tables are all updated to Unicode 10.0.0, using ++ generator scripts contributed by Mike FABIAN (Red Hat). ++ These updates cause user visible changes, especially the changes in ++ wcwidth for many emoji characters cause problems when emoji sequences ++ are rendered with pango, see for example: ++ https://bugzilla.gnome.org/show_bug.cgi?id=780669#c5 ++ ++* Collation of Hungarian has been overhauled and is now consistent with "The ++ Rules of Hungarian Orthography, 12th edition" (Bug 18934). Contributed by ++ Egmont Koblinger. ++ ++* Improvements to the DNS stub resolver, contributed by Florian Weimer: ++ ++ - The GNU C Library will now detect when /etc/resolv.conf has been ++ modified and reload the changed configuration. The new resolver option ++ “no-reload” (RES_NORELOAD) disables this behavior. ++ ++ - The GNU C Library now supports an arbitrary number of search domains ++ (configured using the “search” directive in /etc/resolv.conf); ++ previously, there was a hard limit of six domains. For backward ++ compatibility, applications that directly modify the ‘_res’ global ++ object are still limited to six search domains. ++ ++ - When the “rotate” (RES_ROTATE) resolver option is active, the GNU C ++ Library will now randomly pick a name server from the configuration as a ++ starting point. (Previously, the second name server was always used.) ++ ++* The tunables feature is now enabled by default. This allows users to tweak ++ behavior of the GNU C Library using the GLIBC_TUNABLES environment variable. ++ ++* New function reallocarray, which resizes an allocated block (like realloc) ++ to the product of two sizes, with a guaranteed clean failure upon integer ++ overflow in the multiplication. Originally from OpenBSD, contributed by ++ Dennis Wölfing and Rüdiger Sonderfeld. ++ ++* New wrappers for the Linux-specific system calls preadv2 and pwritev2. ++ These are extended versions of preadv and pwritev, respectively, taking an ++ additional flags argument. The set of supported flags depends on the ++ running kernel; full support currently requires kernel 4.7 or later. ++ ++* posix_spawnattr_setflags now supports the flag POSIX_SPAWN_SETSID, to ++ create a new session ID for the spawned process. This feature is ++ scheduled to be added to the next major revision of POSIX; for the time ++ being, it is available under _GNU_SOURCE. ++ ++* errno.h is now safe to use from C-preprocessed assembly language on all ++ supported operating systems. In this context, it will only define the ++ Exxxx constants, as preprocessor macros expanding to integer literals. ++ ++* On ia64, powerpc64le, x86-32, and x86-64, the math library now implements ++ 128-bit floating point as defined by ISO/IEC/IEEE 60559:2011 (IEEE ++ 754-2008) and ISO/IEC TS 18661-3:2015. Contributed by Paul E. Murphy, ++ Gabriel F. T. Gomes, Tulio Magno Quites Machado Filho, and Joseph Myers. ++ ++ To compile programs that use this feature, the compiler must support ++ 128-bit floating point with the type name _Float128 (as defined by TS ++ 18661-3) or __float128 (the nonstandard name used by GCC for C++, and for ++ C prior to version 7). _GNU_SOURCE or __STDC_WANT_IEC_60559_TYPES_EXT__ ++ must be defined to make the new interfaces visible. ++ ++ The new functions and macros correspond to those present for other ++ floating-point types (except for a few obsolescent interfaces not ++ supported for the new type), with F128 or f128 suffixes; for example, ++ strtof128, HUGE_VAL_F128 and cosf128. Following TS 18661-3, there are no ++ printf or scanf formats for the new type; the strfromf128 and strtof128 ++ interfaces should be used instead. ++ ++Deprecated and removed features, and other changes affecting compatibility: ++ ++* The synchronization that pthread_spin_unlock performs has been changed to ++ now be equivalent to a C11 atomic store with release memory order to the ++ spin lock's memory location. Previously, several (but not all) ++ architectures used stronger synchronization (e.g., containing what is ++ often called a full barrier). This change can improve performance, but ++ may affect odd fringe uses of spin locks that depend on the previous ++ behavior (e.g., using spin locks as atomic variables to try to implement ++ Dekker's mutual exclusion algorithm). ++ ++* The port to Native Client running on ARMv7-A (--host=arm-nacl) has been ++ removed. ++ ++* Sun RPC is deprecated. The rpcgen program, librpcsvc, and Sun RPC headers ++ will only be built and installed when the GNU C Library is configured with ++ --enable-obsolete-rpc. This allows alternative RPC implementations, such ++ as TIRPC or rpcsvc-proto, to be used. ++ ++* The NIS(+) name service modules, libnss_nis, libnss_nisplus, and ++ libnss_compat, are deprecated, and will not be built or installed by ++ default. ++ ++ The NIS(+) support library, libnsl, is also deprecated. By default, a ++ compatibility shared library will be built and installed, but not headers ++ or development libraries. Only a few NIS-related programs require this ++ library. (In particular, the GNU C Library has never required programs ++ that use 'gethostbyname' to be linked with libnsl.) ++ ++ Replacement implementations based on TIRPC, which additionally support ++ IPv6, are available from . The configure ++ option --enable-obsolete-nsl will cause libnsl's headers, and the NIS(+) ++ name service modules, to be built and installed. ++ ++* The DNS stub resolver no longer performs EDNS fallback. If EDNS or DNSSEC ++ support is enabled, the configured recursive resolver must support EDNS. ++ (Responding to EDNS-enabled queries with responses which are not ++ EDNS-enabled is fine, but FORMERR responses are not.) ++ ++* res_mkquery and res_nmkquery no longer support the IQUERY opcode. DNS ++ servers have not supported this opcode for a long time. ++ ++* The _res_opcodes variable has been removed from libresolv. It had been ++ exported by accident. ++ ++* no longer includes inline versions of any string functions, ++ as this kind of optimization is better done by the compiler. The macros ++ __USE_STRING_INLINES and __NO_STRING_INLINES no longer have any effect. ++ ++* The nonstandard header has been removed. Most programs should ++ use instead. If you have a specific need for the definition of ++ locale_t with no other declarations, please contact ++ libc-alpha@sourceware.org and explain. ++ ++* The obsolete header has been removed. ++ ++* The obsolete signal constant SIGUNUSED is no longer defined by . ++ ++* The obsolete function cfree has been removed. Applications should use ++ free instead. ++ ++* The stack_t type no longer has the name struct sigaltstack. This changes ++ the C++ name mangling for interfaces involving this type. ++ ++* The ucontext_t type no longer has the name struct ucontext. This changes ++ the C++ name mangling for interfaces involving this type. ++ ++* On M68k GNU/Linux and MIPS GNU/Linux, the fpregset_t type no longer has ++ the name struct fpregset. On Nios II GNU/Linux, the mcontext_t type no ++ longer has the name struct mcontext. On SPARC GNU/Linux, the struct ++ mc_fq, struct rwindow, struct fpq and struct fq types are no longer ++ defined in sys/ucontext.h, the mc_fpu_t type no longer has the name struct ++ mc_fpu, the gwindows_t type no longer has the name struct gwindows and the ++ fpregset_t type no longer has the name struct fpu. This changes the C++ ++ name mangling for interfaces involving those types. ++ ++* On S/390 GNU/Linux, the constants defined by have been ++ synced with the kernel: ++ ++ - PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS and PTRACE_SETFPREGS ++ are not supported on this architecture and have been removed. ++ ++ - PTRACE_SINGLEBLOCK, PTRACE_SECCOMP_GET_FILTER, PTRACE_PEEKUSR_AREA, ++ PTRACE_POKEUSR_AREA, PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, ++ PTRACE_DISABLE_TE and PTRACE_TE_ABORT_RAND have been added. ++ ++ Programs that assume the GET/SETREGS ptrace requests are universally ++ available will now fail to build, instead of malfunctioning at runtime. ++ ++Changes to build and runtime requirements: ++ ++* Linux kernel 3.2 or later is required at runtime, on all architectures ++ supported by that kernel. (This is a change from version 2.25 only for ++ x86-32 and x86-64.) ++ ++* GNU Binutils 2.25 or later is now required to build the GNU C Library. ++ ++* On most architectures, GCC 4.9 or later is required to build the GNU C ++ Library. On powerpc64le, GCC 6.2 or later is required. ++ ++ Older GCC versions and non-GNU compilers are still supported when ++ compiling programs that use the GNU C Library. (We do not know exactly ++ how old, and some GNU extensions to C may be _de facto_ required. If you ++ are interested in helping us make this statement less vague, please ++ contact libc-alpha@sourceware.org.) ++ ++Security related changes: ++ ++* The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes, ++ to avoid fragmentation-based spoofing attacks (CVE-2017-12132). ++ ++* LD_LIBRARY_PATH is now ignored in binaries running in privileged AT_SECURE ++ mode to guard against local privilege escalation attacks (CVE-2017-1000366). ++ ++* Avoid printing a backtrace from the __stack_chk_fail function since it is ++ called on a corrupt stack and a backtrace is unreliable on a corrupt stack ++ (CVE-2010-3192). ++ ++* A use-after-free vulnerability in clntudp_call in the Sun RPC system has been ++ fixed (CVE-2017-12133). ++ ++The following bugs are resolved with this release: ++ ++ [984] network: Respond to changed resolv.conf in gethostbyname ++ [5010] network: sunrpc service cleanup causes unwanted port mapper traffic ++ [12068] localedata: sc_IT: misspelled yesexpr/day/abday/mon/abmon/date_fmt ++ fields ++ [12189] libc: __stack_chk_fail should not attempt a backtrace ++ (CVE-2010-3192) ++ [14096] time: Race condition on timezone/tst-timezone.out ++ [14172] localedata: az_IR: new locale ++ [14995] build: glibc fails to build if gold is the default linker, even if ++ ld.bfd is available ++ [15998] build: [powerpc] Set arch_minimum_kernel for powerpc LE ++ [16637] network: inet_pton function is accepting IPv6 with bad format ++ [16640] string: string/strtok.c: undefined behaviour inconsistent between ++ x86 and other generic code ++ [16875] localedata: ko_KR: fix lang_name ++ [17225] localedata: ar_SY: localized month names for May and June are ++ incorrect ++ [17297] localedata: da_DK: wrong date_fmt string ++ [18907] stdio: Incorrect order of __wur __THROW in ++ [18934] localedata: hu_HU: collate: fix multiple bugs and add tests ++ [18988] nptl: pthread wastes memory with mlockall(MCL_FUTURE) ++ [19066] localedata: ar_SA abbreviated day and month names are in English ++ [19569] network: resolv: Support an arbitrary number of search domains ++ [19570] network: Implement random DNS server selection in the stub ++ resolver ++ [19838] locale: localedef fails on PA-RISC ++ [19919] localedata: iso14651_t1_common: Correct the Malayalam sorting ++ order of 0D36 and 0D37 ++ [19922] localedata: iso14651_t1_common: Define collation for Malayalam ++ chillu characters ++ [20098] libc: FAIL: debug/backtrace-tst on hppa ++ [20257] network: sunrpc: clntudp_call does not enforce timeout when ++ receiving data ++ [20275] localedata: locale day/abday/mon/abmon should not have trailing ++ whitespace ++ [20313] localedata: Update locale data to Unicode 9.0 ++ [20424] manual: Document how to provide a malloc replacement ++ [20496] localedata: agr_PE: new language locale Awajún / Aguaruna (agr) ++ for Peru ++ [20686] locale: Add el_GR@euro to SUPPORTED. ++ [20831] dynamic-link: _dl_map_segments does not test for __mprotect ++ failures consistently ++ [21015] dynamic-link: Document and fix --enable-bind-now ++ [21016] nptl: pthread_cond support is broken on hppa ++ [21029] libc: glibc-2.23 (and later) fails to compile with -fno-omit- ++ frame-pointer on i386 ++ [21049] libc: segfault in longjmp_chk() due to clobbered processor ++ register ++ [21075] libc: unused assigment to %g4 in sparc/sparc{64,32}/clone.S ++ [21088] libc: Build fails with --enable-static-nss ++ [21094] math: cosf(1.57079697) has 3 ulp error on targets where the ++ generic c code is used ++ [21109] libc: Tunables broken on big-endian ++ [21112] math: powf has large ulp errors with base close to 1 and exponent ++ around 4000 ++ [21115] network: sunrpc: Use-after-free in error path in clntudp_call ++ (CVE-2017-12133) ++ [21120] malloc: glibc malloc is incompatible with GCC 7 ++ [21130] math: Incorrect return from y0l (-inf) and y1l (-inf) when linking ++ with -lieee ++ [21134] math: Exception (divide by zero) not set for y0/y1 (0.0) and y0/y1 ++ (-0.0) when linking with -lieee ++ [21171] math: log10, log2 and lgamma return incorrect results ++ [21179] libc: handle R_SPARC_DISP64 and R_SPARC_REGISTER relocs ++ [21182] libc: __memchr_sse2: regression in glibc-2.25 on i686 ++ [21207] localedata: ce_RU: update weekdays from CLDR ++ [21209] dynamic-link: LD_HWCAP_MASK read in setuid binaries ++ [21217] localedata: Update months from CLDR-31 ++ [21232] libc: miss posix_fadvise64 on MIPS64 when static linking ++ [21243] libc: support_delete_temp_file should issue warning for failed ++ remove() ++ [21244] libc: support resolv_test_start() socket fd close should be ++ checked for errors. ++ [21253] libc: localedef randomly segfaults when using -fstack-check due to ++ new posix_spawn implementation ++ [21258] dynamic-link: Branch predication in _dl_runtime_resolve_avx512_opt ++ leads to lower CPU frequency ++ [21259] libc: [alpha] termios.h missing IXANY for POSIX ++ [21261] libc: [sparc64] bits/setjmp.h namespace ++ [21267] network: [mips] bits/socket.h IOC* namespace ++ [21268] libc: [alpha] termios.h NL2, NL3 namespace ++ [21270] libc: mmap64 silently truncates large offset values ++ [21275] libc: posix_spawn always crashes on ia64 now ++ [21277] libc: [alpha] termios.h missing IUCLC for UNIX98 and older ++ [21280] math: [powerpc] logbl for POWER7 return incorrect results ++ [21289] libc: Incorrect declaration for 32-bit platforms with ++ _FILE_OFFSET_BITS=64 causes build error ++ [21295] network: GETAI(AF_UNSPEC) drops IPv6 addresses if nss module does ++ not support gethostbyname4_r ++ [21298] nptl: rwlock can deadlock on frequent reader/writer phase ++ switching ++ [21338] malloc: mallopt M_ARENA_MAX doesn't set the maximum number of ++ arenas ++ [21340] libc: Support POSIX_SPAWN_SETSID ++ [21357] libc: unwind-dw2-fde deadlock when using AddressSanitizer ++ [21359] network: ns_name_pack needs additional byte in destination buffer ++ [21361] network: resolv: Reduce advertised EDNS0 buffer size to guard ++ against fragmentation attacks (CVE-2017-12132) ++ [21369] network: resolv: Remove EDNS fallback ++ [21371] libc: Missing timespec definition when compiled with _XOPEN_SOURCE ++ and _POSIX_C_SOURCE ++ [21386] nptl: Assertion in fork for distinct parent PID is incorrect ++ [21391] dynamic-link: x86: Set dl_platform and dl_hwcap from CPU features ++ [21393] stdio: Missing dup3 error check in freopen, freopen64 ++ [21396] libc: Use AVX2 memcpy/memset on Skylake server ++ [21399] localedata: Bad description for U00EC in ++ localedata/charmaps/CP1254 ++ [21411] malloc: realloc documentation error ++ [21426] network: sys/socket.h uio.h namespace ++ [21428] libc: [aarch64] tst-backtrace5 testsuite failure ++ [21445] libc: signal.h bsd_signal namespace ++ [21455] network: Network headers stdint.h namespace ++ [21474] network: resolv: res_init does not use RES_DFLRETRY (2) but 4 for ++ retry value ++ [21475] network: resolv: Overlong search path is truncated mid-label ++ [21511] libc: sigstack namespace ++ [21512] libc: clone() ends up calling exit_group() through _exit() wrapper ++ [21514] libc: sysdeps/unix/sysv/linux/sys/syscall.h:31:27: fatal error: ++ bits/syscall.h: No such file or directory ++ [21517] libc: struct sigaltstack namespace ++ [21528] dynamic-link: Duplicated minimal strtoul implementations in ld.so ++ [21533] localedata: Update locale data to Unicode 10.0 ++ [21537] libc: ++ ../sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:44: Error: ++ junk at end of line, first unrecognized character is `@' ++ [21538] libc: SIG_HOLD missing for XPG4 ++ [21539] libc: S390: Mismatch between kernel and glibc ptrace.h with ++ request 12: PTRACE_SINGLEBLOCK vs PTRACE_GETREGS. ++ [21542] libc: Use conservative default for sysconf (_SC_NPROCESSORS_ONLN) ++ [21543] libc: sigevent namespace ++ [21548] libc: [mips] get/set/make/swap context for MIPS O32 assume wrong ++ size for general purpose registers in mcontext_t structure ++ [21550] libc: sigwait namespace ++ [21552] libc: XPG4 bsd_signal namespace ++ [21554] libc: sigpause namespace ++ [21560] libc: sys/wait.h signal.h namespace ++ [21561] libc: waitid namespace ++ [21573] nptl: GCC 7: /usr/bin/install: cannot remove ++ '/usr/include/stdlib.h': Permission denied ++ [21575] libc: sys/wait.h missing struct rusage definition ++ [21584] libc: sigaltstack etc namespace ++ [21597] libc: siginterrupt namespace ++ [21607] math: hppa: FAIL: math/test-tgmath ++ [21609] dynamic-link: Incomplete workaround for GCC __tls_get_addr ABI ++ issue on x86-64 ++ [21622] libc: [tile] missing SA_* for POSIX.1:2008 ++ [21624] dynamic-link: ld.so: Unsafe alloca allows local attackers to alias ++ stack and heap (CVE-2017-1000366) ++ [21625] libc: wait3 namespace ++ [21654] nss: Incorrect pointer alignment in NSS group merge result ++ construction ++ [21657] network: Parse interface zone id for node-local multicast ++ [21662] string: memcmp-avx2-movbe.S lacks saturating subtraction for ++ between_2_3 ++ [21666] libc: .symver is used on common symbol ++ [21668] network: resolv: res_init cross-thread broadcast introduces race ++ conditions ++ [21687] math: tgmath.h totalorder, totalordermag return type ++ [21694] locale: Current Glibc Locale Does Not Support Tok-Pisin and Fiji ++ Hindi Locale ++ [21696] libc: Incorrect assumption of of __cpu_mask in ++ posix/sched_cpucount.c ++ [21697] libc: sysdeps/posix/spawni.c: 2 * suspicious condition ? ++ [21706] localedata: yesstr and nostr are missing for Breton [LC_MESSAGES] ++ locale ++ [21707] math: ppc64le: Invalid IFUNC resolver from libgcc calls getauxval, ++ leading to relocation crash ++ [21709] libc: resolv_conf.c:552: update_from_conf: Assertion ++ `resolv_conf_matches (resp, conf)' failed. ++ [21710] localedata: Added Samoan language locale for Samoa ++ [21711] localedata: Pashto yesstr/nostr locale are missing ++ [21715] nptl: sysdeps/nptl/bits/pthreadtypes.h: typedef guard ++ __have_pthread_attr_t can cause redefinition of typedef ‘pthread_attr_t’ ++ [21721] localedata: Incorrect Full Weekday names for ks_IN@devanagari ++ [21723] localedata: yesstr/nostr missing for Chinese language locale ++ [21724] localedata: yesstr and nostr are missing for Xhosa [LC_MESSAGES] ++ locale ++ [21727] localedata: yesstr and nostr are missing for Tsonga [LC_MESSAGES] ++ locale ++ [21728] localedata: New Locale for Tongan language ++ [21729] localedata: incorrect LC_NAME fields for hi_IN ++ [21733] localedata: yesstr and nostr are missing for zh_HK ++ [21734] localedata: Missing yesstr and nostr are for kw_GB ++ [21738] libc: misc/tst-preadvwritev2 and misc/tst-preadvwritev64v2 fail ++ [21741] libc: Undefined __memmove_chk_XXX and __memset_chk_XXX in libc.a ++ [21742] libc: _dl_num_cache_relocations is undefined in libc.a ++ [21743] localedata: ks_IN@devanagari: abday strings mismatch the day ++ strings ++ [21744] libc: Tests failing on --enable-tunables --enable-stack- ++ protector=all ++ [21749] localedata: Wrong abbreviated day name (“abday”) for ++ ar_JO/ar_LB/ar_SY ++ [21756] localedata: missing yesstr, nostr for nds_DE and nds_NL ++ [21757] localedata: missing yesstr, nostr for pap_AW and pap_CW ++ [21759] localedata: missing yesstr and nostr for Tigrinya ++ [21760] localedata: Fix LC_MESSAGES and LC_ADDRESS for anp_IN ++ [21766] localedata: Wrong LC_MESSAGES for om_ET Locale ++ [21767] localedata: Missing Bislama locales ++ [21768] localedata: Missing yesstr and nostr for aa_ET ++ [21770] localedata: Missing Field in li_NL ++ [21778] nptl: Robust mutex may deadlock ++ [21779] libc: MicroBlaze segfaults when loading libpthread ++ [21783] localedata: Fix int_select international_call_prefixes ++ [21784] localedata: Inconsistency in country_isbn ++ [21788] localedata: Missing Country Postal Abbreviations ++ [21794] localedata: Added-country_isbn-for-Italy ++ [21795] localedata: Add/Fix country_isbn for France ++ [21796] localedata: Added country_isbn for Republic of Korea ++ [21797] localedata: Fix inconsistency in country_isbn and missing prefixes ++ [21799] localedata: Added int_select international_call_prefixes ++ [21801] localedata: Added int_select international_call_prefixes ++ [21804] nptl: Double semicolon in thread-shared-types.h ++ [21807] localedata: LC_ADDRESS fix for pap_CW ++ [21808] localedata: Fix LC_ADDRESS for pap_AW ++ [21821] localedata: Added country_name in mai_IN ++ [21822] localedata: Fix LC_TIME for mai_IN ++ [21823] localedata: missing yesstr, nostr for sa_IN ++ [21825] localedata: Fix name_mrs for mag_IN ++ [21828] localedata: 2.26 changelog should mention user visible changes ++ with unicode 9.0 ++ [21835] localedata: Added Maithili language locale for Nepal ++ [21838] localedata: Removed redundant data for the_NP ++ [21839] localedata: Fix LC_MONETARY for ta_LK ++ [21844] localedata: Fix Latin characters and Months Sequence. ++ [21848] localedata: Fix mai_NP Title Name ++ ++ ++Version 2.25 ++ ++* The feature test macro __STDC_WANT_LIB_EXT2__, from ISO/IEC TR ++ 24731-2:2010, is supported to enable declarations of functions from that ++ TR. Note that not all functions from that TR are supported by the GNU C ++ Library. ++ ++* The feature test macro __STDC_WANT_IEC_60559_BFP_EXT__, from ISO/IEC TS ++ 18661-1:2014, is supported to enable declarations of functions and macros ++ from that TS. Note that not all features from that TS are supported by ++ the GNU C Library. ++ ++* The feature test macro __STDC_WANT_IEC_60559_FUNCS_EXT__, from ISO/IEC TS ++ 18661-4:2015, is supported to enable declarations of functions and macros ++ from that TS. Note that most features from that TS are not supported by ++ the GNU C Library. ++ ++* The nonstandard feature selection macros _REENTRANT and _THREAD_SAFE are ++ now treated as compatibility synonyms for _POSIX_C_SOURCE=199506L. ++ Since the GNU C Library defaults to a much newer revision of POSIX, this ++ will only affect programs that specifically request an old conformance ++ mode. For instance, a program compiled with -std=c89 -D_REENTRANT will ++ see a change in the visible declarations, but a program compiled with ++ just -D_REENTRANT, or -std=c99 -D_POSIX_C_SOURCE=200809L -D_REENTRANT, ++ will not. ++ ++ Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be ++ defined by all multithreaded code, but glibc has not required this for ++ many years. ++ ++* The inclusion of by is deprecated. This ++ means that in a future release, the macros “major”, “minor”, and “makedev” ++ will only be available from . ++ ++ These macros are not part of POSIX nor XSI, and their names frequently ++ collide with user code; see for instance glibc bug 19239 and Red Hat bug ++ 130601. includes under _GNU_SOURCE, and C++ code ++ presently cannot avoid being compiled under _GNU_SOURCE, exacerbating the ++ problem. ++ ++* New features from TS 18661-1:2014 are added to libm: the ++ fesetexcept, fetestexceptflag, fegetmode and fesetmode functions, the ++ femode_t type and the FE_DFL_MODE and FE_SNANS_ALWAYS_SIGNAL macros. ++ ++* Integer width macros from TS 18661-1:2014 are added to : ++ CHAR_WIDTH, SCHAR_WIDTH, UCHAR_WIDTH, SHRT_WIDTH, USHRT_WIDTH, INT_WIDTH, ++ UINT_WIDTH, LONG_WIDTH, ULONG_WIDTH, LLONG_WIDTH, ULLONG_WIDTH; and to ++ : INT8_WIDTH, UINT8_WIDTH, INT16_WIDTH, UINT16_WIDTH, ++ INT32_WIDTH, UINT32_WIDTH, INT64_WIDTH, UINT64_WIDTH, INT_LEAST8_WIDTH, ++ UINT_LEAST8_WIDTH, INT_LEAST16_WIDTH, UINT_LEAST16_WIDTH, ++ INT_LEAST32_WIDTH, UINT_LEAST32_WIDTH, INT_LEAST64_WIDTH, ++ UINT_LEAST64_WIDTH, INT_FAST8_WIDTH, UINT_FAST8_WIDTH, INT_FAST16_WIDTH, ++ UINT_FAST16_WIDTH, INT_FAST32_WIDTH, UINT_FAST32_WIDTH, INT_FAST64_WIDTH, ++ UINT_FAST64_WIDTH, INTPTR_WIDTH, UINTPTR_WIDTH, INTMAX_WIDTH, ++ UINTMAX_WIDTH, PTRDIFF_WIDTH, SIG_ATOMIC_WIDTH, SIZE_WIDTH, WCHAR_WIDTH, ++ WINT_WIDTH. ++ ++* New features are added from TS 18661-1:2014: ++ ++ - Signaling NaN macros: SNANF, SNAN, SNANL. ++ ++ - Nearest integer functions: roundeven, roundevenf, roundevenl, fromfp, ++ fromfpf, fromfpl, ufromfp, ufromfpf, ufromfpl, fromfpx, fromfpxf, ++ fromfpxl, ufromfpx, ufromfpxf, ufromfpxl. ++ ++ - llogb functions: the llogb, llogbf and llogbl functions, and the ++ FP_LLOGB0 and FP_LLOGBNAN macros. ++ ++ - Max-min magnitude functions: fmaxmag, fmaxmagf, fmaxmagl, fminmag, ++ fminmagf, fminmagl. ++ ++ - Comparison macros: iseqsig. ++ ++ - Classification macros: iscanonical, issubnormal, iszero. ++ ++ - Total order functions: totalorder, totalorderf, totalorderl, ++ totalordermag, totalordermagf, totalordermagl. ++ ++ - Canonicalize functions: canonicalize, canonicalizef, canonicalizel. ++ ++ - NaN functions: getpayload, getpayloadf, getpayloadl, setpayload, ++ setpayloadf, setpayloadl, setpayloadsig, setpayloadsigf, setpayloadsigl. ++ ++* The functions strfromd, strfromf, and strfroml, from ISO/IEC TS 18661-1:2014, ++ are added to libc. They convert a floating-point number into string. ++ ++* Most of glibc can now be built with the stack smashing protector enabled. ++ It is recommended to build glibc with --enable-stack-protector=strong. ++ Implemented by Nick Alcock (Oracle). ++ ++* The function explicit_bzero, from OpenBSD, has been added to libc. It is ++ intended to be used instead of memset() to erase sensitive data after use; ++ the compiler will not optimize out calls to explicit_bzero even if they ++ are "unnecessary" (in the sense that no _correct_ program can observe the ++ effects of the memory clear). ++ ++* On ColdFire, MicroBlaze, Nios II and SH3, the float_t type is now defined ++ to float instead of double. This does not affect the ABI of any libraries ++ that are part of the GNU C Library, but may affect the ABI of other ++ libraries that use this type in their interfaces. ++ ++* On x86_64, when compiling with -mfpmath=387 or -mfpmath=sse+387, the ++ float_t and double_t types are now defined to long double instead of float ++ and double. These options are not the default, and this does not affect ++ the ABI of any libraries that are part of the GNU C Library, but it may ++ affect the ABI of other libraries that use this type in their interfaces, ++ if they are compiled or used with those options. ++ ++* The getentropy and getrandom functions, and the header file ++ have been added. ++ ++* The buffer size for byte-oriented stdio streams is now limited to 8192 ++ bytes by default. Previously, on Linux, the default buffer size on most ++ file systems was 4096 bytes (and thus remains unchanged), except on ++ network file systems, where the buffer size was unpredictable and could be ++ as large as several megabytes. ++ ++* The header now includes the header. Support ++ for the Linux quota interface which predates kernel version 2.4.22 has ++ been removed. ++ ++* The malloc_get_state and malloc_set_state functions have been removed. ++ Already-existing binaries that dynamically link to these functions will ++ get a hidden implementation in which malloc_get_state is a stub. As far ++ as we know, these functions are used only by GNU Emacs and this change ++ will not adversely affect already-built Emacs executables. Any undumped ++ Emacs executables, which normally exist only during an Emacs build, should ++ be rebuilt by re-running “./configure; make” in the Emacs build tree. ++ ++* The “ip6-dotint” and “no-ip6-dotint” resolver options, and the ++ corresponding RES_NOIP6DOTINT flag from have been removed. ++ “no-ip6-dotint” had already been the default, and support for the ++ “ip6-dotint” option was removed from the Internet in 2006. ++ ++* The "ip6-bytestring" resolver option and the corresponding RES_USEBSTRING ++ flag from have been removed. The option relied on a ++ backwards-incompatible DNS extension which was never deployed on the ++ Internet. ++ ++* The flags RES_AAONLY, RES_PRIMARY, RES_NOCHECKNAME, RES_KEEPTSIG, ++ RES_BLAST defined in the header file have been deprecated. ++ They were already unimplemented. ++ ++* The "inet6" option in /etc/resolv.conf and the RES_USE_INET6 flag for ++ _res.flags are deprecated. The flag was standardized in RFC 2133, but ++ removed again from the IETF name lookup interface specification in RFC ++ 2553. Applications should use getaddrinfo instead. ++ ++* DNSSEC-related declarations and definitions have been removed from the ++ header file, and libresolv will no longer attempt to ++ decode the data part of DNSSEC record types. Previous versions of glibc ++ only implemented minimal support for the previous version of DNSSEC, which ++ is incompatible with the currently deployed version. ++ ++* The resource record type classification macros ns_t_qt_p, ns_t_mrr_p, ++ ns_t_rr_p, ns_t_udp_p, ns_t_xfr_p have been removed from the ++ header file because the distinction between RR types and ++ meta-RR types is not officially standardized, subject to revision, and ++ thus not suitable for encoding in a macro. ++ ++* The types res_sendhookact, res_send_qhook, re_send_rhook, and the qhook ++ and rhook members of the res_state type in have been removed. ++ The glibc stub resolver did not support these hooks, but the header file ++ did not reflect that. ++ ++* For multi-arch support it is recommended to use a GCC which has ++ been built with support for GNU indirect functions. This ensures ++ that correct debugging information is generated for functions ++ selected by IFUNC resolvers. This support can either be enabled by ++ configuring GCC with '--enable-gnu-indirect-function', or by ++ enabling it by default by setting 'default_gnu_indirect_function' ++ variable for a particular architecture in the GCC source file ++ 'gcc/config.gcc'. ++ ++* GDB pretty printers have been added for mutex and condition variable ++ structures in POSIX Threads. When installed and loaded in gdb these pretty ++ printers show various pthread variables in human-readable form when read ++ using the 'print' or 'display' commands in gdb. ++ ++* Tunables feature added to allow tweaking of the runtime for an application ++ program. This feature can be enabled with the '--enable-tunables' configure ++ flag. The GNU C Library manual has details on usage and README.tunables has ++ instructions on adding new tunables to the library. ++ ++* A new version of condition variables functions have been implemented in ++ the NPTL implementation of POSIX Threads to provide stronger ordering ++ guarantees. ++ ++* A new version of pthread_rwlock functions have been implemented to use a more ++ scalable algorithm primarily through not using a critical section anymore to ++ make state changes. ++>>>>>>> c369d66e54... CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] + + Security related changes: + +diff --git a/posix/glob.c b/posix/glob.c +index ea4b0b61eb..08f240a1ff 100644 +--- a/posix/glob.c ++++ b/posix/glob.c +@@ -856,7 +856,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + *p = '\0'; + } + else +- *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) ++ *((char *) mempcpy (newp, dirname + 1, end_name - dirname - 1)) + = '\0'; + user_name = newp; + } +-- +2.14.2 + diff --git a/glibc-32/Pkgfile b/glibc-32/Pkgfile index 7e3032ca..f9948ec4 100644 --- a/glibc-32/Pkgfile +++ b/glibc-32/Pkgfile @@ -4,10 +4,11 @@ name=glibc-32 version=2.24 -release=7 +release=8 source=(http://ftpmirror.gnu.org/gnu/glibc/glibc-2.24.tar.xz \ http://crux.nu/files/distfiles/kernel-headers-4.9.5.tar.xz \ - glibc-2.24-updates.patch lib32.conf) + glibc-2.24.8.patch 0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch \ + lib32.conf) build() { mkdir build @@ -17,8 +18,9 @@ build() { export CC="${CC:-gcc} -m32" export CFLAGS="$CFLAGS -Wno-error=parentheses" - patch -p1 -d $SRC/glibc-${version:0:4} -i $SRC/glibc-2.24-updates.patch - + patch -p1 -d $SRC/glibc-${version:0:4} -i $SRC/glibc-2.24.8.patch + patch -p1 -d $SRC/glibc-${version:0:4} -i $SRC/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch + ../glibc-${version:0:4}/configure --prefix=/usr \ --libdir=/usr/lib32 \ --libexecdir=/usr/lib32 \ diff --git a/glibc-32/glibc-2.24-updates.patch b/glibc-32/glibc-2.24.8.patch similarity index 90% rename from glibc-32/glibc-2.24-updates.patch rename to glibc-32/glibc-2.24.8.patch index e6e9084c..4f1db10c 100644 --- a/glibc-32/glibc-2.24-updates.patch +++ b/glibc-32/glibc-2.24.8.patch @@ -1,8 +1,128 @@ diff --git a/ChangeLog b/ChangeLog -index c44c926094..24693b184a 100644 +index c44c926094..84189ec762 100644 --- a/ChangeLog +++ b/ChangeLog -@@ -1,3 +1,551 @@ +@@ -1,3 +1,685 @@ ++2017-10-19 H.J. Lu ++ ++ * sysdeps/x86_64/Makefile (tests): Add tst-sse, tst-avx and ++ tst-avx512. ++ (test-extras): Add tst-avx-aux and tst-avx512-aux. ++ (extra-test-objs): Add tst-avx-aux.o and tst-avx512-aux.o. ++ (modules-names): Add tst-ssemod, tst-avxmod and tst-avx512mod. ++ ($(objpfx)tst-sse): New rule. ++ ($(objpfx)tst-avx): Likewise. ++ ($(objpfx)tst-avx512): Likewise. ++ (CFLAGS-tst-avx-aux.c): New. ++ (CFLAGS-tst-avxmod.c): Likewise. ++ (CFLAGS-tst-avx512-aux.c): Likewise. ++ (CFLAGS-tst-avx512mod.c): Likewise. ++ * sysdeps/x86_64/tst-avx-aux.c: New file. ++ * sysdeps/x86_64/tst-avx.c: Likewise. ++ * sysdeps/x86_64/tst-avx512-aux.c: Likewise. ++ * sysdeps/x86_64/tst-avx512.c: Likewise. ++ * sysdeps/x86_64/tst-avx512mod.c: Likewise. ++ * sysdeps/x86_64/tst-avxmod.c: Likewise. ++ * sysdeps/x86_64/tst-sse.c: Likewise. ++ * sysdeps/x86_64/tst-ssemod.c: Likewise. ++ ++2017-10-19 H.J. Lu ++ ++ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Don't ++ adjust CFA when allocating register save area on re-aligned ++ stack. ++ ++2016-12-21 Joseph Myers ++ ++ [BZ #20978] ++ * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r): ++ Compare name == NULL, not name != NULL. ++ ++2016-11-08 Joseph Myers ++ ++ [BZ #20790] ++ * sunrpc/rpc_parse.c (get_prog_declaration): Increase buffer size ++ to MAXLINESIZE. ++ * sunrpc/bug20790.x: New file. ++ * sunrpc/Makefile [$(run-built-tests) = yes] (rpcgen-tests): New ++ variable. ++ [$(run-built-tests) = yes] (tests-special): Add $(rpcgen-tests). ++ [$(run-built-tests) = yes] ($(rpcgen-tests)): New rule. ++ ++2016-10-14 Steve Ellcey ++ ++ * sysdeps/ieee754/dbl-64/e_pow.c (checkint) Make conditions explicitly ++ boolean. ++ ++2017-07-19 DJ Delorie ++ ++ [BZ #21654] ++ * grp/grp-merge.c (libc_hidden_def): Fix cast-after-dereference. ++ ++2017-07-14 DJ Delorie ++ ++ [BZ #21654] ++ * grp/grp_merge.c (__copy_grp): Align char** to minimum pointer ++ alignment not char alignment. ++ (__merge_grp): Likewise. ++ ++2017-08-06 H.J. Lu ++ ++ [BZ #21871] ++ * sysdeps/x86/cpu-features.c (init_cpu_features): Set ++ bit_arch_Use_dl_runtime_resolve_opt only with AVX512F. ++ ++2017-02-27 Florian Weimer ++ ++ [BZ #21115] ++ * sunrpc/clnt_udp.c (clntudp_call): Free ancillary data later. ++ * sunrpc/Makefile (tests): Add tst-udp-error. ++ (tst-udp-error): Link against libc.so explicitly. ++ * sunrpc/tst-udp-error: New file. ++ ++2017-01-24 James Clarke ++ ++ * sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym: Use new REG_R* ++ constants instead of the old R* ones. ++ * sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym: Likewise. ++ * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (NGPREG): Rename... ++ (NGREG): ... to this, to fit in with other architectures. ++ (gpregset_t): Use new NGREG macro. ++ [__USE_GNU]: Remove condition; all architectures other than tile ++ are unconditional. ++ (R*): Rename to REG_R*. ++ ++2017-07-26 H.J. Lu ++ ++ [BZ #21666] ++ * misc/regexp.c (loc1): Add __attribute__ ((nocommon)); ++ (loc2): Likewise. ++ (locs): Likewise. ++ ++2017-07-12 Szabolcs Nagy ++ ++ * sysdeps/aarch64/dl-machine.h (RTLD_START_1): Change _dl_argv to the ++ hidden __GI__dl_argv symbol. ++ ++2016-09-05 Aurelien Jarno ++ ++ * conform/Makefile (conformtest-header-tests): Pass -I. to $(PERL). ++ (linknamespace-symlists-tests): Likewise. ++ (linknamespace-header-tests): Likewise. ++ ++2017-07-06 Florian Weimer ++ H.J. Lu ++ ++ [BZ #21609] ++ * sysdeps/x86_64/Makefile (sysdep-dl-routines): Add tls_get_addr. ++ (gen-as-const-headers): Add rtld-offsets.sym. ++ * sysdeps/x86_64/dl-tls.c: New file. ++ * sysdeps/x86_64/rtld-offsets.sym: Likwise. ++ * sysdeps/x86_64/tls_get_addr.S: Likewise. ++ * sysdeps/x86_64/dl-tls.h: Add multiple inclusion guards. ++ * sysdeps/x86_64/tlsdesc.sym (TI_MODULE_OFFSET): New. ++ (TI_OFFSET_OFFSET): Likwise. ++ +2017-06-14 Florian Weimer + + * sysdeps/i386/i686/multiarch/strcspn-c.c: Add IS_IN (libc) guard. @@ -262,6 +382,20 @@ index c44c926094..24693b184a 100644 + * sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead + of PIC. + ++2016-12-31 Florian Weimer ++ ++ [BZ #18784] ++ CVE-2015-5180 ++ * include/arpa/nameser_compat.h (T_QUERY_A_AND_AAAA): Rename from ++ T_UNSPEC. Adjust value. ++ * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname4_r): Use it. ++ * resolv/res_query.c (__libc_res_nquery): Likewise. ++ * resolv/res_mkquery.c (res_nmkquery): Check for out-of-range ++ QTYPEs. ++ * resolv/tst-resolv-qtypes.c: New file. ++ * resolv/Makefile (xtests): Add tst-resolv-qtypes. ++ (tst-resolv-qtypes): Link against libresolv and libpthread. ++ +2017-02-02 Siddhesh Poyarekar + + * sysdeps/generic/unsecvars.h: Add GLIBC_TUNABLES. @@ -609,10 +743,10 @@ index 03fd89c13e..ee379f5852 100644 ifndef avoid-generated diff --git a/NEWS b/NEWS -index b0447e7169..4a042dbe2b 100644 +index b0447e7169..4831542023 100644 --- a/NEWS +++ b/NEWS -@@ -5,6 +5,17 @@ See the end for copying conditions. +@@ -5,6 +5,33 @@ See the end for copying conditions. Please send GNU C library bug reports via using `glibc' in the "product" field. @@ -626,6 +760,22 @@ index b0447e7169..4a042dbe2b 100644 + (denial of service) in some Go applications compiled with gccgo. Reported + by Andreas Schwab. (CVE-2016-6323) + ++* The DNS stub resolver functions would crash due to a NULL pointer ++ dereference when processing a query with a valid DNS question type which ++ was used internally in the implementation. The stub resolver now uses a ++ question type which is outside the range of valid question type values. ++ (CVE-2015-5180) ++ ++The following bugs are resolved with this release: ++ ++ [20790] Fix rpcgen buffer overrun ++ [20978] Fix strlen on null pointer in nss_nisplus ++ [21209] Ignore and remove LD_HWCAP_MASK for AT_SECURE programs ++ [21289] Fix symbol redirect for fts_set ++ [21386] Assertion in fork for distinct parent PID is incorrect ++ [21609] x86-64: Align the stack in __tls_get_addr ++ [21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366) ++ [21654] nss: Fix invalid cast in group merging + Version 2.24 @@ -811,10 +961,26 @@ index 33bcd62180..8277d9f727 100644 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;; esac], diff --git a/conform/Makefile b/conform/Makefile -index 32a0937b06..762aac98fc 100644 +index 32a0937b06..7883624c81 100644 --- a/conform/Makefile +++ b/conform/Makefile -@@ -229,6 +229,7 @@ $(linknamespace-symlist-stdlibs-tests): $(objpfx)symlist-stdlibs-%: \ +@@ -196,13 +196,13 @@ $(conformtest-header-tests): $(objpfx)%/conform.out: \ + conformtest.pl $(conformtest-headers-data) + (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ + mkdir -p $(@D)/scratch; \ +- $(PERL) conformtest.pl --tmpdir=$(@D)/scratch --cc='$(CC)' \ ++ $(PERL) -I. conformtest.pl --tmpdir=$(@D)/scratch --cc='$(CC)' \ + --flags='$(conformtest-cc-flags)' --standard=$$std \ + --headers=$$hdr > $@); \ + $(evaluate-test) + + $(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.pl +- $(PERL) -w $< --tmpdir=$(objpfx) --cc='$(CC)' \ ++ $(PERL) -I. -w $< --tmpdir=$(objpfx) --cc='$(CC)' \ + --flags='$(conformtest-cc-flags)' --standard=$* \ + --headers="$(strip $(conformtest-headers-$*))" \ + > $@ 2> $@.err; \ +@@ -229,10 +229,11 @@ $(linknamespace-symlist-stdlibs-tests): $(objpfx)symlist-stdlibs-%: \ $(linknamespace-header-tests): $(objpfx)%/linknamespace.out: \ linknamespace.pl \ @@ -822,6 +988,11 @@ index 32a0937b06..762aac98fc 100644 $(linknamespace-symlist-stdlibs-tests) (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ mkdir -p $(@D)/scratch; \ +- $(PERL) -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \ ++ $(PERL) -I. -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \ + --flags='$(conformtest-cc-flags)' --standard=$$std \ + --stdsyms=$(objpfx)symlist-$$std --header=$$hdr \ + --libsyms=$(objpfx)symlist-stdlibs-$$std \ diff --git a/elf/Makefile b/elf/Makefile index 593403c640..847a012f84 100644 --- a/elf/Makefile @@ -1421,6 +1592,49 @@ index b10748d185..2552049135 100644 extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ $(patsubst %,%$o,$(filter-out \ $($(lib)-shared-only-routines),\ +diff --git a/grp/grp-merge.c b/grp/grp-merge.c +index 0a1eb38d2c..5f79755798 100644 +--- a/grp/grp-merge.c ++++ b/grp/grp-merge.c +@@ -85,6 +85,14 @@ __copy_grp (const struct group srcgrp, const size_t buflen, + } + members[i] = NULL; + ++ /* Align for pointers. We can't simply align C because we need to ++ align destbuf[c]. */ ++ if ((((uintptr_t)destbuf + c) & (__alignof__(char **) - 1)) != 0) ++ { ++ uintptr_t mis_align = ((uintptr_t)destbuf + c) & (__alignof__(char **) - 1); ++ c += __alignof__(char **) - mis_align; ++ } ++ + /* Copy the pointers from the members array into the buffer and assign them + to the gr_mem member of destgrp. */ + destgrp->gr_mem = (char **) &destbuf[c]; +@@ -129,7 +137,7 @@ __merge_grp (struct group *savedgrp, char *savedbuf, char *savedend, + + /* Get the count of group members from the last sizeof (size_t) bytes in the + mergegrp buffer. */ +- savedmemcount = (size_t) *(savedend - sizeof (size_t)); ++ savedmemcount = *(size_t *) (savedend - sizeof (size_t)); + + /* Get the count of new members to add. */ + for (memcount = 0; mergegrp->gr_mem[memcount]; memcount++) +@@ -168,6 +176,14 @@ __merge_grp (struct group *savedgrp, char *savedbuf, char *savedend, + /* Add the NULL-terminator. */ + members[savedmemcount + memcount] = NULL; + ++ /* Align for pointers. We can't simply align C because we need to ++ align savedbuf[c]. */ ++ if ((((uintptr_t)savedbuf + c) & (__alignof__(char **) - 1)) != 0) ++ { ++ uintptr_t mis_align = ((uintptr_t)savedbuf + c) & (__alignof__(char **) - 1); ++ c += __alignof__(char **) - mis_align; ++ } ++ + /* Copy the member array back into the buffer after the member list and free + the member array. */ + savedgrp->gr_mem = (char **) &savedbuf[c]; diff --git a/iconv/gconv.h b/iconv/gconv.h index 8d8ce5813b..a87028047b 100644 --- a/iconv/gconv.h @@ -1434,6 +1648,22 @@ index 8d8ce5813b..a87028047b 100644 } *__gconv_t; /* Transliteration using the locale's data. */ +diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h +index 2e735ede4c..7c0deed9ae 100644 +--- a/include/arpa/nameser_compat.h ++++ b/include/arpa/nameser_compat.h +@@ -1,8 +1,8 @@ + #ifndef _ARPA_NAMESER_COMPAT_ + #include + +-/* Picksome unused number to represent lookups of IPv4 and IPv6 (i.e., +- T_A and T_AAAA). */ +-#define T_UNSPEC 62321 ++/* The number is outside the 16-bit RR type range and is used ++ internally by the implementation. */ ++#define T_QUERY_A_AND_AAAA 439963904 + + #endif diff --git a/io/fts.h b/io/fts.h index 127a0d2721..b6b45206c8 100644 --- a/io/fts.h @@ -1664,6 +1894,43 @@ index 229783f3b7..4e16593d8b 100644 (void) mutex_unlock (&free_list_lock); } +diff --git a/misc/regexp.c b/misc/regexp.c +index 3b3668272f..b2a2c6e636 100644 +--- a/misc/regexp.c ++++ b/misc/regexp.c +@@ -29,14 +29,15 @@ + + #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) + +-/* Define the variables used for the interface. */ +-char *loc1; +-char *loc2; ++/* Define the variables used for the interface. Avoid .symver on common ++ symbol, which just creates a new common symbol, not an alias. */ ++char *loc1 __attribute__ ((nocommon)); ++char *loc2 __attribute__ ((nocommon)); + compat_symbol (libc, loc1, loc1, GLIBC_2_0); + compat_symbol (libc, loc2, loc2, GLIBC_2_0); + + /* Although we do not support the use we define this variable as well. */ +-char *locs; ++char *locs __attribute__ ((nocommon)); + compat_symbol (libc, locs, locs, GLIBC_2_0); + + +diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c +index 7f698b4e6d..cb5acce01d 100644 +--- a/nis/nss_nisplus/nisplus-alias.c ++++ b/nis/nss_nisplus/nisplus-alias.c +@@ -291,7 +291,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, + return status; + } + +- if (name != NULL) ++ if (name == NULL) + { + *errnop = EINVAL; + return NSS_STATUS_UNAVAIL; diff --git a/nptl/Makefile b/nptl/Makefile index 0d8aadebed..fa925819ca 100644 --- a/nptl/Makefile @@ -2994,6 +3261,276 @@ index d933f9c92a..7cdb06a611 100644 __execve (buffer, argv, envp); +diff --git a/resolv/Makefile b/resolv/Makefile +index 8be41d3ae1..a4c86b9762 100644 +--- a/resolv/Makefile ++++ b/resolv/Makefile +@@ -40,6 +40,9 @@ ifeq ($(have-thread-library),yes) + extra-libs += libanl + routines += gai_sigqueue + tests += tst-res_hconf_reorder ++ ++# This test sends millions of packets and is rather slow. ++xtests += tst-resolv-qtypes + endif + extra-libs-others = $(extra-libs) + libresolv-routines := gethnamaddr res_comp res_debug \ +@@ -117,3 +120,5 @@ tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace + $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace > $@; \ + $(evaluate-test) ++ ++$(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library) +diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c +index 5f9e35701b..d16fa4b8ed 100644 +--- a/resolv/nss_dns/dns-host.c ++++ b/resolv/nss_dns/dns-host.c +@@ -323,7 +323,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, + + int olderr = errno; + enum nss_status status; +- int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC, ++ int n = __libc_res_nsearch (&_res, name, C_IN, T_QUERY_A_AND_AAAA, + host_buffer.buf->buf, 2048, &host_buffer.ptr, + &ans2p, &nans2p, &resplen2, &ans2p_malloced); + if (n >= 0) +diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c +index 12f9730199..d80b5318e5 100644 +--- a/resolv/res_mkquery.c ++++ b/resolv/res_mkquery.c +@@ -103,6 +103,10 @@ res_nmkquery(res_state statp, + int n; + u_char *dnptrs[20], **dpp, **lastdnptr; + ++ if (class < 0 || class > 65535 ++ || type < 0 || type > 65535) ++ return -1; ++ + #ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";; res_nmkquery(%s, %s, %s, %s)\n", +diff --git a/resolv/res_query.c b/resolv/res_query.c +index 944d1a90f5..07dc6f6583 100644 +--- a/resolv/res_query.c ++++ b/resolv/res_query.c +@@ -122,7 +122,7 @@ __libc_res_nquery(res_state statp, + int n, use_malloc = 0; + u_int oflags = statp->_flags; + +- size_t bufsize = (type == T_UNSPEC ? 2 : 1) * QUERYSIZE; ++ size_t bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * QUERYSIZE; + u_char *buf = alloca (bufsize); + u_char *query1 = buf; + int nquery1 = -1; +@@ -137,7 +137,7 @@ __libc_res_nquery(res_state statp, + printf(";; res_query(%s, %d, %d)\n", name, class, type); + #endif + +- if (type == T_UNSPEC) ++ if (type == T_QUERY_A_AND_AAAA) + { + n = res_nmkquery(statp, QUERY, name, class, T_A, NULL, 0, NULL, + query1, bufsize); +@@ -190,7 +190,7 @@ __libc_res_nquery(res_state statp, + if (__builtin_expect (n <= 0, 0) && !use_malloc) { + /* Retry just in case res_nmkquery failed because of too + short buffer. Shouldn't happen. */ +- bufsize = (type == T_UNSPEC ? 2 : 1) * MAXPACKET; ++ bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * MAXPACKET; + buf = malloc (bufsize); + if (buf != NULL) { + query1 = buf; +diff --git a/resolv/tst-resolv-qtypes.c b/resolv/tst-resolv-qtypes.c +new file mode 100644 +index 0000000000..b3e60c693b +--- /dev/null ++++ b/resolv/tst-resolv-qtypes.c +@@ -0,0 +1,185 @@ ++/* Exercise low-level query functions with different QTYPEs. ++ Copyright (C) 2016 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* If ture, the response function will send the actual response packet ++ over TCP instead of UDP. */ ++static volatile bool force_tcp; ++ ++/* Send back a fake resource record matching the QTYPE. */ ++static void ++response (const struct resolv_response_context *ctx, ++ struct resolv_response_builder *b, ++ const char *qname, uint16_t qclass, uint16_t qtype) ++{ ++ if (force_tcp && ctx->tcp) ++ { ++ resolv_response_init (b, (struct resolv_response_flags) { .tc = 1 }); ++ resolv_response_add_question (b, qname, qclass, qtype); ++ return; ++ } ++ ++ resolv_response_init (b, (struct resolv_response_flags) { }); ++ resolv_response_add_question (b, qname, qclass, qtype); ++ resolv_response_section (b, ns_s_an); ++ resolv_response_open_record (b, qname, qclass, qtype, 0); ++ resolv_response_add_data (b, &qtype, sizeof (qtype)); ++ resolv_response_close_record (b); ++} ++ ++static const const char *domain = "www.example.com"; ++ ++static int ++wrap_res_query (int type, unsigned char *answer, int answer_length) ++{ ++ return res_query (domain, C_IN, type, answer, answer_length); ++} ++ ++static int ++wrap_res_search (int type, unsigned char *answer, int answer_length) ++{ ++ return res_query (domain, C_IN, type, answer, answer_length); ++} ++ ++static int ++wrap_res_querydomain (int type, unsigned char *answer, int answer_length) ++{ ++ return res_querydomain ("www", "example.com", C_IN, type, ++ answer, answer_length); ++} ++ ++static int ++wrap_res_send (int type, unsigned char *answer, int answer_length) ++{ ++ unsigned char buf[512]; ++ int ret = res_mkquery (QUERY, domain, C_IN, type, ++ (const unsigned char *) "", 0, NULL, ++ buf, sizeof (buf)); ++ if (type < 0 || type >= 65536) ++ { ++ /* res_mkquery fails for out-of-range record types. */ ++ TEST_VERIFY_EXIT (ret == -1); ++ return -1; ++ } ++ TEST_VERIFY_EXIT (ret > 12); /* DNS header length. */ ++ return res_send (buf, ret, answer, answer_length); ++} ++ ++static int ++wrap_res_nquery (int type, unsigned char *answer, int answer_length) ++{ ++ return res_nquery (&_res, domain, C_IN, type, answer, answer_length); ++} ++ ++static int ++wrap_res_nsearch (int type, unsigned char *answer, int answer_length) ++{ ++ return res_nquery (&_res, domain, C_IN, type, answer, answer_length); ++} ++ ++static int ++wrap_res_nquerydomain (int type, unsigned char *answer, int answer_length) ++{ ++ return res_nquerydomain (&_res, "www", "example.com", C_IN, type, ++ answer, answer_length); ++} ++ ++static int ++wrap_res_nsend (int type, unsigned char *answer, int answer_length) ++{ ++ unsigned char buf[512]; ++ int ret = res_nmkquery (&_res, QUERY, domain, C_IN, type, ++ (const unsigned char *) "", 0, NULL, ++ buf, sizeof (buf)); ++ if (type < 0 || type >= 65536) ++ { ++ /* res_mkquery fails for out-of-range record types. */ ++ TEST_VERIFY_EXIT (ret == -1); ++ return -1; ++ } ++ TEST_VERIFY_EXIT (ret > 12); /* DNS header length. */ ++ return res_nsend (&_res, buf, ret, answer, answer_length); ++} ++ ++static void ++test_function (const char *fname, ++ int (*func) (int type, ++ unsigned char *answer, int answer_length)) ++{ ++ unsigned char buf[512]; ++ for (int tcp = 0; tcp < 2; ++tcp) ++ { ++ force_tcp = tcp; ++ for (unsigned int type = 1; type <= 65535; ++type) ++ { ++ if (test_verbose) ++ printf ("info: sending QTYPE %d with %s (tcp=%d)\n", ++ type, fname, tcp); ++ int ret = func (type, buf, sizeof (buf)); ++ if (ret != 47) ++ FAIL_EXIT1 ("%s tcp=%d qtype=%d return value %d", ++ fname,tcp, type, ret); ++ /* One question, one answer record. */ ++ TEST_VERIFY (memcmp (buf + 4, "\0\1\0\1\0\0\0\0", 8) == 0); ++ /* Question section. */ ++ static const char qname[] = "\3www\7example\3com"; ++ size_t qname_length = sizeof (qname); ++ TEST_VERIFY (memcmp (buf + 12, qname, qname_length) == 0); ++ /* RDATA part of answer. */ ++ uint16_t type16 = type; ++ TEST_VERIFY (memcmp (buf + ret - 2, &type16, sizeof (type16)) == 0); ++ } ++ } ++ ++ TEST_VERIFY (func (-1, buf, sizeof (buf) == -1)); ++ TEST_VERIFY (func (65536, buf, sizeof (buf) == -1)); ++} ++ ++static int ++do_test (void) ++{ ++ struct resolv_redirect_config config = ++ { ++ .response_callback = response, ++ }; ++ struct resolv_test *obj = resolv_test_start (config); ++ ++ test_function ("res_query", &wrap_res_query); ++ test_function ("res_search", &wrap_res_search); ++ test_function ("res_querydomain", &wrap_res_querydomain); ++ test_function ("res_send", &wrap_res_send); ++ ++ test_function ("res_nquery", &wrap_res_nquery); ++ test_function ("res_nsearch", &wrap_res_nsearch); ++ test_function ("res_nquerydomain", &wrap_res_nquerydomain); ++ test_function ("res_nsend", &wrap_res_nsend); ++ ++ resolv_test_end (obj); ++ return 0; ++} ++ ++#define TIMEOUT 300 ++#include diff --git a/scripts/backport-support.sh b/scripts/backport-support.sh new file mode 100644 index 0000000000..2ece7ce575 @@ -3110,6 +3647,151 @@ index 0000000000..2ece7ce575 +} + +command_$command +diff --git a/sunrpc/Makefile b/sunrpc/Makefile +index 789ef423e5..1e91905011 100644 +--- a/sunrpc/Makefile ++++ b/sunrpc/Makefile +@@ -96,13 +96,18 @@ rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \ + extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs)) + others += rpcgen + +-tests = tst-xdrmem tst-xdrmem2 test-rpcent ++tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error + xtests := tst-getmyaddr + + ifeq ($(have-thread-library),yes) + xtests += thrsvc + endif + ++ifeq ($(run-built-tests),yes) ++rpcgen-tests := $(objpfx)bug20790.out ++tests-special += $(rpcgen-tests) ++endif ++ + headers += $(rpcsvc:%.x=rpcsvc/%.h) + extra-libs := librpcsvc + extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass. +@@ -153,6 +158,7 @@ BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS) + $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so + $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so + $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so ++$(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so + + $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) + +@@ -225,3 +231,9 @@ endif + endif + + $(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library) ++ ++ifeq ($(run-built-tests),yes) ++$(rpcgen-tests): $(objpfx)%.out: %.x $(objpfx)rpcgen ++ $(built-program-cmd) -c $< -o $@; \ ++ $(evaluate-test) ++endif +diff --git a/sunrpc/bug20790.x b/sunrpc/bug20790.x +new file mode 100644 +index 0000000000..a00c9b3830 +--- /dev/null ++++ b/sunrpc/bug20790.x +@@ -0,0 +1 @@ ++program TPROG { version TVERS { int FUNC(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) = 1; } = 1; } = 1; +diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c +index 4d9acb1e6a..1de25cb771 100644 +--- a/sunrpc/clnt_udp.c ++++ b/sunrpc/clnt_udp.c +@@ -421,9 +421,9 @@ send_again: + cmsg = CMSG_NXTHDR (&msg, cmsg)) + if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) + { +- free (cbuf); + e = (struct sock_extended_err *) CMSG_DATA(cmsg); + cu->cu_error.re_errno = e->ee_errno; ++ free (cbuf); + return (cu->cu_error.re_status = RPC_CANTRECV); + } + free (cbuf); +diff --git a/sunrpc/rpc_parse.c b/sunrpc/rpc_parse.c +index 1a1df6d8c2..505a6554cf 100644 +--- a/sunrpc/rpc_parse.c ++++ b/sunrpc/rpc_parse.c +@@ -521,7 +521,7 @@ static void + get_prog_declaration (declaration * dec, defkind dkind, int num /* arg number */ ) + { + token tok; +- char name[10]; /* argument name */ ++ char name[MAXLINESIZE]; /* argument name */ + + if (dkind == DEF_PROGRAM) + { +diff --git a/sunrpc/tst-udp-error.c b/sunrpc/tst-udp-error.c +new file mode 100644 +index 0000000000..1efc02f5c6 +--- /dev/null ++++ b/sunrpc/tst-udp-error.c +@@ -0,0 +1,62 @@ ++/* Check for use-after-free in clntudp_call (bug 21115). ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ support_become_root (); ++ support_enter_network_namespace (); ++ ++ /* Obtain a likely-unused port number. */ ++ struct sockaddr_in sin = ++ { ++ .sin_family = AF_INET, ++ .sin_addr.s_addr = htonl (INADDR_LOOPBACK), ++ }; ++ { ++ int fd = xsocket (AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); ++ xbind (fd, (struct sockaddr *) &sin, sizeof (sin)); ++ socklen_t sinlen = sizeof (sin); ++ xgetsockname (fd, (struct sockaddr *) &sin, &sinlen); ++ /* Close the socket, so that we will receive an error below. */ ++ close (fd); ++ } ++ ++ int sock = RPC_ANYSOCK; ++ CLIENT *clnt = clntudp_create ++ (&sin, 1, 2, (struct timeval) { 1, 0 }, &sock); ++ TEST_VERIFY_EXIT (clnt != NULL); ++ TEST_VERIFY (clnt_call (clnt, 3, ++ (xdrproc_t) xdr_void, NULL, ++ (xdrproc_t) xdr_void, NULL, ++ ((struct timeval) { 3, 0 })) ++ == RPC_CANTRECV); ++ clnt_destroy (clnt); ++ ++ return 0; ++} ++ ++#include diff --git a/support/Makefile b/support/Makefile new file mode 100644 index 0000000000..20b0343ade @@ -11073,6 +11755,21 @@ index 0000000000..134e8ee4c1 + p += ret; + } +} +diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h +index 282805e396..e86d8b5b63 100644 +--- a/sysdeps/aarch64/dl-machine.h ++++ b/sysdeps/aarch64/dl-machine.h +@@ -172,8 +172,8 @@ _dl_start_user: \n\ + cmp x0, #0 \n\ + bne 1b \n\ + // Update _dl_argv \n\ +- adrp x3, _dl_argv \n\ +- str x2, [x3, #:lo12:_dl_argv] \n\ ++ adrp x3, __GI__dl_argv \n\ ++ str x2, [x3, #:lo12:__GI__dl_argv] \n\ + .L_done_stack_adjust: \n\ + // compute envp \n\ + add x3, x2, x1, lsl #3 \n\ diff --git a/sysdeps/aarch64/nptl/tcb-offsets.sym b/sysdeps/aarch64/nptl/tcb-offsets.sym index 0677aeabff..238647dd47 100644 --- a/sysdeps/aarch64/nptl/tcb-offsets.sym @@ -11401,6 +12098,30 @@ index e1707ab1c8..b01f712be2 100644 TID offsetof (struct pthread, tid) - TLS_PRE_TCB_SIZE MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) - TLS_PRE_TCB_SIZE SYSINFO_OFFSET offsetof (tcbhead_t, __private) +diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c +index 663fa392c2..bd758b5979 100644 +--- a/sysdeps/ieee754/dbl-64/e_pow.c ++++ b/sysdeps/ieee754/dbl-64/e_pow.c +@@ -466,15 +466,15 @@ checkint (double x) + return (n & 1) ? -1 : 1; /* odd or even */ + if (k > 20) + { +- if (n << (k - 20)) ++ if (n << (k - 20) != 0) + return 0; /* if not integer */ +- return (n << (k - 21)) ? -1 : 1; ++ return (n << (k - 21) != 0) ? -1 : 1; + } + if (n) + return 0; /*if not integer */ + if (k == 20) + return (m & 1) ? -1 : 1; +- if (m << (k + 12)) ++ if (m << (k + 12) != 0) + return 0; +- return (m << (k + 11)) ? -1 : 1; ++ return (m << (k + 11) != 0) ? -1 : 1; + } diff --git a/sysdeps/m68k/m680x0/m68020/atomic-machine.h b/sysdeps/m68k/m680x0/m68020/atomic-machine.h index 24bc5c5ef7..65965cca9e 100644 --- a/sysdeps/m68k/m680x0/m68020/atomic-machine.h @@ -13626,6 +14347,180 @@ index 391ed5e17b..0000000000 - offset. */ -#define __ALIGNMENT_ARG -#include +diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym +index 17397c5511..25f914a93b 100644 +--- a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym ++++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym +@@ -13,22 +13,22 @@ SIG_SETMASK + oLINK ucontext (uc_link) + oSS_SP ucontext (uc_stack.ss_sp) + oSS_SIZE ucontext (uc_stack.ss_size) +-oR0 mcontext (gregs[R0]) +-oR1 mcontext (gregs[R1]) +-oR2 mcontext (gregs[R2]) +-oR3 mcontext (gregs[R3]) +-oR4 mcontext (gregs[R4]) +-oR5 mcontext (gregs[R5]) +-oR6 mcontext (gregs[R6]) +-oR7 mcontext (gregs[R7]) +-oR8 mcontext (gregs[R8]) +-oR9 mcontext (gregs[R9]) +-oR10 mcontext (gregs[R10]) +-oR11 mcontext (gregs[R11]) +-oR12 mcontext (gregs[R12]) +-oR13 mcontext (gregs[R13]) +-oR14 mcontext (gregs[R14]) +-oR15 mcontext (gregs[R15]) ++oR0 mcontext (gregs[REG_R0]) ++oR1 mcontext (gregs[REG_R1]) ++oR2 mcontext (gregs[REG_R2]) ++oR3 mcontext (gregs[REG_R3]) ++oR4 mcontext (gregs[REG_R4]) ++oR5 mcontext (gregs[REG_R5]) ++oR6 mcontext (gregs[REG_R6]) ++oR7 mcontext (gregs[REG_R7]) ++oR8 mcontext (gregs[REG_R8]) ++oR9 mcontext (gregs[REG_R9]) ++oR10 mcontext (gregs[REG_R10]) ++oR11 mcontext (gregs[REG_R11]) ++oR12 mcontext (gregs[REG_R12]) ++oR13 mcontext (gregs[REG_R13]) ++oR14 mcontext (gregs[REG_R14]) ++oR15 mcontext (gregs[REG_R15]) + oPC mcontext (pc) + oPR mcontext (pr) + oSR mcontext (sr) +diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym +index 65633fbcf4..130f60cd96 100644 +--- a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym ++++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym +@@ -13,22 +13,22 @@ SIG_SETMASK + oLINK ucontext (uc_link) + oSS_SP ucontext (uc_stack.ss_sp) + oSS_SIZE ucontext (uc_stack.ss_size) +-oR0 mcontext (gregs[R0]) +-oR1 mcontext (gregs[R1]) +-oR2 mcontext (gregs[R2]) +-oR3 mcontext (gregs[R3]) +-oR4 mcontext (gregs[R4]) +-oR5 mcontext (gregs[R5]) +-oR6 mcontext (gregs[R6]) +-oR7 mcontext (gregs[R7]) +-oR8 mcontext (gregs[R8]) +-oR9 mcontext (gregs[R9]) +-oR10 mcontext (gregs[R10]) +-oR11 mcontext (gregs[R11]) +-oR12 mcontext (gregs[R12]) +-oR13 mcontext (gregs[R13]) +-oR14 mcontext (gregs[R14]) +-oR15 mcontext (gregs[R15]) ++oR0 mcontext (gregs[REG_R0]) ++oR1 mcontext (gregs[REG_R1]) ++oR2 mcontext (gregs[REG_R2]) ++oR3 mcontext (gregs[REG_R3]) ++oR4 mcontext (gregs[REG_R4]) ++oR5 mcontext (gregs[REG_R5]) ++oR6 mcontext (gregs[REG_R6]) ++oR7 mcontext (gregs[REG_R7]) ++oR8 mcontext (gregs[REG_R8]) ++oR9 mcontext (gregs[REG_R9]) ++oR10 mcontext (gregs[REG_R10]) ++oR11 mcontext (gregs[REG_R11]) ++oR12 mcontext (gregs[REG_R12]) ++oR13 mcontext (gregs[REG_R13]) ++oR14 mcontext (gregs[REG_R14]) ++oR15 mcontext (gregs[REG_R15]) + oPC mcontext (pc) + oPR mcontext (pr) + oSR mcontext (sr) +diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h +index ab9a7e66bf..037fbb73e8 100644 +--- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h ++++ b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h +@@ -31,49 +31,47 @@ + typedef int greg_t; + + /* Number of general registers. */ +-#define NGPREG 16 ++#define NGREG 16 + + /* Container for all general registers. */ +-typedef greg_t gregset_t[NGPREG]; ++typedef greg_t gregset_t[NGREG]; + +-#ifdef __USE_GNU + /* Number of each register is the `gregset_t' array. */ + enum + { +- R0 = 0, +-#define R0 R0 +- R1 = 1, +-#define R1 R1 +- R2 = 2, +-#define R2 R2 +- R3 = 3, +-#define R3 R3 +- R4 = 4, +-#define R4 R4 +- R5 = 5, +-#define R5 R5 +- R6 = 6, +-#define R6 R6 +- R7 = 7, +-#define R7 R7 +- R8 = 8, +-#define R8 R8 +- R9 = 9, +-#define R9 R9 +- R10 = 10, +-#define R10 R10 +- R11 = 11, +-#define R11 R11 +- R12 = 12, +-#define R12 R12 +- R13 = 13, +-#define R13 R13 +- R14 = 14, +-#define R14 R14 +- R15 = 15, +-#define R15 R15 ++ REG_R0 = 0, ++#define REG_R0 REG_R0 ++ REG_R1 = 1, ++#define REG_R1 REG_R1 ++ REG_R2 = 2, ++#define REG_R2 REG_R2 ++ REG_R3 = 3, ++#define REG_R3 REG_R3 ++ REG_R4 = 4, ++#define REG_R4 REG_R4 ++ REG_R5 = 5, ++#define REG_R5 REG_R5 ++ REG_R6 = 6, ++#define REG_R6 REG_R6 ++ REG_R7 = 7, ++#define REG_R7 REG_R7 ++ REG_R8 = 8, ++#define REG_R8 REG_R8 ++ REG_R9 = 9, ++#define REG_R9 REG_R9 ++ REG_R10 = 10, ++#define REG_R10 REG_R10 ++ REG_R11 = 11, ++#define REG_R11 REG_R11 ++ REG_R12 = 12, ++#define REG_R12 REG_R12 ++ REG_R13 = 13, ++#define REG_R13 REG_R13 ++ REG_R14 = 14, ++#define REG_R14 REG_R14 ++ REG_R15 = 15, ++#define REG_R15 REG_R15 + }; +-#endif + + #if (defined(__SH4__) || defined(__SH4A__)) + typedef int freg_t; diff --git a/sysdeps/unix/sysv/linux/sh/vfork.S b/sysdeps/unix/sysv/linux/sh/vfork.S index 6895bc5491..df559cb439 100644 --- a/sysdeps/unix/sysv/linux/sh/vfork.S @@ -13933,10 +14828,11 @@ diff --git a/sysdeps/unix/sysv/linux/tile/vfork.S b/sysdeps/unix/sysv/linux/tile index d8c5ce3e24..2272777187 100644 --- a/sysdeps/unix/sysv/linux/tile/vfork.S +++ b/sysdeps/unix/sysv/linux/tile/vfork.S -@@ -30,18 +30,6 @@ +@@ -29,18 +29,6 @@ + .text ENTRY (__vfork) - { +- { - addli r11, tp, PID_OFFSET /* Point at PID. */ - movei r13, 1 - } @@ -13948,10 +14844,9 @@ index d8c5ce3e24..2272777187 100644 - CMOVEQZ r12, r12, r13 /* Replace zero pids. */ - ST4 r11, r12 /* Store the temporary PID. */ - -- { + { moveli r0, CLONE_VFORK | CLONE_VM | SIGCHLD move r1, zero - } @@ -52,22 +40,6 @@ ENTRY (__vfork) moveli TREG_SYSCALL_NR_NAME, __NR_clone swint1 @@ -14214,7 +15109,7 @@ index 8332ade9fb..cdd2dea32a 100644 jae SYSCALL_ERROR_LABEL /* Branch forward if it failed. */ diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c -index 9ce4b495a5..d1ee922290 100644 +index 9ce4b495a5..508ad2ae7b 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -133,8 +133,6 @@ init_cpu_features (struct cpu_features *cpu_features) @@ -14226,7 +15121,7 @@ index 9ce4b495a5..d1ee922290 100644 case 0x5c: case 0x5f: -@@ -205,6 +203,30 @@ init_cpu_features (struct cpu_features *cpu_features) +@@ -205,6 +203,33 @@ init_cpu_features (struct cpu_features *cpu_features) if (CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable)) cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load] |= bit_arch_AVX_Fast_Unaligned_Load; @@ -14242,10 +15137,13 @@ index 9ce4b495a5..d1ee922290 100644 + |= bit_arch_Prefer_No_AVX512; + + /* To avoid SSE transition penalty, use _dl_runtime_resolve_slow. -+ If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. */ ++ If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. ++ Use _dl_runtime_resolve_opt only with AVX512F since it is ++ slower than _dl_runtime_resolve_slow with AVX. */ + cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow] + |= bit_arch_Use_dl_runtime_resolve_slow; -+ if (cpu_features->max_cpuid >= 0xd) ++ if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable) ++ && cpu_features->max_cpuid >= 0xd) + { + unsigned int eax; + @@ -14327,6 +15225,76 @@ index 97ffe765f4..2609ac0999 100644 #endif /* !__ASSEMBLER__ */ +diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile +index 6d99284cd0..cc990a9685 100644 +--- a/sysdeps/x86_64/Makefile ++++ b/sysdeps/x86_64/Makefile +@@ -27,7 +27,7 @@ ifeq ($(subdir),elf) + CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\ + -mno-mmx) + +-sysdep-dl-routines += tlsdesc dl-tlsdesc ++sysdep-dl-routines += tlsdesc dl-tlsdesc tls_get_addr + + tests += ifuncmain8 + modules-names += ifuncmod8 +@@ -49,9 +49,12 @@ extra-test-objs += tst-quadmod1pie.o tst-quadmod2pie.o + $(objpfx)tst-quad1pie: $(objpfx)tst-quadmod1pie.o + $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o + +-tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 tst-audit10 +-test-extras += tst-audit4-aux tst-audit10-aux +-extra-test-objs += tst-audit4-aux.o tst-audit10-aux.o ++tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \ ++ tst-audit10 tst-sse tst-avx tst-avx512 ++test-extras += tst-audit4-aux tst-audit10-aux \ ++ tst-avx-aux tst-avx512-aux ++extra-test-objs += tst-audit4-aux.o tst-audit10-aux.o \ ++ tst-avx-aux.o tst-avx512-aux.o + + tests += tst-split-dynreloc + LDFLAGS-tst-split-dynreloc = -Wl,-T,$(..)sysdeps/x86_64/tst-split-dynreloc.lds +@@ -62,7 +65,8 @@ modules-names += tst-auditmod3a tst-auditmod3b \ + tst-auditmod5a tst-auditmod5b \ + tst-auditmod6a tst-auditmod6b tst-auditmod6c \ + tst-auditmod7a tst-auditmod7b \ +- tst-auditmod10a tst-auditmod10b ++ tst-auditmod10a tst-auditmod10b \ ++ tst-ssemod tst-avxmod tst-avx512mod + + $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so + $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so +@@ -89,6 +93,10 @@ $(objpfx)tst-audit10: $(objpfx)tst-audit10-aux.o $(objpfx)tst-auditmod10a.so + $(objpfx)tst-audit10.out: $(objpfx)tst-auditmod10b.so + tst-audit10-ENV = LD_AUDIT=$(objpfx)tst-auditmod10b.so + ++$(objpfx)tst-sse: $(objpfx)tst-ssemod.so ++$(objpfx)tst-avx: $(objpfx)tst-avx-aux.o $(objpfx)tst-avxmod.so ++$(objpfx)tst-avx512: $(objpfx)tst-avx512-aux.o $(objpfx)tst-avx512mod.so ++ + AVX-CFLAGS=-mavx -mno-vzeroupper + CFLAGS-tst-audit4-aux.c += $(AVX-CFLAGS) + CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS) +@@ -96,14 +104,18 @@ CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS) + CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS) + CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS) + CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS) ++CFLAGS-tst-avx-aux.c += $(AVX-CFLAGS) ++CFLAGS-tst-avxmod.c += $(AVX-CFLAGS) + ifeq (yes,$(config-cflags-avx512)) + AVX512-CFLAGS = -mavx512f + CFLAGS-tst-audit10-aux.c += $(AVX512-CFLAGS) + CFLAGS-tst-auditmod10a.c += $(AVX512-CFLAGS) + CFLAGS-tst-auditmod10b.c += $(AVX512-CFLAGS) ++CFLAGS-tst-avx512-aux.c += $(AVX512-CFLAGS) ++CFLAGS-tst-avx512mod.c += $(AVX512-CFLAGS) + endif + endif + + ifeq ($(subdir),csu) +-gen-as-const-headers += tlsdesc.sym ++gen-as-const-headers += tlsdesc.sym rtld-offsets.sym + endif diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index ed0c1a8efd..c0f0fa16a2 100644 --- a/sysdeps/x86_64/dl-machine.h @@ -14371,6 +15339,85 @@ index ed0c1a8efd..c0f0fa16a2 100644 else *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_sse; } +diff --git a/sysdeps/x86_64/dl-tls.c b/sysdeps/x86_64/dl-tls.c +new file mode 100644 +index 0000000000..3584805c8e +--- /dev/null ++++ b/sysdeps/x86_64/dl-tls.c +@@ -0,0 +1,53 @@ ++/* Thread-local storage handling in the ELF dynamic linker. x86-64 version. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#ifdef SHARED ++/* Work around GCC PR58066, due to which __tls_get_addr may be called ++ with an unaligned stack. The compat implementation is in ++ tls_get_addr-compat.S. */ ++ ++# include ++ ++/* Define __tls_get_addr within elf/dl-tls.c under a different ++ name. */ ++extern __typeof__ (__tls_get_addr) ___tls_get_addr; ++ ++# define __tls_get_addr ___tls_get_addr ++# include ++# undef __tls_get_addr ++ ++hidden_ver (___tls_get_addr, __tls_get_addr) ++ ++/* Only handle slow paths for __tls_get_addr. */ ++attribute_hidden ++void * ++__tls_get_addr_slow (GET_ADDR_ARGS) ++{ ++ dtv_t *dtv = THREAD_DTV (); ++ ++ if (__glibc_unlikely (dtv[0].counter != GL(dl_tls_generation))) ++ return update_get_addr (GET_ADDR_PARAM); ++ ++ return tls_get_addr_tail (GET_ADDR_PARAM, dtv, NULL); ++} ++#else ++ ++/* No compatibility symbol needed. */ ++# include ++ ++#endif +diff --git a/sysdeps/x86_64/dl-tls.h b/sysdeps/x86_64/dl-tls.h +index cf6c107f54..fa5bf6cd93 100644 +--- a/sysdeps/x86_64/dl-tls.h ++++ b/sysdeps/x86_64/dl-tls.h +@@ -16,6 +16,9 @@ + License along with the GNU C Library; if not, see + . */ + ++#ifndef _X86_64_DL_TLS_H ++#define _X86_64_DL_TLS_H ++ + #include + + /* Type used for the representation of TLS information in the GOT. */ +@@ -27,3 +30,5 @@ typedef struct dl_tls_index + + + extern void *__tls_get_addr (tls_index *ti); ++ ++#endif /* _X86_64_DL_TLS_H */ diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S index 12f1a5cf84..50b23633e3 100644 --- a/sysdeps/x86_64/dl-trampoline.S @@ -14416,7 +15463,7 @@ index 12f1a5cf84..50b23633e3 100644 +#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx512_opt +#include "dl-trampoline.h" diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h -index b90836ab13..32ad3af202 100644 +index b90836ab13..d21c5a987a 100644 --- a/sysdeps/x86_64/dl-trampoline.h +++ b/sysdeps/x86_64/dl-trampoline.h @@ -50,6 +50,106 @@ @@ -14526,7 +15573,17 @@ index b90836ab13..32ad3af202 100644 .globl _dl_runtime_resolve .hidden _dl_runtime_resolve .type _dl_runtime_resolve, @function -@@ -162,7 +262,10 @@ _dl_runtime_resolve: +@@ -69,7 +169,9 @@ _dl_runtime_resolve: + and $-VEC_SIZE, %RSP_LP + #endif + sub $REGISTER_SAVE_AREA, %RSP_LP ++#if !DL_RUNTIME_RESOLVE_REALIGN_STACK + cfi_adjust_cfa_offset(REGISTER_SAVE_AREA) ++#endif + # Preserve registers otherwise clobbered. + movq %rax, REGISTER_SAVE_RAX(%rsp) + movq %rcx, REGISTER_SAVE_RCX(%rsp) +@@ -162,7 +264,10 @@ _dl_runtime_resolve: .size _dl_runtime_resolve, .-_dl_runtime_resolve @@ -14680,6 +15737,18 @@ index aeb752673a..8a25c482cb 100644 CANCELHANDLING offsetof (struct pthread, cancelhandling) CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) CLEANUP offsetof (struct pthread, cleanup) +diff --git a/sysdeps/x86_64/rtld-offsets.sym b/sysdeps/x86_64/rtld-offsets.sym +new file mode 100644 +index 0000000000..fd41b51521 +--- /dev/null ++++ b/sysdeps/x86_64/rtld-offsets.sym +@@ -0,0 +1,6 @@ ++#define SHARED ++#include ++ ++-- ++ ++GL_TLS_GENERATION_OFFSET offsetof (struct rtld_global, _dl_tls_generation) diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h index 75ac747be8..4b67fa80c1 100644 --- a/sysdeps/x86_64/sysdep.h @@ -14700,3 +15769,518 @@ index 75ac747be8..4b67fa80c1 100644 # define JUMPTARGET(name) name #endif +diff --git a/sysdeps/x86_64/tls_get_addr.S b/sysdeps/x86_64/tls_get_addr.S +new file mode 100644 +index 0000000000..9d38fb3be5 +--- /dev/null ++++ b/sysdeps/x86_64/tls_get_addr.S +@@ -0,0 +1,61 @@ ++/* Stack-aligning implementation of __tls_get_addr. x86-64 version. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#ifdef SHARED ++ ++# include ++# include "tlsdesc.h" ++# include "rtld-offsets.h" ++ ++/* See __tls_get_addr and __tls_get_addr_slow in dl-tls.c. This function ++ call __tls_get_addr_slow on both slow paths. It realigns the stack ++ before the call to work around GCC PR58066. */ ++ ++ENTRY (__tls_get_addr) ++ mov %fs:DTV_OFFSET, %RDX_LP ++ mov GL_TLS_GENERATION_OFFSET+_rtld_local(%rip), %RAX_LP ++ /* GL(dl_tls_generation) == dtv[0].counter */ ++ cmp %RAX_LP, (%rdx) ++ jne 1f ++ mov TI_MODULE_OFFSET(%rdi), %RAX_LP ++ /* dtv[ti->ti_module] */ ++# ifdef __LP64__ ++ salq $4, %rax ++ movq (%rdx,%rax), %rax ++# else ++ movl (%rdx,%rax, 8), %eax ++# endif ++ cmp $-1, %RAX_LP ++ je 1f ++ add TI_OFFSET_OFFSET(%rdi), %RAX_LP ++ ret ++1: ++ /* On the slow path, align the stack. */ ++ pushq %rbp ++ cfi_def_cfa_offset (16) ++ cfi_offset (%rbp, -16) ++ mov %RSP_LP, %RBP_LP ++ cfi_def_cfa_register (%rbp) ++ and $-16, %RSP_LP ++ call __tls_get_addr_slow ++ mov %RBP_LP, %RSP_LP ++ popq %rbp ++ cfi_def_cfa (%rsp, 8) ++ ret ++END (__tls_get_addr) ++#endif /* SHARED */ +diff --git a/sysdeps/x86_64/tlsdesc.sym b/sysdeps/x86_64/tlsdesc.sym +index 33854975d0..fc897ab4b5 100644 +--- a/sysdeps/x86_64/tlsdesc.sym ++++ b/sysdeps/x86_64/tlsdesc.sym +@@ -15,3 +15,6 @@ TLSDESC_ARG offsetof(struct tlsdesc, arg) + TLSDESC_GEN_COUNT offsetof(struct tlsdesc_dynamic_arg, gen_count) + TLSDESC_MODID offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module) + TLSDESC_MODOFF offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset) ++ ++TI_MODULE_OFFSET offsetof(tls_index, ti_module) ++TI_OFFSET_OFFSET offsetof(tls_index, ti_offset) +diff --git a/sysdeps/x86_64/tst-avx-aux.c b/sysdeps/x86_64/tst-avx-aux.c +new file mode 100644 +index 0000000000..e3807de7bb +--- /dev/null ++++ b/sysdeps/x86_64/tst-avx-aux.c +@@ -0,0 +1,47 @@ ++/* Test case for preserved AVX registers in dynamic linker, -mavx part. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++ ++int ++tst_avx_aux (void) ++{ ++#ifdef __AVX__ ++ extern __m256i avx_test (__m256i, __m256i, __m256i, __m256i, ++ __m256i, __m256i, __m256i, __m256i); ++ ++ __m256i ymm0 = _mm256_set1_epi32 (0); ++ __m256i ymm1 = _mm256_set1_epi32 (1); ++ __m256i ymm2 = _mm256_set1_epi32 (2); ++ __m256i ymm3 = _mm256_set1_epi32 (3); ++ __m256i ymm4 = _mm256_set1_epi32 (4); ++ __m256i ymm5 = _mm256_set1_epi32 (5); ++ __m256i ymm6 = _mm256_set1_epi32 (6); ++ __m256i ymm7 = _mm256_set1_epi32 (7); ++ __m256i ret = avx_test (ymm0, ymm1, ymm2, ymm3, ++ ymm4, ymm5, ymm6, ymm7); ++ ymm0 = _mm256_set1_epi32 (0x12349876); ++ if (memcmp (&ymm0, &ret, sizeof (ret))) ++ abort (); ++ return 0; ++#else /* __AVX__ */ ++ return 77; ++#endif /* __AVX__ */ ++} +diff --git a/sysdeps/x86_64/tst-avx.c b/sysdeps/x86_64/tst-avx.c +new file mode 100644 +index 0000000000..ec2e3a79ff +--- /dev/null ++++ b/sysdeps/x86_64/tst-avx.c +@@ -0,0 +1,49 @@ ++/* Test case for preserved AVX registers in dynamic linker. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++ ++int tst_avx_aux (void); ++ ++static int ++avx_enabled (void) ++{ ++ unsigned int eax, ebx, ecx, edx; ++ ++ if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0 ++ || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE)) ++ return 0; ++ ++ /* Check the OS has AVX and SSE saving enabled. */ ++ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); ++ ++ return (eax & 6) == 6; ++} ++ ++static int ++do_test (void) ++{ ++ /* Run AVX test only if AVX is supported. */ ++ if (avx_enabled ()) ++ return tst_avx_aux (); ++ else ++ return 77; ++} ++ ++#define TEST_FUNCTION do_test () ++#include "../../test-skeleton.c" +diff --git a/sysdeps/x86_64/tst-avx512-aux.c b/sysdeps/x86_64/tst-avx512-aux.c +new file mode 100644 +index 0000000000..6cebc523f2 +--- /dev/null ++++ b/sysdeps/x86_64/tst-avx512-aux.c +@@ -0,0 +1,48 @@ ++/* Test case for preserved AVX512 registers in dynamic linker, ++ -mavx512 part. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++ ++int ++tst_avx512_aux (void) ++{ ++#ifdef __AVX512F__ ++ extern __m512i avx512_test (__m512i, __m512i, __m512i, __m512i, ++ __m512i, __m512i, __m512i, __m512i); ++ ++ __m512i zmm0 = _mm512_set1_epi32 (0); ++ __m512i zmm1 = _mm512_set1_epi32 (1); ++ __m512i zmm2 = _mm512_set1_epi32 (2); ++ __m512i zmm3 = _mm512_set1_epi32 (3); ++ __m512i zmm4 = _mm512_set1_epi32 (4); ++ __m512i zmm5 = _mm512_set1_epi32 (5); ++ __m512i zmm6 = _mm512_set1_epi32 (6); ++ __m512i zmm7 = _mm512_set1_epi32 (7); ++ __m512i ret = avx512_test (zmm0, zmm1, zmm2, zmm3, ++ zmm4, zmm5, zmm6, zmm7); ++ zmm0 = _mm512_set1_epi32 (0x12349876); ++ if (memcmp (&zmm0, &ret, sizeof (ret))) ++ abort (); ++ return 0; ++#else /* __AVX512F__ */ ++ return 77; ++#endif /* __AVX512F__ */ ++} +diff --git a/sysdeps/x86_64/tst-avx512.c b/sysdeps/x86_64/tst-avx512.c +new file mode 100644 +index 0000000000..a8e42ef553 +--- /dev/null ++++ b/sysdeps/x86_64/tst-avx512.c +@@ -0,0 +1,57 @@ ++/* Test case for preserved AVX512 registers in dynamic linker. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++ ++int tst_avx512_aux (void); ++ ++static int ++avx512_enabled (void) ++{ ++#ifdef bit_AVX512F ++ unsigned int eax, ebx, ecx, edx; ++ ++ if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0 ++ || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE)) ++ return 0; ++ ++ __cpuid_count (7, 0, eax, ebx, ecx, edx); ++ if (!(ebx & bit_AVX512F)) ++ return 0; ++ ++ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); ++ ++ /* Verify that ZMM, YMM and XMM states are enabled. */ ++ return (eax & 0xe6) == 0xe6; ++#else ++ return 0; ++#endif ++} ++ ++static int ++do_test (void) ++{ ++ /* Run AVX512 test only if AVX512 is supported. */ ++ if (avx512_enabled ()) ++ return tst_avx512_aux (); ++ else ++ return 77; ++} ++ ++#define TEST_FUNCTION do_test () ++#include "../../test-skeleton.c" +diff --git a/sysdeps/x86_64/tst-avx512mod.c b/sysdeps/x86_64/tst-avx512mod.c +new file mode 100644 +index 0000000000..4cfb3a2c3d +--- /dev/null ++++ b/sysdeps/x86_64/tst-avx512mod.c +@@ -0,0 +1,48 @@ ++/* Test case for x86-64 preserved AVX512 registers in dynamic linker. */ ++ ++#ifdef __AVX512F__ ++#include ++#include ++#include ++ ++__m512i ++avx512_test (__m512i x0, __m512i x1, __m512i x2, __m512i x3, ++ __m512i x4, __m512i x5, __m512i x6, __m512i x7) ++{ ++ __m512i zmm; ++ ++ zmm = _mm512_set1_epi32 (0); ++ if (memcmp (&zmm, &x0, sizeof (zmm))) ++ abort (); ++ ++ zmm = _mm512_set1_epi32 (1); ++ if (memcmp (&zmm, &x1, sizeof (zmm))) ++ abort (); ++ ++ zmm = _mm512_set1_epi32 (2); ++ if (memcmp (&zmm, &x2, sizeof (zmm))) ++ abort (); ++ ++ zmm = _mm512_set1_epi32 (3); ++ if (memcmp (&zmm, &x3, sizeof (zmm))) ++ abort (); ++ ++ zmm = _mm512_set1_epi32 (4); ++ if (memcmp (&zmm, &x4, sizeof (zmm))) ++ abort (); ++ ++ zmm = _mm512_set1_epi32 (5); ++ if (memcmp (&zmm, &x5, sizeof (zmm))) ++ abort (); ++ ++ zmm = _mm512_set1_epi32 (6); ++ if (memcmp (&zmm, &x6, sizeof (zmm))) ++ abort (); ++ ++ zmm = _mm512_set1_epi32 (7); ++ if (memcmp (&zmm, &x7, sizeof (zmm))) ++ abort (); ++ ++ return _mm512_set1_epi32 (0x12349876); ++} ++#endif +diff --git a/sysdeps/x86_64/tst-avxmod.c b/sysdeps/x86_64/tst-avxmod.c +new file mode 100644 +index 0000000000..6e5b154997 +--- /dev/null ++++ b/sysdeps/x86_64/tst-avxmod.c +@@ -0,0 +1,48 @@ ++/* Test case for x86-64 preserved AVX registers in dynamic linker. */ ++ ++#ifdef __AVX__ ++#include ++#include ++#include ++ ++__m256i ++avx_test (__m256i x0, __m256i x1, __m256i x2, __m256i x3, ++ __m256i x4, __m256i x5, __m256i x6, __m256i x7) ++{ ++ __m256i ymm; ++ ++ ymm = _mm256_set1_epi32 (0); ++ if (memcmp (&ymm, &x0, sizeof (ymm))) ++ abort (); ++ ++ ymm = _mm256_set1_epi32 (1); ++ if (memcmp (&ymm, &x1, sizeof (ymm))) ++ abort (); ++ ++ ymm = _mm256_set1_epi32 (2); ++ if (memcmp (&ymm, &x2, sizeof (ymm))) ++ abort (); ++ ++ ymm = _mm256_set1_epi32 (3); ++ if (memcmp (&ymm, &x3, sizeof (ymm))) ++ abort (); ++ ++ ymm = _mm256_set1_epi32 (4); ++ if (memcmp (&ymm, &x4, sizeof (ymm))) ++ abort (); ++ ++ ymm = _mm256_set1_epi32 (5); ++ if (memcmp (&ymm, &x5, sizeof (ymm))) ++ abort (); ++ ++ ymm = _mm256_set1_epi32 (6); ++ if (memcmp (&ymm, &x6, sizeof (ymm))) ++ abort (); ++ ++ ymm = _mm256_set1_epi32 (7); ++ if (memcmp (&ymm, &x7, sizeof (ymm))) ++ abort (); ++ ++ return _mm256_set1_epi32 (0x12349876); ++} ++#endif +diff --git a/sysdeps/x86_64/tst-sse.c b/sysdeps/x86_64/tst-sse.c +new file mode 100644 +index 0000000000..dd1537cf27 +--- /dev/null ++++ b/sysdeps/x86_64/tst-sse.c +@@ -0,0 +1,46 @@ ++/* Test case for preserved SSE registers in dynamic linker. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++ ++extern __m128i sse_test (__m128i, __m128i, __m128i, __m128i, ++ __m128i, __m128i, __m128i, __m128i); ++ ++static int ++do_test (void) ++{ ++ __m128i xmm0 = _mm_set1_epi32 (0); ++ __m128i xmm1 = _mm_set1_epi32 (1); ++ __m128i xmm2 = _mm_set1_epi32 (2); ++ __m128i xmm3 = _mm_set1_epi32 (3); ++ __m128i xmm4 = _mm_set1_epi32 (4); ++ __m128i xmm5 = _mm_set1_epi32 (5); ++ __m128i xmm6 = _mm_set1_epi32 (6); ++ __m128i xmm7 = _mm_set1_epi32 (7); ++ __m128i ret = sse_test (xmm0, xmm1, xmm2, xmm3, ++ xmm4, xmm5, xmm6, xmm7); ++ xmm0 = _mm_set1_epi32 (0x12349876); ++ if (memcmp (&xmm0, &ret, sizeof (ret))) ++ abort (); ++ return 0; ++} ++ ++#define TEST_FUNCTION do_test () ++#include "../../test-skeleton.c" +diff --git a/sysdeps/x86_64/tst-ssemod.c b/sysdeps/x86_64/tst-ssemod.c +new file mode 100644 +index 0000000000..907a64c69e +--- /dev/null ++++ b/sysdeps/x86_64/tst-ssemod.c +@@ -0,0 +1,46 @@ ++/* Test case for x86-64 preserved SSE registers in dynamic linker. */ ++ ++#include ++#include ++#include ++ ++__m128i ++sse_test (__m128i x0, __m128i x1, __m128i x2, __m128i x3, ++ __m128i x4, __m128i x5, __m128i x6, __m128i x7) ++{ ++ __m128i xmm; ++ ++ xmm = _mm_set1_epi32 (0); ++ if (memcmp (&xmm, &x0, sizeof (xmm))) ++ abort (); ++ ++ xmm = _mm_set1_epi32 (1); ++ if (memcmp (&xmm, &x1, sizeof (xmm))) ++ abort (); ++ ++ xmm = _mm_set1_epi32 (2); ++ if (memcmp (&xmm, &x2, sizeof (xmm))) ++ abort (); ++ ++ xmm = _mm_set1_epi32 (3); ++ if (memcmp (&xmm, &x3, sizeof (xmm))) ++ abort (); ++ ++ xmm = _mm_set1_epi32 (4); ++ if (memcmp (&xmm, &x4, sizeof (xmm))) ++ abort (); ++ ++ xmm = _mm_set1_epi32 (5); ++ if (memcmp (&xmm, &x5, sizeof (xmm))) ++ abort (); ++ ++ xmm = _mm_set1_epi32 (6); ++ if (memcmp (&xmm, &x6, sizeof (xmm))) ++ abort (); ++ ++ xmm = _mm_set1_epi32 (7); ++ if (memcmp (&xmm, &x7, sizeof (xmm))) ++ abort (); ++ ++ return _mm_set1_epi32 (0x12349876); ++}