Zack Weinberg [Fri, 9 Mar 2018 14:42:04 +0000 (09:42 -0500)]
alpha/clone.S: Invoke .set noat/.set at around explicit uses of $at
On Alpha, the register $at is, by default, reserved for use by the
assembler, in the expansion of pseudo-instructions. It's also used
by the special calling convention for _mcount. We get warnings from
Alpha clone.S because the code to call _mcount isn't properly marked
up to tell the assembler not to use $at itself.
* sysdeps/unix/sysv/linux/alpha/clone.s (__clone): Wrap manual
uses of $at in .set noat / .set at.
H.J. Lu [Sat, 10 Mar 2018 17:27:04 +0000 (09:27 -0800)]
Remove hidden __libc_longjmp
Since __libc_longjmp is a private interface for cancellation implementation
in libpthread, there is no need to provide hidden __libc_longjmp in libc.
Tested with build-many-glibcs.py.
* include/setjmp.h (__libc_longjmp): Remove libc_hidden_proto.
* setjmp/longjmp.c (__libc_longjmp): Remove libc_hidden_def.
* sysdeps/s390/longjmp.c (__libc_longjmp): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S (__libc_longjmp):
Likewise.
Florian Weimer [Fri, 9 Mar 2018 15:21:22 +0000 (16:21 +0100)]
malloc: Revert sense of prev_inuse in comments
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
H.J. Lu [Fri, 9 Mar 2018 04:06:30 +0000 (20:06 -0800)]
Fix a typo in ChangeLog: auch_fork -> arch_fork
Aurelien Jarno [Thu, 8 Mar 2018 23:14:27 +0000 (00:14 +0100)]
sparc32: Add nop before __startcontext to stop unwinding [BZ #22919]
On sparc32 tst-makecontext fails, as backtrace called within a context
created by makecontext to yield infinite backtrace.
Fix that the same way than nios2 by adding a nop just before
__startcontext. This is needed as otherwise FDE lookup just repeatedly
finds __setcontext's FDE in an infinite loop, due to the convention of
using 'address - 1' for FDE lookup.
Changelog:
[BZ #22919]
* sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S (__startcontext):
Add nop before __startcontext, add explaining comments.
Adhemerval Zanella [Mon, 5 Mar 2018 17:46:24 +0000 (14:46 -0300)]
powerpc: Fix TLE build for SPE (BZ #22926)
Some SPE opcodes clashes with some recent PowerISA opcodes and
until recently gas did not complain about it. However binutils
recently changed it and now VLE configured gas does not support to
assembler some instruction that might class with VLE (HTM for
instance). It also does not help that glibc build hardware lock
elision support as default (regardless of assembler support).
Although runtime will not actually enables TLE on SPE hardware
(since kernel will not advertise it), I see little advantage on
adding HTM support on SPE built glibc. SPE uses an incompatible
ABI which does not allow share the same build with default
powerpc and HTM code slows down SPE without any benefict.
This patch fixes it by only building HTM when SPE configuration
is not used.
Checked with a powerpc-linux-gnuspe build. I also did some sniff
tests on a e500 hardware without any issue.
[BZ #22926]
* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION_IMPL): Define
empty for __SPE__.
* sysdeps/powerpc/sysdep.h (ABORT_TRANSACTION): Likewise.
* sysdeps/unix/sysv/linux/powerpc/elision-lock.c (__lll_lock_elision):
Do not build hardware transactional code for __SPE__.
* sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
(__lll_trylock_elision): Likewise.
* sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
(__lll_unlock_elision): Likewise.
Adhemerval Zanella [Fri, 5 Jan 2018 17:38:06 +0000 (15:38 -0200)]
Refactor Linux ARCH_FORK implementation
This patch refactors the ARCH_FORK macro and the required architecture
specific header to simplify the required architecture definitions
to provide the fork syscall semantic and proper document current
Linux clone ABI variant.
Instead of require the reimplementation of arch-fork.h header, this
patch changes the ARCH_FORK to an inline function with clone ABI
defined by kernel-features.h define. The generic kernel ABI meant
for newer ports is used as default and redefine if the architecture
requires.
Checked on x86_64-linux-gnu and i686-linux-gnu. Also with a build
for all the afected ABIs.
* sysdeps/nptl/fork.c (ARCH_FORK): Replace by auch_fork.
* sysdeps/unix/sysv/linux/alpha/arch-fork.h: Remove file.
* sysdeps/unix/sysv/linux/riscv/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/aarch64/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/arm/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/i386/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/mips/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/s390/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/sh/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/tile/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/arch-fork.h: Likewise.
* sysdeps/unix/sysv/linux/arch-fork.h (arch_fork): New function.
* sysdeps/unix/sysv/linux/aarch64/kernel-features.h: New file.
* sysdeps/unix/sysv/linux/riscv/kernel-features.h: Likewise.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
(__ASSUME_CLONE_BACKWARDS): Define.
* sysdeps/unix/sysv/linux/createthread.c (ARCH_CLONE): Define to
__clone2 if __NR_clone2 is defined.
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
(__ASSUME_CLONE_BACKWARDS): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_CLONE_BACKWARDS): Likewise.
* sysdeps/unix/sysv/linux/ia64/kernel-features.h
(__ASSUME_CLONE2): Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_CLONE_BACKWARDS3): Likewise.
* sysdeps/unix/sysv/linux/kernel-features.h: Document possible clone
variants and the define architecture can use.
(__ASSUME_CLONE_DEFAULT): Define as default.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_CLONE_BACKWARDS): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_CLONE_BACKWARDS): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_CLONE_BACKWARDS2): Likewise.
Siddhesh Poyarekar [Tue, 6 Mar 2018 17:26:35 +0000 (22:56 +0530)]
aarch64: Fix branch target to loop16
I goofed up when changing the loop8 name to loop16 and missed on out
the branch instance. Fixed and actually build tested this time.
* sysdeps/aarch64/memcmp.S (more16): Fix branch target loop16.
Siddhesh Poyarekar [Tue, 6 Mar 2018 13:52:39 +0000 (19:22 +0530)]
aarch64: Optimized memcmp for medium to large sizes
This improved memcmp provides a fast path for compares up to 16 bytes
and then compares 16 bytes at a time, thus optimizing loads from both
sources. The glibc memcmp microbenchmark retains performance (with an
error of ~1ns) for smaller compare sizes and reduces up to 31% of
execution time for compares up to 4K on the APM Mustang. On Qualcomm
Falkor this improves to almost 48%, i.e. it is almost 2x improvement
for sizes of 2K and above.
* sysdeps/aarch64/memcmp.S: Widen comparison to 16 bytes at a
time.
Siddhesh Poyarekar [Tue, 6 Mar 2018 13:45:02 +0000 (19:15 +0530)]
Add ChangeLog entry for last 3 commits
Apparently I've forgotten how to commit to glibc.
Siddhesh Poyarekar [Tue, 6 Mar 2018 12:59:57 +0000 (18:29 +0530)]
benchtests: Don't benchmark 0 length calls for strncmp
The 0 length strncmp is interesting for correctness but not for
performance.
* benchtests/bench-strncmp.c (test_main): Remove 0 length tests.
(do_test_limit): Likewise.
Siddhesh Poyarekar [Tue, 6 Mar 2018 12:59:52 +0000 (18:29 +0530)]
benchtests: Reallocate buffers for every strncmp implementation
Don't reuse buffers for different strncmp implementations since the
earlier implementation will end up warming the cache for the later
one. Eventually there should be a more elegant way to do this.
* benchtests/bench-strncmp.c (do_test_limit): Reallocate buffers
for every implementation.
(do_test): Likewise.
Siddhesh Poyarekar [Tue, 6 Mar 2018 12:59:34 +0000 (18:29 +0530)]
benchtests: Convert strncmp benchmark output to json
Make the output usable through the compare_strings.py script.
* benchtests/bench-strncmp.c: Convert output to json.
Samuel Thibault [Tue, 6 Mar 2018 08:21:04 +0000 (09:21 +0100)]
Add missing start-of-file descriptive comment.
* io/futimens.c: Add missing start-of-file descriptive comment.
* io/utime.c: Likewise.
* misc/futimesat.c: Likewise.
* misc/utimes.c: Likewise.
* sysdeps/mach/hurd/futimesat.c: Likewise.
* sysdeps/mach/hurd/utimes.c: Likewise.
* sysdeps/posix/utime.c: Likewise.
* sysdeps/posix/utimes.c: Likewise.
* sysdeps/unix/sysv/linux/futimesat.c: Likewise.
* sysdeps/unix/sysv/linux/generic/futimesat.c: Likewise.
* sysdeps/unix/sysv/linux/generic/utimes.c: Likewise.
* sysdeps/unix/sysv/linux/utimes.c: Likewise.
Samuel Thibault [Mon, 5 Mar 2018 23:13:54 +0000 (00:13 +0100)]
hurd: Add futimesat and utimensat support
* sysdeps/mach/hurd/utime-helper.c (hurd_futimens): Rename function to
hurd_futimes.
* sysdeps/mach/hurd/utimes.c (__utimes): Update call accordingly.
* sysdeps/mach/hurd/lutimes.c (__lutimes): Likewise.
* sysdeps/mach/hurd/futimens.c: Include "utime-helper.c".
(__futimens): Move implementation to...
* sysdeps/mach/hurd/utime-helper.c (utime_ts_from_tspec,
utime_tvalue_from_tspec): ... new helper functions.
(hurd_futimens): New function.
* sysdeps/mach/hurd/futimesat.c: New file.
* sysdeps/mach/hurd/utimensat.c: New file.
Flávio Cruz [Mon, 5 Mar 2018 22:25:00 +0000 (23:25 +0100)]
hurd: Define and pass UTIME_NOW and UTIME_OMIT to new file_utimens RPC
* sysdeps/mach/hurd/bits/stat.h [__USE_ATFILE] (UTIME_NOW,
UTIME_OMIT): New macros.
* sysdeps/mach/hurd/futimens.c (__futimens): Try to use __file_utimens
before reverting to converting time spec to time value and calling
__file_utimes.
* sysdeps/mach/hurd/utime-helper.c: New file.
* sysdeps/mach/hurd/futimes.c: Include "utime-helper.c".
(__futimes): Try to use utime_ts_from_tval and __file_utimens before
reverting to utime_tvalue_from_tval and __file_utimes.
* sysdeps/mach/hurd/lutimes.c: Include "utime-helper.c".
(__lutimes): Just call hurd_futimens after lookup.
* sysdeps/mach/hurd/utimes.c: Likewise.
Samuel Thibault [Mon, 5 Mar 2018 01:17:52 +0000 (02:17 +0100)]
hurd: Fix includability of <hurd/signal.h> in all standards
* bits/sigaction.h: Add include guard.
* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/bits/sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/bits/sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/s390/bits/sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h: Likewise.
* sysdeps/unix/sysv/linux/tile/bits/sigaction.h: Likewise.
* hurd/hurd/signal.h: Include <bits/sigaction.h>.
Joseph Myers [Mon, 5 Mar 2018 21:46:55 +0000 (21:46 +0000)]
Fix s390 -Os iconv build.
Building glibc for s390 with -Os (32-bit only, with GCC 7) fails with:
In file included from ../sysdeps/s390/multiarch/8bit-generic.c:370:0,
from ebcdic-at-de.c:28:
../iconv/loop.c: In function '__to_generic_vx':
../iconv/loop.c:264:22: error: 'ch' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (((Character) >> 7) == (0xe0000 >> 7)) \
^~
In file included from ebcdic-at-de.c:28:0:
../sysdeps/s390/multiarch/8bit-generic.c:340:15: note: 'ch' was declared here
uint32_t ch; \
^
../iconv/loop.c:325:7: note: in expansion of macro 'BODY'
BODY
^~~~
It's fairly easy to see, looking at the (long) expansion of the BODY
macro, that this is a false positive and the relevant variable 'ch' is
always initialized before use, in one of two possible places. As
such, disabling the warning for -Os with the DIAG_* macros is the
natural approach to fix this build failure. However, because of the
location at which the warning is reported, the disabling needs to go
in iconv/loop.c, around the definition of UNICODE_TAG_HANDLER (not
inside the definition), as that macro definition is where the
uninitialized use is reported, whereas the code that needs to be
reasoned about to see that the warning is a false positive is in the
definition of BODY elsewhere.
Thus, the patch adds such disabling in iconv/loop.c, with a comment
pointing to the s390-specific code and a comment in the s390-specific
code pointing to the generic file to alert people to the possible need
to update one place when changing the other. It would be possible if
desired to use #ifdef __s390__ around the disabling, though in general
we try to avoid that sort of thing in generic files. (Or some
extremely specialized macros for "disable -Wmaybe-uninitialized in
this particular place" could be specified, defined to 0 in a lot of
different files that include iconv/loop.c and to 1 in that particular
s390 file.)
Tested that this fixed -Os compilation for s390-linux-gnu with
build-many-glibcs.py.
* iconv/loop.c (UNICODE_TAG_HANDLER): Disable
-Wmaybe-uninitialized for -Os.
* sysdeps/s390/multiarch/8bit-generic.c (BODY): Add comment about
this disabling.
Adhemerval Zanella [Fri, 2 Mar 2018 16:04:36 +0000 (13:04 -0300)]
Define _DIRENT_MATCHES_DIRENT64 regardless
This patch defines _DIRENT_MATCHES_DIRENT64 to either 0 or 1 and adjust its
usage from checking its definition to its value.
Checked on a build for major Linux abis.
* bits/dirent.h (__INO_T_MATCHES_INO64_T): Define regardless whether
__INO_T_MATCHES_INO64_T is defined.
* sysdeps/unix/sysv/linux/bits/dirent.h: Likewise.
* dirent/alphasort.c: Check _DIRENT_MATCHES_DIRENT64 value instead
of definition.
* dirent/alphasort64.c: Likewise.
* dirent/scandir.c: Likewise.
* dirent/scandir64-tail.c: Likewise.
* dirent/scandir64.c: Likewise.
* dirent/scandirat.c: Likewise.
* dirent/scandirat64.c: Likewise.
* dirent/versionsort.c: Likewise.
* dirent/versionsort64.c: Likewise.
* include/dirent.h: Likewise.
Adhemerval Zanella [Thu, 22 Feb 2018 18:47:33 +0000 (15:47 -0300)]
nptl: Fix tst-cancel4 sendto tests
Now that send might be implemented calling sendto syscall on Linux,
I am seeing some issue in some kernel configurations where tst-cancel4
sendto do not block as expected.
The socket used to force the syscall blocking is used with default
system configuration for buffer sending size, which might not be
suffice to force blocking. This patch fixes it by explicit setting
buffer socket lower than the buffer size used. It also enables sendto
cancellation tests to work in both ways (since internally send is
implemented routing to sendto on Linux kernel).
The patch also removes unrequired make rules on some archictures
for send/recv. The generic nptl Makefile already set the compiler flags
required on some architectures for correct unwinding and libc object
are not strictly required to support unwind (since pthread_cancel
requires linking against libpthread).
Checked on aarch64-linux-gnu and x86_64-linux-gnu. I also did a
sniff test with tst-cancel{4,5} on a simulated mips64-linux-gnu.
* nptl/tst-cancel4-common.h (set_socket_buffer): New function.
* nptl/tst-cancel4-common.c (do_test): Call set_socket_buffer
for socketpair endpoint.
* nptl/tst-cancel4.c (tf_send): Call set_socket_buffer and use
WRITE_BUFFER_SIZE as buffer size for sending socket.
(tf_sendto): Use SOCK_STREAM instead of SOCK_DGRAM and fix an
issue on system where send is implemented with sendto syscall.
* sysdeps/unix/sysv/linux/mips/mips64/Makefile [$(subdir) = socket]
(CFLAGS-recv.c, CFLAGS-send.c): Remove rules.
[$(subdir) = nptl] (CFLAGS-recv.c, CFLAGS-send.c): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/Makefile: Remove file.
Adhemerval Zanella [Fri, 17 Nov 2017 18:04:29 +0000 (16:04 -0200)]
i386: Fix i386 sigaction sa_restorer initialization (BZ#21269)
This patch fixes the i386 sa_restorer field initialization for sigaction
syscall for kernel with vDSO. As described in bug report, i386 Linux
(and compat on x86_64) interprets SA_RESTORER clear with nonzero
sa_restorer as a request for stack switching if the SS segment is 'funny'.
This means that anything that tries to mix glibc's signal handling with
segmentation (for instance through modify_ldt syscall) is randomly broken
depending on what values lands in sa_restorer.
The testcase added is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
more specifically in do_multicpu_tests function. The main changes are:
- C11 atomics instead of plain access.
- Remove x86_64 support which simplifies the syscall handling and fallbacks.
- Replicate only the test required to trigger the issue.
Checked on i686-linux-gnu.
[BZ #21269]
* sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269.
* sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear
sa_restorer for vDSO case.
* sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file.
Samuel Thibault [Sun, 4 Mar 2018 21:38:20 +0000 (22:38 +0100)]
hurd: Add futimens support
* sysdeps/mach/hurd/futimens.c: New file.
Samuel Thibault [Sun, 4 Mar 2018 02:15:49 +0000 (03:15 +0100)]
Separate out error_t definition
so interfaces needing it can get it.
* stdlib/errno.h (error_t): Move definition to...
* bits/types/error_t.h: ... new header.
* stdlib/Makefile (headers): Add bits/types/error_t.h.
* sysdeps/mach/hurd/bits/errno.h (error_t): Move definition to...
* sysdeps/mach/hurd/bits/types/error_t.h: ... new header.
* sysdeps/mach/hurd/errnos.awk (error_t): Likewise.
* hurd/hurd.h: Include <bits/types/error_t.h>
* hurd/hurd/fd.h: Include <bits/types/error_t.h>
* hurd/hurd/id.h: Include <errno.h> and <bits/types/error_t.h>
* hurd/hurd/lookup.h: Include <errno.h> and <bits/types/error_t.h>
* hurd/hurd/resource.h: Include <bits/types/error_t.h>
* hurd/hurd/signal.h: Include <bits/types/error_t.h>
* hurd/hurd/sigpreempt.h: Include <bits/types/error_t.h>
Samuel Thibault [Sun, 4 Mar 2018 02:44:14 +0000 (03:44 +0100)]
hurd: Make almost all hurd headers includable in all standards
* hurd/hurd.h: Include <bits/types/sigset_t.h>
* hurd/hurd/fd.h: Include <sys/select.h> and <bits/types/sigset_t.h>
(_hurd_fd_read, _hurd_fd_write): Use __loff_t instead of loff_t.
* hurd/hurd/signal.h: Include <bits/types/stack_t.h> and
<bits/types/sigset_t.h>.
[!defined __USE_GNU]: Do not #error out.
(struct hurd_sigstate): Use _NSIG instead of NSIG.
* hurd/hurd/sigpreempt.h (__need_size_t): Define.
Include <stddef.h> and <bits/types/sigset_t.h>
(struct hurd_signal_preemptor, hurd_catch_signal): Use __sighandler_t
instead of sighandler_t.
Samuel Thibault [Sun, 4 Mar 2018 01:49:44 +0000 (02:49 +0100)]
hurd: Fix inclusion of mach headers in all standards
mig_support does not actually inline the stpncpy any more.
* mach/mach/mig_support.h [defined __USE_GNU]: Do not #error out.
* scripts/check-installed-headers.sh: Do not ignore Hurd and Mach
headers.
Samuel Thibault [Sun, 4 Mar 2018 01:11:46 +0000 (02:11 +0100)]
hurd: Avoid using ino64_t and loff_t in headers
* mach/Machrules ($(patsubst %,$(objpfx)%.h,$(user-interfaces)):
Process mig output through $(migheaderpipe).
* hurd/Makefile (migheaderpipe): Define variable.
Samuel Thibault [Sun, 4 Mar 2018 00:59:30 +0000 (01:59 +0100)]
hurd: Add missing include
* sysdeps/mach/hurd/dl-sysdep.c: Include <mach/machine/vm_param.h>.
Samuel Thibault [Sun, 4 Mar 2018 00:35:12 +0000 (01:35 +0100)]
hurd: fix header conformity
* hurd/hurd/fd.h (_hurd_fd_error): Fix struct initializer to be
trivial, for C++ conformity.
Samuel Thibault [Sun, 4 Mar 2018 00:28:55 +0000 (01:28 +0100)]
hurd: avoid including hurd/signal.h when not needed
thus making <hurd/port.h> and <hurd/userlink.h> includable without
_GNU_SOURCE.
* hurd/hurd/port.h: Do not include <hurd/signal.h>.
* hurd/hurd/userlink.h [!defined __USE_EXTERN_INLINES ||
!defined _LIBC || !IS_IN (libc)]: Do not include <hurd/signal.h>.
Samuel Thibault [Sat, 3 Mar 2018 23:42:20 +0000 (00:42 +0100)]
hurd: Move mach/param.h to bits/mach/param.h
* mach/Makefile (headers): Move mach/param.h to bits/mach/param.h.
* sysdeps/mach/i386/mach/param.h: Move file to ...
* sysdeps/mach/i386/bits/mach/param.h: ... here. Update path in #error.
* sysdeps/mach/hurd/bits/param.h: Include <bits/mach/param.h> instead
of <mach/param.h>.
Samuel Thibault [Sat, 3 Mar 2018 23:13:47 +0000 (00:13 +0100)]
hurd: Add missing includes
* mach/Makefile ($(objpfx)mach-shortcuts.h): Make it include
<mach/mach_types.h> and <mach/message.h>.
Samuel Thibault [Sat, 3 Mar 2018 22:58:51 +0000 (23:58 +0100)]
hurd: Add missing includes
* hurd/hurd/id.h: Include <hurd/hurd_types.h>
* hurd/hurd/ioctl.h: Include <mach/port.h>
* hurd/hurd/lookup.h: Include <hurd/hurd_types.h>
Samuel Thibault [Sat, 3 Mar 2018 19:06:04 +0000 (20:06 +0100)]
hurd: do not check Mach and Hurd headers
as they are not standard.
* scripts/check-installed-headers.sh: Ignore Hurd and Mach headers.
Andreas Schwab [Fri, 2 Mar 2018 22:07:14 +0000 (23:07 +0100)]
Fix multiple definitions of __nss_*_database (bug 22918)
Joseph Myers [Fri, 2 Mar 2018 22:27:56 +0000 (22:27 +0000)]
Fix powerpc ifunc-sel.h build for -Os.
Compiling the testsuite for powerpc (multi-arch configurations) with
-Os with GCC 7 fails with:
In file included from ifuncmod1.c:7:0,
from ifuncdep1.c:3:
../sysdeps/powerpc/ifunc-sel.h: In function 'ifunc_sel':
../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 2 probably doesn't match constraints [-Werror]
__asm__ ("mflr 12\n\t"
^~~~~~~
../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 3 probably doesn't match constraints [-Werror]
../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 4 probably doesn't match constraints [-Werror]
../sysdeps/powerpc/ifunc-sel.h:12:3: error: impossible constraint in 'asm'
The "i" constraints on function pointers require the function call to
be inlined so the compiler can see the constant function pointer
arguments passed to the asm. This patch marks the relevant functions
as always_inline accordingly.
Tested that this fixes the -Os testsuite build for
powerpc-linux-gnu-power4, powerpc64-linux-gnu, powerpc64le-linux-gnu
with build-many-glibcs.py.
* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Make always_inline.
(ifunc_one): Likewise.
DJ Delorie [Fri, 2 Mar 2018 04:20:45 +0000 (23:20 -0500)]
[BZ #22342] Fix netgroup cache keys.
Unlike other nscd caches, the netgroup cache contains two types of
records - those for "iterate through a netgroup" (i.e. setnetgrent())
and those for "is this user in this netgroup" (i.e. innetgr()),
i.e. full and partial records. The timeout code assumes these records
have the same key for the group name, so that the collection of records
that is "this netgroup" can be expired as a unit.
However, the keys are not the same, as the in-netgroup key is generated
by nscd rather than being passed to it from elsewhere, and is generated
without the trailing NUL. All other keys have the trailing NUL, and as
noted in the linked BZ, debug statements confirm that two keys for the
same netgroup are added to the cache with two different lengths.
The result of this is that as records in the cache expire, the purge
code only cleans out one of the two types of entries, resulting in
stale, possibly incorrect, and possibly inconsistent cache data.
The patch simply includes the existing NUL in the computation for the
key length ('key' points to the char after the NUL, and 'group' to the
first char of the group, so 'key-group' includes the first char to the
NUL, inclusive).
[BZ #22342]
* nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in
key value.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Maciej W. Rozycki [Thu, 1 Mar 2018 16:10:05 +0000 (16:10 +0000)]
nptl_db: Remove stale `match_pid' parameter from `iterate_thread_list'
Complement commit
c579f48edba8 ("Remove cached PID/TID in clone") and
remove the `match_pid' parameter not used by `iterate_thread_list' any
longer. Update call sites accordingly.
* nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove
`match_pid' parameter.
(td_ta_thr_iter): Update accordingly.
Florian Weimer [Thu, 1 Mar 2018 13:38:00 +0000 (14:38 +0100)]
nptl: Turn libpthread.so into a symbolic link to the real DSO
The linker script is no longer needed.
Mike FABIAN [Thu, 1 Mar 2018 06:05:01 +0000 (07:05 +0100)]
an_ES locale: update some locale data [BZ #22896]
[BZ #22896]
* localedata/locales/an_ES: update month and day names,
improve d_fmt, improve postal_fmt, add country_post,
add country_isbn
Mike FABIAN [Wed, 28 Feb 2018 18:26:29 +0000 (19:26 +0100)]
bg_BG locale: Fix a typo in a comment
* localedata/locales/bg_BG (LC_COLLATE): The comment mentioned
Ukrainian instead of Bulgarian.
Florian Weimer [Thu, 1 Mar 2018 11:53:09 +0000 (12:53 +0100)]
nptl: Drop libpthread_nonshared.a from libpthread.so
Fixes commit
bd60ce86520b781ca24b99b2555e2ad389bbfeaa (nptl: Move
pthread_atfork to libc_nonshared.a).
Florian Weimer [Thu, 1 Mar 2018 07:18:27 +0000 (08:18 +0100)]
nptl: Move pthread_atfork to libc_nonshared.a
libpthread_nonshared.a is unused after this, so remove it from the
build.
There is no ABI impact because pthread_atfork was implemented using
__register_atfork in libc even before this change.
pthread_atfork has to be a weak alias because pthread_* names are not
reserved in libc.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Joseph Myers [Wed, 28 Feb 2018 21:55:51 +0000 (21:55 +0000)]
Fix i386 fenv_private.h float128 for 32-bit --with-fpmath=sse (bug 22902).
As discussed in bug 22902, the i386 fenv_private.h implementation has
problems for float128 for the case of 32-bit glibc built with libgcc
from GCC configured using --with-fpmath=sse.
The optimized floating-point state handling in fenv_private.h needs to
know which floating-point state - x87 or SSE - is used for each
floating-point type, so that only one state needs updating / testing
for libm code using that state internally. On 32-bit x86, the x87
rounding mode is always used for float128, but the x87 exception flags
are only used when libgcc is built using x87 floating-point
arithmetic; if libgcc is built for SSE arithmetic, the SSE exception
flags are used.
The choice of arithmetic with which libgcc is built is independent of
that with which glibc is built. Thus, since glibc cannot tell the
choice used in libgcc, the default implementations of
libc_feholdexcept_setroundf128 and libc_feupdateenv_testf128 (which
use the <fenv.h> functions, thus using both x87 and SSE state on
processors that have both) need to be used; this patch updates the
code accordingly.
Tested for 32-bit x86; HJ reports testing in the --with-fpmath=sse
case.
[BZ #22902]
* sysdeps/i386/fpu/fenv_private.h [!__x86_64__]
(libc_feholdexcept_setroundf128): New macro.
[!__x86_64__] (libc_feupdateenv_testf128): Likewise.
Joseph Myers [Wed, 28 Feb 2018 14:16:21 +0000 (14:16 +0000)]
Use libc_hidden_* for strtoumax (bug 15105).
On sparc, localplt test failures appear when building with -Os because
of a call to strtoumax from
sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c, and strtoumax
is not inlined when building with -Os. This patch fixes those
failures by using libc_hidden_proto and libc_hidden_def for strtoumax.
Tested with build-many-glibcs.py for
sparc64-linux-gnu-disable-multi-arch, sparc64-linux-gnu,
sparcv9-linux-gnu-disable-multi-arch, sparcv9-linux-gnu that this
fixes that test failure with -Os.
[BZ #15105]
* sysdeps/wordsize-32/strtoumax.c (strtoumax): Use
libc_hidden_def.
* sysdeps/wordsize-64/strtoumax.c (strtoumax): Likewise.
* include/inttypes.h: New file.
Joseph Myers [Tue, 27 Feb 2018 16:54:14 +0000 (16:54 +0000)]
Fix two more -Os strcoll / wcscoll build failures.
Continuing fixes for -Os build issues shown with build-many-glibcs.py,
this patch adds uses of DIAG_* to disable -Wmaybe-uninitialized in two
more places where code inlined from strcoll / wcscoll is wrongly
diagnosed as possibly using uninitialized structure fields. (All
these warnings in different places for these functions are I think
essentially the same bug.)
Tested with build-many-glibcs.py for alpha-linux-gnu and
mips-linux-gnu that this fixes the -Os build failures for those
configurations with GCC 7.
* locale/weightwc.h (findidx): Ignore -Wmaybe-uninitialized for
-Os in two more places.
Mike FABIAN [Thu, 21 Dec 2017 17:56:52 +0000 (18:56 +0100)]
Remove the lines from cmn_TW.UTF-8.in which cannot work at the moment.
See this bug https://sourceware.org/bugzilla/show_bug.cgi?id=22898
These lines don’t yet work because of a glibc bug, not because of
problems in the locale data. No matter what sorting rules one uses,
these characters cannot be sorted at all at the moment.
As soon as that bug is fixed, these lines should be added back to the
test file.
* localedata/cmn_TW.UTF-8.in: Remove the lines which cannot
be sorted correctly at the moment because of a bug.
Mike FABIAN [Mon, 11 Dec 2017 17:26:22 +0000 (18:26 +0100)]
Adapt collation in several locales to the new iso14651_t1_common file
[BZ #22550] - es_ES locale (and other es_* locales): collation should
treat ñ as a primary different character, sync the collation
for Spanish with CLDR
[BZ #21547] - Tibetan script collation broken (Dzongkha and Tibetan)
* localedata/Makefile: Add new test files.
* localedata/lv_LV.UTF-8.in: Adapt test file to new collation order.
* localedata/sv_SE.ISO-8859-1.in: Adapt test file to new collation order.
* localedata/uk_UA.UTF-8.in: Adapt test file to new collation order.
* localedata/am_ET.UTF-8.in: New test file.
* localedata/az_AZ.UTF-8.in: Likewise.
* localedata/be_BY.UTF-8.in: Likewise.
* localedata/ber_DZ.UTF-8.in: Likewise.
* localedata/ber_MA.UTF-8.in: Likewise.
* localedata/bg_BG.UTF-8.in: Likewise.
* localedata/br_FR.UTF-8.in: Likewise.
* localedata/cmn_TW.UTF-8.in: Likewise.
* localedata/crh_UA.UTF-8.in: Likewise.
* localedata/csb_PL.UTF-8.in: Likewise.
* localedata/cv_RU.UTF-8.in: Likewise.
* localedata/cy_GB.UTF-8.in: Likewise.
* localedata/dz_BT.UTF-8.in: Likewise.
* localedata/eo.UTF-8.in: Likewise.
* localedata/es_ES.UTF-8.in: Likewise.
* localedata/fa_IR.UTF-8.in: Likewise.
* localedata/fi_FI.UTF-8.in: Likewise.
* localedata/fil_PH.UTF-8.in: Likewise.
* localedata/fur_IT.UTF-8.in: Likewise.
* localedata/gez_ER.UTF-8@abegede.in: Likewise.
* localedata/ha_NG.UTF-8.in: Likewise.
* localedata/ig_NG.UTF-8.in: Likewise.
* localedata/ik_CA.UTF-8.in: Likewise.
* localedata/kk_KZ.UTF-8.in: Likewise.
* localedata/ku_TR.UTF-8.in: Likewise.
* localedata/ky_KG.UTF-8.in: Likewise.
* localedata/ln_CD.UTF-8.in: Likewise.
* localedata/mi_NZ.UTF-8.in: Likewise.
* localedata/ml_IN.UTF-8.in: Likewise.
* localedata/mn_MN.UTF-8.in: Likewise.
* localedata/mr_IN.UTF-8.in: Likewise.
* localedata/mt_MT.UTF-8.in: Likewise.
* localedata/nb_NO.UTF-8.in: Likewise.
* localedata/om_KE.UTF-8.in: Likewise.
* localedata/os_RU.UTF-8.in: Likewise.
* localedata/ps_AF.UTF-8.in: Likewise.
* localedata/ro_RO.UTF-8.in: Likewise.
* localedata/ru_RU.UTF-8.in: Likewise.
* localedata/sc_IT.UTF-8.in: Likewise.
* localedata/se_NO.UTF-8.in: Likewise.
* localedata/sq_AL.UTF-8.in: Likewise.
* localedata/sv_SE.UTF-8.in: Likewise.
* localedata/szl_PL.UTF-8.in: Likewise.
* localedata/tg_TJ.UTF-8.in: Likewise.
* localedata/tk_TM.UTF-8.in: Likewise.
* localedata/tt_RU.UTF-8.in: Likewise.
* localedata/tt_RU.UTF-8@iqtelif.in: Likewise.
* localedata/ug_CN.UTF-8.in: Likewise.
* localedata/uz_UZ.UTF-8.in: Likewise.
* localedata/vi_VN.UTF-8.in: Likewise.
* localedata/yi_US.UTF-8.in: Likewise.
* localedata/yo_NG.UTF-8.in: Likewise.
* localedata/zh_CN.UTF-8.in: Likewise.
* localedata/locales/am_ET: Adapt collation rules to new iso14651_t1_common
file and fix bugs in the collation.
* localedata/locales/az_AZ: Likewise.
* localedata/locales/be_BY: Likewise.
* localedata/locales/ber_DZ: Likewise.
* localedata/locales/ber_MA: Likewise.
* localedata/locales/bg_BG: Likewise.
* localedata/locales/br_FR: Likewise.
* localedata/locales/br_FR@euro: Likewise.
* localedata/locales/ca_ES: Likewise.
* localedata/locales/cns11643_stroke: Likewise.
* localedata/locales/crh_UA: Likewise.
* localedata/locales/cs_CZ: Likewise.
* localedata/locales/csb_PL: Likewise.
* localedata/locales/cv_RU: Likewise.
* localedata/locales/cy_GB: Likewise.
* localedata/locales/da_DK: Likewise.
* localedata/locales/dz_BT: Likewise.
* localedata/locales/en_CA: Likewise.
* localedata/locales/eo: Likewise.
* localedata/locales/es_CU: Likewise.
* localedata/locales/es_EC: Likewise.
* localedata/locales/es_ES: Likewise.
* localedata/locales/es_US: Likewise.
* localedata/locales/et_EE: Likewise.
* localedata/locales/fa_IR: Likewise.
* localedata/locales/fi_FI: Likewise.
* localedata/locales/fil_PH: Likewise.
* localedata/locales/fur_IT: Likewise.
* localedata/locales/gez_ER@abegede: Likewise.
* localedata/locales/ha_NG: Likewise.
* localedata/locales/hr_HR: Likewise.
* localedata/locales/hsb_DE: Likewise.
* localedata/locales/hu_HU: Likewise.
* localedata/locales/ig_NG: Likewise.
* localedata/locales/ik_CA: Likewise.
* localedata/locales/is_IS: Likewise.
* localedata/locales/iso14651_t1_pinyin: Likewise.
* localedata/locales/kk_KZ: Likewise.
* localedata/locales/ku_TR: Likewise.
* localedata/locales/ky_KG: Likewise.
* localedata/locales/ln_CD: Likewise.
* localedata/locales/lt_LT: Likewise.
* localedata/locales/lv_LV: Likewise.
* localedata/locales/mi_NZ: Likewise.
* localedata/locales/ml_IN: Likewise.
* localedata/locales/mn_MN: Likewise.
* localedata/locales/mr_IN: Likewise.
* localedata/locales/mt_MT: Likewise.
* localedata/locales/nb_NO: Likewise.
* localedata/locales/om_KE: Likewise.
* localedata/locales/os_RU: Likewise.
* localedata/locales/pl_PL: Likewise.
* localedata/locales/ps_AF: Likewise.
* localedata/locales/ro_RO: Likewise.
* localedata/locales/ru_RU: Likewise.
* localedata/locales/ru_UA: Likewise.
* localedata/locales/sc_IT: Likewise.
* localedata/locales/se_NO: Likewise.
* localedata/locales/si_LK: Likewise.
* localedata/locales/sq_AL: Likewise.
* localedata/locales/sv_FI: Likewise.
* localedata/locales/sv_FI@euro: Likewise.
* localedata/locales/sv_SE: Likewise.
* localedata/locales/szl_PL: Likewise.
* localedata/locales/tg_TJ: Likewise.
* localedata/locales/ti_ER: Likewise.
* localedata/locales/tk_TM: Likewise.
* localedata/locales/tl_PH: Likewise.
* localedata/locales/tr_TR: Likewise.
* localedata/locales/tt_RU: Likewise.
* localedata/locales/tt_RU@iqtelif: Likewise.
* localedata/locales/ug_CN: Likewise.
* localedata/locales/uk_UA: Likewise.
* localedata/locales/uz_UZ: Likewise.
* localedata/locales/uz_UZ@cyrillic: Likewise.
* localedata/locales/vi_VN: Likewise.
* localedata/locales/yi_US: Likewise.
* localedata/locales/yo_NG: Likewise.
Mike FABIAN [Mon, 1 Jan 2018 14:33:50 +0000 (15:33 +0100)]
Improve gen-locales.mk and gen-locale.sh to make test files with @ options work
With out this, adding collation test files like localedata/gez_ER.UTF-8@abegede.in
does not work for locales which contain @ modifiers.
* gen-locales.mk: Make test files which contain @ modifiers in their
name work.
* localedata/gen-locale.sh: Likewise.
Mike FABIAN [Tue, 23 Jan 2018 16:29:36 +0000 (17:29 +0100)]
Fix test cases tst-fnmatch and tst-regexloc for the new iso14651_t1_common file.
See:
http://pubs.opengroup.org/onlinepubs/7908799/xbd/re.html
> A range expression represents the set of collating elements that fall
> between two elements in the current collation sequence,
> inclusively. It is expressed as the starting point and the ending
> point separated by a hyphen (-).
>
> Range expressions must not be used in portable applications because
> their behaviour is dependent on the collating sequence. Ranges will be
> treated according to the current collating sequence, and include such
> characters that fall within the range based on that collating
> sequence, regardless of character values. This, however, means that
> the interpretation will differ depending on collating sequence. If,
> for instance, one collating sequence defines ä as a variant of a,
> while another defines it as a letter following z, then the expression
> [ä-z] is valid in the first language and invalid in the second.
Therefore, using [a-z] does not make much sense except in the C/POSIX locale.
The new iso14651_t1_common lists upper case and lower case Latin characters
in a different order than the old one which causes surprising results
for example in the de_DE locale: [a-z] now includes A because A comes
after a in iso14651_t1_common but does not include Z because that comes
after z in iso14651_t1_common.
* posix/tst-fnmatch.input: Fix results for range expressions
for non C locales.
* posix/tst-regexloc.c: Do not use a range expression for
de_DE.ISO-8859-1 locale.
Mike FABIAN [Fri, 15 Dec 2017 06:19:45 +0000 (07:19 +0100)]
Fix posix/bug-regex5.c test case, adapt to iso14651_t1_common upate
This test case tests how many collating elements are defined in
da_DK.ISO-8859-1 locale. The da_DK locale source defines 4:
collating-element <A-A> from "<U0041><U0041>"
collating-element <A-a> from "<U0041><U0061>"
collating-element <a-A> from "<U0061><U0041>"
collating-element <a-a> from "<U0061><U0061>"
The new iso14651_t1_common file defines more collating elements, two
of them are in the ISO-8859-1 range:
collating-element <U004C_00B7> from "<U004C><U00B7>" % decomposition of LATIN CAPITAL LETTER L WITH MIDDLE DOT
collating-element <U006C_00B7> from "<U006C><U00B7>" % decomposition of LATIN SMALL LETTER L WITH MIDDLE DOT
So the total count is now 6 instead of 4.
* posix/bug-regex5.c: Fix test case because with the new
iso14651_t1_common file, the da_DK locale now has 6 collating elements
in the ISO-8859-1 range instead of 4 with the old iso14651_t1_common
file.
Mike FABIAN [Wed, 13 Dec 2017 13:39:54 +0000 (14:39 +0100)]
Collation order of @-. and space has changed in new iso14651_t1_common file, adapt test files
* localedata/da_DK.ISO-8859-1.in: In the new iso14651_t1_common file
downloaded from ISO, the collation order of @-. and space has changed.
Therefore, this test file needed to be adapted.
* localedata/fr_CA.UTF-8.in: Likewise.
* localedata/fr_FR.UTF-8.in: Likewise.
* localedata/uk_UA.UTF-8.in: Likewise.
Mike FABIAN [Tue, 12 Dec 2017 13:39:34 +0000 (14:39 +0100)]
Collation order of ȥ has changed in new iso14651_t1_common file, adapt test files
* localedata/cs_CZ.UTF-8.in: adapt this test file to the collation
order of ȥ in the new iso14651_t1_common file.
* localedata/pl_PL.UTF-8.in: Likewise.
Mike FABIAN [Tue, 30 Jan 2018 14:45:05 +0000 (15:45 +0100)]
Add sections for various scripts to the iso14651_t1_common file
* localedata/locales/iso14651_t1_common: Add sections for various
scripts to the iso14651_t1_common file.
Mike FABIAN [Wed, 31 Jan 2018 05:18:47 +0000 (06:18 +0100)]
iso14651_t1_common: make the fourth level the codepoint for characters which are ignorable on all 4 levels
Entries for characters which have “IGNORE” on all 4 levels like:
<U0001> IGNORE;IGNORE;IGNORE;IGNORE % START OF HEADING (in ISO 6429)
are changed into:
<U0001> IGNORE;IGNORE;IGNORE;<U0001> % START OF HEADING (in ISO 6429)
i.e. putting the code point of the character into the fourth level
instead of “IGNORE”. Without that change, all such characters
would compare equal which would make a wcscoll test case fail.
It is better to have a clearly defined sort order even for characters
like this so it is good to use the code point as a tie-break.
* localedata/locales/iso14651_t1_common: Use the code point of a
character in the fourth collation level instead of IGNORE for all
entries which have IGNORE on all 4 levels.
Mike FABIAN [Mon, 11 Dec 2017 19:00:24 +0000 (20:00 +0100)]
Add convenience symbols like <AFTER-A>, <BEFORE-A> to iso14651_t1_common
* localedata/locales/iso14651_t1_common: Add some convenient collation
symbols like <AFTER-A>, <BEFORE-A> to make tailoring easier using
rules similar to those in CLDR.
Mike FABIAN [Tue, 30 Jan 2018 17:24:47 +0000 (18:24 +0100)]
Fixing syntax errors after updating the iso14651_t1_common file
* localedata/locales/iso14651_t1_common: The new version of this
file downloaded from ISO contained several syntax errors which
are fixed by this patch.
Mike FABIAN [Tue, 30 Jan 2018 17:07:39 +0000 (18:07 +0100)]
iso14651_t1_common: <U\([0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]\)> → <U000\1>
* localedata/locales/iso14651_t1_common: replace all <U.....>
with <U000.....> because glibc understands only 4 digit or 8 digit
Mike FABIAN [Tue, 30 Jan 2018 17:04:31 +0000 (18:04 +0100)]
Necessary changes after updating the iso14651_t1_common file
* localedata/locales/iso14651_t1_common: Necessary changes
to make the file downloaded from ISO usable by glibc.
Mike FABIAN [Tue, 30 Jan 2018 16:59:00 +0000 (17:59 +0100)]
Update iso14651_t1_common file to ISO14651_2016_TABLE1_en.txt [BZ #14095]
[BZ #14095] - Review / update collation data from Unicode / ISO 14651
File downloaded from:
http://standards.iso.org/iso-iec/14651/ed-4/ISO14651_2016_TABLE1_en.txt
Updating this file alone is not enough, there are problems in the new
file which need to be fixed and the collation rules for many locales
need to be adapted. This is done by the following patches.
This update also fixes the problem that many characters are treated as
identical when sorting because they were not yet in the old
iso14651_t1_common file, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1336308
- Infinite (∞) and empty set (∅) are treated as if they were the same character by sort and uniq
[BZ #14095]
* localedata/locales/iso14651_t1_common: Update file to
latest version from ISO (ISO14651_2016_TABLE1_en.txt).
Samuel Thibault [Tue, 27 Feb 2018 00:15:09 +0000 (01:15 +0100)]
hurd: fix timer_routines.c build
* sysdeps/pthread/timer_routines.c: Include <timer_routines.h>
instead of <internaltypes.h>.
Samuel Thibault [Tue, 27 Feb 2018 00:10:37 +0000 (01:10 +0100)]
hurd: fix gai_misc build
* sysdeps/mach/hurd/gai_misc.h: New file.
Samuel Thibault [Mon, 26 Feb 2018 23:55:59 +0000 (00:55 +0100)]
hurd: fix timer_routines.c build
* sysdeps/pthread/timer_routines.c: [!defined DELAYTIMER_MAX]
(DELAYTIMER_MAX): Define to INT_MAX.
Samuel Thibault [Sun, 18 Feb 2018 02:00:50 +0000 (03:00 +0100)]
Move NPTL-specific code to NPTL-specific header
* sysdeps/pthread/timer_routines.c: Include <timer_routines.h> instead
of <nptl/pthreadP.h>
(thread_attr_compare): Move function to...
* sysdeps/nptl/timer_routines.h: ... new header.
Joseph Myers [Mon, 26 Feb 2018 18:38:01 +0000 (18:38 +0000)]
Fix another -Os strcoll build issue.
While there are now clean -Os build and test results on x86_64 (given
my patch <https://sourceware.org/ml/libc-alpha/2018-02/msg00602.html>,
pending review), testing with -Os with build-many-glibcs.py shows the
build is still failing with -Os everywhere except for x86_64, x86 and
s390x.
There are a variety of different build failures, but the most common
seem to be in strcoll / wcscoll, similar to existing such cases where
DIAG_* are used to disable -Wmaybe-uninitialized. There are various
different failures even within those functions. This patch fixes one
particular case that seems quite common, where the warning appears at
the declarations of seq1 and seq2.
Tested with build-many-glibcs.py that this fixes the -Os build for
aarch64-linux-gnu with GCC 7.
* string/strcoll_l.c: Include <libc-diag.h>.
(STRCOLL): Ignore -Wmaybe-uninitialized for -Os around
declarations of seq1 and seq2.
Joseph Myers [Mon, 26 Feb 2018 18:17:47 +0000 (18:17 +0000)]
Use libc_hidden_* for atoi (bug 15105).
Continuing the fixes for localplt test failures with -Os arising from
functions not being inlined in that case, this patch fixes such
failures for atoi by using libc_hidden_proto and libc_hidden_def.
Tested for x86_64 (both that it removes this particular localplt
failure for -Os, and that the testsuite continues to pass without
-Os).
[BZ #15105]
* stdlib/atoi.c (atoi): Use libc_hidden_def.
* include/stdlib.h [!_ISOMAC] (atoi): Use libc_hidden_proto.
Dmitry V. Levin [Sat, 10 Feb 2018 23:19:32 +0000 (23:19 +0000)]
linux/powerpc: sync sys/ptrace.h with Linux 4.15 [BZ #22433, #22807]
Tested with strace.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h (__ptrace_request): Add
PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS,
PTRACE_GETVRREGS, PTRACE_SETVRREGS, PTRACE_GETEVRREGS,
PTRACE_SETEVRREGS, PTRACE_GETREGS64, PTRACE_SETREGS64,
PTRACE_GET_DEBUGREG, PTRACE_SET_DEBUGREG, PTRACE_GETVSRREGS,
PTRACE_SETVSRREGS, and PTRACE_SINGLEBLOCK.
Tulio Magno Quites Machado Filho [Mon, 26 Feb 2018 13:40:17 +0000 (10:40 -0300)]
powerpc: Undefine Linux ptrace macros that conflict with __ptrace_request
Linux ptrace headers define macros whose tokens conflict with the
constants of enum __ptrace_request causing build errors when
asm/ptrace.h or linux/ptrace.h are included before sys/ptrace.h.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Undefine Linux
macros used in __ptrace_request.
Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
H.J. Lu [Mon, 26 Feb 2018 12:54:14 +0000 (04:54 -0800)]
Fix a typo in ChangeLog (bit_cpu_BIT -> bit_cpu_IBT)
DJ Delorie [Fri, 23 Feb 2018 21:08:08 +0000 (16:08 -0500)]
Update ChangeLog for BZ 22884 - riscv fmax/fmin
H.J. Lu [Fri, 23 Feb 2018 19:29:27 +0000 (11:29 -0800)]
Define GEN_AS_CONST_HEADERS when generating header files [BZ #22792]
Glibc build generates header files to define constants from special .sym
files. If a .sym file includes the same header file which it generates,
it leads to circular dependency which may lead to build hang on a
many-core machine. Define GEN_AS_CONST_HEADERS when generating header
files to avoid circular dependency.
<tcb-offsets.h> is needed for i686 and it isn't needed for x86-64 at
least since glibc 2.23.
Tested on i686 and x86-64.
[BZ #22792]
* Makerules ($(common-objpfx)%.h): Pass -DGEN_AS_CONST_HEADERS
to $(CC).
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Include
<tcb-offsets.h> only if GEN_AS_CONST_HEADERS isn't defined.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Don't include
<tcb-offsets.h>.
Joseph Myers [Fri, 23 Feb 2018 13:54:53 +0000 (13:54 +0000)]
Use libc_hidden_* for tolower, toupper (bug 15105).
Continuing the fixes for localplt test failures with -Os arising from
functions not being inlined in that case, this patch fixes such
failures for tolower and toupper by using libc_hidden_proto and
libc_hidden_def.
Tested for x86_64 (both that it removes this particular localplt
failure for -Os, and that the testsuite continues to pass without
-Os).
2018-02-22 Joseph Myers <joseph@codesourcery.com>
[BZ #15105]
* ctype/ctype.c (tolower): Use libc_hidden_def.
(toupper): Likewise.
* include/ctype.h [!_ISOMAC] (tolower): Use libc_hidden_proto.
[!_ISOMAC] (toupper): Likewise.
Mike FABIAN [Tue, 20 Feb 2018 17:14:43 +0000 (18:14 +0100)]
Remove --quiet argument when installing locales
Using this argument hides problems. I would like to see when something fails.
* localedata/Makefile: Remove --quiet argument when
installing locales
Mike FABIAN [Wed, 14 Feb 2018 17:17:42 +0000 (18:17 +0100)]
Use / instead of - in d_fmt for pt_BR and pt_PT [BZ #17438]
[BZ #17438]
* localedata/locales/pt_BR (LC_TIME): use / instead of -
in d_fmt.
* localedata/locales/pt_PT (LC_TIME): likewise
Mike FABIAN [Tue, 13 Feb 2018 11:03:49 +0000 (12:03 +0100)]
Use “copy "es_BO"” in LC_TIME of es_CU, es_CL, and es_EC
LC_TIME in these 4 locales is identical, using “copy "es_BO"” makes
that more obvious.
[BZ #22646]
* localedata/locales/es_CL (LC_TIME): copy "es_BO".
* localedata/locales/es_CU (LC_TIME): copy "es_BO".
* localedata/locales/es_EC (LC_TIME): copy "es_BO".
Adhemerval Zanella [Thu, 22 Feb 2018 19:44:58 +0000 (16:44 -0300)]
Update sparc ulps
* sysdeps/sparc/fpu/libm-test-ulps: Update.
Adhemerval Zanella [Thu, 1 Feb 2018 19:57:56 +0000 (17:57 -0200)]
Refactor atfork handlers
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.
Adhemerval Zanella [Sat, 4 Nov 2017 00:37:55 +0000 (22:37 -0200)]
Rename nptl-signals.h to internal-signals.h
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.
Andrew Waterman [Thu, 22 Feb 2018 19:31:54 +0000 (14:31 -0500)]
RISC-V: fmax/fmin: Handle signalling NaNs correctly.
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.
DJ Delorie [Thu, 22 Feb 2018 19:28:47 +0000 (14:28 -0500)]
RISC-V: Do not initialize $gp in TLS macros.
RISC-V TLS doesn't require GP to be initialized, and doing so breaks
TLS in a shared object.
Siddhesh Poyarekar [Thu, 22 Feb 2018 18:18:13 +0000 (23:48 +0530)]
aarch64/strcmp: fix misaligned loop jump target
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.
Steve Ellcey [Thu, 22 Feb 2018 16:38:47 +0000 (08:38 -0800)]
IFUNC for Cavium ThunderX2
* 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.
Rical Jasan [Thu, 22 Feb 2018 14:15:32 +0000 (06:15 -0800)]
Add [BZ #16335] annotation to ChangeLog entry.
Commit
6a3962c4a408e8cbc305d2433711196107374e89 unwittingly fixed a
bug, so update the ChangeLog entry accordingly.
Stefan Liebler [Thu, 22 Feb 2018 08:13:22 +0000 (09:13 +0100)]
S390: Regenerate ULPs.
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.
Samuel Thibault [Wed, 21 Feb 2018 22:32:46 +0000 (23:32 +0100)]
hurd: Add sysdep-cancel.h
Zack Weinberg [Wed, 21 Feb 2018 19:38:24 +0000 (14:38 -0500)]
Remove miscellaneous debris from libio.
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.
Zack Weinberg [Thu, 8 Feb 2018 00:41:01 +0000 (19:41 -0500)]
Remove _IO_file_flags define.
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.
Zack Weinberg [Thu, 8 Feb 2018 00:21:54 +0000 (19:21 -0500)]
Remove legacy configuration knobs from libio.
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.
Zack Weinberg [Wed, 7 Feb 2018 23:42:04 +0000 (18:42 -0500)]
Mechanically remove _IO_ name aliases for types and constants.
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.
Zack Weinberg [Wed, 7 Feb 2018 21:17:49 +0000 (16:17 -0500)]
Remove vestiges of external build support from libio headers.
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.
Joseph Myers [Wed, 21 Feb 2018 18:02:24 +0000 (18:02 +0000)]
Fix -Os putc_unlocked, fputc_unlocked linknamespace, localplt issues (bug 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.
Joseph Myers [Wed, 21 Feb 2018 18:01:11 +0000 (18:01 +0000)]
Fix -Os getc_unlocked linknamespace, localplt issues (bug 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 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.
Mike FABIAN [Mon, 19 Feb 2018 20:59:30 +0000 (21:59 +0100)]
Add missing “reorder-end” in LC_COLLATE of et_EE [BZ #22517]
[BZ #22517]
* localedata/locales/et_EE (LC_COLLATE): add missing “reorder-end”
Rical Jasan [Wed, 21 Feb 2018 12:00:03 +0000 (04:00 -0800)]
Fix a typo in a comment.
* io/fcntl.h: Fix a typo in a comment.
Rical Jasan [Mon, 19 Feb 2018 12:37:16 +0000 (04:37 -0800)]
manual: Update _DEFAULT_SOURCE. [BZ #22862]
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.
Florian Weimer [Wed, 21 Feb 2018 09:42:48 +0000 (10:42 +0100)]
ldconfig: Sync temporary files to disk before renaming them [BZ #20890]
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).
Florian Weimer [Wed, 21 Feb 2018 09:37:22 +0000 (10:37 +0100)]
elf: Remove ad-hoc restrictions on dlopen callers [BZ #22787]
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.
Samuel Thibault [Wed, 21 Feb 2018 00:17:29 +0000 (01:17 +0100)]
hurd: fix build
* sysdeps/mach/hurd/dl-sysdep.c (_dl_random): New variable.
Rical Jasan [Mon, 19 Feb 2018 12:32:35 +0000 (04:32 -0800)]
manual: Update the _ISOC99_SOURCE description.
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.
Rical Jasan [Mon, 19 Feb 2018 11:30:06 +0000 (03:30 -0800)]
manual: Document missing feature test macros.
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.
Joseph Myers [Mon, 19 Feb 2018 17:32:34 +0000 (17:32 +0000)]
Fix -Os ferror_unlocked linknamespace, localplt issues (bug 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 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.