about summary refs log tree commit diff
path: root/io
Commit message (Collapse)AuthorAgeFilesLines
* io: Fix use-after-free in ftw [BZ #26779]Martin Sebor2022-11-111-2/+3
| | | | | Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit ee52ab25ba875f458981fce22c54e3c04c7a17d3)
* io: Fix ftw internal realloc buffer (BZ #28126)Adhemerval Zanella2022-11-113-20/+117
| | | | | | | | | | | The 106ff08526d3ca did not take in consideration the buffer might be reallocated if the total path is larger than PATH_MAX. The realloc uses 'dirbuf', where 'dirstreams' is the allocated buffer. Checked on x86_64-linux-gnu. Reviewed-by: H.J. Lu <hjl.tools@gmail.com> (cherry picked from commit 1836bb2ebf62bd9a3588f2ed2d851c8ae810097a)
* linux: Fix fchmodat with AT_SYMLINK_NOFOLLOW for 64 bit time_t (BZ#29097)Adhemerval Zanella2022-04-283-4/+28
| | | | | | | | | | The AT_SYMLINK_NOFOLLOW emulation ues the default 32 bit stat internal calls, which fails with EOVERFLOW if the file constains timestamps beyond 2038. Checked on i686-linux-gnu. (cherry picked from commit 118a2aee07f64d605b6668cbe195c1f44eac6be6)
* Make sure that the fortified function conditionals are constantSiddhesh Poyarekar2022-03-111-21/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In _FORTIFY_SOURCE=3, the size expression may be non-constant, resulting in branches in the inline functions remaining intact and causing a tiny overhead. Clang (and in future, gcc) make sure that the -1 case is always safe, i.e. any comparison of the generated expression with (size_t)-1 is always false so that bit is taken care of. The rest is avoidable since we want the _chk variant whenever we have a size expression and it's not -1. Rework the conditionals in a uniform way to clearly indicate two conditions at compile time: - Either the size is unknown (-1) or we know at compile time that the operation length is less than the object size. We can call the original function in this case. It could be that either the length, object size or both are non-constant, but the compiler, through range analysis, is able to fold the *comparison* to a constant. - The size and length are known and the compiler can see at compile time that operation length > object size. This is valid grounds for a warning at compile time, followed by emitting the _chk variant. For everything else, emit the _chk variant. This simplifies most of the fortified function implementations and at the same time, ensures that only one call from _chk or the regular function is emitted. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit a643f60c53876be0d57b4b7373770e6cb356fd13)
* Don't add access size hints to fortifiable functionsSiddhesh Poyarekar2022-03-112-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the context of a function definition, the size hints imply that the size of an object pointed to by one parameter is another parameter. This doesn't make sense for the fortified versions of the functions since that's the bit it's trying to validate. This is harmless with __builtin_object_size since it has fairly simple semantics when it comes to objects passed as function parameters. With __builtin_dynamic_object_size we could (as my patchset for gcc[1] already does) use the access attribute to determine the object size in the general case but it misleads the fortified functions. Basically the problem occurs when access attributes are present on regular functions that have inline fortified definitions to generate _chk variants; the attributes get inherited by these definitions, causing problems when analyzing them. For example with poll(fds, nfds, timeout), nfds is hinted using the __attr_access as being the size of fds. Now, when analyzing the inline function definition in bits/poll2.h, the compiler sees that nfds is the size of fds and tries to use that information in the function body. In _FORTIFY_SOURCE=3 case, where the object size could be a non-constant expression, this information results in the conclusion that nfds is the size of fds, which defeats the purpose of the implementation because we're trying to check here if nfds does indeed represent the size of fds. Hence for this case, it is best to not have the access attribute. With the attributes gone, the expression evaluation should get delayed until the function is actually inlined into its destinations. Disable the access attribute for fortified function inline functions when building at _FORTIFY_SOURCE=3 to make this work better. The access attributes remain for the _chk variants since they can be used by the compiler to warn when the caller is passing invalid arguments. [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581125.html Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit e938c02748402c50f60ba0eb983273e7b52937d1)
* io: Add fsync call in tst-statFlorian Weimer2022-03-111-0/+4
| | | | | | | io/tst-stat and io/tst-stat-lfs fail sporadically on the Fedora builders, and this change hopefully helps to avoid the issue. (cherry picked from commit ae132284092edc5885315b44cd17d5ea91177e49)
* Use support_open_dev_null_range io/tst-closefrom, misc/tst-close_range, and ↵Adhemerval Zanella2021-09-211-15/+6
| | | | | | | | | | | posix/tst-spawn5 (BZ #28260) It ensures a continuous range of file descriptor and avoid hitting the RLIMIT_NOFILE. Checked on x86_64-linux-gnu. (cherry picked from commit 6b20880b22d1d0fce7e9f506baa6fe2d5c7fcfdc)
* Linux: Fix fcntl, ioctl, prctl redirects for _TIME_BITS=64 (bug 28182)Florian Weimer2021-08-061-4/+4
| | | | | | | | | | | | | | __REDIRECT and __THROW are not compatible with C++ due to the ordering of the __asm__ alias and the throw specifier. __REDIRECT_NTH has to be used instead. Fixes commit 8a40aff86ba5f64a3a84883e539cb67b ("io: Add time64 alias for fcntl"), commit 82c395d91ea4f69120d453aeec398e30 ("misc: Add time64 alias for ioctl"), commit b39ffab860cd743a82c91946619f1b8158 ("Linux: Add time64 alias for prctl"). Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit c87fcacc50505d550f1bb038382bcc7ea73a5926)
* io: Add time64 alias for fcntlFlorian Weimer2021-07-213-7/+23
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* io: Add closefrom [BZ #10353]Adhemerval Zanella2021-07-084-1/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function closes all open file descriptors greater than or equal to input argument. Negative values are clamped to 0, i.e, it will close all file descriptors. As indicated by the bug report, this is a common symbol provided by different systems (Solaris, OpenBSD, NetBSD, FreeBSD) and, although its has inherent issues with not taking in consideration internal libc file descriptors (such as syslog), this is also a common feature used in multiple projects [1][2][3][4][5]. The Linux fallback implementation iterates over /proc and close all file descriptors sequentially. Although it was raised the questioning whether getdents on /proc/self/fd might return disjointed entries when file descriptor are closed; it does not seems the case on my testing on multiple kernel (v4.18, v5.4, v5.9) and the same strategy is used on different projects [1][2][3][5]. Also, the interface is set a fail-safe meaning that a failure in the fallback results in a process abort. Checked on x86_64-linux-gnu and i686-linux-gnu on kernel 5.11 and 4.15. [1] https://github.com/systemd/systemd/blob/5238e9575906297608ff802a27e2ff9effa3b338/src/basic/fd-util.c#L217 [2] https://github.com/lxc/lxc/blob/ddf4b77e11a4d08f09b7b9cd13e593f8c047edc5/src/lxc/start.c#L236 [3] https://github.com/python/cpython/blob/9e4f2f3a6b8ee995c365e86d976937c141d867f8/Modules/_posixsubprocess.c#L220 [4] https://github.com/rust-lang/rust/blob/5f47c0613ed4eb46fca3633c1297364c09e5e451/src/libstd/sys/unix/process2.rs#L303-L308 [5] https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjava/childproc.c#L82
* hurd: Fix build after 52a5fe70a2Adhemerval Zanella2021-06-231-2/+4
| | | | Hurd does not support 64-bit time_t internally.
* Use 64 bit time_t stat internallyAdhemerval Zanella2021-06-223-10/+10
| | | | | | | | | | For the legacy ABI with supports 32-bit time_t it calls the 64-bit time directly, since the LFS symbols calls the 64-bit time_t ones internally. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* y2038: Add test coverageAdhemerval Zanella2021-06-1518-26/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is enabled through a new rule, tests-y2038, which is built only when the ABI supports the comapt 64-bit time_t (defined by the header time64-compat.h, which also enables the creation of the symbol Version for Linux). It means the tests are not built for ABI which already provide default 64-bit time_t. The new rule already adds the required LFS and 64-bit time_t compiler flags. The current coverage is: * libc: - adjtime tst-adjtime-time64 - adjtimex tst-adjtimex-time64 - clock_adjtime tst-clock_adjtime-time64 - clock_getres tst-clock-time64, tst-cpuclock1-time64 - clock_gettime tst-clock-time64, tst-clock2-time64, tst-cpuclock1-time64 - clock_nanosleep tst-clock_nanosleep-time64, tst-cpuclock1-time64 - clock_settime tst-clock2-time64 - cnd_timedwait tst-cnd-timedwait-time64 - ctime tst-ctime-time64 - ctime_r tst-ctime-time64 - difftime tst-difftime-time64 - fstat tst-stat-time64 - fstatat tst-stat-time64 - futimens tst-futimens-time64 - futimes tst-futimes-time64 - futimesat tst-futimesat-time64 - fts_* tst-fts-time64 - getitimer tst-itimer-timer64 - getrusage - gettimeofday tst-clock_nanosleep-time64 - glob / globfree tst-gnuglob64-time64 - gmtime tst-gmtime-time64 - gmtime_r tst-gmtime-time64 - lstat tst-stat-time64 - localtime tst-y2039-time64 - localtime_t tst-y2039-time64 - lutimes tst-lutimes-time64 - mktime tst-mktime4-time64 - mq_timedreceive tst-mqueue{1248}-time64 - mq_timedsend tst-mqueue{1248}-time64 - msgctl test-sysvmsg-time64 - mtx_timedlock tst-mtx-timedlock-time64 - nanosleep tst-cpuclock{12}-time64, tst-mqueue8-time64, tst-clock-time64 - nftw / ftw ftwtest-time64 - ntp_adjtime tst-ntp_adjtime-time64 - ntp_gettime tst-ntp_gettime-time64 - ntp_gettimex tst-ntp_gettimex-time64 - ppoll tst-ppoll-time64 - pselect tst-pselect-time64 - pthread_clockjoin_np tst-join14-time64 - pthread_cond_clockwait tst-cond11-time64 - pthread_cond_timedwait tst-abstime-time64 - pthread_mutex_clocklock tst-abstime-time64 - pthread_mutex_timedlock tst-abstime-time64 - pthread_rwlock_clockrdlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_clockwrlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_timedrdlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_timedwrlock tst-abstime-time64, tst-rwlock14-time64 - pthread_timedjoin_np tst-join14-time64 - recvmmsg tst-cancel4_2-time64 - sched_rr_get_interval tst-sched_rr_get_interval-time64 - select tst-select-time64 - sem_clockwait tst-sem5-time64 - sem_timedwait tst-sem5-time64 - semctl test-sysvsem-time64 - semtimedop test-sysvsem-time64 - setitimer tst-mqueue2-time64, tst-itimer-timer64 - settimeofday tst-settimeofday-time64 - shmctl test-sysvshm-time64 - sigtimedwait tst-sigtimedwait-time64 - stat tst-stat-time64 - thrd_sleep tst-thrd-sleep-time64 - time tst-mqueue{1248}-time64 - timegm tst-timegm-time64 - timer_gettime tst-timer4-time64 - timer_settime tst-timer4-time64 - timerfd_gettime tst-timerfd-time64 - timerfd_settime tst-timerfd-time64 - timespec_get tst-timespec_get-time64 - timespec_getres tst-timespec_getres-time64 - utime tst-utime-time64 - utimensat tst-utimensat-time64 - utimes tst-utimes-time64 - wait3 tst-wait3-time64 - wait4 tst-wait4-time64 * librt: - aio_suspend tst-aio6-time64 - mq_timedreceive tst-mqueue{1248}-time64 - mq_timedsend tst-mqueue{1248}-time64 - timer_gettime tst-timer4-time64 - timer_settime tst-timer4-time64 * libanl: - gai_suspend Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* io: Add ftw64 with 64-bit time_t supportAdhemerval Zanella2021-06-154-6/+83
| | | | | | | | | | | Similar to fts, ftw routines passes a stat pointer that might differ of size and layout when 64-bit time API is used. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* io: Add fts64 with 64-bit time_t supportAdhemerval Zanella2021-06-153-6/+76
| | | | | | | | | | | Similar to glob, fts routines passes a stat pointer that might differ of size and layout when 64-bit time API is used. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* y2038: Add support for 64-bit time on legacy ABIsAdhemerval Zanella2021-06-153-10/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new build flag, _TIME_BITS, enables the usage of the newer 64-bit time symbols for legacy ABI (where 32-bit time_t is default). The 64 bit time support is only enabled if LFS (_FILE_OFFSET_BITS=64) is also used. Different than LFS support, the y2038 symbols are added only for the required ABIs (armhf, csky, hppa, i386, m68k, microblaze, mips32, mips64-n32, nios2, powerpc32, sparc32, s390-32, and sh). The ABIs with 64-bit time support are unchanged, both for symbol and types redirection. On Linux the full 64-bit time support requires a minimum of kernel version v5.1. Otherwise, the 32-bit fallbacks are used and might results in error with overflow return code (EOVERFLOW). The i686-gnu does not yet support 64-bit time. This patch exports following rediretions to support 64-bit time: * libc: adjtime adjtimex clock_adjtime clock_getres clock_gettime clock_nanosleep clock_settime cnd_timedwait ctime ctime_r difftime fstat fstatat futimens futimes futimesat getitimer getrusage gettimeofday gmtime gmtime_r localtime localtime_r lstat_time lutimes mktime msgctl mtx_timedlock nanosleep nanosleep ntp_gettime ntp_gettimex ppoll pselec pselect pthread_clockjoin_np pthread_cond_clockwait pthread_cond_timedwait pthread_mutex_clocklock pthread_mutex_timedlock pthread_rwlock_clockrdlock pthread_rwlock_clockwrlock pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock pthread_timedjoin_np recvmmsg sched_rr_get_interval select sem_clockwait semctl semtimedop sem_timedwait setitimer settimeofday shmctl sigtimedwait stat thrd_sleep time timegm timerfd_gettime timerfd_settime timespec_get utime utimensat utimes utimes wait3 wait4 * librt: aio_suspend mq_timedreceive mq_timedsend timer_gettime timer_settime * libanl: gai_suspend Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* y2038: Add __USE_TIME_BITS64 support for struct utimbufAdhemerval Zanella2021-06-151-0/+5
| | | | | | | | The __USE_TIME_BITS64 is not defined internally yet. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* io: Fix sporadic test failures in io/tst-statFlorian Weimer2021-06-101-4/+4
| | | | | | | | support_stat_nanoseconds cannot restore the ctime time, and this may lead to sporadic test failures. Therefore, probe for nanoseconds support before the initial statx call. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add missing symbols to Version filesFlorian Weimer2021-06-021-0/+1
| | | | | | | | | Some symbols have explicit versioned_symbol or compat_symbol markers in the sources, but no corresponding entry in the Versions files. This presently works because the local: * directive is only applied to the base version. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Annotate additional APIs with GCC attribute access.Martin Sebor2021-05-062-6/+11
| | | | | | | | | | | | | | | | This change continues the improvements to compile-time out of bounds checking by decorating more APIs with either attribute access, or by explicitly providing the array bound in APIs such as tmpnam() that expect arrays of some minimum size as arguments. (The latter feature is new in GCC 11.) The only effects of the attribute and/or the array bound is to check and diagnose calls to the functions that fail to provide a sufficient number of elements, and the definitions of the functions that access elements outside the specified bounds. (There is no interplay with _FORTIFY_SOURCE here yet.) Tested with GCC 7 through 11 on x86_64-linux.
* io: Use temporary directory and file for ftwtest-shAdhemerval Zanella2021-04-151-123/+119
| | | | | | | | It allows run it in parallel. Checked on x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* io: Add basic tests for utimensatAdhemerval Zanella2021-04-152-0/+71
| | | | | | Checked on x86_64-linux-gnu and i686-linux-gnu Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* linux: Add lutimes testAdhemerval Zanella2021-04-157-5/+64
| | | | | | | | It uses stat to compare against the values set by lutimes. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* linux: Add futimes testAdhemerval Zanella2021-04-152-0/+47
| | | | | | | | It uses stat to compare against the values set by futimes. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* io: Move file timestamps tests out of LinuxAdhemerval Zanella2021-04-155-1/+232
| | | | | | | | | | | | Now that libsupport abstract Linux possible missing support (either due FS limitation that can't handle 64 bit timestamp or architectures that do not handle values larger than unsigned 32 bit values) the tests can be turned generic. Checked on x86_64-linux-gnu and i686-linux-gnu. I also built the tests for i686-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* sys: Fixes possible typo in comment: statfs -> statvfsHugo Gabriel Eyherabide2021-04-071-1/+1
|
* socket: Add CFLAGS-accept.c and CFLAGS-connect.cAdhemerval Zanella2021-04-011-2/+0
| | | | | | | | The c59f716993 (accept) and 3ddf9bc185 (connect) added on io/Makefile instead of socket/Makefile. Checked on arm-linux-gnueabihf (where without the flags both the tst-cancelx4 and tst-cancelx5 fails).
* io: fix spelling typo in diagnosticPaul Eggert2021-03-311-1/+1
|
* io: Check at runtime if timestamp supports nanosecondsAdhemerval Zanella2021-03-311-1/+6
| | | | | | | | Now that non-LFS stat function is implemented on to on LFS, it will use statx when available. It allows to check for nanosecond timestamp if the kernel supports __NR_statx. Checked on s390-linux-gnu with 4.12.14 kernel.
* S390: Don't test nanoseconds in io/tst-stat.cStefan Liebler2021-03-261-2/+5
| | | | | | | | | | | Both new tests io/tst-stat and io/tst-stat-lfs (_FILE_OFFSET_BITS=64) are comparing the nanosecond fields with the statx result. Unfortunately on s390(31bit) those fields are always zero if old KABI with non-LFS support is used. With _FILE_OFFSET_BITS=64 stat is using statx internally. As suggested by Adhemerval this patch disables the nanosecond check for s390(31bit). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Remove connect from libpthreadAdhemerval Zanella2021-03-181-0/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove accept from libpthreadAdhemerval Zanella2021-03-181-0/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove close from libpthreadAdhemerval Zanella2021-03-181-0/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove read from libpthreadAdhemerval Zanella2021-03-181-1/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove write from libpthreadAdhemerval Zanella2021-03-181-1/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* io: Return EBAFD for negative file descriptor on fstat (BZ #27559)Adhemerval Zanella2021-03-115-1/+117
| | | | | | | | Now that fstat is implemented on top fstatat we need to handle negative inputs. The implementation now rejects AT_FDCWD, which would otherwise be accepted by the kernel. Checked on x86_64-linux-gnu and on i686-linux-gnu.
* Update STATX_ATTR_DAX value from Linux 5.10.Joseph Myers2021-01-111-1/+1
| | | | | | | | This patch updates the value of STATX_ATTR_DAX in bits/statx-generic.h for a change made in Linux 5.10. (As with previous such changes, this only does anything if glibc is being used with old kernel headers.) Tested for x86_64.
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-02135-135/+135
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* nonstring: Enable __FORTIFY_LEVEL=3Siddhesh Poyarekar2020-12-311-8/+10
| | | | | Use __builtin_dynamic_object_size in the remaining functions that don't have compiler builtins as is the case for string functions.
* io: Remove xmknod{at} implementationsAdhemerval Zanella2020-12-295-106/+7
| | | | | | | | | | With xmknod wrapper functions removed (589260cef8), the mknod functions are now properly exported, and version is done using symbols versioning instead of the extra _MKNOD_* argument. It also allows us to consolidate Linux and Hurd mknod implementation. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* io: Remove xstat implementationsAdhemerval Zanella2020-12-2917-339/+39
| | | | | | | | With xstat wrapper functions removed (8ed005daf0), the stat functions are now properly exported, and version is done using symbols versioning instead of the extra _STAT_* argument. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* io: nftw/ftw: Fix stack overflow with large nopenfd [BZ #26353]Xiaoming Ni2020-11-263-8/+81
| | | | | | | | | | | The nopenfd value is used as argument for the internal buffer on ftw_statup, which is allocated with alloca and might trigger a stack overflow for large values. This patch replaces the memory allocation to use malloc instead. Checked on x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove tls.h inclusion from internal errno.hAdhemerval Zanella2020-11-131-3/+1
| | | | | | | | | | | | The tls.h inclusion is not really required and limits possible definition on more arch specific headers. This is a cleanup to allow inline functions on sysdep.h, more specifically on i386 and ia64 which requires to access some tls definitions its own. No semantic changes expected, checked with a build against all affected ABIs.
* Remove mknod wrapper functions, move them to symbolsAdhemerval Zanella2020-10-095-96/+6
| | | | | | | | | | | | | | | | | | | This patch removes the mknod and mknodat static wrapper and add the symbols on the libc with the expected names. Both the prototypes of the internal symbol linked by the static wrappers and the inline redirectors are also removed from the installed sys/stat.h header file. The wrapper implementation license LGPL exception is also removed since it is no longer statically linked to binaries. Internally the _STAT_VER* definitions are moved to the arch-specific xstatver.h file. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Remove stat wrapper functions, move them to exported symbolsAdhemerval Zanella2020-10-0911-363/+30
| | | | | | | | | | | | | | | | | | | | | | | | This patch removes the stat, stat64, lstat, lstat64, fstat, fstat64, fstatat, and fstatat64 static wrapper and add the symbol on the libc with the expected names. Both the prototypes of the internal symbol linked by the static wrappers and the inline redirectors are also removed from the installed sys/stat.h header file. The wrapper implementation license LGPL exception is also removed since it is no longer statically linked to binaries. Internally the _STAT_VER* definitions are moved to a arch-specific xstatver.h file. The internal defines that redirects internals {f}stat{at} to their {f}xstat{at} counterparts are removed for Linux (!NO_RTLD_HIDDEN). Hurd still requires them since {f}stat{at} pulls extra objects that makes the loader build fail otherwise (I haven't dig into why exactly). Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Add missing cancellation flags on lockfAdhemerval Zanella2020-10-081-2/+2
| | | | | It also removes CFLAGS-lockf.c duplicate rule. It fixes nptl/tst-cancelx16 on mips64-linux-gnu.
* Remove internal usage of extensible stat functionsAdhemerval Zanella2020-09-1111-45/+47
| | | | | | | | | | | | It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* linux: Remove __ASSUME_ATFCTSAdhemerval Zanella2020-09-021-5/+0
| | | | | | The __have_atfcts is not used anywhere. Checked on x86_64-linux-gnu.
* io/lockf: Include bits/types.h before __OFF_T_MATCHES_OFF64_T checkAlistair Francis2020-08-271-0/+2
| | | | | | | | | It's possible that although __OFF_T_MATCHES_OFF64_T is defined the included the relevent header file. This results in a io/tst-lockf failure for RV32 by calling the non 64-bit version of lockf. This patch fixes the failure by including bits/types.h. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix namespace violation in stdio.h and sys/stat.h if build with ↵Stefan Liebler2020-08-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | optimization. [BZ #26376] If build with optimization, stdio.h and sys/stat.h are defining some inlining functions. This leads to test fails if glibc is build with the following commands. (Note that the conformtests usually builds without optimization or other CFLAGS): <glibc>/configure CC="gcc -O3" --prefix=/usr make make subdirs=conform check - FAIL: conform/XPG4/stdio.h/conform - FAIL: conform/XPG42/stdio.h/conform out-files: ... PASSCOMBINED: Availability of variable optopt PASSCOMBINED: Type of variable optopt Namespace violation: "getc_unlocked" Namespace violation: "getchar_unlocked" Namespace violation: "putc_unlocked" Namespace violation: "putchar_unlocked" FAIL: Namespace of <stdio.h> ---------------------------------------------------------------------------- Total number of tests : 168 Number of failed tests : 1 Number of xfailed tests : 0 Number of skipped tests : 0 - FAIL: conform/POSIX2008/sys/stat.h/conform out-file: ... PASSCOMBINED: Availability of function utimensat PASSCOMBINED: Type of function utimensat Namespace violation: "mknodat" FAIL: Namespace of <sys/stat.h> ---------------------------------------------------------------------------- Total number of tests : 97 Number of failed tests : 1 Number of xfailed tests : 0 Number of skipped tests : 0 For getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked in stdio.h, those are defined "# ifdef __USE_POSIX" instead of "#ifdef __USE_POSIX199506" for the non-inlining declaration. See also "Bug 20014 - stdio.h namespace for pre-threads POSIX" (https://sourceware.org/bugzilla/show_bug.cgi?id=20014). For mknodat in sys/stat.h, those are defined "# ifdef __USE_ATFILE" instead of the additional guard "# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED".