about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* Use clock_settime to implement stime; withdraw stime.Zack Weinberg2019-10-305-58/+17
| | | | | | | | | | | | Unconditionally, on all ports, use clock_settime to implement stime, not settimeofday or a direct syscall. Then convert stime into a compatibility symbol and remove its prototype from time.h. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Change most internal uses of __gettimeofday to __clock_gettime.Zack Weinberg2019-10-3026-137/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since gettimeofday will shortly be implemented in terms of clock_gettime on all platforms, internal code should use clock_gettime directly; in addition to removing a layer of indirection, this will allow us to remove the PLT-bypass gunk for gettimeofday. (We can't quite do that yet, but it'll be coming later in this patch series.) In many cases, the changed code does fewer conversions. The changed code always assumes __clock_gettime (CLOCK_REALTIME) cannot fail. Most of the call sites were assuming gettimeofday could not fail, but a few places were checking for errors. POSIX says clock_gettime can only fail if the clock constant is invalid or unsupported, and CLOCK_REALTIME is the one and only clock constant that's required to be supported. For consistency I grepped the entire source tree for any other places that checked for errors from __clock_gettime (CLOCK_REALTIME), found one, and changed it too. (For the record, POSIX also says gettimeofday can never fail.) (It would be nice if we could declare that GNU systems will always support CLOCK_MONOTONIC as well as CLOCK_REALTIME; there are several places where we are using CLOCK_REALTIME where _MONOTONIC would be more appropriate, and/or trying to use _MONOTONIC and then falling back to _REALTIME. But the Hurd doesn't support CLOCK_MONOTONIC yet, and it looks like adding it would involve substantial changes to gnumach's internals and API. Oh well.) A few Hurd-specific files were changed to use __host_get_time instead of __clock_gettime, as this seemed tidier. We also assume this cannot fail. Skimming the code in gnumach leads me to believe the only way it could fail is if __mach_host_self also failed, and our Hurd-specific code consistently assumes that can't happen, so I'm going with that. With the exception of support/support_test_main.c, test cases are not modified, mainly because I didn't want to have to figure out which test cases were testing gettimeofday specifically. The definition of GETTIME in sysdeps/generic/memusage.h had a typo and was not reading tv_sec at all. I fixed this. It appears nobody has been generating malloc traces on a machine that doesn't have a superseding definition. There are a whole bunch of places where the code could be simplified by factoring out timespec subtraction and/or comparison logic, but I want to keep this patch as mechanical as possible. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Linux/Alpha: don't use timeval32 system calls.Zack Weinberg2019-10-3018-131/+637
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux/Alpha has two versions of several system call wrappers that take or return data of type "struct timeval" (possibly nested inside a larger structure). The GLIBC_2.0 version is a compat symbol that calls __NR_osf_foo or __NR_old_foo and uses a struct timeval with a 32-bit tv_sec field. The GLIBC_2.1 version is used for current code, calls __NR_foo, and uses a struct timeval with a 64-bit tv_sec field. This patch changes all of the compat symbols of this type to be wrappers around their GLIBC_2.1 counterparts; the compatibility system calls will no longer be used. It serves as a proposal for part of how we do the transition to 64-bit time_t on systems that currently use 32-bit time_t: * The patched glibc will NOT use system calls that involve 32-bit time_t to implement its compatibility symbols. This will make both our lives and the kernel maintainers' lives easier. The primary argument I've seen against it is that the kernel could warn about uses of the old system calls, helping people find old binaries that need to be recompiled. I think there are several other ways we could accomplish this, e.g. scripts to scan the filesystem for binaries with references to the old symbol versions, or issuing diagnostics ourselves. * The compat symbols do NOT report failure after the Y2038 deadline. An earlier revision of this patch had them return -1 and set errno to EOVERFLOW, but Adhemerval pointed out that many of them have already performed side effects at the point where we discover the overflow, so that would break more than it fixes. Also, we don't want people to be _checking_ for EOVERFLOW from these functions; we want them to recompile with 64-bit time_t. So it's not actually useful for them to report failure to the calling code. * What they do do, when they encounter overflow, is saturate the overflowed "struct timeval"(s): tv_sec is set to INT32_MAX and tv_nsec is set to 999999. That means time stops advancing for programs with 32-bit time_t when they reach the deadline. That's obviously going to break stuff, but I think wrapping around is probably going to break _more_ stuff. I'd be interested to hear arguments against, if anyone has one. The new header file tv32-compat.h is currently Alpha-specific but I mean for it to be reused to aid in writing wrappers for all affected architectures. I only put it in sysdeps/unix/sysv/linux/alpha for now because I haven't checked whether the various "foo32" structures it defines agree with the ABI for ports other than Linux/Alpha. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* resolv/tst-idna_name_classify: Isolate from system librariesFlorian Weimer2019-10-301-0/+4
| | | | | Loading NSS modules from static binaries uses installed system libraries if LD_LIBRARY_PATH is not set.
* hurd: Support for file record lockingSvante Signell2019-10-301-24/+87
| | | | | | * sysdeps/mach/hurd/fcntl.c: Add support for file-record-lock RPC fixing posix file locking using the flock64 version of struct flock.
* Comment out initgroups from example nsswitch.conf (Bug 25146)Carlos O'Donell2019-10-291-1/+2
| | | | | | | | | | In commit 4b7c74179c8928d971d370e1137d202f891a4cf5 the nsswitch.conf file was harmonized with downstream distributions, but this change included adding "initgroups: files". We should not add initgroups by default, we can have it, but it should be commented out to allow it to inherit the settings for group. The problem is principally that downstream authconfig won't update initgroups and it will get out of sync with the setting for group.
* y2038: linux: Provide __clock_getres64 implementationLukasz Majewski2019-10-272-3/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __clock_getres64 explicit 64 bit function for getting the resolution (precision) of specified clock ID. Moreover, a 32 bit version - __clock_getres has been refactored to internally use __clock_getres64. The __clock_getres is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion from 64 bit struct __timespec64 to struct timespec. The new clock_getres_time64 syscall available from Linux 5.1+ has been used, when applicable. On systems which are not supporting clock_getres_time64 (as their clock_getres supports 64 bit time ABI) the vDSO syscall is attempted. On the contrary the non-vDSO syscall is used for clock_getres_time64 as up till now the kernel is not providing such interface. No additional checks (i.e. if tv_nsec value overflow) are performed on values returned via clock_getres{_time64} syscall, as it is assumed that the Linux kernel will either return 0 and provide correct value or error. The check for tv_sec being out of range on systems still supporting 32 bit time (__TIMESIZE != 64) without Y2038 time support is also omitted as it is _very_ unlikely that we would have a timer with resolution which exceeds 32 bit time_t range. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make xcheck PARALLELMFLAGS="-j8" - The glibc has been build tested (make PARALLELMFLAGS="-j8") for x86 (i386), x86_64-x32, and armv7 Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master - Use of cross-test-ssh.sh for ARM (armv7): make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with clock_getres_time64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports clock_getres_time64 syscall. - Linux v4.19 (no clock_getres_time64 support) with default minimal kernel version for contemporary glibc This kernel doesn't support clock_getres_time64 syscall, so the fallback to clock_getres is tested. The above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed.
* time: Introduce function to check correctness of nanoseconds valueLukasz Majewski2019-10-2724-36/+49
| | | | | | | | | | | | | | | The valid_nanoseconds () static inline function has been introduced to check if nanoseconds value is in the correct range - greater or equal to zero and less than 1000000000. The explicit #include <time.h> has been added to files where it was missing. The __syscall_slong_t type for ns has been used to avoid issues on x32. Tested with: - scripts/build-many-glibcs.py - make PARALLELMFLAGS="-j12" && make PARALLELMFLAGS="-j12" xcheck on x86_64
* Add Transliterations for Unicode Misc. Mathematical Symbols-A/B [BZ #23132]Arjun Shankar2019-10-253-3/+157
| | | | | | | | | This commit adds previously missing transliterations for several code points in the Unicode blocks "Miscellaneous Mathematical Symbols-A/B" - transliterated to their approximate ASCII representations. It also adds a corresponding iconv transliteration test. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Install charmaps uncompressed in testrootDJ Delorie2019-10-242-1/+26
| | | | | | | | | | | | | The testroot does not have a gunzip command, so the charmap files should not be installed gzipped else they cannot be used (and thus tested). With this patch, installing with INSTALL_UNCOMPRESSED=yes installs uncompressed charmaps instead. Note that we must purge the $(symbolic_link_list) as it contains references to $(DESTDIR), which we change during the testroot installation. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Add wait-for-debugger test harness hooksDJ Delorie2019-10-242-0/+75
| | | | | | | | If WAIT_FOR_DEBUGGER is set to a non-zero value in the environment, any test that runs will print some useful gdb information and wait for gdb to attach to it and clear the "wait_for_debugger" variable. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Define __STATFS_MATCHES_STATFS64Alistair Francis2019-10-249-2/+37
| | | | | | | | Add a new macro __STATFS_MATCHES_STATFS64 that specifies if fsblkcnt_t matches fsblkcnt64_t and if fsfilcnt_t matches fsfilcnt64_t. As we don't have the padding we also need to update the overflow checker to not access the undefined members.
* hurd: Fix build after __pread64 usage in the dynamic loaderFlorian Weimer2019-10-241-3/+11
| | | | | | | | | | | Commit 95c1056962a3f2297c94ce47f0eaf0c5b6563231 ("elf: Use nocancel pread64() instead of lseek()+read()") added calls to __pread64 to the dynamic loader. On Hurd, this needs an implementation in the dynamic loader because the rtld-pread64 rebuild pulls in too many symbols. Fixes: 95c1056962a3f2297c94ce47f0eaf0c5b6563231 Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/stat: Handle 64-bit ino_t types on 32-bit hostsAlistair Francis2019-10-234-2/+38
| | | | | | | On a 32-bit platform with a 64-bit ino_t type (__INO_T_MATCHES_INO64_T defined) we want to update the stat struct to remove the padding as it isn't required. As we don't have the padding we also need to update the overflow checker to not access the undefined members.
* S390: Remove not needed stack frame in syscall function.Stefan Liebler2019-10-232-44/+8
| | | | | | | | As an svc invocation does not clobber any user space registers despite of the return value r2 and it does not need a special stack frame. This patch gets rid of the extra frame. We just have to save and restore r6 and r7 as those are preserved across function calls.
* Fix testroot.pristine creation copying dynamic linker.Joseph Myers2019-10-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch addresses an issue reported in <https://sourceware.org/ml/libc-alpha/2019-07/msg00661.html> where the creation of testroot.pristine, on encountering LD_TRACE_LOADED_OBJECTS=1 of the form libc.so.6 => /scratch/jmyers/glibc/mbs/obj/glibc-8-0-mips64-linux-gnu-x86_64-linux-gnu/default/libc.so.6 (0x772dd000) /lib32/ld.so.1 => /scratch/jmyers/glibc/mbs/obj/glibc-8-0-mips64-linux-gnu-x86_64-linux-gnu/default/elf/ld.so.1 (0x7747b000) tries to copy /lib32/ld.so.1 (which does not exist) into the testroot instead of copying the path on the RHS of "=>", which does exist, because the Makefile logic assumes that the path on such a line with '/' should be copied, when if there are such paths on both the LHS and the RHS of "=>", only the one on the RHS necessarily exists and so only that should be copied. The patch follows the approach suggested by DJ in <https://sourceware.org/ml/libc-alpha/2019-07/msg00662.html>, with the suggestion from Andreas in <https://sourceware.org/ml/libc-alpha/2019-10/msg00514.html> of a single sed command in place of pipeline of grep and three sed commands. Tested for x86_64, with and without --enable-hardcoded-path-in-tests; a previous version with multiple sed commands, implementing the same logic, also tested for MIPS, with and without --enable-hardcoded-path-in-tests, to confirm it fixes the original problem. Co-authored-by: DJ Delorie <dj@redhat.com>
* Remove x64 _finite tests and referencesWilco Dijkstra2019-10-2152-429/+58
| | | | | | | | | Remove _finite tests and references from x86_64. Rather than calling __exp_finite, use exp directly (since it's the same entry point). x86_64 builds and passes testsuite. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove finite-math testsWilco Dijkstra2019-10-2113-244/+10
| | | | | | | | | Remove the finite-math tests from the testsuite - these are no longer useful after removing math-finite.h header. Passes buildmanyglibc, build&test on x86_64 and AArch64. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove math-finite.hWilco Dijkstra2019-10-214-443/+1
| | | | | | | | Remove math-finite.h redirections for math functions. Passes buildmanyglibc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Include <kernel-features.h> explicitly in Linux clock_settime.cLukasz Majewski2019-10-201-0/+1
| | | | | | | | | | | The rewritten clock_settime code (which now supports 64 bit time on systems with __WORDSIZE == 32) for Linux now relies on the __ASSUME_TIME64_SYSCALLS flag set. Lets explicitly include the header file where it is defined to avoid any indirect inclusion (which may pose some unwanted API definitions). Tested with scripts/build-many-glibcs.py script.
* loadarchive: guard against locale-archive corruption (Bug #25115)DJ Delorie2019-10-181-1/+1
| | | | | | | | | | | | _nl_load_locale_from_archive() checks for a zero size, but divides by both (size) and (size-2). Extend the check to guard against a size of two or less. Tested by manually corrupting locale-archive and running a program that calls setlocale() with LOCPATH unset (size is typically very large). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Undo accidental commit to ChangeLog.19.Carlos O'Donell2019-10-181-0/+4
| | | | | | | | | I had a local commit fed33b0fb03 which crossed the boundary between when we had and didn't have ChangeLog's and this caused me to have an odd behaviour with the file rename, despite cleaning up the original ChangeLog changes. Sorry. Corrected now.
* nptl: Document AS-safe functions in cancellation.c.Carlos O'Donell2019-10-181-2/+5
| | | | | | Document in comments that __pthread_enable_asynccancel and __pthread_disable_asynccancel must be AS-safe in general with the exception of the act of cancellation.
* elf: Use nocancel pread64() instead of lseek()+read()Leandro Pereira2019-10-182-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Transforms this, when linking in a shared object: openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3"..., 832) = 832 lseek(3, 792, SEEK_SET) = 792 read(3, "\4\0\0\0\24\0\0\0"..., 68) = 68 fstat(3, {st_mode=S_IFREG|0755, st_size=6699224, ...}) = 0 lseek(3, 792, SEEK_SET) = 792 read(3, "\4\0\0\0\24\0\0\0"..., 68) = 68 lseek(3, 864, SEEK_SET) = 864 read(3, "\4\0\0\0\20\0\0\0"..., 32) = 32 Into this: openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3"..., 832) = 832 pread(3, "\4\0\0\0\24\0\0\0"..., 68, 792) = 68 fstat(3, {st_mode=S_IFREG|0755, st_size=6699224, ...}) = 0 pread(3, "\4\0\0\0\24\0\0\0"..., 68, 792) = 68 pread(3, "\4\0\0\0\20\0\0\0"..., 32, 864) = 32 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Add nocancel version of pread64()Leandro Pereira2019-10-186-6/+42
| | | | | | | This is in preparation for changes in the dynamic linker so that pread() is used instead of lseek()+read(). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Add run-one-test convenience target and makefile help textDJ Delorie2019-10-182-2/+62
| | | | | | | | Adds "make test" for re-running just one test. Also adds "make help" for help with our Makefile targets, and adds a mini-help when you just run "make". Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update sysvipc kernel-features.h files for Linux 5.1Adhemerval Zanella2019-10-1811-27/+57
| | | | | | | | | | | | | | | | | | | | | | | | Linux 5.1 adds missing SySV IPC syscalls to the syscall table for remanining one that still uses the ipc syscall on glibc (m68k, mips-o32, powerpc, s390, sh, and sparc32). However the newly added direct ipc syscall are different than the old ones: 1. They do not expect IPC_64, meaning __IPC_64 should be set to zero when new syscalls are used. And new syscalls can not be used for compat functions like __old_semctl (to emulated old sysvipc it requires to use the old __NR_ipc syscall without __IPC_64). Thus IPC_64 is redefined for newer kernels on affected ABIs. 2. semtimedop and semop does not exist on 32-bit ABIs (only semtimedop_time64 is supplied). The provided syscall wrappers only uses the wire-up syscall if __NR_semtimedop and __NR_semop are also defined. Checked on x86_64-linux-gnu and i686-linux-gnu on both a 4.15 kernel configure with default options and sysvipc tests on a 5.3.0 kernel with --enable-kernel=5.1. Tested-by: Paul A. Clarke <pc@us.ibm.com>
* S390: Add new s390 platform z15.Stefan Liebler2019-10-182-3/+3
| | | | | The new IBM z15 is added to platform string array. The macro _DL_PLATFORMS_COUNT is incremented.
* nptl: SIGCANCEL, SIGTIMER, SIGSETXID are always definedFlorian Weimer2019-10-1810-128/+34
| | | | | | | | | | | All nptl targets have these signal definitions nowadays. This changes also replaces the nptl-generic version of pthread_sigmask with the Linux version. Tested on x86_64-linux-gnu and i686-linux-gnu. Built with build-many-glibcs.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nptl/tst-cancel25 needs to be an internal testFlorian Weimer2019-10-182-2/+3
| | | | | | | | Otherwise the definition of SIGCANCEL is not visible. Tested on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Remove libc_hidden_def from __semtimedop stubFlorian Weimer2019-10-171-1/+0
| | | | | This breaks the Hurd build after commit 765cdd0bffd77960ae852104f ("sysvipc: Implement semop based on semtimedop") added it to the stub.
* sysvipc: Implement semop based on semtimedopAdhemerval Zanella2019-10-174-10/+17
| | | | | | | | | | | | | | Besides semop being a subset of semtimedop, new 32-bit architectures on Linux are not expected to provide the syscall (only the 64-bit time semtimedop). Also, Linux 5.1 only wired-up semtimedop for the 64-bit architectures that missed it (powerpc, s390, and sparc). This simplifies the code to support it. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* ipc: Refactor sysvipc internal definitionsAdhemerval Zanella2019-10-1722-192/+56
| | | | | | | | | | | | | | | | | | | | | | | This patch refactor the internal sysvipc in two main points: 1. Add a new __ASSUME_SYSVIPC_DEFAULT_IPC_64 to infer the __IPC_64 value to be used along either the multiplexed __NR_ipc or wired-up syscall. The defaut value assumed for __IPC_64 is also changed from 0x100 to 0x0, aligning with Linux generic UAPI. The idea is to simplify the Linux 5.1 wire-up for sysvipc syscalls for some 32-bit ABIs (which expectes __IPC_64 being 0x0) and simplify new ports (which will no longer need to add ipc_priv.h). 2. It also removes some duplicated internal definition used on compat sysvipc symbols defined at ipc_priv.h (more specifically the __old_ipc_perm, SEMCTL_ARG_ADDRESS, MSGRCV_ARGS, and SEMTIMEDOP_IPC_ARGS). The idea is also to make it simpler to enable the new wire-up sysvipc syscall provided by Linux v5.1. There is no semantic change expected on any port. Checked with a build against all affected ABIs. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Rename and split elf/tst-dlopen-aout collection of testsFlorian Weimer2019-10-178-24/+177
| | | | | | | | | | | | | | | From the beginning, elf/tst-dlopen-aout has exercised two different bugs: (a) failure to report errors for a dlopen of the executable itself in some cases (bug 24900) and (b) incorrect rollback of the TLS modid allocation in case of a dlopen failure (bug 16634). This commit replaces the test with elf/tst-dlopen-self for (a) and elf/tst-dlopen-tlsmodid for (b). The latter tests use the elf/tst-dlopen-self binaries (or iconv) with dlopen, so they are no longer self-dlopen tests. Tested on x86_64-linux-gnu and i686-linux-gnu, with a toolchain that does not default to PIE.
* dlfcn: Remove remnants of caller sensitivity from dlinfoFlorian Weimer2019-10-162-28/+6
| | | | | dlinfo operates on a specific handle, which means that there is no caller sensivity involved.
* ldconfig: handle .dynstr located in separate segment (bug 25087)Andreas Schwab2019-10-161-13/+23
| | | | | | To determine the load offset of the DT_STRTAB section search for the segment containing it, instead of using the load offset of the first segment.
* ldd: Print "not a dynamic executable" on standard error [BZ #24150]Florian Weimer2019-10-151-1/+1
| | | | | | Tested with the testsuite on x86_64-linux-gnu, and manually. Reviewed-By: Richard W.M. Jones <rjones@redhat.com>
* Add PTRACE_GET_SYSCALL_INFO from Linux 5.3 to sys/ptrace.h.Joseph Myers2019-10-149-7/+96
| | | | | | | | | | | | | Linux 5.3 adds a PTRACE_GET_SYSCALL_INFO constant, with an associated structure and PTRACE_SYSCALL_INFO_* constants. This patch adds these to sys/ptrace.h in glibc (PTRACE_GET_SYSCALL_INFO in each architecture version, the rest in bits/ptrace-shared.h). As with previous such constants and associated structures, the glibc version of the structure is named struct __ptrace_syscall_info. Tested for x86_64, and with build-many-glibcs.py.
* Move ChangeLog to ChangeLog.old/ChangeLog.19 changelog-ends-hereFlorian Weimer2019-10-111-0/+0
| | | | | | | | | | | | | | We no longer maintain a manually-written ChangeLog file: <https://sourceware.org/ml/libc-alpha/2019-09/msg00333.html> <https://sourceware.org/ml/libc-alpha/2019-10/msg00131.html> Instead the release manager is expected to generate a ChangeLog-like file using scripts/gitlog_to_changelog.py. For further details, see commit f2144b7874b23be7c7eb184ec601633ec6fa8fac ("Script to generate ChangeLog-like output from git log"). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* manual: Remove warning in the documentation of the abort functionFlorian Weimer2019-10-112-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning is confusing to those who do not understand the context, and the warning is easy to misunderstand: A reader needs to know that it was written by someone who is generally skeptical of government influence and control, otherwise it reads as an affirmation of the U.S. government's role as the ultimate editor of the manual. This is precisely the opposite of what the warning intends to convey. (Reportedly, it criticizes that several U.S. administrations have tried to restrict the medical advice that U.S.-funded health care workers can provide abroad, considering that censorship.) The warning is also misleading on a technical level. A reader who makes the connection to pregnancy termination will get the wrong impression that calling the abort function will terminate subprocesses of the current process, but this is not what generally happens. Finally, for both GNU and the FSF, it is inappropriate to use female reproductive health as mere joke material, since these organizations do not concern themselves with such issues otherwise, and the warning is purportedly about something else entirely. This reinstates commit 340d9652b9d0e1d4136588f18b726662d195777c ("manual/startup.texi (Aborting a Program): Remove inappropriate joke."), effectively reverting the revert in commit ffa81c22a3ac0fb75ad9bf2b1c3cdbf9eafa0bc9 ("Revert:"). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysvipc: Set ipc_perm mode as mode_t (BZ#18231)Adhemerval Zanella2019-10-1034-421/+388
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch sets the mode field in ipc_perm as mode_t for all architectures, as POSIX specification [1]. The changes required are as follow: 1. It moves the ipc_perm definition out of ipc.h to its own header ipc_perm.h. It also allows consolidate the IPC_* definition on only one header. 2. The generic implementation follow the kernel ipc64_perm size so the syscall can be made directly without temporary buffer copy. However, since glibc defines the MODE field as mode_t, it omits the __PAD1 field (since glibc does not export mode_t as 16-bit for any architecture). It is a two-fold improvement: 2.1. New implementation which follow Linux UAPI will not need to provide an arch-specific ipc-perm.h header neither wrongly use the wrong 16-bit definition from previous default ipc.h (as csky did). 2.1. It allows consolidate ipc_perm definition for architectures that already provide mode_t as 32-bit. 3. All kernel ABIs for the supported architectures already provides the expected padding for mode type extension to 32-bit. However, some architectures the padding has the wrong placement, so it requires the ipc control routines (msgctl, semctl, and shmctl) to adjust the mode field accordingly. Currently they are armeb, microblaze, m68k, s390, and sheb. A new assume is added, __ASSUME_SYSVIPC_BROKEN_MODE_T, which the required ABIs define. 4. For the ABIs that define __ASSUME_SYSVIPC_BROKEN_MODE_T, it also require compat symbols that do not adjust the mode field. Checked on arm-linux-gnueabihf, aarch64-linux-gnu, powerpc64le-linux-gnu, and x86_64-linux-gnu. I also checked the sysvipc tests on hppa-linux-gnu, sh4-linux-gnu, s390x-linux-gnu, and s390-linux-gnu. I also did a sanity test against armeb qemu usermode for the sysvipc tests. [BZ #18231] * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/ipc-perm.h. * sysdeps/unix/sysv/linux/aarch64/bits/ipc.h: Remove file. * sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h [__BYTE_ORDER == __BIG_ENDIAN] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/sysv/linux/microblaze/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h [!__s390x__] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/bits/ipc-perm.h: New file. * sysdeps/unix/sysv/linux/powerpc/bits/ipc-perm.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/ipc-perm.h: Likewise. * sysdeps/unix/sysv/linux/bits/ipc.h (ipc_perm): Move to bits/ipc-perm.h. * sysdeps/unix/sysv/linux/hppa/bits/ipc-perm.h: New file. * sysdeps/unix/sysv/linux/kernel-features.h: Add comment about __ASSUME_SYSVIPC_BROKEN_MODE_T semantic. * sysdeps/unix/sysv/linux/msgctl.c (DEFAULT_VERSION): Define as 2.31 if __ASSUME_SYSVIPC_BROKEN_MODE_T is defined. (msgctl_syscall, __msgctl_mode16): New symbol. (__new_msgctl): Add bits for __ASSUME_SYSVIPC_BROKEN_MODE_T. * sysdeps/unix/sysv/linux/semctl.c: Likewise. * sysdeps/unix/sysv/linux/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/arm/be/libc.abilist (GLIBC_2.31): Add msgctl, semctl, and shmctl. * sysdeps/sysv/linux/microblaze/be/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/be/libc.abilist: Likewise. * conform/data/sys/ipc.h-data: Only xfail {struct ipc_perm} mode_t mode for Hurd. * sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_2.31]: Add msgctl, semctl, and shmctl. * sysdeps/unix/sysv/linux/arm/be/Versions: New file. * sysdeps/unix/sysv/linux/microblaze/be/Versions: Likewise. * sysdeps/unix/sysv/linux/sh/be/Versions: Likewise. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html
* Simplify note processingAndreas Schwab2019-10-102-14/+7
| | | | This removes dead code during note processing.
* syscall-names.list: fix typos in commentDmitry V. Levin2019-10-102-5/+9
| | | | | * sysdeps/unix/sysv/linux/syscall-names.list: Fix typos in comment, reformat the affected paragraph.
* y2038: linux: Provide __clock_settime64 implementationLukasz Majewski2019-10-103-4/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __clock_settime64 explicit 64 bit function for setting the time. Moreover, a 32 bit version - __clock_settime - has been refactored to internally use __clock_settime64. The __clock_settime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit struct timespec. The new clock_settime64 syscall available from Linux 5.1+ has been used, when applicable. In this patch the internal padding (tv_pad) of struct __timespec64 is left untouched (on systems with __WORDSIZE == 32) as Linux kernel ignores upper 32 bits of tv_nsec. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make xcheck PARALLELMFLAGS="-j8" - The glibc has been build tested (make PARALLELMFLAGS="-j8") for x86 (i386), x86_64-x32, and armv7 Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master - Use of cross-test-ssh.sh for ARM (armv7): make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with clock_settime64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports __clock_settime64 syscalls. - Linux v4.19 (no clock_settime64 support) with default minimal kernel version for contemporary glibc This kernel doesn't support __clock_settime64 syscalls, so the fallback to clock_settime is tested. The above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed. * include/time.h (__clock_settime64): Add __clock_settime alias according to __TIMESIZE define * sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime): Refactor this function to be used only on 32 bit machines as a wrapper on __clock_settime64. * sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime64): Add * sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime64): Use clock_settime64 kernel syscall (available from 5.1+ Linux)
* posix: Use posix_spawn for wordexpAdhemerval Zanella2019-10-095-158/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces the fork+exec by posix_spawn on wordexp, which allows a better scability on Linux and simplifies the thread cancellation handling. The only change which can not be implemented with posix_spawn the /dev/null check to certify it is indeed the expected device. I am not sure how effetive this check is since /dev/null tampering means something very wrong with the system and this is the least of the issues. My view is the tests is really out of the place and the hardening provided is minimum. If the idea is still to provide such check, I think a possibilty would be to open /dev/null, check it, add a dup2 file action, and close the file descriptor. Checked on powerpc64le-linux-gnu and x86_64-linux-gnu. * include/spawn.h (__posix_spawn_file_actions_addopen): New prototype. * posix/spawn_faction_addopen.c (posix_spawn_file_actions_addopen): Add internal alias. * posix/wordexp.c (create_environment, free_environment): New functions. (exec_comm_child, exec_comm): Use posix_spawn instead of fork+exec. * posix/wordexp-test.c: Use libsupport.
* mips: Do not malloc on getdents64 fallbackAdhemerval Zanella2019-10-092-59/+88
| | | | | | | | | | | | | | | | | | | | | This patch changes how the fallback getdents64 implementation calls non-LFS getdents by replacing the scratch_buffer with static buffer plus a loop on getdents calls. This avoids the potential malloc call on scratch_buffer_set_array_size for large input buffer size at the cost of more getdents syscalls. It also adds a small optimization for older kernels, where the first ENOSYS failure for getdents64 disable subsequent calls. Check the dirent tests on a mips64-linux-gnu with getdents64 code disabled. * sysdeps/unix/sysv/linux/mips/mips64/getdents64.c (__getdents64): Add small optimization for older kernel to avoid issuing __NR_getdents64 on each call and replace scratch_buffer usage with a static allocated buffer. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* sparc: Assume GOTDATA support in the toolchainFlorian Weimer2019-10-094-68/+9
| | | | | | HAVE_GCC_GOTDATA has apparently never been used. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* <dirent.h>: Remove wrong comment about getdents64 declarationPetr Vorel2019-10-092-2/+5
| | | | | | | Originally the public interface for getdents64 was declared in <unistd.h> in 51ea67d548. Later, b8b3d5a14e moved it to <dirent.h>. Fixes: b8b3d5a14e ("Linux: Move getdents64 to <dirent.h>")
* ChangeLog: Remove leading spaces before tabs and trailing whitespaceFlorian Weimer2019-10-091-25/+25
|
* Make tst-strftime2 and tst-strftime3 depend on locale generationGabriel F. T. Gomes2019-10-082-0/+8
| | | | | | | | | | | | Building the test cases in parallel might make tst-strftime2 and tst-strftime3 fail. Simply re-running the test case (or building serially) makes the problem go away. This patch adds the necessary dependency to allow parallel builds in the time subdirectory. Tested for powerpc64le. Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>