aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-11-12login: Use pread64 in utmp implementationFlorian Weimer
This reduces the possible error scenarios considerably because no longer can file seek fail, leaving the file descriptor in an inconsistent state and out of sync with the cache. As a result, it is possible to avoid setting file_offset to -1 to make an error persistent. Instead, subsequent calls will retry the operation and report any errors returned by the kernel. This change also avoids reading the file from the start if pututline is called multiple times, to work around lock acquisition failures due to timeouts. Change-Id: If21ea0c162c38830a89331ea93cddec14c0974de
2019-11-12Clarify purpose of assert in _dl_lookup_symbol_xFlorian Weimer
Only one of the currently defined flags is incompatible with versioned symbol lookups, so it makes sense to check for that flag and not its complement. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> Change-Id: I3384349cef90cfd91862ebc34a4053f0c0a99404
2019-11-12aarch64: Increase small and medium cases for __memcpy_genericKrzysztof Koch
Increase the upper bound on medium cases from 96 to 128 bytes. Now, up to 128 bytes are copied unrolled. Increase the upper bound on small cases from 16 to 32 bytes so that copies of 17-32 bytes are not impacted by the larger medium case. Benchmarking: The attached figures show relative timing difference with respect to 'memcpy_generic', which is the existing implementation. 'memcpy_med_128' denotes the the version of memcpy_generic with only the medium case enlarged. The 'memcpy_med_128_small_32' numbers are for the version of memcpy_generic submitted in this patch, which has both medium and small cases enlarged. The figures were generated using the script from: https://www.sourceware.org/ml/libc-alpha/2019-10/msg00563.html Depending on the platform, the performance improvement in the bench-memcpy-random.c benchmark ranges from 6% to 20% between the original and final version of memcpy.S Tested against GLIBC testsuite and randomized tests.
2019-11-12login: Introduce matches_last_entry to utmp processingFlorian Weimer
This simplifies internal_getut_nolock and fixes a regression, introduced in commit be6b16d975683e6cca57852cd4cfe715b2a9d8b1 ("login: Acquire write lock early in pututline [BZ #24882]") in pututxline because __utmp_equal can only compare process-related utmp entries. Fixes: be6b16d975683e6cca57852cd4cfe715b2a9d8b1 Change-Id: Ib8a85002f7f87ee41590846d16d7e52bdb82f5a5
2019-11-12slotinfo in struct dtv_slotinfo_list should be flexible array [BZ #25097]Florian Weimer
GCC 10 will warn about subscribing inner length zero arrays. Use a GCC extension in csu/libc-tls.c to allocate space for the static_slotinfo variable. Adjust nptl_db so that the type description machinery does not attempt to determine the size of the flexible array member slotinfo. Change-Id: I51be146a7857186a4ede0bb40b332509487bdde8
2019-11-11Fix clock_nanosleep when interrupted by a signalAdhemerval Zanella
This patch fixes the time64 support (added by 2e44b10b42d) where it misses the remaining argument updated if __NR_clock_nanosleep returns EINTR. Checked on i686-linux-gnu on 4.15 kernel (no time64 support) and on 5.3 kernel (with time64 support). Reviewed-by: Alistair Francis <alistair23@gmail.com>
2019-11-11libio/tst-fopenloc: Use xsetlocale, xfopen, and xfcloseArjun Shankar
2019-11-11support: Add xsetlocale functionArjun Shankar
2019-11-11Declare asctime_r, ctime_r, gmtime_r, localtime_r for C2X.Joseph Myers
C2X adds the asctime_r, ctime_r, gmtime_r and localtime_r functions. This patch duly adds __GLIBC_USE (ISOC2X) to the conditions under which <time.h> declares them. Tested for x86_64.
2019-11-11y2038: linux: Provide __ppoll64 implementationLukasz Majewski
This patch provides new __ppoll64 explicit 64 bit function for handling polling events (with struct timespec specified timeout) for a set of file descriptors. Moreover, a 32 bit version - __ppoll has been refactored to internally use __ppoll64. The __ppoll is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit struct __timespec64. The new ppoll_time64 syscall available from Linux 5.1+ has been used, when applicable. The Linux kernel checks if passed tv_nsec value overflows, so there is no need to repeat it in the glibc. When ppoll syscall on systems supporting 32 bit time ABI is used, the check is performed if passed data (which may have 64 bit tv_sec) fits into 32 bit range. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make check 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 ppoll_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 ppoll_time64 syscall. - Linux v4.19 (no ppoll_time64 support) with default minimal kernel version for contemporary glibc This kernel doesn't support ppoll_time64 syscall, so the fallback to ppoll is tested. 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.
2019-11-11linux: Reduce stack size for nptl/tst-thread-affinity-pthreadFlorian Weimer
And related tests. These tests create a thread for each core, so they may fail due to address space limitations with the default stack size. Change-Id: Ieef44a7731f58d3b7d6638cce4ccd31126647551
2019-11-11support: Add support_set_small_thread_stack_sizeFlorian Weimer
And support_small_stack_thread_attribute Change-Id: I1cf79a469984f8f30a4a947ee9ec2a5e74de8926
2019-11-11Fix array bounds violation in regex matcher (bug 25149)Andreas Schwab
If the regex has more subexpressions than the number of elements allocated in the regmatch_t array passed to regexec then proceed_next_node may access the regmatch_t array outside its bounds. No testcase added because even without this bug it would then crash in pop_fail_stack which is bug 11053.
2019-11-08sysdeps/clock_nanosleep: Use clock_nanosleep_time64 if avaliableAlistair Francis
The clock_nanosleep syscall is not supported on newer 32-bit platforms (such as RV32). To fix this issue let's use clock_nanosleep_time64 if it is avaliable.
2019-11-08Remove hppa pthreadP.hAdhemerval Zanella
It just contains duplicated defitions provided by other generic nptl headers. Checked with run-built-tests=no against hppa-linux-gnu. Change-Id: I95f55d5b7b7ae528c81cd2394d57ce92398189bf
2019-11-07login: Acquire write lock early in pututline [BZ #24882]Florian Weimer
It has been reported that due to lack of fairness in POSIX file locking, the current reader-to-writer lock upgrade can result in lack of forward progress. Acquiring the write lock directly hopefully avoids this issue if there are only writers. This also fixes bug 24882 due to the cache revalidation in __libc_pututline. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Change-Id: I57e31ae30719e609a53505a0924dda101d46372e
2019-11-07nptl: Add missing placeholder abi symbol from nanosleep moveAdhemerval Zanella
Adds the __libpthread_version_placeholder symbol with the same version of nanosleep/__nanosleep that was removed by 79a547b162657b3f and that is not provided by other symbols.
2019-11-07login: Remove double-assignment of fl.l_whence in try_file_lockFlorian Weimer
Since l_whence is the second member of struct flock, it is written twice. The double-assignment is technically undefined behavior due to the lack of a sequence point. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Change-Id: I2baf9e70690e723c61051b25ccbd510aec15976c
2019-11-07hurd: Use __clock_gettime in _hurd_selectFlorian Weimer
The __gettimeofday references caused check-localplt failures after commit 5e46749c64d5. Fixes: 5e46749c64d51f50f8511ed99c1266d7c13e182b Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Change-Id: Ia6da4045157a5bbccc67d79e881d7592e6f8a890
2019-11-07hurd: Remove lingering references to the time functionFlorian Weimer
They cause a check-localplt failure after commit f9a7554009cf38f39. Fixes: f9a7554009cf38f390e74fcabc5b49f974f72382 Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Change-Id: I37bc20f3449b9e358f32879ed231720c969965b4
2019-11-07math: enhance the endloop condition of function handle_input_flagliqingqing
In the function handle_input_flag, the end-loop condition is not correct, because when the loop variable i equals 16 (num_input_flag_types), then input_flags[16] will be out of bounds. (This issue is only relevant with invalid input files to gen-auto-libm-tests.)
2019-11-06nptl: Refactor thrd_sleep in terms of clock_nanosleepAdhemerval Zanella
Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2019-11-06Refactor nanosleep in terms of clock_nanosleepAdhemerval Zanella
The generic version is straightforward. For Hurd, its nanosleep implementation is moved to clock_nanosleep with adjustments from generic unix implementation. The generic clock_nanosleep unix version is also removed since it calls nanosleep. Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2019-11-06nptl: Move nanosleep implementation to libcAdhemerval Zanella
Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. I also checked the libpthread.so .gnu.version_d entries for every ABI affected and all of them contains the required versions (including for architectures which exports __nanosleep with a different version). Reviewed-by: Florian Weimer <fweimer@redhat.com>
2019-11-06posix: Sync regex with gnulibAdhemerval Zanella
It sync with gnulib commit 6cfb4302b3e1da14d706198b693558290e9b00f4 and contains the fixes: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=32915b2a8a43825720755113bdffe9f67a591748 https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=48f07576b8cd935b48e1050551f45ab1a79b9f01 https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=5e407aba1f775d51b25481cb55f324c9868f62d7 https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4e02b30c761c76d04057fa5f6bba71401f9310cd https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=79f8ee4e389f8cb1339f8abed9a7d29816e2a2d4 Checked on x86_64-linux-gnu and i686-linux-gnu.
2019-11-06Add mnw language code [BZ #25139]Mike FABIAN
2019-11-06Add new locale: mnw_MM (Mon language spoken in Myanmar) [BZ #25139]Talachan Mon
2019-11-06S390: Fp comparison are now raising FE_INVALID with gcc 10.Stefan Liebler
The s390 gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77918 "S390: Floating point comparisons don't raise invalid for unordered operands." is fixed with gcc 10. Thus we conditionally set FIX_COMPARE_INVALID to 0 or 1.
2019-11-05linux: pselect: Remove CALL_PSELECT6 macroLukasz Majewski
Nothing defines CALL_PSELECT6 in the current tree, so remove it. Tested with: - make PARALLELMFLAGS="-j8" && make xcheck PARALLELMFLAGS="-j8" (x86_64) - scripts/build-many-glibcs.py
2019-11-05Fix run-one-test so that it runs elf testsArjun Shankar
The `test' make target passes a trailing slash in the subdir argument. This does not play well with elf/rtld-Rules which looks for `elf' without any trailing slash, and therefore doesn't find a match when running an elf test individually. This commit removes the trailing slash from the invocation. Reviewed-by: DJ Delorie <dj@redhat.com>
2019-11-04nptl: Fix niggles with pthread_clockjoin_npMike Crowe
Joseph Myers spotted[1] that 69ca4b54c151cec42ccca5e05790efc1a8206b47 added pthread_clockjoin_np to sysdeps/nptl/pthread.h but not to its hppa-specific equivalent sysdeps/unix/sysv/linux/hppa/pthread.h. Rafal Luzynski spotted[2] typos in the NEWS entry and manual updates too. Florian Weimer spotted[3] that the clockid parameter was not using a reserved identifier in pthread.h. [1] https://sourceware.org/ml/libc-alpha/2019-11/msg00016.html [2] https://sourceware.org/ml/libc-alpha/2019-11/msg00019.html [3] https://sourceware.org/ml/libc-alpha/2019-11/msg00022.html Reviewed-by: Joseph Myers <joseph@codesourcery.com> Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com> Reviewed-by: Florian Weimer <fw@deneb.enyo.de>
2019-11-03hppa: Align __clone stack argument to 8 bytes (Bug 25066)John David Anglin
The hppa architecture requires strict alignment for loads and stores. As a result, the minimum stack alignment that will work is 8 bytes. This patch adjusts __clone() to align the stack argument passed to it. It also adjusts slightly some formatting. This fixes the nptl/tst-tls1 test.
2019-11-02y2038: linux: Provide __futimens64 implementationLukasz Majewski
This patch provides new __futimens64 explicit 64 bit function for setting access and modification time of file (by using its file descriptor). Moreover, a 32 bit version - __futimens has been refactored to internally use __futimens64. The __futimens is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions to 64 bit struct __timespec64. When pointer to struct __timespec64 is NULL - the file access and modification time is set to the current one (by the kernel) and no conversions from struct timespec to __timespec64 are performed. The __futimens64 reuses __utimensat64_helper defined for __utimensat64. The test procedure for __futimens64 is the same as for __utimensat64 conversion patch.
2019-11-02y2038: linux: Provide __utimensat64 implementationLukasz Majewski
This patch provides new __utimensat64 explicit 64 bit function for setting access and modification time of a file. Moreover, a 32 bit version - __utimensat has been refactored to internally use __utimensat64. The __utimensat is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions to 64 bit struct __timespec64. When pointer to struct __timespec64 is NULL - the file access and modification time is set to the current one and no conversions from struct timespec to __timespec64 are performed. The new utimensat_time64 syscall available from Linux 5.1+ has been used, when applicable. The new helper function - __utimensat64_helper - has been introduced to facilitate code re-usage on function providing futimens syscall handling. The Linux kernel checks if passed tv_nsec value overflows, so there is no need to repeat it in glibc. When utimensat syscall on systems supporting 32 bit time ABI is used, the check is performed if passed data (which may have 64 bit tv_sec) fits into 32 bit 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 utimensat_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 utimensat_time64 syscall. - Linux v4.19 (no utimensat_time64 support) with default minimal kernel version for contemporary glibc This kernel doesn't support utimensat_time64 syscall, so the fallback to utimensat 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.
2019-11-01nptl: Add pthread_timedjoin_np, pthread_clockjoin_np NULL timeout testMike Crowe
Passing NULL as the timeout parameter to pthread_timedjoin_np has resulted in it behaving like pthread_join for a long time. Since that is now the documented behaviour, we ought to test that both it and the new pthread_clockjoin_np support it. Checked on x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-11-01nptl: Add pthread_clockjoin_npMike Crowe
Introduce pthread_clockjoin_np as a version of pthread_timedjoin_np that accepts a clockid_t parameter to indicate which clock the timeout should be measured against. This mirrors the recently-added POSIX-proposed "clock" wait functions. Checked on x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-11-01manual: Add documentation for pthread_tryjoin_np and pthread_timedjoin_npMike Crowe
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-11-01nptl: Convert tst-join3 to use libsupportMike Crowe
Checked on x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-10-31Sync time/mktime.c with gnulibPaul Eggert
This syncs with gnulib commit 9e78024bad107fe786cc3e5e328a475921ea0873. * time/mktime.c: Update URL in comment.
2019-10-31Sync timespec-{add,sub} with gnulibAdhemerval Zanella
It sync with gnulib commit 06011ed74e978613422aca43c0bd92dc44213933. Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2019-10-31Sync intprops.h with gnulibAdhemerval Zanella
It sync with gnulib commit f5756b919addb9e8ce03f4e61a10e4fcff14874a. Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2019-10-31Refactor adjtimex based on clock_adjtimeAdhemerval Zanella
Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2019-10-31Refactor PI mutexes internal definitionsAdhemerval Zanella
This patch adds the generic futex_lock_pi and futex_unlock_pi to wrap around the syscall machinery required to issue the syscall calls. It simplifies a bit the futex code required to implement PI mutexes. No function changes, checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-10-31Remove pause and nanosleep not cancel wrappersAdhemerval Zanella
Since they are not used any longer. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-10-31nptl: Replace non cancellable pause/nanosleep with futexAdhemerval Zanella
To help y2038 work avoid duplicate all the logic of nanosleep on non cancellable version, the patch replace it with a new futex operation, lll_timedwait. The changes are: - Add a expected value for __lll_clocklock_wait, so it can be used to wait for generic values. - Remove its internal atomic operation and move the logic to __lll_clocklock. It makes __lll_clocklock_wait even more generic and __lll_clocklock slight faster on fast-path (since it won't require a function call anymore). - Add lll_timedwait, which uses __lll_clocklock_wait, to replace both __pause_nocancel and __nanosleep_nocancel. It also allows remove the sparc32 __lll_clocklock_wait implementation (since it is similar to the generic one). Checked on x86_64-linux-gnu, sparcv9-linux-gnu, and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-10-31Consolidate lowlevellock-futex.hAdhemerval Zanella
NPTL is already Linux specific, there is no need to parametrize low level lock futex operations and add a sysdep Linux specific implementation. This patch moves the relevant Linux code to nptl one. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-10-31Consolidate futex-internal.hAdhemerval Zanella
NPTL is already Linux specific, there is no need to parametrize futex operations and add a sysdep Linux specific implementation. This patch moves the relevant Linux code to nptl one. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-10-30Base max_fast on alignment, not width, of bins (Bug 24903)DJ Delorie
set_max_fast sets the "impossibly small" value based on, eventually, MALLOC_ALIGNMENT. The comparisons for the smallest chunk used is, eventually, MIN_CHUNK_SIZE. Note that i386 is the only platform where these are the same, so a smallest chunk *would* be put in a no-fastbins fastbin. This change calculates the "impossibly small" value based on MIN_CHUNK_SIZE instead, so that we can know it will always be impossibly small.
2019-10-30Revise the documentation of simple calendar time.Zack Weinberg
This is a thorough revision of all the material relating to the functions time, stime, gettimeofday, settimeofday, clock_gettime, clock_getres, clock_settime, and difftime, spilling over into the discussion of time-related data types (which now get their own section) and touching the adjtime family as well (which deserves its own thorough revision, but I'd have to do a bunch of research first). Substantive changes are: * Document clock_gettime, clock_getres, and clock_settime. (Only CLOCK_REALTIME and CLOCK_MONOTONIC are documented; the others are either a bit too Linux-specific, or have more to do with measuring CPU/processor time. That section _also_ deserves its own thorough revision but again I'd have to do a bunch of research first.) * Present gettimeofday, settimeofday, and struct timeval as obsolete relative to clock_*. * Remove the documentation of struct timezone. Matching POSIX, say that the type of the second argument to gettimeofday and settimeofday is [const] void *. * Clarify ISO C and POSIX's requirements on time_t. Clarify the circumstances under which difftime is equivalent to simple subtraction. * Consolidate documentation of most of the time-related data types into a new section "Time Types," right after "Time Basics." (The exceptions are struct tm, which stays in "Broken-down Time," and struct times, which stays in "Processor And CPU Time." * The "Elapsed Time" section is now called "Calculating Elapsed Time" and includes only difftime and the discussion of how to compute timeval differences by hand. * Fold the "Simple Calendar Time," "High Resolution Calendar," and "High Accuracy Clock" sections together into two new sections titled "Getting the Time" and "Setting and Adjusting the Time."
2019-10-30Make second argument of gettimeofday as 'void *'Zack Weinberg
Also make the public prototype of gettimeofday declare its second argument with type "void *" unconditionally, consistent with POSIX. It is also consistent with POSIX. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu. Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>