aboutsummaryrefslogtreecommitdiff
path: root/rt
AgeCommit message (Collapse)Author
2023-07-05Exclude routines from fortificationFrédéric Bérat
Since the _FORTIFY_SOURCE feature uses some routines of Glibc, they need to be excluded from the fortification. On top of that: - some tests explicitly verify that some level of fortification works appropriately, we therefore shouldn't modify the level set for them. - some objects need to be build with optimization disabled, which prevents _FORTIFY_SOURCE to be used for them. Assembler files that implement architecture specific versions of the fortified routines were not excluded from _FORTIFY_SOURCE as there is no C header included that would impact their behavior. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-06-22rt/tst-mqueue4.c: Fix wrong number of argument for mq_openFrederic Berat
The mq_open routine should only get either 2 or 4 arguments, this test wrongly passed 3. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-06-02Fix all the remaining misspellings -- BZ 25337Paul Pluzhnikov
2023-06-01tests: replace write by xwriteFrédéric Bérat
Using write without cheks leads to warn unused result when __wur is enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-04-12aio: Fix freeing memorySamuel Thibault
The content of the pool array is initialized only until pool_size, pointers between pool_size and pool_max_size were not initialized by the realloc call in get_elem so they should not be freed. This fixes aio tests crashing at their termination on GNU/Hurd.
2023-03-27Move libc_freeres_ptrs and libc_subfreeres to hidden/weak functionsAdhemerval Zanella Netto
They are both used by __libc_freeres to free all library malloc allocated resources to help tooling like mtrace or valgrind with memory leak tracking. The current scheme uses assembly markers and linker script entries to consolidate the free routine function pointers in the RELRO segment and to be freed buffers in BSS. This patch changes it to use specific free functions for libc_freeres_ptrs buffers and call the function pointer array directly with call_function_static_weak. It allows the removal of both the internal macros and the linker script sections. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-03-08rt: fix shm_open not set ENAMETOOLONG when name exceeds {_POSIX_PATH_MAX}abushwang
according to man-pages-posix-2017, shm_open() function may fail if the length of the name argument exceeds {_POSIX_PATH_MAX} and set ENAMETOOLONG Signed-off-by: abushwang <abushwangs@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-02-01hurd: Implement SHM_ANONSergey Bugaev
This adds a special SHM_ANON value that can be passed into shm_open () in place of a name. When called in this way, shm_open () will create a new anonymous shared memory file. The file will be created in the same way that other shared memory files are created (i.e., under /dev/shm/), except that it is not given a name and therefore cannot be reached from the file system, nor by other calls to shm_open (). This is accomplished by utilizing O_TMPFILE. This is intended to be compatible with FreeBSD's API of the same name. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230130125216.6254-4-bugaevc@gmail.com>
2023-01-06Update copyright dates with scripts/update-copyrightsJoseph Myers
2022-10-05rt: Initialize mq_send input on tst-mqueue{5,6}Adhemerval Zanella Netto
GCC with -Os warns that the mq_send input may be used uninitialized. Although for the tests the data content sent is not important, since both tests checks only if mq_notify was properly set, the warning is correct and data is indeed uninitialized. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-09-22Use '%z' instead of '%Z' on printf functionsAdhemerval Zanella Netto
The Z modifier is a nonstandard synonymn for z (that predates z itself) and compiler might issue an warning for in invalid conversion specifier. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-06-30Refactor internal-signals.hAdhemerval Zanella
The main drive is to optimize the internal usage and required size when sigset_t is embedded in other data structures. On Linux, the current supported signal set requires up to 8 bytes (16 on mips), was lower than the user defined sigset_t (128 bytes). A new internal type internal_sigset_t is added, along with the functions to operate on it similar to the ones for sigset_t. The internal-signals.h is also refactored to remove unused functions Besides small stack usage on some functions (posix_spawn, abort) it lower the struct pthread by about 120 bytes (112 on mips). Checked on x86_64-linux-gnu. Reviewed-by: Arjun Shankar <arjun@redhat.com>
2022-01-17rt/tst-mqueue*: Return UNSUPPORTED when mq_open fails with ENOSYSSamuel Thibault
Rather than returning 0 or a failure.
2022-01-01Update copyright dates with scripts/update-copyrightsPaul Eggert
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 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
2021-12-17Fix The GNU ToolChain Authors copyright noticeSiddhesh Poyarekar
I (and maybe one or two others) added a (C) to the copyright notice regardless of the contribution checklist[1] not mentioning it. Fix all these instances so that the notice reads as "Copyright The GNU Toolchain Authors" across the source code. [1] https://sourceware.org/glibc/wiki/Contribution%20checklist Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-10-07Remove unreliable parts of rt/tst-cpuclock2DJ Delorie
This is a follow-up to the tst-cpuclock1.c change here: 9a29f1a2ae3d4bb253ee368e0d71db0ca9494120 This test, like tst-cpuclock1, may fail on heavily loaded VM servers (and has occasionally failed on the 32bit trybot), so tests that rely on "wall time" have been removed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-09-03Remove "Contributed by" linesSiddhesh Poyarekar
We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-08-12librt: add test (bug 28213)Nikita Popov
This test implements following logic: 1) Create POSIX message queue. Register a notification with mq_notify (using NULL attributes). Then immediately unregister the notification with mq_notify. Helper thread in a vulnerable version of glibc should cause NULL pointer dereference after these steps. 2) Once again, register the same notification. Try to send a dummy message. Test is considered successfulif the dummy message is successfully received by the callback function. Signed-off-by: Nikita Popov <npv1310@gmail.com> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-08-04rt: Set the correct message queue for tst-mqueue10Adhemerval Zanella
Checked on x86_64-linux-gnu.
2021-06-28Linux: Cleanups after librt moveFlorian Weimer
librt.so is no longer installed for PTHREAD_IN_LIBC, and tests are not linked against it. $(librt) is introduced globally for shared tests that need to be linked for both PTHREAD_IN_LIBC and !PTHREAD_IN_LIBC. GLIBC_PRIVATE symbols that were needed during the transition are removed again. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-06-28Linux: Move timer_settime, __timer_settime64 from librt to libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. The way the ABI intransition is implemented is changed with this commit: the implementation is now consolidated in one file with a TIMER_T_WAS_INT_COMPAT check. The shared librt is now empty, so this commit adds a placeholder symbol at the base version, GLIBC_2.2, and potentially at the GLIBC_2.3.3 version as well (the leftover from the int/timer_t ABI transition). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-28Linux: Move timer_gettime, __timer_gettime64 from librt to libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. The way the ABI intransition is implemented is changed with this commit: the implementation is now consolidated in one file with a TIMER_T_WAS_INT_COMPAT check. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-28Linux: Move timer_getoverrun from librt to libcFlorian Weimer
The symbol was moved using scripts/move-symbol-to-libc.py. The way the ABI intransition is implemented is changed with this commit: the implementation is now consolidated in one file with a TIMER_T_WAS_INT_COMPAT check. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-28Linux: Move timer_create, timer_delete from librt to libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. timer_create and timer_delete are tied together via the int/timer_t compatibility code. The way the ABI intransition is implemented is changed with this commit: the implementation is now consolidated in one file with a TIMER_T_WAS_INT_COMPAT check. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move mq_unlink from librt to libcFlorian Weimer
The symbol was moved using scripts/move-symbol-to-libc.py. A placeholder symbol is needed on some architectures for the GLIBC_2.3.4 version. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move mq_send, mq_timedsend, __mq_timedsend_time64 to libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move mq_receive, mq_timedreceive, __mq_timedreceive_time64 to libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move mq_open, __mq_open_2 from librt to libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. A placeholder symbol is required to keep the GLIBC_2.7 version. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move mq_notify from librt to libcFlorian Weimer
The symbol was moved using scripts/move-symbol-to-libc.py. An explicit call from fork into the mq_notify implementation replaces the previous use of pthread_atfork. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move mq_getattr from librt to libcFlorian Weimer
The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move mq_setattr from librt to libcFlorian Weimer
The symbol was moved using scripts/move-symbol-to-libc.py. To introduce the proper symbol versioning, the implementation of the system call wrapper us moved to a C file. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move mq_close from librt to libcFlorian Weimer
The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move lio_listio, lio_listio64 from librt to libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. Placeholder symbols are needed on some architectures, to keep the GLIBC_2.1 and GLIBC_2.4 symbol versions around. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25rt: Rework lio_listio implementationFlorian Weimer
Move the common code into rt/lio_listio-common.c and include the file in both rt/lio_listio.c and rt/lio_listio64.c. The common code automatically defines both public symbols for __WORDSIZE == 64. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move aio_write, aio_write64 into libcFlorian Weimer
Both symbols have to be moved at the same time because they are intertwined for __WORDSIZE == 64. The treatment of this case is also changed to match more closely how the other files suppress the declaration of the *64 identifier. The symbols were moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move aio_suspend, aio_suspend64, __aio_suspend_time64 to libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. There is a minor oddity here: This is generic code shared with Hurd, and Hurd does not have time64 support. This is why the versioned_symbol export for __aio_suspend_time64 is restricted to the PTHREAD_IN_LIBC code. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move aio_return, aio_return64 into libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move aio_read, aio_read64 into libcFlorian Weimer
Both symbols have to be moved at the same time because they are intertwined for __WORDSIZE == 64. The treatment of this case is also changed to match more closely how the other files suppress the declaration of the *64 identifier. The symbols were moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move aio_fsync, aio_fsync64 into libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move aio_error, aio_error64 into libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-25Linux: Move aio_cancel, aio_cancel64 into libcFlorian Weimer
The symbols were moved using scripts/move-symbol-to-libc.py. A version placeholder symbol is needed on alpha and sparc because of the additional symbols formerly at version GLIBC_2.3. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>:
2021-06-25Linux: Move aio_init from librt into libcFlorian Weimer
This commit also moves the aio_misc and aio_sigquue helper, so GLIBC_PRIVATE exports need to be added. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-22linux: Only use 64-bit syscall if required for mq_timedsendAdhemerval Zanella
For !__ASSUME_TIME64_SYSCALLS there is no need to issue a 64-bit syscall if the provided timeout fits in a 32-bit one. The 64-bit usage should be rare since the timeout is a relative one. Checked on i686-linux-gnu on a 4.15 kernel and on a 5.11 kernel (with and without --enable-kernel=5.1) and on x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2021-06-22linux: Only use 64-bit syscall if required for mq_timedreceiveAdhemerval Zanella
For !__ASSUME_TIME64_SYSCALLS there is no need to issue a 64-bit syscall if the provided timeout fits in a 32-bit one. The 64-bit usage should be rare since the timeout is a relative one. Checked on i686-linux-gnu on a 4.15 kernel and on a 5.11 kernel (with and without --enable-kernel=5.1) and on x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2021-06-22rt: Move generic implementation from sysdeps/pthread to rtFlorian Weimer
The pthread-based implementation is the generic one. Replacing the stubs makes it clear that they do not have to be adjusted for the libpthread move. Result of: git mv -f sysdeps/pthread/aio_misc.h sysdeps/generic/ git mv sysdeps/pthread/timer_routines.c sysdeps/htl/ git mv -f sysdeps/pthread/{aio,lio,timer}_*.c rt/ Followed by manual adjustment of the #include paths in sysdeps/unix/sysv/linux/wordsize-64, and a move of the version definitions formerly in sysdeps/pthread/Versions. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-21rt: Move shm_unlink into libcFlorian Weimer
This function has no dependency on libpthread, so the move is also applied to Hurd. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-21rt: Move shm_open into libcFlorian Weimer
This function has no dependency on libpthread, so the move is also applied to Hurd. To avoid localplt failures, use __open64_nocancel instead of pthread_setcancelstate and open. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-21rt: Replace generic stub of shm_unlink with the posix versionFlorian Weimer
Result of: git mv -f sysdeps/posix/shm_unlink.c rt and manual removal of the _POSIX_MAPPED_FILES preprocessor condition. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-21rt: Replace generic stub of shm_open with the posix versionFlorian Weimer
Result of: git mv -f sysdeps/posix/shm_open.c rt and manual removal of the _POSIX_MAPPED_FILES preprocessor condition. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-21Fix librt-routines-var issues for !PTHREAD_IN_LIBCFlorian Weimer
The variable name was incorrect, and the existing librt-routines variable needs to be augmented (not assigned) in rt/Makefile. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>