about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor atfork handlersAdhemerval Zanella2018-02-227-315/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation (sysdeps/nptl/fork.c) replicates the atfork handlers list backward to invoke the child handlers after fork/clone syscall. The internal atfork handlers is implemented as a single-linked list so a lock-free algorithm can be used, trading fork mulithread call performance for some code complexity and dynamic stack allocation (since the backwards list should not fail). This patch refactor it to use a dynarary instead of a linked list. It simplifies the external variables need to be exported and also the internal atfork handler member definition. The downside is a serialization of fork call in multithread, since to operate on the dynarray the internal lock should be used. However as noted by Florian, it already acquires external locks for malloc and libio so it is already hitting some lock contention. Besides, posix_spawn should be faster and more scalable to run external programs in multithread environments. Checked on x86_64-linux-gnu. * nptl/Makefile (routines): Remove unregister-atfork. * nptl/register-atfork.c (fork_handler_pool): Remove variable. (fork_handler_alloc): Remove function. (fork_handlers, fork_handler_init): New variables. (__fork_lock): Rename to atfork_lock. (__register_atfork, __unregister_atfork, libc_freeres_fn): Rewrite to use a dynamic array to add/remove atfork handlers. * sysdeps/nptl/fork.c (__libc_fork): Likewise. * sysdeps/nptl/fork.h (__fork_lock, __fork_handlers, __linkin_atfork): Remove declaration. (fork_handler): Remove next, refcntr, and need_signal member. (__run_fork_handler_type): New enum. (__run_fork_handlers): New prototype. * sysdeps/nptl/libc-lockP.h (__libc_atfork): Remove declaration.
* Rename nptl-signals.h to internal-signals.hAdhemerval Zanella2018-02-226-15/+30
| | | | | | | | | | | | | | | | | | | | | | | This patch renames the nptl-signals.h header to internal-signals.h. On Linux the definitions and functions are not only NPTL related, but used for other POSIX definitions as well (for instance SIGTIMER for posix times, SIGSETXID for id functions, and signal block/restore helpers) and since generic functions will be places and used in generic implementation it makes more sense to decouple it from NPTL. Checked on x86_64-linux-gnu. * sysdeps/nptl/nptl-signals.h: Move to ... * sysdeps/generic/internal-signals.h: ... here. Adjust internal comments. * sysdeps/unix/sysv/linux/internal-signals.h: Add include guards. (__nptl_is_internal_signal): Rename to __is_internal_signal. (__nptl_clear_internal_signals): Rename to __clear_internal_signals. * sysdeps/unix/sysv/linux/raise.c: Adjust nptl-signal.h to include-signals.h rename. * nptl/pthreadP.h: Likewise. * sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Call __is_internal_signal instead of __nptl_is_internal_signal.
* RISC-V: fmax/fmin: Handle signalling NaNs correctly.Andrew Waterman2018-02-225-8/+43
| | | | | | | | | RISC-V's fmax(sNAN,4) returns 4 but glibc expects it to return qNAN. * sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly. * sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise. * sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise. * sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise.
* RISC-V: Do not initialize $gp in TLS macros.DJ Delorie2018-02-222-17/+7
| | | | | RISC-V TLS doesn't require GP to be initialized, and doing so breaks TLS in a shared object.
* aarch64/strcmp: fix misaligned loop jump targetSiddhesh Poyarekar2018-02-222-1/+6
| | | | | | | | | I accidentally set the loop jump back label as misaligned8 instead of do_misaligned. The typo is harmless but it's always nice to not have to unnecessarily execute those two instructions. * sysdeps/aarch64/strcmp.S (do_misaligned): Jump back to do_misaligned, not misaligned8.
* IFUNC for Cavium ThunderX2Steve Ellcey2018-02-227-10/+73
| | | | | | | | | | | | | | | | | * sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add memcpy_thunderx2. * sysdeps/aarch64/multiarch/ifunc-impl-list.c (MAX_IFUNC): Increment to 4. (__libc_ifunc_impl_list): Add __memcpy_thunderx2. * sysdeps/aarch64/multiarch/memcpy.c (libc_ifunc): Add IS_THUNDERX2 and IS_THUNDERX2PA checks. * sysdeps/aarch64/multiarch/memcpy_thunderx.S (USE_THUNDERX2): Use macro to set name appropriately. (memcpy): Use USE_THUNDERX2 macro to modify prefetches. * sysdeps/aarch64/multiarch/memcpy_thunderx2.S: New file. * sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_THUNDERX2PA): New macro. (IS_THUNDERX2): New macro.
* Add [BZ #16335] annotation to ChangeLog entry.Rical Jasan2018-02-221-0/+1
| | | | | Commit 6a3962c4a408e8cbc305d2433711196107374e89 unwittingly fixed a bug, so update the ChangeLog entry accordingly.
* S390: Regenerate ULPs.Stefan Liebler2018-02-222-6/+10
| | | | | | | | | | After regenerating ULPs from scratch in commit 8e7196c8759287a3e4c882e3c7cf32ddc322df8a, I've missed to test it with multiple gcc versions. Hence, here is a further update. ChangeLog: * sysdeps/s390/fpu/libm-test-ulps: Regenerated.
* hurd: Add sysdep-cancel.hSamuel Thibault2018-02-212-0/+10
|
* Remove miscellaneous debris from libio.Zack Weinberg2018-02-2120-236/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch eliminates a number of #if 0 and #ifdef TODO blocks, macros that are never used, macros that provide portability to substrates that lack basic things like EINVAL and off_t, and other such debris. I preserved IO_DEBUG and CHECK_FILE, even though as far as I can tell IO_DEBUG is never defined and therefore CHECK_FILE never does anything, because it seems like we might actually want to turn it _on_. Installed stripped libraries and executables are unchanged, except, again, that the line number of an assertion changes (this time it's somewhere in fileops.c). * libio/libio.h (_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust): Define here, unconditionally. * libio/iolibio.h (_IO_pos_BAD): Don't define here. * libio/libioP.h: Remove #if 0 blocks. (_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust): Don't define here. (_IO_va_start, COERCE_FILE, MAYBE_SET_EINVAL): Don't define. (CHECK_FILE): Don't use MAYBE_SET_EINVAL or COERCE_FILE. Fix style. * libio/clearerr.c, libio/fputc.c, libio/getchar.c: Assume weak_alias is always defined. * libio/fileops.c, libio/genops.c, libio/oldfileops.c * libio/oldpclose.c, libio/pclose.c, libio/wfileops.c: Remove #if 0 and #ifdef TODO blocks. Assume text_set_element is always defined. * libio/iofdopen.c, libio/iogetdelim.c, libio/oldiofdopen.c Use __set_errno (EINVAL) instead of MAYBE_SET_EINVAL. * libio/tst-mmap-eofsync.c: Make #if 1 block unconditional.
* Remove _IO_file_flags define.Zack Weinberg2018-02-2122-122/+99
| | | | | | | | | | This entirely mechanical (except for some indentation fixups) patch replaces all uses of _IO_file_flags with _flags and removes the #define. Installed stripped libraries and executables are unchanged by this patch. * libio/libio.h (_IO_file_flags): Remove macro. All uses changed to _flags.
* Remove legacy configuration knobs from libio.Zack Weinberg2018-02-2111-50/+24
| | | | | | | | | | | | | | | | | | | | This patch eliminates the "compatibility defines" _IO_UNIFIED_JUMPTABLES (always defined to 1, used in a number of #ifs which are therefore always false), _STDIO_USES_IOSTREAM (unused), __HAVE_COLUMN (unused), _IO_BE (replaced with __glibc_unlikely), and yet another redundant definition of EOF. Installed stripped libraries are unchanged by this patch. * libio/libio.h (_IO_UNIFIED_JUMPTABLES, _STDIO_USES_IOSTREAM) (__HAVE_COLUMN, _IO_BE): Don't define. (_IO_peekc_unlocked, _IO_getwc_unlocked, _IO_putwc_unlocked) (_IO_fwide_maybe_incompatible): Use __glibc_unlikely. * libio/libioP.h (EOF): Don't define. * libio/iofdopen.c, libio/iofopen.c, libio/iopopen.c * libio/iovdprintf.c, libio/oldiofdopen.c, libio/oldiofopen.c * libio/oldiopopen.c, debug/vdprintf_chk.c: Remove #if block testing _IO_UNIFIED_JUMPTABLES.
* Mechanically remove _IO_ name aliases for types and constants.Zack Weinberg2018-02-21128-971/+937
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch mechanically removes all remaining uses, and the definitions, of the following libio name aliases: name replaced with ---- ------------- _IO_FILE FILE _IO_fpos_t __fpos_t _IO_fpos64_t __fpos64_t _IO_size_t size_t _IO_ssize_t ssize_t or __ssize_t _IO_off_t off_t _IO_off64_t off64_t _IO_pid_t pid_t _IO_uid_t uid_t _IO_wint_t wint_t _IO_va_list va_list or __gnuc_va_list _IO_BUFSIZ BUFSIZ _IO_cookie_io_functions_t cookie_io_functions_t __io_read_fn cookie_read_function_t __io_write_fn cookie_write_function_t __io_seek_fn cookie_seek_function_t __io_close_fn cookie_close_function_t I used __fpos_t and __fpos64_t instead of fpos_t and fpos64_t because the definitions of fpos_t and fpos64_t depend on the largefile mode. I used __ssize_t and __gnuc_va_list in a handful of headers where namespace cleanliness might be relevant even though they're internal-use-only. In all other cases, I used the public-namespace name. There are a tiny handful of places where I left a use of 'struct _IO_FILE' alone, because it was being used together with 'struct _IO_FILE_plus' or 'struct _IO_FILE_complete' in the same arithmetic expression. Because this patch was almost entirely done with search and replace, I may have introduced indentation botches. I did proofread the diff, but I may have missed something. The ChangeLog below calls out all of the places where this was not a pure search-and-replace change. Installed stripped libraries and executables are unchanged by this patch, except that some assertions in vfscanf.c change line numbers. * libio/libio.h (_IO_FILE): Delete; all uses changed to FILE. (_IO_fpos_t): Delete; all uses changed to __fpos_t. (_IO_fpos64_t): Delete; all uses changed to __fpos64_t. (_IO_size_t): Delete; all uses changed to size_t. (_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t. (_IO_off_t): Delete; all uses changed to off_t. (_IO_off64_t): Delete; all uses changed to off64_t. (_IO_pid_t): Delete; all uses changed to pid_t. (_IO_uid_t): Delete; all uses changed to uid_t. (_IO_wint_t): Delete; all uses changed to wint_t. (_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list. (_IO_BUFSIZ): Delete; all uses changed to BUFSIZ. (_IO_cookie_io_functions_t): Delete; all uses changed to cookie_io_functions_t. (__io_read_fn): Delete; all uses changed to cookie_read_function_t. (__io_write_fn): Delete; all uses changed to cookie_write_function_t. (__io_seek_fn): Delete; all uses changed to cookie_seek_function_t. (__io_close_fn): Delete: all uses changed to cookie_close_function_t. * libio/iofopncook.c: Remove unnecessary forward declarations. * libio/iolibio.h: Correct outdated commentary. * malloc/malloc.c (__malloc_stats): Remove unnecessary casts. * stdio-common/fxprintf.c (__fxprintf_nocancel): Remove unnecessary casts. * stdio-common/getline.c: Use _IO_getdelim directly. Don't redefine ssize_t. * stdio-common/printf_fp.c, stdio_common/printf_fphex.c * stdio-common/printf_size.c: Don't redefine size_t or FILE. Remove outdated comments. * stdio-common/vfscanf.c: Don't redefine va_list.
* Remove vestiges of external build support from libio headers.Zack Weinberg2018-02-214-43/+12
| | | | | | | | | | | | | | As requested by Adhemerval, this patch removes some preprocessor conditionals from the libio headers that were only relevant when building libio outside glibc. Installed stripped libraries and executables are unchanged by this patch. * libio/iolibio.h, libio/libioP.h: Remove extern "C". * libio/libio.h: Remove __BEGIN_DECLS and __END_DECLS. Remove preprocessor conditionals on _LIBC and __USE_GNU, which are always true, and __cplusplus, which is always false.
* Fix -Os putc_unlocked, fputc_unlocked linknamespace, localplt issues (bug ↵Joseph Myers2018-02-215-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 15105, bug 19463). Continuing the fixes for linknamespace and localplt test failures with -Os that arise from functions not being inlined in that case, this patch fixes such failures for putc_unlocked and fputc_unlocked. libc_hidden_* are used for both functions, while namespace issues are addressed by making putc_unlocked a weak alias of hidden __putc_unlocked, which is called in the one place where namespace issues arise (and defined as an inline function in include/stdio.h). Tested for x86_64 (both without -Os to make sure that case continues to work, and with -Os to make sure all the relevant linknamespace and localplt test failures are resolved). This completes fixing the -Os linknamespace failures (at least for x86_64); localplt failures remain after this patch. 2018-02-19 Joseph Myers <joseph@codesourcery.com> [BZ #15105] [BZ #19463] * libio/fputc_u.c (fputc_unlocked): Use libc_hidden_def. * libio/putc_u.c (putc_unlocked): Rename to __putc_unlocked and define as weak alias of __putc_unlocked. Use libc_hidden_weak. * include/stdio.h [!_ISOMAC] (fputc_unlocked): Use libc_hidden_proto. [!_ISOMAC] (putc_unlocked): Likewise. [!_ISOMAC] (__putc_unlocked): Declare as hidden function, and define inline if [__USE_EXTERN_INLINES]. * misc/syslog.c (__vsyslog_chk): Call __putc_unlocked instead of putc_unlocked.
* Fix -Os getc_unlocked linknamespace, localplt issues (bug 15105, bug 19463).Joseph Myers2018-02-215-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the fixes for linknamespace and localplt test failures with -Os that arise from functions not being inlined in that case, this patch fixes such failures for getc_unlocked. __getc_unlocked already exists; this patch makes it explicitly hidden, calls it where needed for namespace reasons, adds an inline function for it when inline functions are used and adds libc_hidden_proto / libc_hidden_weak for getc_unlocked. Tested for x86_64 (both without -Os to make sure that case continues to work, and with -Os to make sure all the relevant linknamespace and localplt test failures are resolved). Because of other such failures that remain after this patch, neither of the bugs can yet be closed. [BZ #15105] [BZ #19463] * libio/getc_u.c (getc_unlocked): Use libc_hidden_weak. * include/stdio.h [!_ISOMAC] (__getc_unlocked): Use attribute_hidden, and define inline if [__USE_EXTERN_INLINES]. [!_ISOMAC] (getc_unlocked): Use libc_hidden_proto. * misc/getttyent.c (__getttyent): Call __getc_unlocked instead of getc_unlocked. * time/tzfile.c (__tzfile_read): Likewise.
* Add missing “reorder-end” in LC_COLLATE of et_EE [BZ #22517]Mike FABIAN2018-02-212-0/+7
| | | | | [BZ #22517] * localedata/locales/et_EE (LC_COLLATE): add missing “reorder-end”
* Fix a typo in a comment.Rical Jasan2018-02-212-1/+5
| | | | * io/fcntl.h: Fix a typo in a comment.
* manual: Update _DEFAULT_SOURCE. [BZ #22862]Rical Jasan2018-02-213-8/+22
| | | | | | | | | | | | | | | | | The description of the interplay between feature test macros and compiler options in the description of _DEFAULT_SOURCE is a little confusing, and dated, so clarify the situation, and don't assume a specific value for _DEFAULT_SOURCE. Also, _DEFAULT_SOURCE is supposed to be defined if none of the C/POSIX feature test macros are defined, but the condition was lacking a test for _ISOC11_SOURCE, so that is also addressed. [BZ #22862] * include/features.h: Add _ISOC11_SOURCE to test for whether to define _DEFAULT_SOURCE. * manual/creature.texi (_DEFAULT_SOURCE): Improve documentation.
* ldconfig: Sync temporary files to disk before renaming them [BZ #20890]Florian Weimer2018-02-212-3/+15
| | | | | | | If the system crashes before the file data has been written to disk, the file system recovery upon the next mount may restore a partially rewritten temporary file under the non-temporary (final) name (after the rename operation).
* elf: Remove ad-hoc restrictions on dlopen callers [BZ #22787]Florian Weimer2018-02-219-148/+22
| | | | | | | | | | | | | | | | | | | | | | This looks like a post-exploitation hardening measure: If an attacker is able to redirect execution flow, they could use that to load a DSO which contains additional code (or perhaps make the stack executable). However, the checks are not in the correct place to be effective: If they are performed before the critical operation, an attacker with sufficient control over execution flow could simply jump directly to the code which performs the operation, bypassing the check. The check would have to be executed unconditionally after the operation and terminate the process in case a caller violation was detected. Furthermore, in _dl_check_caller, there was a fallback reading global writable data (GL(dl_rtld_map).l_map_start and GL(dl_rtld_map).l_text_end), which could conceivably be targeted by an attacker to disable the check, too. Other critical functions (such as system) remain completely unprotected, so the value of these additional checks does not appear that large. Therefore this commit removes this functionality.
* hurd: fix buildSamuel Thibault2018-02-212-0/+6
| | | | * sysdeps/mach/hurd/dl-sysdep.c (_dl_random): New variable.
* manual: Update the _ISOC99_SOURCE description.Rical Jasan2018-02-202-4/+8
| | | | | | | | The current description refers to ISO C99 not being widely adopted, which it is believed to be now. * manual/creature.texi (_ISOC99_SOURCE): Update the dated description.
* manual: Document missing feature test macros.Rical Jasan2018-02-202-2/+46
| | | | | | | | | | | | | | Several feature test macros are documented in features.h but absent in the manual, and some documented macros accept undocumented values. This commit updates the manual to mention all the accepted macros, along with any values that hold special meaning. * manual/creature.texi (_POSIX_C_SOURCE): Document special values of 199606L, 200112L, and 200809L. (_XOPEN_SOURCE): Document special values of 600 and 700. (_ISOC11_SOURCE): Document macro. (_ATFILE_SOURCE): Likewise. (_FORTIFY_SOURCE): Likewise.
* Fix -Os ferror_unlocked linknamespace, localplt issues (bug 15105, bug 19463).Joseph Myers2018-02-194-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the fixes for linknamespace and localplt test failures with -Os that arise from functions not being inlined in that case, this patch fixes such failures for ferror_unlocked. The usual approach is followed of adding __ferror_unlocked (inlined when ferror_unlocked is), making calls use it when required for namespace reasons (only one such call), and using libc_hidden_proto / libc_hidden_weak for the ferror_unlocked weak alias when only localplt but not namespace issues are involved. Tested for x86_64 (both without -Os to make sure that case continues to work, and with -Os to make sure all the relevant linknamespace and localplt test failures are resolved). Because of other such failures that remain after this patch, neither of the bugs can yet be closed. [BZ #15105] [BZ #19463] * libio/ferror_u.c (ferror_unlocked): Rename to __ferror_unlocked and define as weak alias of __ferror_unlocked. Use libc_hidden_weak. * include/stdio.h [!_ISOMAC] (ferror_unlocked): Use libc_hidden_proto. [!_ISOMAC] (__ferror_unlocked) New declaration, and inline function if [__USE_EXTERN_INLINES]. * time/getdate.c (__getdate_r): Call __ferror_unlocked instead of ferror_unlocked.
* manual: Improve documentation of get_current_dir_name. [BZ #6889]Rical Jasan2018-02-192-8/+14
| | | | | | | | | | | This is a minor rewording to clarify the behaviour of get_current_dir_name. Additionally, the @vindex is moved above the @deftypefun so that following links give a better result with regard to context. [BZ #6889] * manual/filesys.texi (get_current_dir_name): Clarify behaviour.
* Fix posix/tst-glob_lstat_compat on alpha [BZ #22818]Aurelien Jarno2018-02-182-0/+13
| | | | | | | | | | | | | The tst-glob_lstat_compat test needs to run tests on the previous version of glob. On alpha, there are three versions of glob, GLIBC_2.0, GLIBC_2.1 and GLIBC_2.27, while on other architectures there are only the GLIBC_2.0 and GLIBC_2.27 version. Therefore on alpha the previous version is GLIBC_2.1 and not GLIBC_2.0. Changelog: [BZ #22818] * posix/tst-glob_lstat_compat.c [__alpha__] (glob): Access the GLIBC_2.1 version.
* intl/tst-gettext: fix failure with newest msgfmtAurelien Jarno2018-02-184-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since upstream gettext commit d13f165b83 (msgfmt: Remove POT-Creation-Date field from the header in the output.), msgfmt does not copy the POT-Creation-Date field in the header entry from the po file to the mo file anymore. This breaks the assumption that we can test gettext by comparing each message in the po files with the corresponding string return by gettext. This makes the intl/tst-gettext to fail. While it would have been possible to modify the po2test.awk script to also strip the line POT-Creation-Date field when creating the msgs.h file, it would not work with both the old and new msgfmt. Instead create a tst-gettext-de.po file from de.po by removing the POT-Creation-Date line. Another alternative would be to use a static tst-gettext-de.po file, but I guess the reason for using de.po is to also catch issues caused by newly added strings. As tst-catgets also uses msg.h, it should also be updated. Instead of using the new tst-gettext-de.po file, the patch modifies xopen-msg.awk to avoid creating a second catgets->intl dependency. Changelog: [BZ #21508] * catgets/xopen-msg.awk: Ignore POT-Creation-Date line. * intl/Makefile ($(objpfx)tst-gettext-de.po): Generate intl/tst-gettext-de.po from po/de.po by removing the POT-Creation-Date line. ($(objpfx)msgs.h): Depend on $(objpfx)tst-gettext-de.po instead of ../po/de.po. * intl/tst-gettext.sh: Use ${objpfx}tst-gettext-de.po instead of ../po/de.po.
* hurd: Fix build on missing __ptsname_internal functionSamuel Thibault2018-02-172-4/+23
| | | | | | | * sysdeps/mach/hurd/ptsname.c: Include <sys/stat.h>. (__ptsname_r): Move implementation to... (__ptsname_internal): ... new function. Add filling the STP structure.
* hurd: Define EXEC_PAGESIZESamuel Thibault2018-02-174-1/+34
| | | | | | * mach/Makefile (headers): Add mach/param.h. * sysdeps/mach/hurd/bits/param.h: Include <mach/param.h>. * sysdeps/mach/i386/mach/param.h: New file, defines EXEC_PAGESIZE
* Fix ulps for pow on hppa.John David Anglin2018-02-172-0/+7
| | | | | * sysdeps/hppa/fpu/libm-test-ulps (pow): Increase double and idouble to 1 ULP.
* manual: Fix a syntax error.Rical Jasan2018-02-162-1/+6
| | | | | | | | | | | | | The opening parenthesis for function arguments in an @deftypefun need to be separated from the function name. This isn't just a matter of the GNU coding style---it causes the "(void" (in this case) to be rendered as a part of the function name, causing a visual defect, and also results in a warning to the following effect during `make pdf': Warning: unbalanced parentheses in @def...) * manual/platform.texi (__riscv_flush_icache): Fix @deftypefun syntax.
* Add runtime check if mutex will be elided in tst-mutex8 testcases.Stefan Liebler2018-02-163-47/+89
| | | | | | | | | | | | | | | | | | | | | | | | | An elided mutex don't fail destroy. Elision was disabled for the test nptl/tst-mutex8 in nptl/Makefile. Thus we can run tests which destroy a locked mutex. As elision is only disabled for tst-mutex8, the variants tst-mutex8-static, tst-mutexpi8 and tst-mutexpi8-static are still failing if lock elision is enabled. This patch adds a runtime check, if the checked type of mutex will be elided. This check is using TUNABLE_GET_FULL to determine if elision is enabled via the tunables framework. The pthread_mutex_destroy tests are only run if we dont't assume an elided mutex. This way, we can run the whole glibc testsuite with or without enabled lock elision. ChangeLog: * nptl/Makefile (tst-mutex8-ENV): Delete. * nptl/tst-mutex8.c (check_type): Add runtime check if mutex will be elided.
* Document use of CC and CFLAGS in more detail (bug 20980, bug 21234).Joseph Myers2018-02-153-12/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are some bug reports from people setting CFLAGS not including a -O option and then being confused when the build fails. This patch addresses this by documenting the proper use of CC and CFLAGS in more detail - saying what options should go where and specifying the requirement to compile with optimization. The previous text incorrectly used @var markup with CC and CFLAGS. The correct markup for environment variables is @env, but it's also the case that passing such variables explicitly on the configure command line is preferred to passing them in the environment, so this patch changes the documentation to describe passing them on the command line (and uses @code). In many cases putting options in the wrong place may in fact work, but I believe what I've specified is the correct rule for which options to put where. [BZ #20980] [BZ #21234] * manual/install.texi (Configuring and compiling): Describe passing CC and CFLAGS on configure command line, not as environment variables. Use @code markup on those variables. Specify what options go in CC and what go in CFLAGS. Note the requirement to compile with optimization. * INSTALL: Regenerated.
* Fix hppa local PLT entries for sigprocmask (bug 18124).Joseph Myers2018-02-154-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adding/updating localplt.data for various architectures to get the compilation tests passing everywhere, I generally made it reflect the existing state of what local PLT entries were actually seen, rather than an ideal state with as few as possible such entries, mainly for functions that are intended to be interposable. This patch eliminates some local PLT entries for hppa by using __sigprocmask instead of sigprocmask in getcontext and setcontext. The specific case of sigprocmask called by setcontext is the third of four items in bug 18124 (the other three have already been fixed for 2.26 or earlier releases). Note that hppa-specific localplt.data entries for __sigsetjmp, _IO_funlockfile and __errno_location remain, but the causes / fixes are less immediately obvious from source inspection. Tested (compilation tests only) with build-many-glibcs.py for hppa-linux-gnu. [BZ #18124] * sysdeps/hppa/bsd-setjmp.S: Include <sysdep.h>. (setjmp): Use HIDDEN_JUMPTARGET with __sigsetjmp. * sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Call __sigprocmask instead of sigprocmask. * sysdeps/unix/sysv/linux/hppa/setcontext.S (__setcontext): Likewise. * sysdeps/unix/sysv/linux/hppa/localplt.data: Remove entries for __sigsetjmp and sigprocmask.
* Use libc_hidden_* for argz_next, __argz_next (bug 15105).Joseph Myers2018-02-153-0/+10
| | | | | | | | | | | | | | | | | | Among other localplt test failures when building with -Os, there are libc.so PLT references for argz_next and __argz_next. This is a simple case of functions that are inlined for -O2 but not for -Os; this patch adds libc_hidden_proto / libc_hidden_def for them to avoid localplt failures even when not inlined. Tested for x86_64 (both that it removes these particular localplt failures for -Os - but other such failures remain so the bug can't yet be closed - and that the testsuite continues to pass without -Os). [BZ #15105] * include/argz.h (argz_next): Use libc_hidden_proto. (__argz_next): Likewise. * string-argz-next.c (__argz_next): Use libc_hidden_def. (argz_next): Use libc_hidden_weak.
* Use libc_hidden_* for __cmsg_nxthdr (bug 15105).Joseph Myers2018-02-153-0/+9
| | | | | | | | | | | | | | | | | | Among other localplt test failures when building with -Os, there are libc.so PLT references for __cmsg_nxthdr. This is a simple case of a function that is inlined for -O2 but not for -Os; this patch adds libc_hidden_proto / libc_hidden_def for it to avoid a localplt failure even when it is not inlined. Tested for x86_64 (both that it removes this particular localplt failure for -Os - but other such failures remain so the bug can't yet be closed - and that the testsuite continues to pass without -Os). [BZ #15105] * include/sys/socket.h [!_ISOMAC] (__cmsg_nxthdr): Use libc_hidden_proto. * sysdeps/unix/sysv/linux/cmsg_nxthdr.c (__cmsg_nxthdr): Use libc_hidden_def.
* Use libc_hidden_* for fputs (bug 15105).Joseph Myers2018-02-153-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Among other localplt test failures when building with -Os, there are libc.so PLT references for fputs. fputs calls normally get redirected to _IO_fputs by a macro in include/stdio.h (and _IO_fputs in turn uses libc_hidden_proto), but GCC can convert an fprintf call with a constant string argument into an fputs call, which of course is then unaffected by the macro redirection. (I don't know why this issue only appears with -Os.) This patch duly adds a use of libc_hidden_proto for fputs. I see no obvious reason why the fputs macro redirection is needed at all, but this patch does not change it. Tested for x86_64 (both that it removes this particular localplt failure for -Os - but other such failures remain so the bug can't yet be closed - and that the testsuite continues to pass without -Os). [BZ #15105] * include/stdio.h [!_ISOMAC && IS_IN (libc)] (fputs): Use libc_hidden_proto. * libio/iofputs.c (fputs): Use libc_hidden_weak.
* Fix -Os feof_unlocked linknamespace, localplt issues (bug 15105, bug 19463).Joseph Myers2018-02-159-6/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the fixes for linknamespace and localplt test failures with -Os that arise from functions not being inlined in that case, this patch fixes such failures for feof_unlocked. The usual approach is followed of adding __feof_unlocked (inlined when feof_unlocked is), making calls use it when required for namespace reasons, and using libc_hidden_proto / libc_hidden_weak for the feof_unlocked weak alias when only localplt but not namespace issues are involved. In the case of getaddrinfo.c, use of __feof_unlocked needs to be conditional since that code is also used in nscd (where __feof_unlocked is not available). Tested for x86_64 (both without -Os to make sure that case continues to work, and with -Os to make sure all the relevant linknamespace and localplt test failures are resolved). Because of other such failures that remain after this patch, neither of the bugs can yet be closed. [BZ #15105] [BZ #19463] * libio/feof_u.c (feof_unlocked): Rename to __feof_unlocked and define as weak alias of __feof_unlocked. Use libc_hidden_weak. * include/stdio.h (feof_unlocked): Use libc_hidden_proto. (__feof_unlocked): New declaration, and inline function if [__USE_EXTERN_INLINES]. * iconv/gconv_conf.c (read_conf_file): Call __feof_unlocked instead of feof_unlocked. * intl/localealias.c [_LIBC] (FEOF): Likewise. * nss/nsswitch.c (nss_parse_file): Likewise. * sysdeps/unix/sysv/linux/readonly-area.c (__readonly_area): Likewise. * time/getdate.c (__getdate_r): Likewise. * sysdeps/posix/getaddrinfo.c [IS_IN (libc)] (feof_unlocked): Define as macro to call __feof_unlocked.
* [AArch64] Fix include.Wilco Dijkstra2018-02-152-1/+5
| | | | | | Fix include to use <>. * sysdeps/aarch64/fpu/fpu_control.h: Use <> in include.
* Remove mplog and mpexpWilco Dijkstra2018-02-1522-342/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove the now unused mplog and mpexp files. * math/Makefile: Remove mpexp.c and mplog.c * sysdeps/i386/fpu/mpexp.c: Delete file. * sysdeps/i386/fpu/mplog.c: Likewise. * sysdeps/ia64/fpu/mpexp.c: Likewise. * sysdeps/ia64/fpu/mplog.c: Likewise. * sysdeps/ieee754/dbl-64/e_exp.c: Remove mention of mpexp and mplog. * sysdeps/ieee754/dbl-64/mpa.h (__pow_mp): Remove unused function. * sysdeps/ieee754/dbl-64/mpexp.c: Delete file. * sysdeps/ieee754/dbl-64/mplog.c: Likewise. * sysdeps/m68k/m680x0/fpu/mpexp.c: Likewise. * sysdeps/m68k/m680x0/fpu/mplog.c: Likewise. * sysdeps/x86_64/fpu/multiarch/Makefile: Remove mpexp* and mplog*. * sysdeps/x86_64/fpu/multiarch/e_log-avx.c: Remove unused defines. * sysdeps/x86_64/fpu/multiarch/e_log-fma.c: Likewise. * sysdeps/x86_64/fpu/multiarch/e_log-fma4.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mpexp-avx.c: Delete file. * sysdeps/x86_64/fpu/multiarch/mpexp-fma.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mpexp-fma4.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mplog-avx.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mplog-fma.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mplog-fma4.c: Likewise.
* S390: Regenerate ULPs.Stefan Liebler2018-02-152-68/+24
| | | | | | | | Regenerated ulps file from scratch due to recent pow changes. ChangeLog: * sysdeps/s390/fpu/libm-test-ulps: Regenerated.
* Update SH libm-tests-ulpsAdhemerval Zanella2018-02-142-48/+449
| | | | | | * sysdeps/sh/libm-test-ulps: Update. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* powerpc: Update pow() ULPsTulio Magno Quites Machado Filho2018-02-122-0/+7
| | | | | | | * sysdeps/powerpc/fpu/libm-test-ulps (pow): Increase double and idouble to 1 ULP. Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* [BZ #19239] Don't include sys/sysmacros.h from sys/types.h.Zack Weinberg2018-02-124-58/+21
| | | | | | | | | This completes the deprecation and removal of this inclusion, which was begun in the 2.25 release. * posix/sys/types.h: Don't include sys/sysmacros.h. * misc/sys/sysmacros.h: Remove the conditional deprecation warnings for the macros defined by this header.
* Remove slow paths from expSzabolcs Nagy2018-02-1218-189/+43
| | | | | | | | | | | | | | | | | | | | | | | | | Remove the __slowexp code, so exp is no longer correctly rounded. The result is computed to about 70 bits precision so the worst case ulp error is about 0.500007 in nearest rounding mode. * manual/probes.texi: Remove slowexp probes. * math/Makefile: Remove slowexp. * sysdeps/generic/math_private.h (__slowexp): Remove. * sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Remove __slowexp and document error bounds. * sysdeps/i386/fpu/slowexp.c: Remove. * sysdeps/ia64/fpu/slowexp.c: Remove. * sysdeps/ieee754/dbl-64/slowexp.c: Remove. * sysdeps/ieee754/dbl-64/uexp.h (err_0): Remove. * sysdeps/m68k/m680x0/fpu/slowexp.c: Remove. * sysdeps/powerpc/power4/fpu/Makefile (CPPFLAGS-slowexp.c): Remove. * sysdeps/x86_64/fpu/multiarch/Makefile: Remove slowexp-fma. * sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-avx.c: Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c: Remove.
* Remove slow paths from powWilco Dijkstra2018-02-1226-525/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the slow paths from pow. Like several other double precision math functions, pow is exactly rounded. This is not required from math functions and causes major overheads as it requires multiple fallbacks using higher precision arithmetic if a result is close to 0.5ULP. Ridiculous slowdowns of up to 100000x have been reported when the highest precision path triggers. All GLIBC math tests pass on AArch64 and x64 (with ULP of pow set to 1). The worst case error is ~0.506ULP. A simple test over a few hundred million values shows pow is 10% faster on average. This fixes BZ #13932. [BZ #13932] * sysdeps/ieee754/dbl-64/uexp.h (err_1): Remove. * benchtests/pow-inputs: Update comment for slow path cases. * manual/probes.texi (slowpow_p10): Delete removed probe. (slowpow_p10): Likewise. * math/Makefile: Remove halfulp.c and slowpow.c. * sysdeps/aarch64/libm-test-ulps: Set ULP of pow to 1. * sysdeps/generic/math_private.h (__exp1): Remove error argument. (__halfulp): Remove. (__slowpow): Remove. * sysdeps/i386/fpu/halfulp.c: Delete file. * sysdeps/i386/fpu/slowpow.c: Likewise. * sysdeps/ia64/fpu/halfulp.c: Likewise. * sysdeps/ia64/fpu/slowpow.c: Likewise. * sysdeps/ieee754/dbl-64/e_exp.c (__exp1): Remove error argument, improve comments and add error analysis. * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Add error analysis. (power1): Remove function: (log1): Remove error argument, add error analysis. (my_log2): Remove function. * sysdeps/ieee754/dbl-64/halfulp.c: Delete file. * sysdeps/ieee754/dbl-64/slowpow.c: Likewise. * sysdeps/m68k/m680x0/fpu/halfulp.c: Likewise. * sysdeps/m68k/m680x0/fpu/slowpow.c: Likewise. * sysdeps/powerpc/power4/fpu/Makefile: Remove CPPFLAGS-slowpow.c. * sysdeps/x86_64/fpu/libm-test-ulps: Set ULP of pow to 1. * sysdeps/x86_64/fpu/multiarch/Makefile: Remove slowpow-fma.c, slowpow-fma4.c, halfulp-fma.c, halfulp-fma4.c. * sysdeps/x86_64/fpu/multiarch/e_pow-fma.c (__slowpow): Remove define. * sysdeps/x86_64/fpu/multiarch/e_pow-fma4.c (__slowpow): Likewise. * sysdeps/x86_64/fpu/multiarch/halfulp-fma.c: Delete file. * sysdeps/x86_64/fpu/multiarch/halfulp-fma4.c: Likewise. * sysdeps/x86_64/fpu/multiarch/slowpow-fma.c: Likewise. * sysdeps/x86_64/fpu/multiarch/slowpow-fma4.c: Likewise.
* nscd: don't unconditionally use ↵Samuel Thibault2018-02-112-5/+16
| | | | | | | | | | | | PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP is Linux-only. * nscd/connections.c (RWLOCK_INITIALIZER): Define to PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP or PTHREAD_RWLOCK_INITIALIZER if that is not available. (dbs): Use RWLOCK_INITIALIZER instead of PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP.
* linux/aarch64: sync sys/ptrace.h with Linux 4.15 [BZ #22433]Dmitry V. Levin2018-02-102-8/+7
| | | | | | | | | | | Remove compat-specific constants that were never exported by kernel headers under these names. Before linux commit v3.7-rc1~16^2~1 they were exported with COMPAT_ prefix, and since that commit they are not exported at all. * sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (__ptrace_request): Remove arm-specific PTRACE_GET_THREAD_AREA, PTRACE_GETHBPREGS, and PTRACE_SETHBPREGS.
* [BZ #22830] malloc_stats: restore cancellation for stderr correctly.Zack Weinberg2018-02-104-1/+227
| | | | | | | | | | | | malloc_stats means to disable cancellation for writes to stderr while it runs, but it restores stderr->_flags2 with |= instead of =, so what it actually does is disable cancellation on stderr permanently. [BZ #22830] * malloc/malloc.c (__malloc_stats): Restore stderr->_flags2 correctly. * malloc/tst-malloc-stats-cancellation.c: New test case. * malloc/Makefile: Add new test case.