about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* malloc/tst-mallocfork2: Use process-shared barriers fw/tst-mallocfork2Florian Weimer2019-05-033-52/+106
| | | | | | | | This synchronization method has a lower overhead and makes it more likely that the signal arrives during one of the critical functions. Also test for fork deadlocks explicitly.
* misc/tst-tsearch: Additional explicit error checkingFlorian Weimer2019-05-032-0/+6
| | | | This avoids an undefined variable warning with certain GCC versions.
* Add missing bug number on CL entry for BZ#24506 (b2af6fb2ed239)Adhemerval Zanella2019-05-021-0/+1
|
* elf: Fix elf/tst-pldd with --enable-hardcoded-path-in-tests (BZ#24506)Adhemerval Zanella2019-05-022-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | The elf/tst-pldd (added by 1a4c27355e146 to fix BZ#18035) test does not expect the hardcoded paths that are output by pldd when the test is built with --enable-hardcoded-path-in-tests. Instead of showing the ABI installed library names for loader and libc (such as ld-linux-x86-64.so.2 and libc.so.6 for x86_64), pldd shows the default built ld.so and libc.so. It makes the tests fail with an invalid expected loader/libc name. This patch fixes the elf-pldd test by adding the canonical ld.so and libc.so names in the expected list of possible outputs when parsing the result output from pldd. The test now handles both default build and --enable-hardcoded-path-in-tests option. Checked on x86_64-linux-gnu (built with and without --enable-hardcoded-path-in-tests) and i686-linux-gnu. * elf/tst-pldd.c (in_str_list): New function. (do_test): Add default names for ld and libc as one option. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* misc: Add twalk_r functionFlorian Weimer2019-05-0237-4/+315
| | | | | | | | | The twalk function is very difficult to use in a multi-threaded program because there is no way to pass external state to the iterator function. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Make mktime etc. compatible with __time64_tPaul Eggert2019-04-306-54/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep these functions compatible with Gnulib while adding __time64_t support. The basic idea is to move private API declarations from include/time.h to time/mktime-internal.h, since the former file cannot easily be shared with Gnulib whereas the latter can. Also, do some other minor cleanup while in the neighborhood. * include/time.h: Include stdbool.h, time/mktime-internal.h. (__mktime_internal): Move this prototype to time/mktime-internal.h, since Gnulib needs it. (__localtime64_r, __gmtime64_r) [__TIMESIZE == 64]: Move these macros to time/mktime-internal.h, since Gnulib needs them. (__mktime64, __timegm64) [__TIMESIZE != 64]: New prototypes. (in_time_t_range): New static function. * posix/bits/types.h (__time64_t) [__TIMESIZE == 64 && !defined __LIBC]: Do not define as a macro in this case, so that portable code is less tempted to use __time64_t. * time/mktime-internal.h: Rewrite so that it does both glibc and Gnulib work. Include time.h if not _LIBC. (mktime_offset_t) [!_LIBC]: Define for gnulib. (__time64_t, __gmtime64_r, __localtime64_r, __mktime64, __timegm64) [!_LIBC || __TIMESIZE == 64]: New macros, mostly moved here from include/time.h. (__gmtime_r, __localtime_r, __mktime_internal) [!_LIBC]: New macros, taken from GNulib. (__mktime_internal): New prototype, moved here from include/time.h. * time/mktime.c (mktime_min, mktime_max, convert_time) (ranged_convert, __mktime_internal, __mktime64): * time/timegm.c (__timegm64): Use __time64_t, not time_t. * time/mktime.c: Stop worrying about whether time_t is floating-point. (__mktime64) [! (_LIBC && __TIMESIZE != 64)]: Rename from mktime. (mktime) [_LIBC && __TIMESIZE != 64]: New function. * time/timegm.c [!_LIBC]: Include libc-config.h, not config.h, for libc_hidden_def. Include errno.h. (__timegm64) [! (_LIBC && __TIMESIZE != 64)]: Rename from timegm. (timegm) [_LIBC && __TIMESIZE != 64]: New function. First cut at publicizing __time64_t
* Fix -O1 compilation errors with `__ddivl' and `__fdivl' [BZ #19444]Maciej W. Rozycki2019-04-303-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Complementing commit 4a06ceea33ec ("sysdeps/ieee754/soft-fp: ignore maybe-uninitialized with -O [BZ #19444]") and commit 27c5e756a2a8 ("sysdeps/ieee754: prevent maybe-uninitialized errors with -O [BZ #19444]") also fix compilation errors observed at -O1 in `__ddivl' and `__fdivl' with GCC 9 and RISC-V targets: In file included from ../soft-fp/soft-fp.h:318, from ../sysdeps/ieee754/soft-fp/s_fdivl.c:27: ../sysdeps/ieee754/soft-fp/s_fdivl.c: In function '__fdivl': ../soft-fp/op-2.h:108:9: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized] 108 | : (X##_f1 << (2*_FP_W_TYPE_SIZE - (N)))) \ | ^ ../sysdeps/ieee754/soft-fp/s_fdivl.c:37:14: note: 'R_f1' was declared here 37 | FP_DECL_Q (R); | ^ ../soft-fp/op-common.h:39:3: note: in expansion of macro '_FP_FRAC_DECL_2' 39 | _FP_FRAC_DECL_##wc (X) | ^~~~~~~~~~~~~~ ../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL' 226 | # define FP_DECL_Q(X) _FP_DECL (2, X) | ^~~~~~~~ ../sysdeps/ieee754/soft-fp/s_fdivl.c:37:3: note: in expansion of macro 'FP_DECL_Q' 37 | FP_DECL_Q (R); | ^~~~~~~~~ ../soft-fp/op-2.h:109:8: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized] 109 | | X##_f0) != 0)); \ | ^ ../sysdeps/ieee754/soft-fp/s_fdivl.c:37:14: note: 'R_f0' was declared here 37 | FP_DECL_Q (R); | ^ ../soft-fp/op-common.h:39:3: note: in expansion of macro '_FP_FRAC_DECL_2' 39 | _FP_FRAC_DECL_##wc (X) | ^~~~~~~~~~~~~~ ../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL' 226 | # define FP_DECL_Q(X) _FP_DECL (2, X) | ^~~~~~~~ ../sysdeps/ieee754/soft-fp/s_fdivl.c:37:3: note: in expansion of macro 'FP_DECL_Q' 37 | FP_DECL_Q (R); | ^~~~~~~~~ In file included from ../soft-fp/soft-fp.h:318, from ../sysdeps/ieee754/soft-fp/s_ddivl.c:31: ../sysdeps/ieee754/soft-fp/s_ddivl.c: In function '__ddivl': ../soft-fp/op-2.h:98:25: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized] 98 | X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \ | ^~ ../sysdeps/ieee754/soft-fp/s_ddivl.c:41:14: note: 'R_f1' was declared here 41 | FP_DECL_Q (R); | ^ ../soft-fp/op-2.h:37:36: note: in definition of macro '_FP_FRAC_DECL_2' 37 | _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT | ^ ../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL' 226 | # define FP_DECL_Q(X) _FP_DECL (2, X) | ^~~~~~~~ ../sysdeps/ieee754/soft-fp/s_ddivl.c:41:3: note: in expansion of macro 'FP_DECL_Q' 41 | FP_DECL_Q (R); | ^~~~~~~~~ ../soft-fp/op-2.h:101:17: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized] 101 | : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \ | ^~ ../sysdeps/ieee754/soft-fp/s_ddivl.c:41:14: note: 'R_f0' was declared here 41 | FP_DECL_Q (R); | ^ ../soft-fp/op-2.h:37:14: note: in definition of macro '_FP_FRAC_DECL_2' 37 | _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT | ^ ../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL' 226 | # define FP_DECL_Q(X) _FP_DECL (2, X) | ^~~~~~~~ ../sysdeps/ieee754/soft-fp/s_ddivl.c:41:3: note: in expansion of macro 'FP_DECL_Q' 41 | FP_DECL_Q (R); | ^~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [.../sysd-rules:587: .../math/s_fdivl.o] Error 1 make[2]: *** Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[2]: *** [.../sysd-rules:587: .../math/s_ddivl.o] Error 1 This comes from cases in _FP_DIV that return a result described as FP_CLS_ZERO or FP_CLS_INF and do not initialize the fractional part, which is then operated on unconditionally in FP_TRUNC_COOKED before being ignored by _FP_PACK_CANONICAL. Clearly at this optimization level GCC cannot guarantee to be able to determine that the fractional part is ultimately unused, so ignore the error as with the earlier commits referred, letting compilation proceed. [BZ #19444] * sysdeps/ieee754/soft-fp/s_ddivl.c (__ddivl): Ignore errors from `-Wmaybe-uninitialized'. * sysdeps/ieee754/soft-fp/s_fdivl.c (__fdivl): Likewise.
* powerpc: ceil/ceilf refactorAdhemerval Zanella2019-04-2934-637/+275
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patches consolidates all the powerpc ceil{f} implementations on the generic sysdeps/powerpc/fpu/s_ceil{f}. The generic implementation uses either the compiler builts for ISA 2.03+ (which generates the frip instruction) or a generic implementation which uses FP only operations. It adds a generic implementation (round_to_integer.h) which is shared with other rounding to integer routines. The resulting code should be similar in term os performance to previous assembly one. The IFUNC organization for powerpc64 is also change to be enabled only for powerpc64 and not for powerpc64le (since minium ISA of 2.08 does not require the fallback generic implementation). Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/fenv_libc.h (__fesetround_inline_nocheck): New function. * sysdeps/powerpc/fpu/round_to_integer.h: New file. * sysdeps/powerpc/fpu/s_ceil.c: Likewise. * sysdeps/powerpc/fpu/s_ceilf.c: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile (CFLAGS-s_ceil-power5+.c, CFLAGS-s_ceilf-power5+.c): New rule. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c: New file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Remove file. * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile: New file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c: ... here. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c: New file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c: ... * here. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_ceil-power5+, s_ceil-ppc64, s_ceilf-power5+, and s_ceilf-ppc64. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise. Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
* powerpc: Remove power4 mpa optimizationAdhemerval Zanella2019-04-294-275/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the POWER4 optimized mpa optimization used currently on all powerpc targets. In fact for newer chips, GCC generates *worse* code than generic implementation as below. One possibilty would to add ifunc variants for the mpa routines (as x86_64), but it will add complexity only for older chips (and one would need to check if power5, power5+, and power6 do benefict from this optimization), and only for specific implementation (since most used one such as sin, cos, exp, pow where optimized to avoid calling the slow multiprecision path). * POWER9 patched $ ./testrun.sh benchtests/bench-atan "atan": { "": { "duration": 5.12565e+09, "iterations": 1.552e+08, "max": 100.552, "min": 7.799, "mean": 33.0261 }, "144bits": { "duration": 5.12745e+09, "iterations": 825000, "max": 7517.17, "min": 6186.3, "mean": 6215.09 } } $ ./testrun.sh benchtests/bench-acos "acos": { "": { "duration": 5.21741e+09, "iterations": 1.269e+08, "max": 191.738, "min": 7.931, "mean": 41.1144 }, "slow": { "duration": 5.25999e+09, "iterations": 198000, "max": 26681.7, "min": 26463.6, "mean": 26565.6 } } * POWER9 master $ ./testrun.sh benchtests/bench-atan "atan": { "": { "duration": 5.12815e+09, "iterations": 1.552e+08, "max": 134.788, "min": 7.803, "mean": 33.0422 }, "144bits": { "duration": 5.1209e+09, "iterations": 447000, "max": 11615.8, "min": 11301.8, "mean": 11456.2 } } $ ./testrun.sh benchtests/bench-acos "acos": { "": { "duration": 5.22272e+09, "iterations": 1.269e+08, "max": 115.981, "min": 7.931, "mean": 41.1562 }, "slow": { "duration": 5.28723e+09, "iterations": 96000, "max": 55434.1, "min": 54820.6, "mean": 55075.3 } } * POWER8 patched $ taskset -c 16 ./testrun.sh benchtests/bench-acos "acos": { "": { "duration": 5.16398e+09, "iterations": 9.99e+07, "max": 174.408, "min": 8.645, "mean": 51.6915 }, "slow": { "duration": 5.16982e+09, "iterations": 96000, "max": 54830.5, "min": 53703.8, "mean": 53852.3 } } * POWER8 master $ taskset -c 16 ./testrun.sh benchtests/bench-acos "acos": { "": { "duration": 5.17019e+09, "iterations": 9.99e+07, "max": 186.127, "min": 8.633, "mean": 51.7537 }, "slow": { "duration": 5.34225e+09, "iterations": 90000, "max": 60353.2, "min": 59155.3, "mean": 59358.4 } } * POWER7 patched $ taskset -c 16 benchtests/bench-asin "asin": { "": { "duration": 5.15559e+09, "iterations": 6.5e+07, "max": 193.335, "min": 12.227, "mean": 79.3168 }, "slow": { "duration": 5.20538e+09, "iterations": 80000, "max": 65705.2, "min": 64299.4, "mean": 65067.3 } } * POWER7 master $ taskset -c 16 benchtests/bench-asin "asin": { "": { "duration": 5.15446e+09, "iterations": 6.5e+07, "max": 184.575, "min": 12.226, "mean": 79.2994 }, "slow": { "duration": 5.20616e+09, "iterations": 80000, "max": 65705.1, "min": 64336.6, "mean": 65076.9 } } Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/power4/fpu/Makefile: Remove file. * sysdeps/powerpc/power4/fpu/mpa-arch.h: Likewise. * sysdeps/powerpc/power4/fpu/mpa.c: Likewise. Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
* <semaphore.h>: Add nonnull attributesYann Droneaud2019-04-292-10/+20
| | | | | | | | | | | | | | Except the following functions, NPTL implementation assume sem_t argument (or other arguments) are not NULL, so they would benefit from having the nonnull attribute. - sem_close(): can cope with a NULL sem_t and return -1 with error EINVAL; - sem_destroy(): does nothing at all * sysdeps/pthread/semaphore.h (sem_init): Add __nonnull attribute. (sem_destroy, sem_open, sem_close, sem_unlink): Likewise. (sem_wait, sem_timedwait, sem_trywait, sem_post): Likewise. (sem_getvalue): Likewise.
* elf: Link sotruss-lib.so with BIND_NOW for --enable-bind-nowFlorian Weimer2019-04-262-0/+6
| | | | | | | | | The audit module itself can be linked with BIND_NOW; it does not affect its functionality. This should complete the leftovers from commit 2d6ab5df3b675e96ee587ae6a8c2ce004c6b1ba9 ("Document and fix --enable-bind-now [BZ #21015]").
* Makeconfig: Move -Wl,-rpath-link options before library referencesFlorian Weimer2019-04-262-5/+29
| | | | | | | | | | | | | | | | | | | Previously, the -Wl,-rpath-link options came after the libraries injected using LDLIBS-* variables on the link editor command line for main programs. As a result, it could happen that installed libraries that reference glibc libraries used the installed glibc from the system directories, instead of the glibc from the build tree. This can lead to link failures if the wrong version of libpthread.so.0 is used, for instance, due to differences in the internal GLIBC_PRIVATE interfaces, as seen with memusagestat and -lgd after commit f9b645b4b0a10c43753296ce3fa40053fa44606a ("memusagestat: use local glibc when linking [BZ #18465]"). The isolation is necessarily imperfect because these installed libraries are linked against the installed glibc in the system directories. However, in most cases, the built glibc will be newer than the installed glibc, and this link is permitted because of the ABI backwards compatibility glibc provides.
* Makeconfig: Move $(CC) to +link command variablesFlorian Weimer2019-04-262-13/+26
| | | | | | This change is needed to add linker flags which come very early in the command linke (before LDFLAGS) and are not applied to test programs (only to installed programs).
* riscv: remove DL_RO_DYN_SECTIONDavid Abdurachmanov2019-04-252-4/+5
| | | | | | | | | | | | | | While working on enabling D front-end (GDC) in GCC we noticed that druntime was segfaulting if it is linked dynamically. This was tracked to DL_RO_DYN_SECTION. DL_RO_DYN_SECTION lines seem to be copied from MIPS file (which is the only user of it), but the comment doesn't apply to RISC-V. There is no such requirement in RISC-V ABI. [BZ#24484] * sysdeps/riscv/ldsodefs.h: Remove DL_RO_DYN_SECTION as it is not required by RISC-V ABI.
* benchtests: Enable BIND_NOW if configured with --enable-bind-nowFlorian Weimer2019-04-252-2/+17
| | | | | | | | | | | Benchmarks should reflect distribution build policies, so it makes sense to honor the BIND_NOW configuration for them. This commit keeps using $(+link-tests), so that the benchmarks are linked according to the --enable-hardcoded-path-in-tests configure option. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Extend BIND_NOW to installed programs with --enable-bind-nowFlorian Weimer2019-04-255-11/+27
| | | | | | | | Commit 2d6ab5df3b675e96ee587ae6a8c2ce004c6b1ba9 ("Document and fix --enable-bind-now [BZ #21015]") extended BIND_NOW to all installed shared objects. This change also covers installed programs. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Reduce benchtests timeWilco Dijkstra2019-04-243-3/+8
| | | | | | | | | | | Reduce the total time taken by benchtests. The malloc thread test takes 4 minutes to run which is significantly more than most other tests. Reduce this to a more reasonable 40 seconds. The math tests take 10 seconds each, eventhough all they do is loop on the same input. Anything more than 1 second runtime is way overkill, so set the limit to 1 second. * benchtests/Makefile (BENCH_DURATION): Set to 1 second. * benchtests/bench-malloc-thread.c (BENCH_DURATION): Set to 10 seconds.
* memusagestat: use local glibc when linking [BZ #18465]Mike Frysinger2019-04-242-2/+9
| | | | | | | | | The memusagestat is the only binary that has its own link line which causes it to be linked against the existing installed C library. It has been this way since it was originally committed in 1999, but I don't see any reason as to why. Since we want all the programs we build locally to be against the new copy of glibc, change the build to be like all other programs.
* locale/tst-locale-locpath: Run test only for $(run-built-tests) == yesFlorian Weimer2019-04-242-1/+10
|
* elf: Fix pldd (BZ#18035)Adhemerval Zanella2019-04-235-108/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 9182aa67994 (Fix vDSO l_name for GDB's, BZ#387) the initial link_map for executable itself and loader will have both l_name and l_libname->name holding the same value due: elf/dl-object.c 95 new->l_name = *realname ? realname : (char *) newname->name + libname_len - 1; Since newname->name points to new->l_libname->name. This leads to pldd to an infinite call at: elf/pldd-xx.c 203 again: 204 while (1) 205 { 206 ssize_t n = pread64 (memfd, tmpbuf.data, tmpbuf.length, name_offset); 228 /* Try the l_libname element. */ 229 struct E(libname_list) ln; 230 if (pread64 (memfd, &ln, sizeof (ln), m.l_libname) == sizeof (ln)) 231 { 232 name_offset = ln.name; 233 goto again; 234 } Since the value at ln.name (l_libname->name) will be the same as previously read. The straightforward fix is just avoid the check and read the new list entry. I checked also against binaries issues with old loaders with fix for BZ#387, and pldd could dump the shared objects. Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, and powerpc64le-linux-gnu. [BZ #18035] * elf/Makefile (tests-container): Add tst-pldd. * elf/pldd-xx.c: Use _Static_assert in of pldd_assert. (E(find_maps)): Avoid use alloca, use default read file operations instead of explicit LFS names, and fix infinite loop. * elf/pldd.c: Explicit set _FILE_OFFSET_BITS, cleanup headers. (get_process_info): Use _Static_assert instead of assert, use default directory operations instead of explicit LFS names, and free some leadek pointers. * elf/tst-pldd.c: New file.
* Remove do_set_mallopt_check prototypeH.J. Lu2019-04-232-1/+4
| | | | | | | | | Remove do_set_mallopt_check prototype since it is unused. * malloc/arena.c (do_set_mallopt_check): Removed. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: DJ Delorie <dj@redhat.com>
* locale: Add LOCPATH diagnostics to the locale programFlorian Weimer2019-04-234-9/+229
| | | | | | The implementation of quote_string is based on support_quote_blob. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Fix NEWS entry from 9bf8e29ca136Adhemerval Zanella2019-04-212-6/+11
| | | | | * NEWS: Move memory allocation changes of BZ#23741 from 2.29 to 2.30 notes.
* malloc: make malloc fail with requests larger than PTRDIFF_MAX (BZ#23741)Adhemerval Zanella2019-04-1812-88/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed previously on libc-alpha [1], this patch follows up the idea and add both the __attribute_alloc_size__ on malloc functions (malloc, calloc, realloc, reallocarray, valloc, pvalloc, and memalign) and limit maximum requested allocation size to up PTRDIFF_MAX (taking into consideration internal padding and alignment). This aligns glibc with gcc expected size defined by default warning -Walloc-size-larger-than value which warns for allocation larger than PTRDIFF_MAX. It also aligns with gcc expectation regarding libc and expected size, such as described in PR#67999 [2] and previously discussed ISO C11 issues [3] on libc-alpha. From the RFC thread [4] and previous discussion, it seems that consensus is only to limit such requested size for malloc functions, not the system allocation one (mmap, sbrk, etc.). The implementation changes checked_request2size to check for both overflow and maximum object size up to PTRDIFF_MAX. No additional checks are done on sysmalloc, so it can still issue mmap with values larger than PTRDIFF_T depending on the requested size. The __attribute_alloc_size__ is for functions that return a pointer only, which means it cannot be applied to posix_memalign (see remarks in GCC PR#87683 [5]). The runtimes checks to limit maximum requested allocation size does applies to posix_memalign. Checked on x86_64-linux-gnu and i686-linux-gnu. [1] https://sourceware.org/ml/libc-alpha/2018-11/msg00223.html [2] https://gcc.gnu.org/bugzilla//show_bug.cgi?id=67999 [3] https://sourceware.org/ml/libc-alpha/2011-12/msg00066.html [4] https://sourceware.org/ml/libc-alpha/2018-11/msg00224.html [5] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87683 [BZ #23741] * malloc/hooks.c (malloc_check, realloc_check): Use __builtin_add_overflow on overflow check and adapt to checked_request2size change. * malloc/malloc.c (__libc_malloc, __libc_realloc, _mid_memalign, __libc_pvalloc, __libc_calloc, _int_memalign): Limit maximum allocation size to PTRDIFF_MAX. (REQUEST_OUT_OF_RANGE): Remove macro. (checked_request2size): Change to inline function and limit maximum requested size to PTRDIFF_MAX. (__libc_malloc, __libc_realloc, _int_malloc, _int_memalign): Limit maximum allocation size to PTRDIFF_MAX. (_mid_memalign): Use _int_memalign call for overflow check. (__libc_pvalloc): Use __builtin_add_overflow on overflow check. (__libc_calloc): Use __builtin_mul_overflow for overflow check and limit maximum requested size to PTRDIFF_MAX. * malloc/malloc.h (malloc, calloc, realloc, reallocarray, memalign, valloc, pvalloc): Add __attribute_alloc_size__. * stdlib/stdlib.h (malloc, realloc, reallocarray, valloc): Likewise. * malloc/tst-malloc-too-large.c (do_test): Add check for allocation larger than PTRDIFF_MAX. * malloc/tst-memalign.c (do_test): Disable -Walloc-size-larger-than= around tests of malloc with negative sizes. * malloc/tst-posix_memalign.c (do_test): Likewise. * malloc/tst-pvalloc.c (do_test): Likewise. * malloc/tst-valloc.c (do_test): Likewise. * malloc/tst-reallocarray.c (do_test): Replace call to reallocarray with resulting size allocation larger than PTRDIFF_MAX with reallocarray_nowarn. (reallocarray_nowarn): New function. * NEWS: Mention the malloc function semantic change.
* powerpc: Fix format issue from 3a16dd780eeba602Adhemerval Zanella2019-04-173-2/+7
| | | | | * sysdeps/powerpc/fpu/s_fma.c: Fix format. * sysdeps/powerpc/fpu/s_fmaf.c: Likewise.
* powerpc: fma using builtinsAdhemerval Zanella2019-04-173-14/+15
| | | | | | | | | | | | | | | This patch just refactor the assembly implementation to use compiler builtins instead. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/s_fma.S: Remove file. * sysdeps/powerpc/fpu/s_fmaf.S: Likewise. * sysdeps/powerpc/fpu/s_fma.c: New file. * sysdeps/powerpc/fpu/s_fmaf.c: Likewise.
* powerpc: Use generic fabs{f} implementationsAdhemerval Zanella2019-04-173-34/+3
| | | | | | | | | | | | | Since be2e25bbd78f9fdf the generic ieee754 implementation uses compiler builtin which generates fabs{f} for all supported targets. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/s_fabs.S: Remove file. * sysdeps/powerpc/fpu/s_fabsf.S: Likewise.
* mips: Remove rt_sigreturn usage on context functionAdhemerval Zanella2019-04-175-53/+9
| | | | | | | | | | | | | | | | | | Similar to powerpc, mips also issues rt_sigreturn for setcontext case the v0 value saved is not the one set by setcontext or makecontext. As for powerpc, it is intention is no really supported since setcontext is not async-signal-safe. Checked the context tests on mips64-linux-gnu and mips-linux-gnu. * sysdeps/unix/sysv/linux/mips/getcontext.S (__getcontext): Remove the magic flag store. * sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext): Likewise. * sysdeps/unix/sysv/linux/mips/swapcontext.S (__swapcontext): Likewise. * sysdeps/unix/sysv/linux/mips/setcontext.S (__setcontext): Remove rt_sigreturn call.
* powerpc: Remove rt_sigreturn usage on context functionAdhemerval Zanella2019-04-175-162/+7
| | | | | | | | | | | | | | | | | | As described in a recent glibc thread [1], the rt_sigreturn syscall on setcontext and swapcontext is not used on default use and its intention is no really supported since neither setcontext nor swapcontext are async-signal-safe. Checked on powerpc64-linux-gnu and powerpc-linux-gnu. * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S: Remove rt_sigreturn call. * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S: Likewie. * sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S: Likewise. [1] https://sourceware.org/ml/libc-alpha/2019-02/msg00367.html
* support: Add support_capture_subprogramAdhemerval Zanella2019-04-1711-50/+573
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Its API is similar to support_capture_subprocess, but rather creates a new process based on the input path and arguments. Under the hoods it uses posix_spawn to create the new process. It also allows the use of other support_capture_* functions to check for expected results and free the resources. Checked on x86_64-linux-gnu. * support/Makefile (libsupport-routines): Add support_subprocess, xposix_spawn, xposix_spawn_file_actions_addclose, and xposix_spawn_file_actions_adddup2. (tst-support_capture_subprocess-ARGS): New rule. * support/capture_subprocess.h (support_capture_subprogram): New prototype. * support/support_capture_subprocess.c (support_capture_subprocess): Refactor to use support_subprocess and support_capture_poll. (support_capture_subprogram): New function. * support/tst-support_capture_subprocess.c (write_mode_to_str, str_to_write_mode, test_common, parse_int, handle_restart, do_subprocess, do_subprogram, do_multiple_tests): New functions. (do_test): Add support_capture_subprogram tests. * support/subprocess.h: New file. * support/support_subprocess.c: Likewise. * support/xposix_spawn.c: Likewise. * support/xposix_spawn_file_actions_addclose.c: Likewise. * support/xposix_spawn_file_actions_adddup2.c: Likewise. * support/xspawn.h: Likewise. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* stdlib/tst-secure-getenv: handle >64 groupsMike Gerow2019-04-172-4/+20
| | | | | | | This test would fail unnecessarily if the user running it had more than 64 groups since getgroups returns EINVAL if the size provided is less than the number of supplementary group IDs. Instead dynamically determine the number of supplementary groups the user has.
* ChangeLog: Correct excess and deficiency of spacesTAMUKI Shoichi2019-04-171-50/+50
|
* ChangeLog: Convert leading spaces to tabsTAMUKI Shoichi2019-04-161-45/+45
|
* nss_dns: Do not replace root domain with empty stringFlorian Weimer2019-04-113-6/+6
| | | | | | The purpose of the bp[0] == '.' check is unclear. Only the root domain starts with '.'. The empty string is accepted as a domain name in many places, denoting the root, but using it implicitly is confusing.
* alloc_buffer: Return unqualified pointer type in alloc_buffer_nextFlorian Weimer2019-04-112-5/+33
| | | | | | | | alloc_buffer_next is useful for peeking to the remaining part of the buffer and update it, with subsequent allocation (once the length is known) using alloc_buffer_alloc_bytes. This is not as robust as the other interfaces, but it allows using alloc_buffer with string-writing interfaces such as snprintf and ns_name_ntop.
* Add missing ChangeLog entry for commit 10dd69e9a00Florian Weimer2019-04-111-0/+5
|
* Add more bug numbers to historic ChangeLog entriesFlorian Weimer2019-04-111-0/+2
|
* Add missing percent sign to conversion specifierTAMUKI Shoichi2019-04-111-3/+3
|
* Add bug number to historic ChangeLog entryFlorian Weimer2019-04-101-0/+1
|
* malloc: Set and reset all hooks for tracing (Bug 16573)Carlos O'Donell2019-04-092-26/+61
| | | | | | | | | | | | | | | | | | | | If an error occurs during the tracing operation, particularly during a call to lock_and_info() which calls _dl_addr, we may end up calling back into the malloc-subsystem and relock the loader lock and deadlock. For all intents and purposes the call to _dl_addr can call any of the malloc family API functions and so we should disable all tracing before calling such loader functions. This is similar to the strategy that the new malloc tracer takes when calling the real malloc, namely that all tracing ceases at the boundary to the real function and any faults at that point are the purvue of the library (though the new tracer does this on a per-thread basis in an MT-safe fashion). Since the new tracer and the hook deprecation are not yet complete we must fix these issues where we can. Tested on x86_64 with no regressions. Co-authored-by: Kwok Cheung Yeung <kcy@codesourcery.com> Reviewed-by: DJ Delorie <dj@redhat.com>
* Improve string benchtestsWilco Dijkstra2019-04-0910-141/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | Replace slow byte-oriented tests in several string benchmarks with the generic implementations from the string/ directory so the comparisons are more realistic and useful. * benchtests/bench-stpcpy.c (SIMPLE_STPCPY): Remove function. (generic_stpcpy): New function. * benchtests/bench-stpncpy.c (SIMPLE_STPNCPY): Remove function. (generic_stpncpy): New function. * benchtests/bench-strcat.c (SIMPLE_STRCAT): Remove function. (generic_strcat): New function. * benchtests/bench-strcpy.c (SIMPLE_STRCPY): Remove function. (generic_strcpy): New function. * benchtests/bench-strncat.c (SIMPLE_STRNCAT): Remove function. (STUPID_STRNCAT): Remove function. (generic_strncat): New function. * benchtests/bench-strncpy.c (SIMPLE_STRNCPY): Remove function. (STUPID_STRNCPY): Remove function. (generic_strncpy): New function. * benchtests/bench-strnlen.c (SIMPLE_STRNLEN): Remove function. (generic_strnlen): New function. (memchr_strnlen): New function. * benchtests/bench-strlen.c (generic_strlen): Define for WIDE. (memchr_strlen): Likewise.
* Improve bench-strstrWilco Dijkstra2019-04-092-83/+147
| | | | | | | | | | | | | | | | | | | | | Improve bench-strstr by using an extract from the manual as the input to make the test more realistic. Use the same input for both found and fail cases rather than using a memset of '0' for most of the string, which measures performance of strchr rather than strstr. Add result checking to catch potential errors. Remove the repeated tests at slightly different alignments and add more large needle and haystack testcases. Replace stupid_strstr with an efficient basic implementation. Add the Two-way implementation to simplify comparisons with much faster generic implementations. * benchtests/bench-strstr.c (input): Add realistic input text. (stupid_strstr): Remove function. (basic_strstr): Add function. (twoway_strstr): Add function. (do_one_test): Add result checking. (do_test): Use new input text. Remove accidental early matches. (test_main): Improve range of tests, reduce unaligned cases.
* Improve bench-memmemWilco Dijkstra2019-04-092-17/+68
| | | | | | | | | | Improve bench-memmem by replacing simple_memmem with a more efficient implementation. Add the Two-way implementation to enable direct comparison with the optimized memmem. * benchtests/bench-memmem.c (simple_memmem): Remove function. (basic_memmem): Add function. (twoway_memmem): Add function.
* Remove TIMING_INITWilco Dijkstra2019-04-096-17/+9
| | | | | | | | | | Remove TIMING_INIT since it's no longer used. * benchtests/bench-malloc-simple.c: Remove TIMING_INIT. * benchtests/bench-malloc-thread.c: Likewise. * benchtests/bench-skeleton.c: Likewise. * benchtests/bench-strtod.c: Likewise. * benchtests/bench-timing.h: Likewise.
* resolv: Remove RES_INSECURE1, RES_INSECURE2Florian Weimer2019-04-085-23/+25
| | | | Always perform the associated security checks.
* resolv: Remove support for RES_USE_INET6 and the inet6 optionFlorian Weimer2019-04-0815-680/+61
| | | | | | | | | This functionality was deprecated in glibc 2.25. This commit only includes the core changes to remove the functionality. It does not remove the RES_USE_INET6 handling in the individual NSS service modules and the res_use_inet6 function. These changes will happen in future commits.
* aarch64: thunderx2 memcpy implementation cleanup and streamliningAnton Youdkevitch2019-04-052-21/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here is the updated patch for improving the long unaligned code path (the one using "ext" instruction). 1. Always taken conditional branch at the beginning is removed. 2. Epilogue code is placed after the end of the loop to reduce the number of branches. 3. The redundant "mov" instructions inside the loop are gone due to the changed order of the registers in the "ext" instructions inside the loop, the prologue has additional "ext" instruction. 4.Updating count in the prologue was hoisted out as it is the same update for each prologue. 5. Invariant code of the loop epilogue was hoisted out. 6. As the current size of the ext chunk is exactly 16 instructions long "nop" was added at the beginning of the code sequence so that the loop entry for all the chunks be aligned. * sysdeps/aarch64/multiarch/memcpy_thunderx2.S: Cleanup branching and remove redundant code.
* powerpc: Use generic wcsrchr optimizationAdhemerval Zanella2019-04-0416-320/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the power6 wcsrchr optimization and uses generic implementation instead. Currently, both power6 and power7 IFUNC variant resulting binary are essentially the same and the generic implementation with unrolling loop set to 8 also results in similar performance. Checked on powerpc64-linux-gnu. * sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcsrchr.c): New rule. * sysdeps/powerpc/power6/wcsrchr.c: Remove file. * sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c: Likewise. * sysdeps/powerpc/powerpc64/power6/wcsrchr.c: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/Makefile [$(subdir) == wcsmbs] (sysdeps_routines): Remove wcsrchr-power6 and wcsrchr-power7. (CFLAGS-wcsrchr-power7.c, CFLAGS-wcsrchr-power6.c): Remove rule. * sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c: Remove wcsrchr optimizations. * sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
* wcsmbs: Use loop_unroll on wcsrchrAdhemerval Zanella2019-04-042-6/+19
| | | | | | | | | This allows an architecture to set explicit loop unrolling. Checked on aarch64-linux-gnu. * wcsmbs/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize the loop unroll.
* powerpc: Use generic wcschr optimizationAdhemerval Zanella2019-04-0416-362/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the power6 wcschr optimization and uses generic implementation instead. Currently, both power6 and power7 IFUNC variant resulting binary are essentially the same and the generic implementation with unrolling loop set to 8 also results in similar performance. Checked on powerpc64-linux-gnu. * sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcschr.c): New rule. * sysdeps/powerpc/power6/wcschr.c: Remove file. * sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise. * sysdeps/powerpc/powerpc64/power6/wcschr.c: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/Makefile [$(subdir) == wcsmbs] (sysdeps_routines): Remove wcschr-power6 and wcschr-power7. (CFLAGS-wcschr-power7.c, CFLAGS-wcschr-power6.c): Remove rule. * sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c: Remove wcschr optimizations. * sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.