aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-12-08alpha: fix trunc for big input valuesgentoo/2.23Aurelien Jarno
The alpha specific version of trunc and truncf always add and subtract 0x1.0p23 or 0x1.0p52 even for big values. This causes this kind of errors in the testsuite: Failure: Test: trunc_towardzero (0x1p107) Result: is: 1.6225927682921334e+32 0x1.fffffffffffffp+106 should be: 1.6225927682921336e+32 0x1.0000000000000p+107 difference: 1.8014398509481984e+16 0x1.0000000000000p+54 ulp : 0.5000 max.ulp : 0.0000 Change this by returning the input value when its absolute value is greater than 0x1.0p23 or 0x1.0p52. NaN have to go through the add and subtract operations to get possibly silenced. Finally remove the code to handle inexact exception, trunc should never generate such an exception. Changelog: * sysdeps/alpha/fpu/s_trunc.c (__trunc): Return the input value when its absolute value is greater than 0x1.0p52. [_IEEE_FP_INEXACT] Remove. * sysdeps/alpha/fpu/s_truncf.c (__truncf): Return the input value when its absolute value is greater than 0x1.0p23. [_IEEE_FP_INEXACT] Remove. (cherry picked from commit b74d259fe793499134eb743222cd8dd7c74a31ce) (cherry picked from commit 3a5aa2ee4ffc515c8e7e615ea38d6b3b20ed0a30)
2016-12-08alpha: fix rint on sNaN inputAurelien Jarno
The alpha version of rint wrongly return sNaN for sNaN input. Fix that by checking for NaN and by returning the input value added with itself in that case. Changelog: * sysdeps/alpha/fpu/s_rint.c (__rint): Add argument with itself when it is a NaN. * sysdeps/alpha/fpu/s_rintf.c (__rintf): Likewise. (cherry picked from commit cb7f9d63b921ea1a1cbb4ab377a8484fd5da9a2b) (cherry picked from commit 51a313c50445eded2cfbbb60da2bbb98f3e9b219)
2016-12-08alpha: fix floor on sNaN inputAurelien Jarno
The alpha version of floor wrongly return sNaN for sNaN input. Fix that by checking for NaN and by returning the input value added with itself in that case. Finally remove the code to handle inexact exception, floor should never generate such an exception. Changelog: * sysdeps/alpha/fpu/s_floor.c (__floor): Add argument with itself when it is a NaN. [_IEEE_FP_INEXACT] Remove. * sysdeps/alpha/fpu/s_floorf.c (__floorf): Likewise. (cherry picked from commit 65cc568cf57156e5230db9a061645e54ff028a41) (cherry picked from commit 12bf4f130d46a075c628a2c948b31973b2a12222)
2016-12-08alpha: fix ceil on sNaN inputAurelien Jarno
The alpha version of ceil wrongly return sNaN for sNaN input. Fix that by checking for NaN and by returning the input value added with itself in that case. Finally remove the code to handle inexact exception, ceil should never generate such an exception. Changelog: * sysdeps/alpha/fpu/s_ceil.c (__ceil): Add argument with itself when it is a NaN. [_IEEE_FP_INEXACT] Remove. * sysdeps/alpha/fpu/s_ceilf.c (__ceilf): Likewise. (cherry picked from commit 062e53c195b4a87754632c7d51254867247698b4) (cherry picked from commit 85186de4f422170e4aff108200d96ffa60d61081)
2016-12-08MIPS: Add `.insn' to ensure a text label is defined as code not dataMaciej W. Rozycki
Avoid a build error with microMIPS compilation and recent versions of GAS which complain if a branch targets a label which is marked as data rather than microMIPS code: ../sysdeps/mips/mips32/crti.S: Assembler messages: ../sysdeps/mips/mips32/crti.S:72: Error: branch to a symbol in another ISA mode make[2]: *** [.../csu/crti.o] Error 1 as commit 9d862524f6ae ("MIPS: Verify the ISA mode and alignment of branch and jump targets") closed a hole in branch processing, making relocation calculation respect the ISA mode of the symbol referred. This allowed diagnosing the situation where an attempt is made to pass control from code assembled for one ISA mode to code assembled for a different ISA mode and either relaxing the branch to a cross-mode jump or if that is not possible, then reporting this as an error rather than letting such code build and then fail unpredictably at the run time. This however requires the correct annotation of branch targets as code, because the ISA mode is not relevant for data symbols and is therefore not recorded for them. The `.insn' pseudo-op is used for this purpose and has been supported by GAS since: Wed Feb 12 14:36:29 1997 Ian Lance Taylor <ian@cygnus.com> * config/tc-mips.c (mips_pseudo_table): Add "insn". (s_insn): New static function. * doc/c-mips.texi: Document .insn. so there has been no reason to avoid it where required. More recently this pseudo-op has been documented, by the microMIPS architecture specification[1][2], as required for the correct interpretation of any code label which is not followed by an actual instruction in an assembly source. Use it in our crti.S files then, to mark that the trailing label there with no instructions following is indeed not a code bug and the branch is legitimate. References: [1] "MIPS Architecture for Programmers, Volume II-B: The microMIPS32 Instruction Set", MIPS Technologies, Inc., Document Number: MD00582, Revision 5.04, January 15, 2014, Section 7.1 "Assembly-Level Compatibility", p. 533 [2] "MIPS Architecture for Programmers, Volume II-B: The microMIPS64 Instruction Set", MIPS Technologies, Inc., Document Number: MD00594, Revision 5.04, January 15, 2014, Section 8.1 "Assembly-Level Compatibility", p. 623 2016-11-23 Matthew Fortune <Matthew.Fortune@imgtec.com> Maciej W. Rozycki <macro@imgtec.com> * sysdeps/mips/mips32/crti.S (_init): Add `.insn' pseudo-op at `.Lno_weak_fn' label. * sysdeps/mips/mips64/n32/crti.S (_init): Likewise. * sysdeps/mips/mips64/n64/crti.S (_init): Likewise. (cherry picked from commit cfaf1949ff1f8336b54c43796d0e2531bc8a40a2) (cherry picked from commit 8ee1ecb99cd8928b767b9b50f31b5618d046f0f2)
2016-11-15configure: accept __stack_chk_fail_local for ssp support too [BZ #20662]Denis Kaganovich
When glibc is compiled with gcc 6.2 that has been configured with --enable-default-pie and --enable-default-ssp, the configure script fails to detect that the compiler has ssp turned on by default when being built for i686-linux-gnu. This is because gcc is emitting __stack_chk_fail_local but the script is only looking for __stack_chk_fail. Support both. Example output: checking whether x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed implicitly enables -fstack-protector... no (cherry picked from commit c7409aded44634411a19b0b7178b7faa237835e6) (cherry picked from commit a6a59e99d1249dc386d0a042c39e3860fbb7b6b6)
2016-11-12Fix cos computation for multiple precision fallback (bz #20357)Siddhesh Poyarekar
During the sincos consolidation I made two mistakes, one was a logical error due to which cos(0x1.8475e5afd4481p+0) returned sin(0x1.8475e5afd4481p+0) instead. The second issue was an error in negating inputs for the correct quadrants for sine. I could not find a suitable test case for this despite running a program to search for such an input for a couple of hours. Following patch fixes both issues. Tested on x86_64. Thanks to Matt Clay for identifying the issue. [BZ #20357] * sysdeps/ieee754/dbl-64/s_sin.c (sloww): Fix up condition to call __mpsin/__mpcos and to negate values. * math/auto-libm-test-in: Add test. * math/auto-libm-test-out: Regenerate. (cherry picked from commit cbf88869edced4b23d792d95a8626e35b831df35) (cherry picked from commit 422facff9f2c4972e2dc46090a704d11b840b0c0)
2016-11-12Don't compile do_test with -mavx/-mavx2/-mavx512.Andrew Senkevich
Don't compile do_test (in sincos ABI tests) with -mavx, -mavx2 nor -mavx512 since they won't run on non-AVX machines. (cherry-picked from commit fe0cf8614836e2b08b802eb1f55abca75d558545) (cherry picked from commit 6ab1e91474c0faab25a568436b846c2630624039)
2016-11-12Fixed x86_64 vector sincos/sincosf ABI.Andrew Senkevich
Fixed wrong vector sincos/sincosf ABI to have it compatible with current vector function declaration "#pragma omp declare simd notinbranch", according to which vector sincos should have vector of pointers for second and third parameters. It is fixed with implementation as wrapper to version having second and third parameters as pointers. (cherry-picked from commit ee2196bb6766ca7e63a1ba22ebb7619a3266776a) (cherry picked from commit 0350824fabf12da92c3ed5e1f3938bc1453a5938)
2016-11-12powerpc: Fix POWER9 impliesTulio Magno Quites Machado Filho
Fix multiarch build for POWER9 by correcting the order of the directories listed at sysnames configure variable. (cherry picked from commit 1850ce5a2ea3b908b26165e7e951cd4334129f07) (cherry picked from commit 79312adef2645f9051b251c56b0e45f6c4d38058)
2016-11-12nptl/tst-once5: Reduce time to expected failureFlorian Weimer
(cherry picked from commit 1f645571d2db9008b3cd3d5acb9ff93357864283) (cherry picked from commit 2eda04ec6f55d2a622481aeb51e4c42cf1607995)
2016-11-12argp: Do not override GCC keywords with macros [BZ #16907]Florian Weimer
glibc provides fallback definitions already. It is not necessary to suppress warnings for unknown attributes because GCC does this automatically for system headers. This commit does not sync with gnulib because gnulib has started to use _GL_* macros in the header file, which are arguably in the gnulib implementation space and not suitable for an installed glibc header file. (cherry picked from commit 2c820533c61fed175390bc6058afbbe42d2edc37) (cherry picked from commit a86b1fac2883617c24d719af125c473635bb5ac5)
2016-11-12fopencookie: Mangle function pointers stored on the heap [BZ #20222]Florian Weimer
(cherry picked from commit 983fd5c41ab7e5a5c33922259ca1ac99b3b413f8) (cherry picked from commit 9e9fcd095a9417acd28645946bd6e35bd3cbc194)
2016-11-12nss_db: Fix initialization of iteration position [BZ #20237]Florian Weimer
When get*ent is called without a preceding set*ent, we need to set the initial iteration position in get*ent. Reproducer: Add “services: db files” to /etc/nsswitch.conf, then run “perl -e getservent”. It will segfault before this change, and exit silently after it. (cherry picked from commit 31d0a4fa646db8b8c97ce24e0ec0a7b73de4fca1) (cherry picked from commit 79ad3fa2b1f38997be255d4eb709da928b66796a)
2016-11-12Return proper status from _nss_nis_initgroups_dyn (bug 20262)Andreas Schwab
(cherry picked from commit 73fb56a4d51fd4437e4cde6dd3c8077a610f88a8) (cherry picked from commit 395b1b9cbfda75fcdef0a9654d7ef6bf8bf7db11)
2016-11-12malloc: Avoid premature fallback to mmap [BZ #20284]Florian Weimer
Before this change, the while loop in reused_arena which avoids returning a corrupt arena would never execute its body if the selected arena were not corrupt. As a result, result == begin after the loop, and the function returns NULL, triggering fallback to mmap. (cherry picked from commit a3b473373ee43a292f5ec68a7fda6b9cfb26a9b0) (cherry picked from commit a69d26143b80cb1927481509279577c57bc22ba4)
2016-11-12arm: mark __startcontext as .cantunwind (bug 20435)Andreas Schwab
__startcontext marks the bottom of the call stack of the contexts created by makecontext. (cherry picked from commit 9e2ff6c9cc54c0b4402b8d49e4abe7000fde7617) Also includes the NEWS update, cherry-picked from commits 056dd72af83f5459ce6d545a49dea6dba7d635dc and 4d047efdbc55b0d68947cde682e5363d16a66294. (cherry picked from commit 23446cad92195d8c50092410b4f72ca7f6d1d2f1)
2016-11-12Do not override objects in libc.a in other static libraries [BZ #20452]Florian Weimer
With this change, we no longer add sysdep.o and similar objects which are present in libc.a to other static libraries. (cherry picked from commit d9067fca40b8aac156d73cfa44d6875813555a6c) (cherry picked from commit 3a97372dbe373e02cb1d4053a449d246c32cf454)
2016-11-12malloc: Preserve arena free list/thread count invariant [BZ #20370]Florian Weimer
It is necessary to preserve the invariant that if an arena is on the free list, it has thread attach count zero. Otherwise, when arena_thread_freeres sees the zero attach count, it will add it, and without the invariant, an arena could get pushed to the list twice, resulting in a cycle. One possible execution trace looks like this: Thread 1 examines free list and observes it as empty. Thread 2 exits and adds its arena to the free list, with attached_threads == 0). Thread 1 selects this arena in reused_arena (not from the free list). Thread 1 increments attached_threads and attaches itself. (The arena remains on the free list.) Thread 1 exits, decrements attached_threads, and adds the arena to the free list. The final step creates a cycle in the usual way (by overwriting the next_free member with the former list head, while there is another list item pointing to the arena structure). tst-malloc-thread-exit exhibits this issue, but it was only visible with a debugger because the incorrect fix in bug 19243 removed the assert from get_free_list. (cherry picked from commit f88aab5d508c13ae4a88124e65773d7d827cd47b) (cherry picked from commit 026671037948fd31009243a2173278dfa0ac9b25)
2016-11-12x86: Use sysdep.o from libc.a in static librariesFlorian Weimer
Static libraries can use the sysdep.o copy in libc.a without a performance penalty. This results in a visible difference if libpthread.a is relinked into a single object file (which is needed to support libraries which check for the presence of certain symbols to enable threading support, which generally fails with static linking unless libpthread.a is relinked). (cherry picked from commit e67330ab57bfd0f964539576ae7dcc658c456724) (cherry picked from commit e3e0bedf697c8c5858cd7ad1a541a179a20a6320)
2016-11-12SPARC64: update localplt.dataAurelien Jarno
Commits d81f90cc and 89faa0340 replaced called to __isnan and __isinf by the corresponding GCC builtins. In turns GCC emits calls to _Qp_cmp. We should therefore add _Qp_cmp to localplt.data as otherwise the elf/check-localplt test fails with: Extra PLT reference: libc.so: _Qp_cmp A similar change has already been done for SPARC32 in commit 6ef1cb95. Changelog: * sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data: Add _Qp_cmp. (cherry picked from commit fd1cf1dc3b2d90c2a61332363feb1043f6916564) (cherry picked from commit bbe472f4e02c18f998d8e327f4a0e7c5004c8010)
2016-11-12hppa: fix loading of global pointer in _start [BZ #20277]John David Anglin
The patched change fixes a regression for executables compiled with the -p option and linked with gcrt1.o. The executables crash on startup. This regression was introduced in 2.22 and was noticed in the gcc testsuite. (cherry picked from commit 9765ffa71030efd8bb4f2ea4ed6e020fcb4bb714) (cherry picked from commit 0903610fdc31efbea4309f69e5ee3e1d4f7ed29e)
2016-11-12i686/multiarch: Regenerate ulpsAurelien Jarno
This comes from running “make regen-ulps” on AMD Opteron 6272 CPUs. Changelog: * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated. (cherry picked from commit 6a40d8df0c269a953726a432c50702372b86c500) (cherry picked from commit 3d21617c430d190e5412bc450afad22169218c0e)
2016-11-12Fix tst-cancel17/tst-cancelx17, which sometimes segfaults while exiting.Stefan Liebler
The testcase tst-cancel[x]17 ends sometimes with a segmentation fault. This happens in one of 10000 cases. Then the real testcase has already exited with success and returned from do_test(). The segmentation fault occurs after returning from main in _dl_fini(). In those cases, the aio_read(&a) was not canceled because the read request was already in progress. In the meanwhile aio_write(ap) wrote something to the pipe and the read request is able to read the requested byte. The read request hasn't finished before returning from do_test(). After it finishes, it writes the return value and error code from the read syscall to the struct aiocb a, which lies on the stack of do_test. The stack of the subsequent function call of _dl_fini or _dl_sort_fini, which is inlined in _dl_fini is corrupted. In case of S390, it reads a zero and decrements it by 1: unsigned int k = nmaps - 1; struct link_map **runp = maps[k]->l_initfini; The load from unmapped memory leads to the segmentation fault. The stack corruption also happens on other architectures. I saw them e.g. on x86 and ppc, too. This patch adds an aio_suspend call to ensure, that the read request is finished before returning from do_test(). ChangeLog: * nptl/tst-cancel17.c (do_test): Wait for finishing aio_read(&a). (cherry picked from commit b3a810d0d3d5c6ce7ddfb61321cd7971808ca703) (cherry picked from commit 6bf10d196d2935195ed46a52466f97c517dd6075)
2016-11-12MIPS: run tst-mode-switch-{1,2,3}.c using test-skeleton.cAurelien Jarno
For some reasons I have not investigated yet, tst-mode-switch-1 hangs on a MIPS UTM-8 machine running an o32 userland and a 3.6.1 kernel. This patch changes the test so that it runs under the test-skeleton framework, causing the test to fail after a timeout instead of hanging the whole testsuite. At the same time, also change the tst-mode-switch-2 and tst-mode-switch-3 tests. Changelog: * sysdeps/mips/tst-mode-switch-1.c (main): Converted to ... (do_test): ... this. (TEST_FUNCTION): New macro. Include test-skeleton.c. * sysdeps/mips/tst-mode-switch-2.c (main): Likewise. * sysdeps/mips/tst-mode-switch-3.c (main): Likewise. (cherry picked from commit 0cdaef4dac5a885af9848e158e77cc347ee781bb) (cherry picked from commit cacad9315ebcf5a0c067950500cc7c31b442af22)
2016-11-12MIPS, SPARC: more fixes to the vfork aliases in libpthread.soAurelien Jarno
Commit 43c29487 tried to fix the vfork aliases in libpthread.so on MIPS and SPARC, but failed to do it correctly, introducing an ABI change. This patch does the remaining changes needed to align the MIPS and SPARC vfork implementations with the other architectures. That way the the alpha version of pt-vfork.S works correctly for MIPS and SPARC. The changes for alpha were done in 82aab97c. Changelog: * sysdeps/unix/sysv/linux/mips/vfork.S (__vfork): Rename into __libc_vfork. (__vfork) [IS_IN (libc)]: Remove alias. (__libc_vfork) [IS_IN (libc)]: Define as an alias. * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise. (cherry picked from commit b87c1ec3fa398646f042a68f0ce0f7d09c1348c7) (cherry picked from commit d16e36e575b7ac0c4ab74f43c9a752c631b943c9)
2016-11-12MIPS, SPARC: fix wrong vfork aliases in libpthread.soAurelien Jarno
With recent binutils versions the GNU libc fails to build on at least MISP and SPARC, with this kind of error: /home/aurel32/glibc/glibc-build/nptl/libpthread.so:(*IND*+0x0): multiple definition of `vfork@GLIBC_2.0' /home/aurel32/glibc/glibc-build/nptl/libpthread.so::(.text+0xee50): first defined here It appears that on these architectures pt-vfork.S includes vfork.S (through the alpha version of pt-vfork.S) and that the __vfork aliases are not conditionalized on IS_IN (libc) like on other architectures. Therefore the aliases are also wrongly included in libpthread.so. Fix this by properly conditionalizing the aliases like on other architectures. Changelog: * sysdeps/unix/sysv/linux/mips/vfork.S (__vfork): Conditionalize hidden_def, weak_alias and strong_alias on [IS_IN (libc)]. * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise. (cherry picked from commit 43c2948756bb6e144c7b871e827bba37d61ad3a3) (cherry picked from commit 80bf719031867f6afa96be7813f4dea1296d6bfd)
2016-11-12libio: Fix fmemopen append mode failure (BZ# 20012)Adhemerval Zanella
The fmemopen implementation does not account the file position correctly in append mode. The following example shows the failure: === int main () { char buf[10] = "test"; FILE *fp = fmemopen (buf, 10, "a+"); fseek (fp, 0, SEEK_SET); int gr; if ((gr = getc (fp)) != 't' || (gr = getc (fp)) != 'e' || (gr = getc (fp)) != 's' || (gr = getc (fp)) != 't' || (gr = getc (fp)) != EOF) { printf ("%s: getc failed returned %i\n", __FUNCTION__, gr); return 1; } return 0; } === This is due both how read and write operation update the buffer position, taking in consideration buffer lenght instead of maximum position defined by the open mode. This patch fixes it and also fixes fseek not returning EINVAL for invalid whence modes. Tested on x86_64 and i686. This is a backport of b65b205fbcabbb02463e31df17f5cabf7556f892. [BZ #20012] * libio/fmemopen.c (fmemopen_read): Use buffer maximum position, not length to calculate the buffer to read. (fmemopen_write): Set the buffer position based on bytes written. (fmemopen_seek): Return EINVAL for invalid whence modes. (cherry picked from commit 321e1cef26ccbece949b16622ef74c203bd8ecc6)
2016-11-12libio: Update internal fmemopen position after write (BZ #20005)Adhemerval Zanella
Current GLIBC fmemopen fails with a simple testcase: char buffer[500] = "x"; FILE *stream; stream = fmemopen(buffer, 500, "r+"); fwrite("fish",sizeof(char),5,stream); printf("pos-1:%ld\n",ftell(stream)); fflush(stream); printf("pos-2:%ld\n",ftell(stream)); It returns: pos-1:5 pos-2:0 Where it should return: pos-1:5 pos-2:5 This is due the internal write function does not correctly update the internal object position state and then the seek operation returns a wrong value. This patch fixes it. It fixes both BZ #20005 and BZ #19230 (marked as duplicated). A new test is added to check for such case. Tested on x86_64 and i686. This is a backport of f9123b5003e62b6e54996076e860f23aee9a0593. * libio/fmemopen.c (fmemopen_write): Update internal position after write. * stdio-common/Makefile (tests): Add tst-fmemopen4.c. * stdio-common/tst-fmemopen4.c: New file.. (cherry picked from commit c2fba3b047c2fac50985a47ff96075b5d9078432)
2016-11-12fork in libpthread cannot use IFUNC resolver [BZ #19861]Florian Weimer
This commit only addresses the fork case, the vfork case has to be a tail call, which is why the generic code needs an IFUNC resolver there. (cherry picked from commit f06f3f05b48c72e2c9b0fa78671f94fd22d67da8) (cherry picked from commit 1915d6d182a55d1eb852643a78ac24bc17783fb0)
2016-11-12test-skeleton.c: Do not set RLIMIT_DATA [BZ #19648]Florian Weimer
With older kernels, it is mostly ineffective because it causes malloc to switch from sbrk to mmap (potentially invalidating malloc testing compared to what real appliations do). With newer kernels which have switched to enforcing RLIMIT_DATA for mmap as well, some test cases will fail in an unintended fashion because the limit which was set previously does not include room for all mmap mappings. (cherry picked from commit 900056024b75eae8b550d7fee1dec9e71f28344e) (cherry picked from commit e6eea05ee7bc49dbe9531620595fd7f6ca587dcd)
2016-11-12Make padding in struct sockaddr_storage explicit [BZ #20111]Florian Weimer
This avoids aliasing issues with GCC 6 in -fno-strict-aliasing mode. (With implicit padding, not all data is copied.) This change makes it explicit that struct sockaddr_storage is only 126 bytes large on m68k (unlike elsewhere, where we end up with the requested 128 bytes). The new test case makes sure that this does not happen on other architectures. (cherry picked from commit 3375cfafa7961c6ae0e509c31c3b3cef9ad1f03d) (cherry picked from commit f2225475118c8804b1b31731bdfb3f76eb179e6d)
2016-11-12CVE-2016-4429: sunrpc: Do not use alloca in clntudp_call [BZ #20112]Florian Weimer
The call is technically in a loop, and under certain circumstances (which are quite difficult to reproduce in a test case), alloca can be invoked repeatedly during a single call to clntudp_call. As a result, the available stack space can be exhausted (even though individual alloca sizes are bounded implicitly by what can fit into a UDP packet, as a side effect of the earlier successful send operation). (cherry picked from commit bc779a1a5b3035133024b21e2f339fe4219fb11c) (cherry picked from commit bdce95930e1d9a7d013d1ba78740243491262879)
2016-11-12tst-mallocfork2: Fix race condition, use fewer resourcesFlorian Weimer
The first SIGUSR1 signal could arrive when sigusr1_sender_pid was still 0. As a result, kill would send SIGSTOP to the entire process group. This would cause the test to hang before printing any output. This commit also adds a sched_yield to the signal source, so that it does not flood the parent process with signals it has never a chance to handle. Even with these changes, tst-mallocfork2 still fails reliably after the fix in commit commit 56290d6e762c1194547e73ff0b948cd79d3a1e03 (Increase fork signal safety for single-threaded processes) is backed out. (cherry picked from commit e2cd73a2ccabe8acae28719a0c3c1c03f2b5f9fb) The backport increases the timeout to 20 seconds, in line with the default on master. (The branch default of 2 seconds is too tight.) (cherry picked from commit 25a34b0ac1356c1442380db2d2b13e05ccaeedd9)
2016-11-12Increase fork signal safety for single-threaded processes [BZ #19703]Florian Weimer
This provides a band-aid and addresses the scenario where fork is called from a signal handler while the process is in the malloc subsystem (or has acquired the libio list lock). It does not address the general issue of async-signal-safety of fork; multi-threaded processes are not covered, and some glibc subsystems have fork handlers which are not async-signal-safe. (cherry picked from commit 56290d6e762c1194547e73ff0b948cd79d3a1e03) (cherry picked from commit 2143af6a47027c48d8dc168e255d8f527377bc56)
2016-11-12Fix strfmon_l: Use specified locale for number formatting [BZ #19633]Stefan Liebler
The commit 985fc132f23dbb83de76c5af9e783ef1b5900148 "strfmon_l: Use specified locale for number formatting [BZ #19633]" introduced an elf/check-abi-libc testfailure due to __printf_fp_l on architectures which use sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h. This patch uses libc_hidden_def instead of ldbl_hidden_def. The ldbl_strong_alias is removed due to the rename of ___printf_fp_l to __printf_fp_l. ChangeLog: * stdio-common/printf_fp.c (__printf_fp_l): Rename ___printf_fp_l to __printf_fp_l and remove strong alias. Use libc_hidden_def instead of ldbl_hidden_def macro. (cherry picked from commit b1b8f5d89d06a994773e22ad4b7fe1036b37f8ab) (cherry picked from commit a37d61a662027a5d92fa54ceb75cd3167d732b5f)
2016-11-12CVE-2016-3706: getaddrinfo: stack overflow in hostent conversion [BZ #20010]Florian Weimer
When converting a struct hostent response to struct gaih_addrtuple, the gethosts macro (which is called from gaih_inet) used alloca, without malloc fallback for large responses. This commit changes this code to use calloc unconditionally. This commit also consolidated a second hostent-to-gaih_addrtuple conversion loop (in gaih_inet) to use the new conversion function. (cherry picked from commit 4ab2ab03d4351914ee53248dc5aef4a8c88ff8b9) (cherry picked from commit 1a8a7c12950a0026a3c406a7cb1608f96aa1460e)
2016-11-12Revert "Report dlsym, dlvsym lookup errors using dlerror [BZ #19509]"Florian Weimer
This reverts commits 80f87443eed17838fe453f1f5406ccf5d3698c25 and a824d609581d5ee7544aabcbbc70e8da44b2b5b6. See bug 20069. We can revisit this change once there has been a GCC release with a fix for Address Sanitizer. (cherry picked from commit 24e2b1cede1952d7d4411a3cafd25dd8593dab9f)
2016-11-12Remove trailing newline from date_fmt in Serbian locales [BZ #19581]Florian Weimer
(cherry picked from commit ff889b196575c2fbf6aa7130abb1ec862714ea4e) (cherry picked from commit bbea74b29974d559604691441d12ea80b2abe919)
2016-11-12Fix tst-dlsym-error buildAdhemerval Zanella
This patch fixes the new test tst-dlsym-error build on aarch64 (and possible other architectures as well) due missing strchrnul definition. * elf/tst-dlsym-error.c: Include <string.h> for strchrnul. (cherry picked from commit e91bd7465816f474617dcb4bbfe72f3594c5783c) (cherry picked from commit a824d609581d5ee7544aabcbbc70e8da44b2b5b6)
2016-11-12Report dlsym, dlvsym lookup errors using dlerror [BZ #19509]Florian Weimer
* elf/dl-lookup.c (_dl_lookup_symbol_x): Report error even if skip_map != NULL. * elf/tst-dlsym-error.c: New file. * elf/Makefile (tests): Add tst-dlsym-error. (tst-dlsym-error): Link against libdl. (cherry picked from commit 7d45c163d00c88d5875a112343c4ea3e61349e6b) (cherry picked from commit 80f87443eed17838fe453f1f5406ccf5d3698c25)
2016-11-12ldconfig: Do not remove stale symbolic links with -X [BZ #19610]Florian Weimer
(cherry picked from commit 920b35c92ed8f41796c090c2819434e56701da5b) (cherry picked from commit c4294bd8620fabf0afddc2b85701371fafd40a6b)
2016-11-12CVE-2016-1234: glob: Do not copy d_name field of struct dirent [BZ #19779]Florian Weimer
Instead, we store the data we need from the return value of readdir in an object of the new type struct readdir_result. This type is independent of the layout of struct dirent. (cherry picked from commit 5171f3079f2cc53e0548fc4967361f4d1ce9d7ea) (cherry picked from commit c87db3fcbdf890990b44d956621763538c878cd3)
2016-11-12glob: Simplify the interface for the GLOB_ALTDIRFUNC callback gl_readdirFlorian Weimer
Previously, application code had to set up the d_namlen member if the target supported it, involving conditional compilation. After this change, glob will use the length of the string in d_name instead of d_namlen to determine the file name length. All glibc targets provide the d_type and d_ino members, and setting them as needed for gl_readdir is straightforward. Changing the behavior with regards to d_ino is left to a future cleanup. (cherry picked from commit 137fe72eca6923a00381a3ca9f0e7672c1f85e3f) (cherry picked from commit 68302147ee061c69eb447e243ad9a18ef4cfbc4c)
2016-11-12strfmon_l: Use specified locale for number formatting [BZ #19633]Florian Weimer
(cherry picked from commit 985fc132f23dbb83de76c5af9e783ef1b5900148) (cherry picked from commit 90c0f166e9fd6b2c7685437558cf7e8f8bc6876a)
2016-11-12tst-audit10: Fix compilation on compilers without bit_AVX512F [BZ #19860]Florian Weimer
[BZ# 19860] * sysdeps/x86_64/tst-audit10.c (avx512_enabled): Always return zero if the compiler does not provide the AVX512F bit. (cherry picked from commit f327f5b47be57bc05a4077344b381016c1bb2c11) (cherry picked from commit 4cf055a2a331b7361622dc9ac8993b59c6f0ef59)
2016-11-12Fix tst-audit10 build when -mavx512f is not supported.Roland McGrath
(cherry picked from commit 3bd80c0de2f8e7ca8020d37739339636d169957e) (cherry picked from commit d603d94994a1d326ebc9e93c8be892acc834a114)
2016-11-12tst-audit4, tst-audit10: Compile AVX/AVX-512 code separately [BZ #19269]Florian Weimer
This ensures that GCC will not use unsupported instructions before the run-time check to ensure support. (cherry picked from commit 3c0f7407eedb524c9114bb675cd55b903c71daaa) (cherry picked from commit 7fa9775594b1592dfcdad5bc32ea449882ca9d9a)
2016-11-12resolv: Always set *resplen2 out parameter in send_vc [BZ #19825]Florian Weimer
In various error scenarios (for example, if the server closes the TCP connection before sending the full response), send_vc can return without resetting the *resplen2 value. This can pass uninitialized or unexpected data to the caller. (cherry picked from commit b9bdfa7c8fa22c944bb5f21a673dfd1f91b71c56) (cherry picked from commit 075b2665b159491fdd17f5aee90d47fa7388ed6f)
2016-11-12nss_dns: Skip over non-PTR records in the netent code [BZ #19868]Florian Weimer
This requires additional checks for the RDATA length and the availability of record metadata. (cherry picked from commit a12f9431b3808e78b9ed397e4fce7de69410d94d) (cherry picked from commit 1e5ac8a1daa360cd9632e5056e4bdf29e18ac2c7)