aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-01-28libio: Start to return errors when flushing fwrite's buffer [BZ #29459]Tulio Magno Quites Machado Filho7-6/+304
When an error happens, fwrite is expected to return a value that is less than nmemb. If this error happens while flushing its internal buffer, fwrite is in a complex scenario: all the data might have been written to the buffer, indicating a successful copy, but the buffer is expected to be flushed and it was not. POSIX.1-2024 states the following about errors on fwrite: If an error occurs, the resulting value of the file-position indicator for the stream is unspecified. The fwrite() function shall return the number of elements successfully written, which may be less than nitems if a write error is encountered. With that in mind, this commit modifies _IO_new_file_write in order to return the total number of bytes written via the file pointer. It also modifies fwrite in order to use the new information and return the correct number of bytes written even when sputn returns EOF. Add 2 tests: 1. tst-fwrite-bz29459: This test is based on the reproducer attached to bug 29459. In order to work, it requires to pipe stdout to another process making it hard to reuse test-driver.c. This code is more specific to the issue reported. 2. tst-fwrite-pipe: Recreates the issue by creating a pipe that is shared with a child process. Reuses test-driver.c. Evaluates a more generic scenario. Co-authored-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: DJ Delorie <dj@redhat.com>
2025-01-28Add new tests for fopenMartin Coufal4-0/+531
Adding some basic tests for fopen, testing different modes, stream positioning and concurrent read/write operation on files. Reviewed-by: DJ Delorie <dj@redhat.com>
2025-01-28Increase version to 2.41.9000, add new section to NEWSglibc-2.41.9000Andreas K. Hüttel2-2/+29
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-28Create ChangeLog.old/ChangeLog.30glibc-2.41Andreas K. Hüttel1-0/+13253
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-28Bump version to 2.41Andreas K. Hüttel2-3/+3
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-28po: update translations (final, only timestamp and line number changes)Andreas K. Hüttel38-91/+91
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-28libc.pot: regenerate (only line number changes)Andreas K. Hüttel1-3/+3
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-28INSTALL: update last tested version numbersAndreas K. Hüttel2-15/+15
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-27contrib.texi: minor improvementsAndreas K. Hüttel1-2/+3
Mention CORE-MATH developers by name Fix accent Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-27NEWS: Add some more news from the 2.41 cycleAndreas K. Hüttel1-8/+31
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-27contrib.texi: Update from 2.40..2.41 commit logAndreas K. Hüttel1-22/+78
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-26NEWS: Add reference to (single) advisoryAndreas K. Hüttel1-2/+3
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-26NEWS: Add list of bugs fixed in 2.41Andreas K. Hüttel1-2/+135
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-26NEWS: editorial changes (language, line breaks)Andreas K. Hüttel1-54/+62
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-26testsuite: Make stdio-common/tst-printf-format-*-mem UNSUPPORTED if the ↵Xi Ruoyao1-2/+5
mtrace output does not exist When gawk was not built with MPFR, there's no mtrace output and those tests FAIL. But we should make them UNSUPPORTED like other tst-printf-format-* tests in the case. Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Sam James <sam@gentoo.org> Reviewed-by: Andreas K Hüttel <dilfridge@gentoo.org>
2025-01-25elf: fix 'valgrind' typo in commentSam James1-1/+1
2025-01-25malloc: cleanup casts in tst-callocSam James1-2/+2
Followup to c3d1dac96bdd10250aa37bb367d5ef8334a093a1. As pointed out by Maciej W. Rozycki, the casts are obviously useless now. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-01-25stdlib: Test using setenv with updated environ [BZ #32588]H.J. Lu2-0/+37
Add a test for setenv with updated environ. Verify that BZ #32588 is fixed. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-24LICENSES: update CORE-MATH copyrightAurelien Jarno1-4/+4
Many more files from the CORE-MATH have been added. Also update the authors and copyright years. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-24LICENSES: update location of getaddrinfo.c and getnameinfo.cAurelien Jarno1-2/+2
posix/getaddrinfo.c got moved into nss/getaddrinfo.c in commit 7f602256ab5b ("Move getaddrinfo from 'posix' into 'nss'") inet/getnameinfo.c got moved into nss/getnameinfo.c in commit 2f1c 6652 d7b3 ("Move getnameinfo from 'inet' to 'nss'") Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-24LICENSES: remove Intel License AgreementAurelien Jarno1-36/+0
The corresponding files are gone with the IA64 removal in commit 460860f457e2 ("Remove ia64-linux-gnu"). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-24stdlib: Re-implement free (environ) compatibility kludge for setenvFlorian Weimer8-17/+158
For the originally failing application (userhelper from usermode), it is not actually necessary to call realloc on the environ pointer. Yes, there will be a memory leak because the application assigns a heap-allocated pointer to environ that it never frees, but this leak was always there: the old realloc-based setenv had a hidden internal variable, last_environ, that was used in a similar way to __environ_array_list. The application is not impacted by the leak anyway because the relevant operations do not happen in a loop. The change here just uses a separte heap allocation and points environ to that. This means that if an application calls free (environ) and restores the environ pointer to the value at process start, and does not modify the environment further, nothing bad happens. This change should not invalidate any previous testing that went into the original getenv thread safety change, commit 7a61e7f557a97ab597d6 ("stdlib: Make getenv thread-safe in more cases"). The new test cases are modeled in part on the env -i use case from bug 32588 (with !DO_MALLOC && !DO_EARLY_SETENV), and the previous stdlib/tst-setenv-malloc test. The DO_MALLOC && !DO_EARLY_SETENV case in the new test should approximate what userhelper from the usermode package does. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-01-24Revert "stdlib: Support malloc-managed environ arrays for compatibility"Florian Weimer7-105/+33
This reverts commit b62759db04b8ed7f829c06f1d7c3b8fb70616493. Reason for revert: Incompatible with “env -i” and coreutils (bug 32588). Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-01-23stdlib: Support malloc-managed environ arrays for compatibilityFlorian Weimer7-33/+105
Some applications set environ to a heap-allocated pointer, call setenv (expecting it to call realloc), free environ, and then restore the original environ pointer. This breaks after commit 7a61e7f557a97ab597d6fca5e2d1f13f65685c61 ("stdlib: Make getenv thread-safe in more cases") because after the setenv call, the environ pointer does not point to the start of a heap allocation. Instead, setenv creates a separate allocation and changes environ to point into that. This means that the free call in the application results in heap corruption. The interim approach was more compatible with other libcs because it does not assume that the incoming environ pointer is allocated as if by malloc (if it was written by the application). However, it seems to be more important to stay compatible with previous glibc version: assume the incoming pointer is heap allocated, and preserve this property after setenv calls. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-01-22po: Incorporate translationsAndreas K. Hüttel38-4950/+5090
be ca cs da de el eo es fi fr gl hr hu ia id it ja ka ko lt nb nl pl pt ro ru rw sk sl sr sv tr uk vi zh_CN zh_TW Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-22Update advisory GLIBC-SA-2025-0001 (2.40)Siddhesh Poyarekar1-0/+1
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2025-01-22Add advisory text for CVE-2025-0395Siddhesh Poyarekar1-0/+24
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-22Fix underallocation of abort_msg_s struct (CVE-2025-0395)Siddhesh Poyarekar2-2/+6
Include the space needed to store the length of the message itself, in addition to the message string. This resolves BZ #32582. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-21NEWS: Add note on Guarded Control Stack supportYury Khrustalev1-0/+10
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-01-21Fix typo: _POSIX_REATIME_SIGNALS -> _POSIX_REALTIME_SIGNALS [BZ# 32515]Paul Pluzhnikov1-1/+1
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-21aarch64: Add HWCAP_GCSYury Khrustalev2-4/+1
Use upper 32 bits of HWCAP. Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-01-21nptl: Include <stdbool.h> in tst-skeleton-affinity-inheritance.cFlorian Weimer1-0/+1
The file uses the identifiers bool, false, true.
2025-01-20stdlib: Test for expected sequence of random numbers from randFlorian Weimer2-0/+58
As the test comment explains, this test is not quite valid, but preserving the exact sequences helps distributions to port to newer glibc versions. We can remove this test if we ever switch to a different implementation. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2025-01-20stdlib: Fix unintended change to the random_r implementationFlorian Weimer1-3/+4
Commit d5bceac99d24af1131b90027dab267e437b65cd1 changed the sequence of random numbers. This was completely unintended. The statistical properties of the new sequences are unclear, so restore the old behavior. Fixes commit d5bceac99d24af1131b90027dab267e437b65cd1 ("stdlib: random_r: fix unaligned access in initstate and initstate_r [BZ #30584]"). Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2025-01-20elf: Make tst-ro-dynamic-mod.map compatible with older binutilsFlorian Weimer1-1/+1
Older versions such as binutils 2.35.2 do not recognize PT_GNU_PROPERTY. Fixes commit d3f2b71ef1d146137a25dd1367d97a14fac341c6 ("aarch64: Fix tests not compatible with targets supporting GCS").
2025-01-20NEWS: Add the extensible rseq ABI to new featuresMichael Jeanson1-0/+7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-20Linux: Do not check unused bytes after sched_getattr in tst-sched_setattrFlorian Weimer2-14/+3
Linux 6.13 was released with a change that overwrites those bytes. This means that the check_unused subtest fails. Update the manual accordingly. Tested-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-20i386: Update ulps for *pi functionsFlorian Weimer1-9/+9
As seen with GCC 11.5 on an AMD Ryzen 9 7950X CPU, with an -fpmath=sse, --disable-multi-arch build of glibc.
2025-01-20aarch64: Fix tests not compatible with targets supporting GCSYury Khrustalev4-5/+57
- Add GCS marking to some of the tests when target supports GCS - Fix tst-ro-dynamic-mod.map linker script to avoid removing GNU properties - Add header with macros for GNU properties Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-01-20aarch64: Use __alloc_gcs in makecontextSzabolcs Nagy1-30/+8
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-20aarch64: Add GCS user-space allocation logicSzabolcs Nagy3-1/+93
Allocate GCS based on the stack size, this can be used for coroutines (makecontext) and thread creation (if the kernel allows user allocated GCS). Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-01-20aarch64: Process gnu properties in static exeSzabolcs Nagy1-0/+14
Unlike for BTI, the kernel does not process GCS properties so update GL(dl_aarch64_gcs) before the GCS status is set. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-20aarch64: Ignore GCS property of ld.soSzabolcs Nagy1-0/+5
check_gcs is called for each dependency of a DSO, but the GNU property of the ld.so is not processed so ldso->l_mach.gcs may not be correct. Just assume ld.so is GCS compatible independently of the ELF marking. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-01-20aarch64: Handle GCS markingSzabolcs Nagy3-6/+103
- Handle GCS marking - Use l_searchlist.r_list for gcs (allows using the same function for static exe) Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-20aarch64: Use l_searchlist.r_list for btiSzabolcs Nagy1-3/+2
Allows using the same function for static exe. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-01-20aarch64: Mark objects with GCS property noteSzabolcs Nagy1-2/+3
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-01-20aarch64: Enable GCS in dynamic linked exeSzabolcs Nagy4-6/+66
Use the dynamic linker start code to enable GCS in the dynamic linked case after _dl_start returns and before _dl_start_user which marks the point after which user code may run. Like in the static linked case this ensures that GCS is enabled on a top level stack frame. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-20aarch64: Enable GCS in static linked exeSzabolcs Nagy1-0/+48
Use the ARCH_SETUP_TLS hook to enable GCS in the static linked case. The system call must be inlined and then GCS is enabled on a top level stack frame that does not return and has no exception handlers above it. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-20aarch64: Add glibc.cpu.aarch64_gcs tunableSzabolcs Nagy4-0/+94
This tunable controls Guarded Control Stack (GCS) for the process. 0 = disabled: do not enable GCS 1 = enforced: check markings and fail if any binary is not marked 2 = optional: check markings but keep GCS off if a binary is unmarked 3 = override: enable GCS, markings are ignored By default it is 0, so GCS is disabled, value 1 will enable GCS. The status is stored into GL(dl_aarch64_gcs) early and only applied later, since enabling GCS is tricky: it must happen on a top level stack frame. Using GL instead of GLRO because it may need updates depending on loaded libraries that happen after readonly protection is applied, however library marking based GCS setting is not yet implemented. Describe new tunable in the manual. Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-20aarch64: Add GCS support for makecontextSzabolcs Nagy2-2/+63
Changed the makecontext logic: previously the first setcontext jumped straight to the user callback function and the return address is set to __startcontext. This does not work when GCS is enabled as the integrity of the return address is protected, so instead the context is setup such that setcontext jumps to __startcontext which calls the user callback (passed in x20). The map_shadow_stack syscall is used to allocate a suitably sized GCS (which includes some reserved area to account for altstack signal handlers and otherwise supports maximum number of 16 byte aligned stack frames on the given stack) however the GCS is never freed as the lifetime of ucontext and related stack is user managed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>