about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* posix/tst-wordexp-nocmd: Fix diagnostics output in testFlorian Weimer2019-10-082-2/+6
|
* wordexp: Split out command execution tests from posix/wordexp-testFlorian Weimer2019-10-084-84/+194
| | | | | | | | | | Once wordexp switches to posix_spawn, testing for command execution based on fork handlers will not work anymore. Therefore, move these subtests into a new test, posix/tst-wordexp-nocmd, which uses a different form of command execution detection, based on PID namespaces. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_setschedparam implementation into libcFlorian Weimer2019-10-0733-37/+69
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* riscv: Remove support for variable page sizesFlorian Weimer2019-10-074-120/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _dl_var_init is used to patch the read-only data section after relocation. Several architectures use this to update GLRO(page_size) with the correct value for the static dlopen case, where _rtld_global_ro has not been initialized by the dynamic loader. RISC-V does not need this. The RISC-V Instruction Set Manual, Volume II: Privileged Architecture, Document Version 20190608-Priv-MSU-Ratified says this: After much deliberation, we have settled on a conventional page size of 4 KiB for both RV32 and RV64. We expect this decision to ease the porting of low-level runtime software and device drivers. The TLB reach problem is ameliorated by transparent superpage support in modern operating systems [2]. Additionally, multi-level TLB hierarchies are quite inexpensive relative to the multi-level cache hierarchies whose address space they map. [2] Juan Navarro, Sitaram Iyer, Peter Druschel, and Alan Cox. Practical, transparent operating system support for superpages. SIGOPS Oper. Syst. Rev., 36(SI):89–104, December 2002. This means that the initialization of _rtld_global_ro._dl_page_size in elf/rtld.c with EXEC_PAGESIZE is sufficient for RISC-V.
* nptl: Move pthread_attr_getschedparam implementation into libcFlorian Weimer2019-10-0733-36/+70
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Assign TLS modid later during dlopen [BZ #24930]Florian Weimer2019-10-044-30/+60
| | | | | | | | | | | | | | Commit a42faf59d6d9f82e5293a9ebcc26d9c9e562b12b ("Fix BZ #16634.") attempted to fix a TLS modid consistency issue by adding additional checks to the open_verify function. However, this is fragile because open_verify cannot reliably predict whether _dl_map_object_from_fd will later fail in the more complex cases (such as memory allocation failures). Therefore, this commit assigns the TLS modid as late as possible. At that point, the link map pointer will eventually be passed to _dl_close, which will undo the TLS modid assignment. Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
* elf: Never use the file ID of the main executable [BZ #24900]Florian Weimer2019-10-042-21/+38
| | | | | | | | | | | | | | If the loader is invoked explicitly and loads the main executable, it stores the file ID of the main executable in l_file_id. This information is not available if the main excutable is loaded by the kernel, so this is another case where the two cases differ. This enhances commit 23d2e5faf0bca6d9b31bef4aa162b95ee64cbfc6 ("elf: Self-dlopen failure with explict loader invocation [BZ #24900]"). Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
* nptl: Move pthread_attr_setinheritsched implementation into libc.Florian Weimer2019-10-0433-35/+69
| | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html>
* ChangeLog update from my last commitPaul A. Clarke2019-10-031-0/+10
| | | | | | | I forgot to include the ChangeLog update with my last commit: 7b8481b330720d28c019a2e5994492a1923d5daa. Signed-off-by: Paul A. Clarke <pc@us.ibm.com>
* Disable -Wmaybe-uninitialized for total_deadline in sunrpc/clnt_udp.c.Joseph Myers2019-10-022-0/+17
| | | | | | | | | | | | | | | | | | | To work around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691> for RV32, we recently disabled -Wmaybe-uninitialized for some inline functions in inet/net-internal.h, as included by sunrpc/clnt_udp.c. The same error has now appeared with current GCC trunk for MIPS, in a form that is located at the definition of the variable in question and so unaffected by the disabling in inet/net-internal.h. Thus, this patch adds the same disabling around the definition of that variable, to cover the MIPS case. Tested with build-many-glibcs.py (compilers and glibcs stages) for mips64-linux-gnu with GCC mainline. * sunrpc/clnt_udp.c: Include <libc-diag.h>. (clntudp_call): Disable -Wmaybe-uninitialized around declaration of total_deadline.
* string/endian.h: Restore the __USE_MISC conditionalsAlistair Francis2019-10-022-5/+11
| | | | | | | | | | | | | Commit 69fd157a3 "time: Add padding for the timespec if required" caused a breakage in the glibc tests as the endian.h include file was kept in the networking headers while the __USE_MISC #ifdefs had been removed. This resulted in namespace violations in the networking headers. This patche restores the __USE_MISC conditionals in endian.h to fix the test failures. * string/endian.h: Restore the __USE_MISC conditionals.