import UBI glibc-2.39-58.el10_1.2

This commit is contained in:
eabdullin 2025-11-11 22:14:44 +00:00
parent 9169b83e01
commit 8de692b9be
162 changed files with 31751 additions and 42 deletions

69
glibc-RHEL-106562-1.patch Normal file
View File

@ -0,0 +1,69 @@
commit f942a732d37a96217ef828116ebe64a644db18d7
Author: Joe Talbott <joetalbott@gmail.com>
Date: Tue May 14 14:39:38 2024 +0000
math: Add GLIBC_TEST_LIBM_VERBOSE environment variable support.
Allow the libm-test-driver based tests to have their verbosity set based
on the GLIBC_TEST_LIBM_VERBOSE environment variable. This allows the entire
testsuite to be run with a non-default verbosity.
While here check the conversion for the verbose option as well.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/math/libm-test-support.c b/math/libm-test-support.c
index 1d60ac783be6fb65..0cae545f86ac1352 100644
--- a/math/libm-test-support.c
+++ b/math/libm-test-support.c
@@ -130,7 +130,7 @@ static int noTests; /* number of tests (without testing exceptions) */
static int noExcTests; /* number of tests for exception flags */
static int noErrnoTests;/* number of tests for errno values */
-static int verbose;
+static unsigned int verbose;
static int output_max_error; /* Should the maximal errors printed? */
static int output_points; /* Should the single function results printed? */
static int ignore_max_ulp; /* Should we ignore max_ulp? */
@@ -1057,7 +1057,14 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
case 'v':
if (optarg)
- verbose = (unsigned int) strtoul (optarg, NULL, 0);
+ {
+ char *optstr_conv = optarg;
+ unsigned int opt_verbose;
+
+ opt_verbose = (unsigned int) strtoul (optarg, &optstr_conv, 0);
+ if (*optstr_conv == '\0' && optstr_conv != optarg)
+ verbose = opt_verbose;
+ }
else
verbose = 3;
break;
@@ -1139,6 +1146,7 @@ libm_test_init (int argc, char **argv)
int remaining;
char *ulps_file_path;
size_t dir_len = 0;
+ char *envstr_verbose;
verbose = 1;
output_ulps = 0;
@@ -1148,6 +1156,17 @@ libm_test_init (int argc, char **argv)
/* XXX set to 0 for releases. */
ignore_max_ulp = 0;
+ envstr_verbose = getenv("GLIBC_TEST_LIBM_VERBOSE");
+ if (envstr_verbose != NULL)
+ {
+ char *envstr_conv = envstr_verbose;
+ unsigned int env_verbose;
+
+ env_verbose = (unsigned int) strtoul (envstr_verbose, &envstr_conv, 0);
+ if (*envstr_conv == '\0' && envstr_conv != envstr_verbose)
+ verbose = env_verbose;
+ }
+
/* Parse and process arguments. */
argp_parse (&argp, argc, argv, 0, &remaining, NULL);

View File

@ -0,0 +1,20 @@
commit 79f44e1a47e87907fb8e97bbd098e01c4adc26a5
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Aug 26 16:45:31 2024 +0200
inet: Avoid label at end of compound statement in tst-if_nameindex
This fails to compile with GCC 8.
diff --git a/inet/tst-if_nameindex.c b/inet/tst-if_nameindex.c
index b025cdb3a7c6b68c..5b905601245bef34 100644
--- a/inet/tst-if_nameindex.c
+++ b/inet/tst-if_nameindex.c
@@ -105,6 +105,7 @@ do_test (void)
TEST_VERIFY (errno == ENODEV);
not_this_one:
+ ;
}

288
glibc-RHEL-106562-11.patch Normal file
View File

@ -0,0 +1,288 @@
commit 4945ffc88a8ad49280bae64165683ddfd12b2390
Author: DJ Delorie <dj@redhat.com>
Date: Wed Aug 7 16:55:16 2024 -0400
fgets: more tests
Add more tests for unusual situations fgets() might see:
* zero size file
* zero sized buffer
* NULL buffer
* NUL data
* writable stream
* closed stream
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index c822434293b7e809..6b52fd3e0d818960 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -209,6 +209,7 @@ tests := \
tst-fdopen2 \
tst-ferror \
tst-fgets \
+ tst-fgets2 \
tst-fileno \
tst-fmemopen \
tst-fmemopen2 \
diff --git a/stdio-common/tst-fgets2.c b/stdio-common/tst-fgets2.c
new file mode 100644
index 0000000000000000..5b78447ea9aa3cbe
--- /dev/null
+++ b/stdio-common/tst-fgets2.c
@@ -0,0 +1,253 @@
+/* Test for additional fgets error handling.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <libc-diag.h>
+#include <stdio.h>
+#include <error.h>
+#include <errno.h>
+#include <limits.h>
+#include <mcheck.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <support/support.h>
+#include <support/check.h>
+
+/* This avoids compiler warnings about passing NULL where a valid
+ pointer is expected. */
+static void *volatile null = NULL;
+
+/* Implementation of our FILE stream backend. */
+
+static int bytes_read;
+static int cookie_valid = 0;
+struct Cookie {
+ const char *buffer;
+ int bufptr;
+ int bufsz;
+};
+
+#define VALIDATE_COOKIE() if (! cookie_valid) { \
+ FAIL ("call to %s after file closed", __FUNCTION__); \
+ return -1; \
+ }
+
+static ssize_t
+io_read (void *vcookie, char *buf, size_t size)
+{
+ struct Cookie *cookie = (struct Cookie *) vcookie;
+
+ VALIDATE_COOKIE ();
+
+ if (size > cookie->bufsz - cookie->bufptr)
+ size = cookie->bufsz - cookie->bufptr;
+
+ memcpy (buf, cookie->buffer + cookie->bufptr, size);
+ cookie->bufptr += size;
+ bytes_read += size;
+ return size;
+}
+
+static ssize_t
+io_write (void *vcookie, const char *buf, size_t size)
+{
+ VALIDATE_COOKIE ();
+ FAIL_EXIT1 ("io_write called");
+}
+
+static int
+io_seek (void *vcookie, off64_t *position, int whence)
+{
+ VALIDATE_COOKIE ();
+ FAIL_EXIT1 ("io_seek called");
+}
+
+static int
+io_clean (void *vcookie)
+{
+ struct Cookie *cookie = (struct Cookie *) vcookie;
+
+ VALIDATE_COOKIE ();
+
+ cookie->buffer = NULL;
+ cookie->bufsz = 0;
+ cookie->bufptr = 0;
+
+ cookie_valid = 0;
+ free (cookie);
+ return 0;
+}
+
+cookie_io_functions_t io_funcs = {
+ .read = io_read,
+ .write = io_write,
+ .seek = io_seek,
+ .close = io_clean
+};
+
+FILE *
+io_open (const char *buffer, int buflen, const char *mode, void **vcookie)
+{
+ FILE *f;
+ struct Cookie *cookie;
+
+ cookie = (struct Cookie *) xcalloc (1, sizeof (struct Cookie));
+ *vcookie = cookie;
+ cookie_valid = 1;
+
+ cookie->buffer = buffer;
+ cookie->bufsz = buflen;
+ bytes_read = 0;
+
+ f = fopencookie (cookie, mode, io_funcs);
+ if (f == NULL)
+ FAIL_EXIT1 ("fopencookie failed");
+
+ clearerr (f);
+ return f;
+}
+
+/* The test cases. */
+
+#define my_open(s,l,m) io_open (s, l, m, (void *) &cookie)
+
+#define TEST_COMPARE_0x11(buf, len) \
+ TEST_COMPARE_BLOB (buf + (len), sizeof (buf) - (len), \
+ buf2, sizeof (buf) - (len));
+
+#define check_flags(f, expected_eof, expected_err) \
+ { \
+ if (expected_eof) \
+ TEST_VERIFY (feof (f) != 0); \
+ else \
+ TEST_VERIFY (feof (f) == 0); \
+ if (expected_err) \
+ TEST_VERIFY (ferror (f) != 0); \
+ else \
+ TEST_VERIFY (ferror (f) == 0); \
+ }
+
+static int
+do_test (void)
+{
+ FILE *f;
+ struct Cookie *cookie;
+ char buf [10];
+ char buf2 [10];
+ char *returned_string;
+
+ memset (buf2, 0x11, sizeof (buf2));
+
+ printf ("testing base operation...\n");
+ f = my_open ("hello\n", 6, "r");
+ memset (buf, 0x11, sizeof (buf));
+ returned_string = fgets (buf, sizeof (buf) - 1, f);
+ TEST_VERIFY (returned_string == buf);
+ TEST_COMPARE_BLOB (buf, bytes_read + 1, "hello\n\0", 7);
+ TEST_COMPARE_0x11 (buf, bytes_read + 1);
+ check_flags (f, 0, 0);
+
+ fclose (f);
+
+ printf ("testing zero size file...\n");
+ f = my_open ("hello\n", 0, "r");
+ memset (buf, 0x11, sizeof (buf));
+ returned_string = fgets (buf, sizeof (buf) - 1, f);
+ TEST_VERIFY (returned_string == NULL);
+ TEST_VERIFY (bytes_read == 0);
+ check_flags (f, 1, 0);
+ fclose (f);
+
+ printf ("testing zero size buffer...\n");
+ f = my_open ("hello\n", 6, "r");
+ memset (buf, 0x11, sizeof (buf));
+ returned_string = fgets (buf, 0, f);
+ TEST_VERIFY (returned_string == NULL);
+ TEST_VERIFY (bytes_read == 0);
+ check_flags (f, 0, 0);
+ fclose (f);
+
+ printf ("testing NULL buffer with empty stream...\n");
+ f = my_open ("hello\n", 0, "r");
+ memset (buf, 0x11, sizeof (buf));
+
+ returned_string = fgets (null, sizeof (buf), f);
+
+ TEST_VERIFY (returned_string == NULL);
+ TEST_VERIFY (bytes_read == 0);
+ check_flags (f, 1, 0);
+ fclose (f);
+
+ printf ("testing embedded NUL...\n");
+ f = my_open ("hel\0lo\n", 7, "r");
+ memset (buf, 0x11, sizeof (buf));
+ returned_string = fgets (buf, sizeof (buf) - 1, f);
+ TEST_VERIFY (returned_string == buf);
+ TEST_COMPARE_BLOB (buf, bytes_read + 1, "hel\0lo\n\0", 8);
+ TEST_COMPARE_0x11 (buf, bytes_read + 1);
+ check_flags (f, 0, 0);
+ fclose (f);
+
+ printf ("testing writable stream...\n");
+ f = my_open ("hel\0lo\n", 7, "w");
+ memset (buf, 0x11, sizeof (buf));
+ returned_string = fgets (buf, sizeof (buf) - 1, f);
+ TEST_VERIFY (returned_string == NULL);
+ TEST_VERIFY (bytes_read == 0);
+ check_flags (f, 0, 1);
+ fclose (f);
+
+ printf ("testing closed fd stream...\n");
+ int fd = open ("/dev/null", O_RDONLY);
+ f = fdopen (fd, "r");
+ close (fd);
+ memset (buf, 0x11, sizeof (buf));
+ returned_string = fgets (buf, sizeof (buf) - 1, f);
+ TEST_VERIFY (returned_string == NULL);
+ TEST_VERIFY (bytes_read == 0);
+ check_flags (f, 0, 1);
+ fclose (f);
+
+#ifdef IO_DEBUG
+ /* These tests only pass if glibc is built with -DIO_DEBUG, but are
+ included for reference. */
+
+ printf ("testing NULL descriptor...\n");
+ memset (buf, 0x11, sizeof (buf));
+ returned_string = fgets (buf, sizeof (buf) - 1, null);
+ TEST_VERIFY (returned_string == NULL);
+ TEST_VERIFY (bytes_read == 0);
+
+ printf ("testing closed descriptor...\n");
+ f = my_open ("hello\n", 7, "r");
+ fclose (f);
+ memset (buf, 0x11, sizeof (buf));
+ returned_string = fgets (buf, sizeof (buf) - 1, f);
+ TEST_VERIFY (returned_string == NULL);
+ TEST_VERIFY (bytes_read == 0);
+#endif
+
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -0,0 +1,90 @@
commit 83fd4149ffdae86c8864a6828f39dd942956636f
Author: Aaron Merey <amerey@redhat.com>
Date: Thu Sep 19 11:11:39 2024 -0400
Test that errno is set to 0 at program startup
Add new testcase elf/tst-startup-errno.c which tests that errno is set
to 0 at first ELF constructor execution and at the start of the
program's main function.
Tested for x86_64
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/elf/Makefile b/elf/Makefile
index a46c4f69d98553f7..92da608da1ebc175 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -457,6 +457,7 @@ tests += \
tst-single_threaded-pthread \
tst-sonamemove-dlopen \
tst-sonamemove-link \
+ tst-startup-errno \
tst-thrlock \
tst-tls-dlinfo \
tst-tls-ie \
diff --git a/elf/tst-startup-errno.c b/elf/tst-startup-errno.c
new file mode 100644
index 0000000000000000..59a1005fb674a5c3
--- /dev/null
+++ b/elf/tst-startup-errno.c
@@ -0,0 +1,58 @@
+/* Test the value of errno at program startup.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Verify that errno is 0 at first ELF constructor execution and at
+ the start of main. */
+
+static void set_ctor_errno (void) __attribute__((constructor));
+static int ctor_errno = -1;
+
+static void
+set_ctor_errno (void)
+{
+ ctor_errno = errno;
+}
+
+static int
+get_ctor_errno (void)
+{
+ return ctor_errno;
+}
+
+int
+main (void)
+{
+ if (errno != 0)
+ {
+ printf ("At start of main errno set to %d != 0\n", errno);
+ exit (1);
+ }
+
+ if (get_ctor_errno () != 0)
+ {
+ printf ("At ctor exec errno set to %d != 0\n", get_ctor_errno ());
+ exit (1);
+ }
+
+ return 0;
+}
+

301
glibc-RHEL-106562-13.patch Normal file
View File

@ -0,0 +1,301 @@
commit cfb35f5f7f32cec8fa4e16b99e35b7d70fa13f1f
Author: DJ Delorie <dj@redhat.com>
Date: Tue Sep 17 22:52:37 2024 -0400
rt: more clock_nanosleep tests
Test that clock_nanosleep rejects out of range time values.
Test that clock_nanosleep actually sleeps for at least the
requested time relative to the requested clock.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/rt/Makefile b/rt/Makefile
index 7b50c64f7664c07f..bc5f28c6d03722a3 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -77,6 +77,7 @@ tests := tst-shm tst-timer tst-timer2 \
tst-bz28213 \
tst-timer3 tst-timer4 tst-timer5 \
tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
+ tst-clock_nanosleep2 \
tst-shm-cancel \
tst-mqueue10
tests-internal := tst-timer-sigmask
@@ -84,6 +85,7 @@ tests-internal := tst-timer-sigmask
tests-time64 := \
tst-aio6-time64 \
tst-cpuclock2-time64 \
+ tst-clock_nanosleep2-time64 \
tst-mqueue1-time64 \
tst-mqueue2-time64 \
tst-mqueue4-time64 \
diff --git a/rt/tst-clock_nanosleep2-time64.c b/rt/tst-clock_nanosleep2-time64.c
new file mode 100644
index 0000000000000000..8deb4201f38b094a
--- /dev/null
+++ b/rt/tst-clock_nanosleep2-time64.c
@@ -0,0 +1 @@
+#include "tst-clock_nanosleep2.c"
diff --git a/rt/tst-clock_nanosleep2.c b/rt/tst-clock_nanosleep2.c
new file mode 100644
index 0000000000000000..10c822fd54668531
--- /dev/null
+++ b/rt/tst-clock_nanosleep2.c
@@ -0,0 +1,255 @@
+/* Test program for process CPU clocks - invalid inputs, minimum time
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+/* This test has two primary goals - first, to validate that invalid
+ inputs to clock_nanosleep are caught, and second, to validate that
+ clock_nanosleep sleeps for at least the amount of time requested.
+ It is assumed that the system may sleep for an arbitrary additional
+ amount of time beyond the requested time. */
+
+#include <unistd.h>
+#include <stdint.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+#include <support/xunistd.h>
+#include <support/check.h>
+#include <support/xthread.h>
+#include <support/timespec.h>
+
+/* This is 1 ms per test, we have 10 tests, so this file runs in on
+ the order of 0.01 seconds. */
+#define TEST_NSEC 1000000
+
+/* Nanoseconds per second. */
+#define NSECMAX 1000000000L
+
+static pthread_barrier_t barrier;
+
+/* This function is intended to rack up both user and system time. */
+static void *
+chew_cpu (void *arg)
+{
+ pthread_barrier_wait (&barrier);
+
+ while (1)
+ {
+ static volatile char buf[4096];
+ for (int i = 0; i < 100; ++i)
+ for (size_t j = 0; j < sizeof buf; ++j)
+ buf[j] = 0xaa;
+ int nullfd = xopen ("/dev/null", O_WRONLY, 0);
+ for (int i = 0; i < 100; ++i)
+ for (size_t j = 0; j < sizeof buf; ++j)
+ buf[j] = 0xbb;
+ xwrite (nullfd, (char *) buf, sizeof buf);
+ close (nullfd);
+ }
+
+ return NULL;
+}
+
+static void
+ptime_1 (const char *n, struct timespec t)
+{
+ /* This is only for debugging failed test cases. */
+ printf ("%12s: %lld.%09lld\n", n, (long long int) t.tv_sec,
+ (long long int) t.tv_nsec);
+}
+#define ptime(t) ptime_1 (#t, t)
+
+static void
+test_interval_1 (const char *n_clock, clockid_t t_clock)
+{
+ struct timespec me_before, me_after, quantum, me_sleep, me_slept;
+ long long int slept, min_slept;
+
+ /* Arbitrary to ensure our time period is sufficiently bigger than
+ the time step. */
+ TEST_VERIFY (clock_getres (t_clock, &quantum) == 0);
+ printf("Clock quantum: %lld ns, test time: %lld ns\n",
+ (long long int) quantum.tv_nsec, (long long int) TEST_NSEC);
+ TEST_VERIFY (quantum.tv_nsec <= TEST_NSEC / 10);
+
+ min_slept = TEST_NSEC;
+
+ me_sleep = make_timespec (0, min_slept);
+
+ printf ("test clock %s for %lld.%09lld sec relative\n",
+ n_clock, (long long int) me_sleep.tv_sec,
+ (long long int) me_sleep.tv_nsec);
+
+ TEST_COMPARE (clock_gettime (t_clock, &me_before), 0);
+ TEST_COMPARE (clock_nanosleep (t_clock, 0, &me_sleep, NULL), 0);
+ TEST_COMPARE (clock_gettime (t_clock, &me_after), 0);
+
+ me_slept = timespec_sub (me_after, me_before);
+ slept = support_timespec_ns (me_slept);
+
+ ptime (me_before);
+ ptime (me_after);
+ ptime (me_sleep);
+ ptime (me_slept);
+ printf ("test slept %lld nsec >= asked for %lld ?\n", slept, min_slept);
+
+ /* This is the important part - verify that the time slept is at
+ least as much as the time requested. */
+ TEST_VERIFY (slept >= min_slept);
+}
+
+static void
+test_abs_1 (const char *n_clock, clockid_t t_clock)
+{
+ struct timespec me_before, me_after, quantum, me_sleep;
+
+ /* Arbitrary to ensure our time period is sufficiently bigger than
+ the time step. */
+ TEST_VERIFY (clock_getres (t_clock, &quantum) == 0);
+ printf("Clock quantum: %lld ns, test time: %lld ns\n",
+ (long long int) quantum.tv_nsec, (long long int) TEST_NSEC);
+ TEST_VERIFY (quantum.tv_nsec <= TEST_NSEC / 10);
+
+ me_sleep = make_timespec (0, TEST_NSEC);
+
+ printf ("test clock %s for %lld.%09lld sec absolute\n",
+ n_clock, (long long int) me_sleep.tv_sec,
+ (long long int) me_sleep.tv_nsec);
+
+ TEST_COMPARE (clock_gettime (t_clock, &me_before), 0);
+ me_sleep = timespec_add (me_sleep, me_before);
+ TEST_COMPARE (clock_nanosleep (t_clock, TIMER_ABSTIME, &me_sleep, NULL), 0);
+ TEST_COMPARE (clock_gettime (t_clock, &me_after), 0);
+
+ ptime (me_before);
+ ptime (me_sleep);
+ ptime (me_after);
+
+ printf("test slept until %lld.%09lld after requested %lld.%09lld ?\n",
+ (long long int) me_after.tv_sec, (long long int) me_after.tv_nsec,
+ (long long int) me_sleep.tv_sec, (long long int) me_sleep.tv_nsec);
+
+ /* This is the important part - verify that the time slept is at
+ least as much as the time requested. */
+ TEST_TIMESPEC_EQUAL_OR_AFTER (me_after, me_sleep);
+}
+
+static void
+test_invalids_1 (const char *the_clock_name, int the_clock,
+ const char *flags_name, int flags)
+{
+ struct timespec me_before;
+
+ /* Note: do not use make_timespec() in case that function tries to
+ normalize the fields. */
+
+ printf ("%s: %s: test tv 0, 0\n", the_clock_name, flags_name);
+ me_before.tv_sec = 0;
+ me_before.tv_nsec = 0;
+ TEST_COMPARE (clock_nanosleep (the_clock, 0, &me_before, NULL), 0);
+
+ printf ("%s: %s: test tv -1, 0\n", the_clock_name, flags_name);
+ me_before.tv_sec = -1;
+ me_before.tv_nsec = 0;
+ TEST_COMPARE (clock_nanosleep (the_clock, 0, &me_before, NULL), EINVAL);
+
+ printf ("%s: %s: test tv 0, -1\n", the_clock_name, flags_name);
+ me_before.tv_sec = 0;
+ me_before.tv_nsec = -1;
+ TEST_COMPARE (clock_nanosleep (the_clock, 0, &me_before, NULL), EINVAL);
+
+ printf ("%s: %s: test tv -1, -1\n", the_clock_name, flags_name);
+ me_before.tv_sec = -1;
+ me_before.tv_nsec = -1;
+ TEST_COMPARE (clock_nanosleep (the_clock, 0, &me_before, NULL), EINVAL);
+
+ printf ("%s: %s: test tv 0, MAX\n", the_clock_name, flags_name);
+ me_before.tv_sec = 0;
+ me_before.tv_nsec = NSECMAX;
+ TEST_COMPARE (clock_nanosleep (the_clock, 0, &me_before, NULL), EINVAL);
+}
+
+static int
+do_test (void)
+{
+ pthread_t th;
+
+ pthread_barrier_init (&barrier, NULL, 2);
+
+ /* Test for proper error detection. */
+
+#define test_invalids(c, f) test_invalids_1 (#c, c, #f, f)
+ test_invalids (CLOCK_REALTIME, 0);
+#ifdef CLOCK_TAI
+ test_invalids (CLOCK_TAI, 0);
+#endif
+ test_invalids (CLOCK_MONOTONIC, 0);
+#ifdef CLOCK_BOOTTIME
+ test_invalids (CLOCK_BOOTTIME, 0);
+#endif
+ test_invalids (CLOCK_PROCESS_CPUTIME_ID, 0);
+ test_invalids (CLOCK_REALTIME, TIMER_ABSTIME);
+#ifdef CLOCK_TAI
+ test_invalids (CLOCK_TAI, TIMER_ABSTIME);
+#endif
+ test_invalids (CLOCK_MONOTONIC, TIMER_ABSTIME);
+#ifdef CLOCK_BOOTTIME
+ test_invalids (CLOCK_BOOTTIME, TIMER_ABSTIME);
+#endif
+ test_invalids (CLOCK_PROCESS_CPUTIME_ID, TIMER_ABSTIME);
+
+ /* Test for various clocks "working". */
+
+#define test_interval(c) test_interval_1 (#c, c)
+ test_interval (CLOCK_REALTIME);
+#ifdef CLOCK_TAI
+ test_interval (CLOCK_TAI);
+#endif
+ test_interval (CLOCK_MONOTONIC);
+#ifdef CLOCK_BOOTTIME
+ test_interval (CLOCK_BOOTTIME);
+#endif
+
+ th = xpthread_create (NULL, chew_cpu, NULL);
+ xpthread_barrier_wait (&barrier);
+ test_interval (CLOCK_PROCESS_CPUTIME_ID);
+ xpthread_cancel (th);
+
+#define test_abs(c) test_abs_1 (#c, c)
+ test_abs (CLOCK_REALTIME);
+#ifdef CLOCK_TAI
+ test_abs (CLOCK_TAI);
+#endif
+ test_abs (CLOCK_MONOTONIC);
+#ifdef CLOCK_BOOTTIME
+ test_abs (CLOCK_BOOTTIME);
+#endif
+
+ th = xpthread_create (NULL, chew_cpu, NULL);
+ xpthread_barrier_wait (&barrier);
+ test_abs (CLOCK_PROCESS_CPUTIME_ID);
+ xpthread_cancel (th);
+
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -0,0 +1,18 @@
commit 1895a35e7092713b224166d36b9bc26e8eb3371f
Author: DJ Delorie <dj@redhat.com>
Date: Tue Oct 8 14:30:21 2024 -0400
rt: more clock_nanosleep tests addendum
Forgot to change the first-line description.
diff --git a/rt/tst-clock_nanosleep2.c b/rt/tst-clock_nanosleep2.c
index 10c822fd54668531..e9b2a2716d6e9016 100644
--- a/rt/tst-clock_nanosleep2.c
+++ b/rt/tst-clock_nanosleep2.c
@@ -1,4 +1,4 @@
-/* Test program for process CPU clocks - invalid inputs, minimum time
+/* Test for clock_nanosleep parameter checks and sleep duration.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.

218
glibc-RHEL-106562-15.patch Normal file
View File

@ -0,0 +1,218 @@
commit 99671e72bb27a3cb98860bdc4c0e25961ce96b3e
Author: Joseph Myers <josmyers@redhat.com>
Date: Fri Nov 22 16:58:51 2024 +0000
Add multithreaded test of sem_getvalue
Test coverage of sem_getvalue is fairly limited. Add a test that runs
it on threads on each CPU. For this purpose I adapted
tst-skeleton-thread-affinity.c; it didn't seem very suitable to use
as-is or include directly in a different test doing things per-CPU,
but did seem a suitable starting point (thus sharing
tst-skeleton-affinity.c) for such testing.
Tested for x86_64.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index eee91c7b64d79fe7..47bf050759bd2b4e 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -653,6 +653,7 @@ ifeq ($(subdir),nptl)
tests += \
tst-align-clone \
tst-getpid1 \
+ tst-sem_getvalue-affinity \
# tests
# tst-rseq-nptl is an internal test because it requires a definition of
diff --git a/sysdeps/unix/sysv/linux/tst-sem_getvalue-affinity.c b/sysdeps/unix/sysv/linux/tst-sem_getvalue-affinity.c
new file mode 100644
index 0000000000000000..4176f67533357909
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-sem_getvalue-affinity.c
@@ -0,0 +1,185 @@
+/* Test sem_getvalue across CPUs. Based on tst-skeleton-thread-affinity.c.
+ Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <support/xthread.h>
+#include <sys/time.h>
+
+struct conf;
+static bool early_test (struct conf *);
+
+static int
+setaffinity (size_t size, const cpu_set_t *set)
+{
+ int ret = pthread_setaffinity_np (pthread_self (), size, set);
+ if (ret != 0)
+ {
+ errno = ret;
+ return -1;
+ }
+ return 0;
+}
+
+static int
+getaffinity (size_t size, cpu_set_t *set)
+{
+ int ret = pthread_getaffinity_np (pthread_self (), size, set);
+ if (ret != 0)
+ {
+ errno = ret;
+ return -1;
+ }
+ return 0;
+}
+
+#include "tst-skeleton-affinity.c"
+
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+static sem_t sem;
+
+static void *
+tf (void *arg)
+{
+ void *ret = NULL;
+ xpthread_mutex_lock (&lock);
+ int semval;
+ if (sem_getvalue (&sem, &semval) != 0)
+ {
+ printf ("sem_getvalue failed: %m\n");
+ ret = (void *) 1;
+ }
+ else if (semval != 12345)
+ {
+ printf ("sem_getvalue returned %d not 12345\n", semval);
+ ret = (void *) 1;
+ }
+ xpthread_mutex_unlock (&lock);
+ return ret;
+}
+
+static int
+stop_and_join_threads (struct conf *conf, cpu_set_t *set,
+ pthread_t *pinned_first, pthread_t *pinned_last)
+{
+ int failed = 0;
+ for (pthread_t *p = pinned_first; p < pinned_last; ++p)
+ {
+ int cpu = p - pinned_first;
+ if (!CPU_ISSET_S (cpu, CPU_ALLOC_SIZE (conf->set_size), set))
+ continue;
+
+ void *retval = (void *) 1;
+ int ret = pthread_join (*p, &retval);
+ if (ret != 0)
+ {
+ printf ("error: Failed to join thread %d: %s\n", cpu, strerror (ret));
+ fflush (stdout);
+ /* Cannot shut down cleanly with threads still running. */
+ abort ();
+ }
+ if (retval != NULL)
+ failed = 1;
+ }
+ return failed;
+}
+
+static bool
+early_test (struct conf *conf)
+{
+ int ret;
+ ret = sem_init (&sem, 0, 12345);
+ if (ret != 0)
+ {
+ printf ("error: sem_init failed: %m\n");
+ return false;
+ }
+ xpthread_mutex_lock (&lock);
+ pthread_t *pinned_threads
+ = calloc (conf->last_cpu + 1, sizeof (*pinned_threads));
+ cpu_set_t *initial_set = CPU_ALLOC (conf->set_size);
+ cpu_set_t *scratch_set = CPU_ALLOC (conf->set_size);
+
+ if (pinned_threads == NULL || initial_set == NULL || scratch_set == NULL)
+ {
+ puts ("error: Memory allocation failure");
+ return false;
+ }
+ if (getaffinity (CPU_ALLOC_SIZE (conf->set_size), initial_set) < 0)
+ {
+ printf ("error: pthread_getaffinity_np failed: %m\n");
+ return false;
+ }
+
+ pthread_attr_t attr;
+ ret = pthread_attr_init (&attr);
+ if (ret != 0)
+ {
+ printf ("error: pthread_attr_init failed: %s\n", strerror (ret));
+ return false;
+ }
+ support_set_small_thread_stack_size (&attr);
+
+ /* Spawn a thread pinned to each available CPU. */
+ for (int cpu = 0; cpu <= conf->last_cpu; ++cpu)
+ {
+ if (!CPU_ISSET_S (cpu, CPU_ALLOC_SIZE (conf->set_size), initial_set))
+ continue;
+ CPU_ZERO_S (CPU_ALLOC_SIZE (conf->set_size), scratch_set);
+ CPU_SET_S (cpu, CPU_ALLOC_SIZE (conf->set_size), scratch_set);
+ ret = pthread_attr_setaffinity_np
+ (&attr, CPU_ALLOC_SIZE (conf->set_size), scratch_set);
+ if (ret != 0)
+ {
+ printf ("error: pthread_attr_setaffinity_np for CPU %d failed: %s\n",
+ cpu, strerror (ret));
+ stop_and_join_threads (conf, initial_set,
+ pinned_threads, pinned_threads + cpu);
+ return false;
+ }
+ ret = pthread_create (pinned_threads + cpu, &attr,
+ tf, (void *) (uintptr_t) cpu);
+ if (ret != 0)
+ {
+ printf ("error: pthread_create for CPU %d failed: %s\n",
+ cpu, strerror (ret));
+ stop_and_join_threads (conf, initial_set,
+ pinned_threads, pinned_threads + cpu);
+ return false;
+ }
+ }
+
+ /* Main thread. */
+ xpthread_mutex_unlock (&lock);
+ int failed = stop_and_join_threads (conf, initial_set,
+ pinned_threads,
+ pinned_threads + conf->last_cpu + 1);
+
+ printf ("info: Main thread ran on %d CPU(s) of %d available CPU(s)\n",
+ CPU_COUNT_S (CPU_ALLOC_SIZE (conf->set_size), scratch_set),
+ CPU_COUNT_S (CPU_ALLOC_SIZE (conf->set_size), initial_set));
+
+ pthread_attr_destroy (&attr);
+ CPU_FREE (scratch_set);
+ CPU_FREE (initial_set);
+ free (pinned_threads);
+ return failed == 0;
+}

View File

@ -0,0 +1,65 @@
commit 4b7cfcc3fbfab55a1bbb32a2da69c048060739d6
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Nov 25 17:32:54 2024 +0100
debug: Wire up tst-longjmp_chk3
The test was added in commit ac8cc9e300a002228eb7e660df3e7b333d9a7414
without all the required Makefile scaffolding. Tweak the test
so that it actually builds (including with dynamic SIGSTKSZ).
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/debug/Makefile b/debug/Makefile
index 3903cc97a3706354..76c311d2845df9c1 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -287,6 +287,7 @@ tests = \
tst-fortify-wide \
tst-longjmp_chk \
tst-longjmp_chk2 \
+ tst-longjmp_chk3 \
tst-realpath-chk \
tst-sprintf-fortify-rdonly \
tst-sprintf-fortify-unchecked \
diff --git a/debug/tst-longjmp_chk3.c b/debug/tst-longjmp_chk3.c
index 9ff99772075926ce..7bf1646b354fd2fe 100644
--- a/debug/tst-longjmp_chk3.c
+++ b/debug/tst-longjmp_chk3.c
@@ -18,9 +18,12 @@
#include <setjmp.h>
#include <signal.h>
+#include <stdio.h>
#include <string.h>
-static char buf[SIGSTKSZ * 4];
+#include <support/support.h>
+
+static char *buf;
static jmp_buf jb;
static void
@@ -49,8 +52,10 @@ do_test (void)
set_fortify_handler (handler);
/* Create a valid signal stack and enable it. */
+ size_t bufsize = SIGSTKSZ * 4;
+ buf = xmalloc (bufsize);
ss.ss_sp = buf;
- ss.ss_size = sizeof (buf);
+ ss.ss_size = bufsize;
ss.ss_flags = 0;
if (sigaltstack (&ss, NULL) < 0)
{
@@ -65,8 +70,8 @@ do_test (void)
/* Shrink the signal stack so the jmpbuf is now invalid.
We adjust the start & end to handle stacks that grow up & down. */
- ss.ss_sp = buf + sizeof (buf) / 2;
- ss.ss_size = sizeof (buf) / 4;
+ ss.ss_sp = buf + bufsize / 2;
+ ss.ss_size = bufsize / 4;
if (sigaltstack (&ss, NULL) < 0)
{
printf ("second sigaltstack failed: %m\n");

View File

@ -0,0 +1,20 @@
commit 4836a9af89f1b4d482e6c72ff67e36226d36434c
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Nov 26 19:26:13 2024 +0100
debug: Fix tst-longjmp_chk3 build failure on Hurd
Explicitly include <unistd.h> for _exit and getpid.
diff --git a/debug/tst-longjmp_chk3.c b/debug/tst-longjmp_chk3.c
index 7bf1646b354fd2fe..9b9db3b9e9e37d54 100644
--- a/debug/tst-longjmp_chk3.c
+++ b/debug/tst-longjmp_chk3.c
@@ -20,6 +20,7 @@
#include <signal.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <support/support.h>

111
glibc-RHEL-106562-18.patch Normal file
View File

@ -0,0 +1,111 @@
commit bde47662b74b883149c3001e2c052dea5d3cd92f
Author: Sergey Kolosov <skolosov@redhat.com>
Date: Wed Nov 6 15:24:06 2024 +0100
nptl: Add new test for pthread_spin_trylock
Add a threaded test for pthread_spin_trylock attempting to lock already
acquired spin lock and checking for correct return code.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index 04ea56559ef3a79b..8c80b7a606da4c94 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -265,6 +265,7 @@ tests += \
tst-spin2 \
tst-spin3 \
tst-spin4 \
+ tst-spin5 \
tst-stack1 \
tst-stdio1 \
tst-stdio2 \
diff --git a/sysdeps/pthread/tst-spin5.c b/sysdeps/pthread/tst-spin5.c
new file mode 100644
index 0000000000000000..5c23bd48ef27b3ce
--- /dev/null
+++ b/sysdeps/pthread/tst-spin5.c
@@ -0,0 +1,82 @@
+/* Threaded test the pthread_spin_trylock function.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <errno.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/xunistd.h>
+#include <support/xthread.h>
+
+pthread_spinlock_t lock;
+
+void *
+thread (void *arg)
+{
+ int ret;
+ int thr_id = *(int *) arg;
+
+ ret = pthread_spin_trylock (&lock);
+ if (thr_id == 1)
+ /* thread with already acquired lock. */
+ {
+ if (ret != EBUSY)
+ {
+ FAIL_EXIT1 ("pthread_spin_trylock should fail with EBUSY");
+ }
+ }
+ else if (thr_id == 2)
+ /* thread with released spin lock. */
+ {
+ if (ret != 0)
+ {
+ FAIL_EXIT1 ("pthread_spin_trylock should be able to acquire lock");
+ }
+ }
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ pthread_t thr1, thr2;
+ int ret;
+ int thr1_id = 1, thr2_id = 2;
+
+ pthread_spin_init (&lock, PTHREAD_PROCESS_PRIVATE);
+ /* lock spin in main thread. */
+ ret = pthread_spin_trylock (&lock);
+ if (ret != 0)
+ {
+ FAIL_EXIT1 ("Main thread should be able to acquire spin lock");
+ }
+
+ /* create first thread to try locking already acquired spin lock. */
+ thr1 = xpthread_create (NULL, thread, &thr1_id);
+ xpthread_join (thr1);
+
+ /* release spin lock and create thread to acquire released spin lock. */
+ pthread_spin_unlock (&lock);
+ thr2 = xpthread_create (NULL, thread, &thr2_id);
+ xpthread_join (thr2);
+
+ pthread_spin_destroy (&lock);
+ return 0;
+}
+
+#include <support/test-driver.c>

575
glibc-RHEL-106562-19.patch Normal file
View File

@ -0,0 +1,575 @@
commit 45c42b65c29422b773ac94771aa71165e245f8f8
Author: Martin Coufal <mcoufal@redhat.com>
Date: Thu Jan 23 13:04:06 2025 +0100
Add new tests for fopen
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>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 6b52fd3e0d818960..f44562df75cb98bc 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -215,6 +215,7 @@ tests := \
tst-fmemopen2 \
tst-fmemopen3 \
tst-fmemopen4 \
+ tst-fopen \
tst-fphex \
tst-fphex-wide \
tst-fread \
diff --git a/stdio-common/tst-fopen.c b/stdio-common/tst-fopen.c
new file mode 100644
index 0000000000000000..8c1fefd116f9f581
--- /dev/null
+++ b/stdio-common/tst-fopen.c
@@ -0,0 +1,279 @@
+/* Basic test for fopen.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <support/check.h>
+#include <support/temp_file.h>
+#include <support/xstdio.h>
+
+#define APPENDED_TEXT "This is appended text. "
+#define DEFAULT_TEXT "Lorem ipsum dolor sit amet, consectetur " \
+ "adipiscing elit, sed do eiusmod tempor incididunt ut labore et " \
+ "dolore magna aliqua."
+#define MAX_BUFFER_SIZE 300
+
+
+static int
+do_test (void)
+{
+ char *temp_file;
+ FILE *fd_file = NULL;
+ char read_buffer[MAX_BUFFER_SIZE] = "";
+ size_t ret;
+
+ /* Prepare files. */
+ int fd = create_temp_file ("tst-fopen.", &temp_file);
+ TEST_VERIFY_EXIT (fd != -1);
+ fd_file = fdopen (fd, "w");
+ ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file);
+ TEST_COMPARE (ret, strlen (DEFAULT_TEXT));
+ xfclose (fd_file);
+
+ /* Test 1: This checks for fopen with mode "r". Open text file for
+ reading. The stream is positioned at the beginning of the file. */
+ printf ("Test 1: This checks for fopen with mode \"r\".\n");
+ fd_file = fopen (temp_file, "r");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+ /* Read should succeed. */
+ ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, strlen (DEFAULT_TEXT));
+ TEST_VERIFY (strcmp (read_buffer, DEFAULT_TEXT) == 0);
+ /* Write should fail. */
+ errno = 0;
+ ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file);
+ TEST_VERIFY (ferror (fd_file) != 0);
+ TEST_COMPARE (errno, EBADF);
+ TEST_COMPARE (ret, 0);
+ clearerr (fd_file);
+ /* Opening non-existent file should fail. */
+ xfclose (fd_file);
+ errno = 0;
+ fd_file = fopen ("file-that-does-not-exist", "r");
+ TEST_VERIFY (fd_file == NULL);
+ TEST_COMPARE (errno, ENOENT);
+ TEST_VERIFY (fd_file == NULL);
+
+ memset (read_buffer, 0, MAX_BUFFER_SIZE);
+
+ /* Test 2: This checks for fopen with mode "r+". Open for reading and
+ writing. The stream is positioned at the beginning of the file. */
+ printf ("Test 2: This checks for fopen with mode \"r+\".\n");
+ fd_file = fopen (temp_file, "r+");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+ /* Read should succeed. */
+ ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, strlen (DEFAULT_TEXT));
+ TEST_VERIFY (strcmp (read_buffer, DEFAULT_TEXT) == 0);
+ fflush (fd_file);
+ /* File position indicator expected at 0 + read bytes. */
+ TEST_COMPARE (ftell (fd_file), ret);
+ /* Write should succeed. */
+ ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, strlen (DEFAULT_TEXT));
+ /* Opening non-existent file should fail. */
+ xfclose (fd_file);
+ errno = 0;
+ fd_file = fopen ("file-that-does-not-exist", "r+");
+ TEST_VERIFY (fd_file == NULL);
+ TEST_COMPARE (errno, ENOENT);
+ TEST_VERIFY (fd_file == NULL);
+
+ memset (read_buffer, 0, MAX_BUFFER_SIZE);
+
+ /* Test 3: This checks for fopen with mode "w". Truncate file to zero
+ length or create text file for writing. The stream is positioned
+ at the beginning of the file. */
+ printf ("Test 3: This checks for fopen with mode \"w\".\n");
+ fd_file = fopen (temp_file, "w");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+ /* Read should fail. */
+ errno = 0;
+ ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file);
+ TEST_VERIFY (ferror (fd_file) != 0);
+ TEST_COMPARE (errno, EBADF);
+ TEST_COMPARE (ret, 0);
+ clearerr (fd_file);
+ /* Write should succeed. */
+ ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, strlen (DEFAULT_TEXT));
+ /* Opening non-existent file should succeed. */
+ xfclose (fd_file);
+ fd_file = fopen ("/tmp/file-that-does-not-exist", "w");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+
+ xfclose (fd_file);
+ remove ("/tmp/file-that-does-not-exist");
+ memset (read_buffer, 0, MAX_BUFFER_SIZE);
+
+ /* Test 4: This checks for fopen with mode "w+". Open for reading and
+ writing. The file is created if it does not exist, otherwise it is
+ truncated. The stream is positioned at the beginning of the file.
+ */
+ printf ("Test 4: This checks for fopen with mode \"w+\".\n");
+ fd_file = fopen (temp_file, "w+");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+ /* Read should succeed. */
+ ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, 0);
+ TEST_VERIFY (read_buffer[0] == '\0');
+ /* Write should succeed. */
+ ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, strlen (DEFAULT_TEXT));
+ /* Opening non-existent file should succeed. */
+ xfclose (fd_file);
+ fd_file = fopen ("/tmp/file-that-does-not-exist", "w+");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+
+ xfclose (fd_file);
+ remove ("/tmp/file-that-does-not-exist");
+ memset (read_buffer, 0, MAX_BUFFER_SIZE);
+
+ /* Test 5: This checks for fopen with mode "a". Open for appending
+ (writing at end of file). The file is created if it does not
+ exist. The stream is positioned at the end of the file. */
+ printf ("Test 5: This checks for fopen with mode \"a\".\n");
+ fd_file = fopen (temp_file, "a");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), strlen (DEFAULT_TEXT));
+ /* Read should fail. */
+ errno = 0;
+ ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file);
+ TEST_VERIFY (ferror (fd_file) != 0);
+ TEST_COMPARE (errno, EBADF);
+ TEST_COMPARE (ret, 0);
+ clearerr (fd_file);
+ /* Write should succeed. */
+ ret = fwrite (APPENDED_TEXT, sizeof (char), strlen (APPENDED_TEXT), fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, strlen (APPENDED_TEXT));
+ /* The file position indicator for the stream is advanced by the
+ * number of bytes successfully read or written. */
+ TEST_COMPARE (ftell (fd_file), strlen (DEFAULT_TEXT) + ret);
+ /* Opening non-existent file should succeed. */
+ xfclose (fd_file);
+ fd_file = fopen ("/tmp/file-that-does-not-exist", "a");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+
+ xfclose (fd_file);
+ remove ("/tmp/file-that-does-not-exist");
+ memset (read_buffer, 0, MAX_BUFFER_SIZE);
+
+ /* Test 6: This checks for fopen with mode "a+". Open for reading and
+ appending (writing at end of file). The file is created if it does
+ not exist. Output is always appended to the end of the file. The
+ initial file position for reading is at the beginning of the file,
+ but it is advanced to the end prior to each write. */
+ printf ("Test 6: This checks for fopen with mode \"a+\".\n");
+ errno = 0;
+ fd_file = fopen (temp_file, "a+");
+ TEST_COMPARE (errno, 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+ /* Read should succeed. */
+ ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, strlen (DEFAULT_TEXT) + strlen (APPENDED_TEXT));
+ TEST_VERIFY (strcmp (read_buffer, DEFAULT_TEXT APPENDED_TEXT) == 0);
+ /* Write should succeed. */
+ const char* SECOND_APPEND = "This is second append.";
+ ret = fwrite (SECOND_APPEND, sizeof (char), strlen (SECOND_APPEND), fd_file);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_COMPARE (ret, strlen (SECOND_APPEND));
+ /* The file position indicator for the stream is advanced by the
+ number of bytes successfully read or written. */
+ TEST_COMPARE (ftell (fd_file),
+ strlen (DEFAULT_TEXT) + strlen (APPENDED_TEXT) + ret);
+ /* Opening non-existent file should succeed. */
+ xfclose (fd_file);
+ fd_file = fopen ("/tmp/file-that-does-not-exist", "a+");
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ TEST_COMPARE (ftell (fd_file), 0);
+
+ xfclose (fd_file);
+ remove ("/tmp/file-that-does-not-exist");
+ memset (read_buffer, 0, MAX_BUFFER_SIZE);
+
+ /* Test 7: This checks for fopen with other valid modes set, such as
+ "rc", "we" or "am". The test calls fopen with these modes and
+ checks that no errors appear. */
+ printf ("Test 7: This checks for fopen with other valid modes set, "
+ "such as \"rc\", \"we\" or \"am\".\n");
+ /* These modes all operate correctly with the file already present. */
+ static const char *valid_modes[] =
+ { "rc", "we", "am", "r+x", "wb+", "ab", 0 };
+ const char **p = valid_modes;
+ while (*p != 0)
+ {
+ fd_file = fopen (temp_file, *p);
+ TEST_COMPARE (ferror (fd_file), 0);
+ TEST_VERIFY (fd_file != NULL);
+ xfclose (fd_file);
+ ++p;
+ }
+
+ /* Test 8: This checks for fopen with invalid modes. The test calls
+ fopen with these modes and checks that opening existing files with
+ invalid mode fails and that opening non-existing files with invalid
+ mode doesn't create a new file. */
+ printf ("Test 8: This checks for fopen with invalid modes.\n");
+ static const char *invalid_modes[] = { "0", "tr", "z", "x", " ", 0 };
+ p = invalid_modes;
+ while (*p != 0)
+ {
+ errno = 0;
+ fd_file = fopen (temp_file, *p);
+ TEST_VERIFY (fd_file == NULL);
+ TEST_COMPARE (errno, EINVAL);
+ errno = 0;
+ fd_file = fopen ("/tmp/file-that-does-not-exist", *p);
+ TEST_VERIFY (fd_file == NULL);
+ TEST_COMPARE (errno, EINVAL);
+ ++p;
+ TEST_VERIFY (access ("/tmp/file-that-does-not-exist", F_OK) == -1);
+ }
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index 8c80b7a606da4c94..ef3035cea8e1344b 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -154,6 +154,7 @@ tests += \
tst-exit3 \
tst-flock1 \
tst-flock2 \
+ tst-fopen-threaded \
tst-fork1 \
tst-fork2 \
tst-fork3 \
diff --git a/sysdeps/pthread/tst-fopen-threaded.c b/sysdeps/pthread/tst-fopen-threaded.c
new file mode 100644
index 0000000000000000..5c792c93e3711621
--- /dev/null
+++ b/sysdeps/pthread/tst-fopen-threaded.c
@@ -0,0 +1,250 @@
+/* Test for fread and fwrite with multiple threads.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+/* Description of test intent.
+ The test creates NUM_THREADS threads for reading and writing to the
+ prepared file. The prepared file contains 'NUM_THREADS - 1' bytes
+ where each byte is unique number from 0 to 'NUM_THREADS - 2'. If all
+ operations are correctly multi-threaded safe then all concurent read
+ operations should succeed and read a unique 1 byte value. The last
+ thread to read should get an EOF. In concurrent write, all write
+ operations should succeed and the file should contain all unique 1
+ byte values from 0 to 'NUM_THREADS - 1'. Both concurrent read and
+ concurrent write tests are repeated ITERS times to increase
+ the probability of detecting concurrency issues. */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <support/check.h>
+#include <support/temp_file.h>
+#include <support/xstdio.h>
+#include <support/xthread.h>
+
+#define NUM_THREADS 100
+#define ITERS 10
+
+char *temp_file;
+pthread_barrier_t barrier;
+
+struct thread_data
+{
+ FILE *fd;
+ /* Read value or value to be written. */
+ unsigned char value;
+ bool eof;
+};
+
+static void *
+threadReadRoutine (void *argv)
+{
+ struct thread_data *my_data;
+ unsigned char read_buffer;
+ int ret = 0;
+ my_data = (struct thread_data *) argv;
+ /* Wait for all threads to be ready to read. */
+ xpthread_barrier_wait (&barrier);
+
+ ret =
+ fread (&read_buffer, sizeof (char), sizeof (read_buffer), my_data->fd);
+ if (feof (my_data->fd) != 0)
+ {
+ clearerr (my_data->fd);
+ my_data->eof = true;
+ }
+ else
+ {
+ TEST_COMPARE (ret, 1);
+ /* Save the read value. */
+ my_data->value = read_buffer;
+ }
+ TEST_COMPARE (ferror (my_data->fd), 0);
+ return NULL;
+}
+
+void *
+threadWriteRoutine (void *argv)
+{
+ struct thread_data *my_data;
+ int ret = 0;
+ my_data = (struct thread_data *) argv;
+ /* Wait for all threads to be ready to write. */
+ xpthread_barrier_wait (&barrier);
+
+ ret = fwrite (&my_data->value, sizeof (unsigned char), 1, my_data->fd);
+ TEST_COMPARE (ferror (my_data->fd), 0);
+ TEST_COMPARE (feof (my_data->fd), 0);
+ TEST_COMPARE (ret, 1);
+ return NULL;
+}
+
+void *
+threadOpenCloseRoutine (void *argv)
+{
+ /* Wait for all threads to be ready to call fopen and fclose. */
+ xpthread_barrier_wait (&barrier);
+
+ FILE *fd = xfopen ("/tmp/openclosetest", "w+");
+ xfclose (fd);
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ FILE *fd_file = NULL;
+ unsigned char buffer[NUM_THREADS] = "0";
+ size_t ret = 0;
+ pthread_t threads[NUM_THREADS];
+ struct thread_data thread_data_array[NUM_THREADS];
+ bool present_values[NUM_THREADS] = { false };
+
+ /* Prepare files. */
+ for (int i = 0; i < NUM_THREADS; i++)
+ buffer[i] = i;
+ int fd = create_temp_file ("tst-fopen.", &temp_file);
+ TEST_VERIFY_EXIT (fd != -1);
+ fd_file = fdopen (fd, "w");
+ /* NUM_THREADS - 1: last thread will read EOF */
+ ret = fwrite (buffer, sizeof (unsigned char), NUM_THREADS - 1, fd_file);
+ TEST_COMPARE (ret, NUM_THREADS - 1);
+ xfclose (fd_file);
+
+ /* Test 1: Concurrent read. */
+ for (int reps = 1; reps <= ITERS; reps++)
+ {
+ fd_file = xfopen (temp_file, "r");
+ xpthread_barrier_init (&barrier, NULL, NUM_THREADS);
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ thread_data_array[i].fd = fd_file;
+ /* Initialize with highest possible value so it's easier to debug if
+ anything goes wrong. */
+ thread_data_array[i].value = 255;
+ thread_data_array[i].eof = false;
+
+ threads[i] =
+ xpthread_create (support_small_stack_thread_attribute (),
+ threadReadRoutine,
+ (void *) &thread_data_array[i]);
+ }
+
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ xpthread_join (threads[i]);
+ }
+ xpthread_barrier_destroy (&barrier);
+ xfclose (fd_file);
+
+ /* Verify read values. */
+ int eof_cnt = 0;
+ for (int i = 0; i < NUM_THREADS; i++)
+ present_values[i] = false;
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ if (thread_data_array[i].eof)
+ {
+ /* EOF was read. */
+ present_values[NUM_THREADS - 1] = true;
+ eof_cnt++;
+ }
+ else
+ {
+ /* The same value shouldn't be read twice. */
+ TEST_VERIFY (!present_values[thread_data_array[i].value]);
+ present_values[thread_data_array[i].value] = true;
+ }
+ }
+ /* EOF is read exactly once. */
+ TEST_COMPARE (eof_cnt, 1);
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ /* All values should be read. */
+ TEST_VERIFY (present_values[i]);
+ }
+ }
+
+ /* Test 2: Concurrent write. */
+ for (int reps = 1; reps <= ITERS; reps++)
+ {
+ fd_file = xfopen (temp_file, "w");
+ xpthread_barrier_init (&barrier, NULL, NUM_THREADS);
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ thread_data_array[i].fd = fd_file;
+ thread_data_array[i].value = i;
+
+ threads[i] =
+ xpthread_create (support_small_stack_thread_attribute (),
+ threadWriteRoutine,
+ (void *) &thread_data_array[i]);
+ }
+
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ xpthread_join (threads[i]);
+ }
+ xpthread_barrier_destroy (&barrier);
+ xfclose (fd_file);
+
+ /* Verify written values. */
+ for (int i = 0; i < NUM_THREADS; i++)
+ present_values[i] = false;
+ memset (buffer, 0, NUM_THREADS);
+ fd_file = xfopen (temp_file, "r");
+ ret = fread (buffer, sizeof (unsigned char), NUM_THREADS, fd_file);
+ TEST_COMPARE (ret, NUM_THREADS);
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ /* The same value shouldn't be written twice. */
+ TEST_VERIFY (!present_values[buffer[i]]);
+ present_values[buffer[i]] = true;
+ }
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ /* All values should be written. */
+ TEST_VERIFY (present_values[i]);
+ }
+ xfclose (fd_file);
+ }
+
+ /* Test 3: Concurrent open/close. */
+ for (int reps = 1; reps <= ITERS; reps++)
+ {
+ xpthread_barrier_init (&barrier, NULL, NUM_THREADS);
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ threads[i] =
+ xpthread_create (support_small_stack_thread_attribute (),
+ threadOpenCloseRoutine, NULL);
+ }
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ xpthread_join (threads[i]);
+ }
+ xpthread_barrier_destroy (&barrier);
+ }
+
+ return 0;
+}
+
+#include <support/test-driver.c>

529
glibc-RHEL-106562-2.patch Normal file
View File

@ -0,0 +1,529 @@
commit ae18044f95271ed422ed847bd8d8c6d8e84674ce
Author: Joe Simmons-Talbott <josimmon@redhat.com>
Date: Mon May 20 14:09:35 2024 +0000
math: Add more details to the test driver output.
Add start and end indicators that identify the test being run in the
verbose output. Better identify the tests for max errors in the
summary output. Count each exception checked for each test. Remove
double counting of tests for the check_<type> functions other than
check_float_internal. Rename print_max_error and
print_complex_max_error to check_max_error and check_complex_max_error
respectively since they have side effects.
Co-Authored-By: Carlos O'Donell <carlos@redhat.com>
Reviewed-By: Joseph Myers <josmyers@redhat.com>
diff --git a/math/libm-test-driver.c b/math/libm-test-driver.c
index 3356f9b10d7f364e..dfb56e8cde13519a 100644
--- a/math/libm-test-driver.c
+++ b/math/libm-test-driver.c
@@ -1083,9 +1083,9 @@ struct test_Ff_b1_data
= STR_CON3 (FUN, SUFF, TEST_SUFF) TEST_SUFF_STR; \
init_max_error (this_func, EXACT, TEST_COND_any_ibm128)
#define END \
- print_max_error (this_func)
+ check_max_error (this_func)
#define END_COMPLEX \
- print_complex_max_error (this_func)
+ check_complex_max_error (this_func)
/* Run tests for a given function in all rounding modes. */
#define ALL_RM_TEST(FUNC, EXACT, ARRAY, LOOP_MACRO, END_MACRO, ...) \
diff --git a/math/libm-test-support.c b/math/libm-test-support.c
index 0cae545f86ac1352..0796f9d4956e3818 100644
--- a/math/libm-test-support.c
+++ b/math/libm-test-support.c
@@ -112,6 +112,7 @@
#include <argp.h>
#include <errno.h>
#include <string.h>
+#include <assert.h>
/* This header defines func_ulps, func_real_ulps and func_imag_ulps
arrays. */
@@ -125,10 +126,13 @@ static FILE *ulps_file; /* File to document difference. */
static int output_ulps; /* Should ulps printed? */
static char *output_dir; /* Directory where generated files will be written. */
-static int noErrors; /* number of errors */
-static int noTests; /* number of tests (without testing exceptions) */
-static int noExcTests; /* number of tests for exception flags */
-static int noErrnoTests;/* number of tests for errno values */
+#define TEST_INPUT 1
+#define TEST_MAXERROR 2
+static int noErrors; /* number of errors */
+static int noTests; /* number of tests (without testing exceptions) */
+static int noMaxErrorTests; /* number of max error tests */
+static int noExcTests; /* number of tests for exception flags */
+static int noErrnoTests; /* number of tests for errno values */
static unsigned int verbose;
static int output_max_error; /* Should the maximal errors printed? */
@@ -299,9 +303,19 @@ print_screen_max_error (int ok)
/* Update statistic counters. */
static void
-update_stats (int ok)
+update_stats (int ok, int testType)
{
- ++noTests;
+ switch (testType)
+ {
+ case TEST_INPUT:
+ ++noTests;
+ break;
+ case TEST_MAXERROR:
+ ++noMaxErrorTests;
+ break;
+ default:
+ abort();
+ }
if (!ok)
++noErrors;
}
@@ -367,11 +381,30 @@ fpstack_test (const char *test_name)
#endif
}
+static void
+print_test_start (int test_num, const char *test_name, int test_type)
+{
+ if (print_screen (1))
+ printf ("--- Start of%s test # %d, named \"%s\" ---\n",
+ test_type == TEST_MAXERROR ? " max error" : "", test_num, test_name);
+}
+static void
+print_test_end (int test_num, const char *test_name, int test_type)
+{
+ if (print_screen (1))
+ printf ("--- End of%s test # %d, named \"%s\" ---\n",
+ test_type == TEST_MAXERROR ? " max error" : "", test_num, test_name);
+}
+
+/* This is a builtin test of overall max error. */
void
-print_max_error (const char *func_name)
+check_max_error (const char *func_name)
{
int ok = 0;
+ int thisTest = noMaxErrorTests;
+
+ print_test_start (thisTest, func_name, TEST_MAXERROR);
if (max_error == 0.0 || (max_error <= prev_max_error && !ignore_max_ulp))
{
@@ -392,14 +425,19 @@ print_max_error (const char *func_name)
printf (" accepted: %s ulp\n", pmestr);
}
- update_stats (ok);
-}
+ update_stats (ok, TEST_MAXERROR);
+ print_test_end (thisTest, func_name, TEST_MAXERROR);
+}
+/* This is a builtin test of overall max error. */
void
-print_complex_max_error (const char *func_name)
+check_complex_max_error (const char *func_name)
{
int real_ok = 0, imag_ok = 0, ok;
+ int thisTest = noMaxErrorTests;
+
+ print_test_start (thisTest, func_name, TEST_MAXERROR);
if (real_max_error == 0
|| (real_max_error <= prev_real_max_error && !ignore_max_ulp))
@@ -436,7 +474,8 @@ print_complex_max_error (const char *func_name)
printf (" accepted: %s ulp\n", pimestr);
}
- update_stats (ok);
+ update_stats (ok, TEST_MAXERROR);
+ print_test_end (thisTest, func_name, TEST_MAXERROR);
}
@@ -477,12 +516,13 @@ test_single_exception (const char *test_name,
else
{
if (print_screen (1))
- printf ("%s: Exception \"%s\" not set\n", test_name,
+ printf ("Pass: %s: Exception \"%s\" not set\n", test_name,
flag_name);
}
}
if (!ok)
++noErrors;
+ ++noExcTests;
}
#endif
@@ -494,23 +534,32 @@ test_exceptions (const char *test_name, int exception)
{
if (flag_test_exceptions && EXCEPTION_TESTS (FLOAT))
{
- ++noExcTests;
+ int ran = 0;
#ifdef FE_DIVBYZERO
if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
- test_single_exception (test_name, exception,
- DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
- "Divide by zero");
+ {
+ test_single_exception (test_name, exception,
+ DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
+ "Divide by zero");
+ ran = 1;
+ }
#endif
#ifdef FE_INVALID
if ((exception & INVALID_EXCEPTION_OK) == 0)
- test_single_exception (test_name, exception,
- INVALID_EXCEPTION, FE_INVALID,
- "Invalid operation");
+ {
+ test_single_exception (test_name, exception,
+ INVALID_EXCEPTION, FE_INVALID,
+ "Invalid operation");
+ ran = 1;
+ }
#endif
#ifdef FE_OVERFLOW
if ((exception & OVERFLOW_EXCEPTION_OK) == 0)
- test_single_exception (test_name, exception, OVERFLOW_EXCEPTION,
- FE_OVERFLOW, "Overflow");
+ {
+ test_single_exception (test_name, exception, OVERFLOW_EXCEPTION,
+ FE_OVERFLOW, "Overflow");
+ ran = 1;
+ }
#endif
/* Spurious "underflow" and "inexact" exceptions are always
allowed for IBM long double, in line with the underlying
@@ -519,17 +568,30 @@ test_exceptions (const char *test_name, int exception)
if ((exception & UNDERFLOW_EXCEPTION_OK) == 0
&& !(test_ibm128
&& (exception & UNDERFLOW_EXCEPTION) == 0))
- test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION,
- FE_UNDERFLOW, "Underflow");
+ {
+ test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION,
+ FE_UNDERFLOW, "Underflow");
+ ran = 1;
+ }
+
#endif
#ifdef FE_INEXACT
if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0
&& !(test_ibm128
&& (exception & NO_INEXACT_EXCEPTION) != 0))
- test_single_exception (test_name, exception, INEXACT_EXCEPTION,
- FE_INEXACT, "Inexact");
+ {
+ test_single_exception (test_name, exception, INEXACT_EXCEPTION,
+ FE_INEXACT, "Inexact");
+ ran = 1;
+ }
#endif
+ assert (ran == 1);
}
+ else
+ {
+ if (print_screen (1))
+ printf ("Info: %s: No exceptions tested\n", test_name);
+ }
feclearexcept (FE_ALL_EXCEPT);
}
@@ -552,6 +614,7 @@ test_single_errno (const char *test_name, int errno_value,
printf ("Failure: %s: errno set to %d, expected %d (%s)\n",
test_name, errno_value, expected_value, expected_name);
}
+ ++noErrnoTests;
}
/* Test whether errno (value ERRNO_VALUE) has been for TEST_NAME set
@@ -561,13 +624,39 @@ test_errno (const char *test_name, int errno_value, int exceptions)
{
if (flag_test_errno)
{
- ++noErrnoTests;
+ int ran = 0;
+
+ if ((exceptions & (ERRNO_UNCHANGED|ERRNO_EDOM|ERRNO_ERANGE)) == 0)
+ {
+ if (print_screen (1))
+ printf ("Info: %s: The value of errno was not tested\n",
+ test_name);
+ return;
+ }
+
+
if (exceptions & ERRNO_UNCHANGED)
- test_single_errno (test_name, errno_value, 0, "unchanged");
+ {
+ test_single_errno (test_name, errno_value, 0, "unchanged");
+ ran = 1;
+ }
if (exceptions & ERRNO_EDOM)
- test_single_errno (test_name, errno_value, EDOM, "EDOM");
+ {
+ test_single_errno (test_name, errno_value, EDOM, "EDOM");
+ ran = 1;
+ }
if (exceptions & ERRNO_ERANGE)
- test_single_errno (test_name, errno_value, ERANGE, "ERANGE");
+ {
+ test_single_errno (test_name, errno_value, ERANGE, "ERANGE");
+ ran = 1;
+ }
+
+ assert (ran == 1);
+ }
+ else
+ {
+ if (print_screen (1))
+ printf ("Info: %s: No errno tests\n", test_name);
}
}
@@ -619,6 +708,9 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
FLOAT diff = 0;
FLOAT ulps = 0;
int errno_value = errno;
+ int thisTest = noTests;
+
+ print_test_start (thisTest, test_name, TEST_INPUT);
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
@@ -716,12 +808,13 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
printf (" max.ulp : %s\n", mustrn);
}
}
- update_stats (ok);
+ update_stats (ok, TEST_INPUT);
out:
fpstack_test (test_name);
feclearexcept (FE_ALL_EXCEPT);
errno = 0;
+ print_test_end (thisTest, test_name, TEST_INPUT);
}
@@ -776,12 +869,14 @@ check_int (const char *test_name, int computed, int expected,
{
int ok = 0;
int errno_value = errno;
+ int thisTest = noTests;
+
+ print_test_start (thisTest, test_name, TEST_INPUT);
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
if (exceptions & IGNORE_RESULT)
goto out;
- noTests++;
if (computed == expected)
ok = 1;
@@ -795,11 +890,12 @@ check_int (const char *test_name, int computed, int expected,
printf (" should be: %d\n", expected);
}
- update_stats (ok);
+ update_stats (ok, TEST_INPUT);
out:
fpstack_test (test_name);
feclearexcept (FE_ALL_EXCEPT);
errno = 0;
+ print_test_end (thisTest, test_name, TEST_INPUT);
}
@@ -810,12 +906,14 @@ check_long (const char *test_name, long int computed, long int expected,
{
int ok = 0;
int errno_value = errno;
+ int thisTest = noTests;
+
+ print_test_start (thisTest, test_name, TEST_INPUT);
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
if (exceptions & IGNORE_RESULT)
goto out;
- noTests++;
if (computed == expected)
ok = 1;
@@ -829,11 +927,12 @@ check_long (const char *test_name, long int computed, long int expected,
printf (" should be: %ld\n", expected);
}
- update_stats (ok);
+ update_stats (ok, TEST_INPUT);
out:
fpstack_test (test_name);
feclearexcept (FE_ALL_EXCEPT);
errno = 0;
+ print_test_end (thisTest, test_name, TEST_INPUT);
}
@@ -844,12 +943,14 @@ check_bool (const char *test_name, int computed, int expected,
{
int ok = 0;
int errno_value = errno;
+ int thisTest = noTests;
+
+ print_test_start (thisTest, test_name, TEST_INPUT);
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
if (exceptions & IGNORE_RESULT)
goto out;
- noTests++;
if ((computed == 0) == (expected == 0))
ok = 1;
@@ -863,11 +964,12 @@ check_bool (const char *test_name, int computed, int expected,
printf (" should be: %d\n", expected);
}
- update_stats (ok);
+ update_stats (ok, TEST_INPUT);
out:
fpstack_test (test_name);
feclearexcept (FE_ALL_EXCEPT);
errno = 0;
+ print_test_end (thisTest, test_name, TEST_INPUT);
}
@@ -879,12 +981,14 @@ check_longlong (const char *test_name, long long int computed,
{
int ok = 0;
int errno_value = errno;
+ int thisTest = noTests;
+
+ print_test_start (thisTest, test_name, TEST_INPUT);
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
if (exceptions & IGNORE_RESULT)
goto out;
- noTests++;
if (computed == expected)
ok = 1;
@@ -898,11 +1002,12 @@ check_longlong (const char *test_name, long long int computed,
printf (" should be: %lld\n", expected);
}
- update_stats (ok);
+ update_stats (ok, TEST_INPUT);
out:
fpstack_test (test_name);
feclearexcept (FE_ALL_EXCEPT);
errno = 0;
+ print_test_end (thisTest, test_name, TEST_INPUT);
}
@@ -913,12 +1018,14 @@ check_intmax_t (const char *test_name, intmax_t computed,
{
int ok = 0;
int errno_value = errno;
+ int thisTest = noTests;
+
+ print_test_start (thisTest, test_name, TEST_INPUT);
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
if (exceptions & IGNORE_RESULT)
goto out;
- noTests++;
if (computed == expected)
ok = 1;
@@ -932,11 +1039,12 @@ check_intmax_t (const char *test_name, intmax_t computed,
printf (" should be: %jd\n", expected);
}
- update_stats (ok);
+ update_stats (ok, TEST_INPUT);
out:
fpstack_test (test_name);
feclearexcept (FE_ALL_EXCEPT);
errno = 0;
+ print_test_end (thisTest, test_name, TEST_INPUT);
}
@@ -947,12 +1055,14 @@ check_uintmax_t (const char *test_name, uintmax_t computed,
{
int ok = 0;
int errno_value = errno;
+ int thisTest = noTests;
+
+ print_test_start (thisTest, test_name, TEST_INPUT);
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
if (exceptions & IGNORE_RESULT)
goto out;
- noTests++;
if (computed == expected)
ok = 1;
@@ -966,11 +1076,12 @@ check_uintmax_t (const char *test_name, uintmax_t computed,
printf (" should be: %ju\n", expected);
}
- update_stats (ok);
+ update_stats (ok, TEST_INPUT);
out:
fpstack_test (test_name);
feclearexcept (FE_ALL_EXCEPT);
errno = 0;
+ print_test_end (thisTest, test_name, TEST_INPUT);
}
/* Return whether a test with flags EXCEPTIONS should be run. */
@@ -1211,9 +1322,11 @@ libm_test_finish (void)
fclose (ulps_file);
printf ("\nTest suite completed:\n");
- printf (" %d test cases plus %d tests for exception flags and\n"
- " %d tests for errno executed.\n",
- noTests, noExcTests, noErrnoTests);
+ printf (" %d max error test cases,\n", noMaxErrorTests);
+ printf (" %d input tests,\n", noTests);
+ printf (" - with %d tests for exception flags,\n", noExcTests);
+ printf (" - with %d tests for errno executed.\n", noErrnoTests);
+
if (noErrors)
{
printf (" %d errors occurred.\n", noErrors);
diff --git a/math/libm-test-support.h b/math/libm-test-support.h
index 8baf7e1817157b2a..efb9523e9e91f64f 100644
--- a/math/libm-test-support.h
+++ b/math/libm-test-support.h
@@ -170,8 +170,8 @@ extern const char doc[];
int enable_test (int);
void init_max_error (const char *, int, int);
-void print_max_error (const char *);
-void print_complex_max_error (const char *);
+void check_max_error (const char *);
+void check_complex_max_error (const char *);
void check_float (const char *, FLOAT, FLOAT, int);
void check_complex (const char *, CFLOAT, CFLOAT, int);
void check_int (const char *, int, int, int);

151
glibc-RHEL-106562-20.patch Normal file
View File

@ -0,0 +1,151 @@
commit a9017caff3b77032d04e2e439f7c04a63241e63e
Author: Sergey Kolosov <skolosov@redhat.com>
Date: Tue Jan 28 23:56:26 2025 +0100
nptl: extend test coverage for sched_yield
We add sched_yield() API testing to the existing thread affinity
test case because it allows us to test sched_yield() operation
in the following scenarios:
* On a main thread.
* On multiple threads simultaneously.
* On every CPU the system reports simultaneously.
The ensures we exercise sched_yield() in as many scenarios as
we would exercise calls to the affinity functions.
Additionally, the test is improved by adding a semaphore to coordinate
all the threads running, so that an early starter thread won't consume
cpu resources that could be used to start the other threads.
Co-authored-by: DJ Delorie <dj@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c b/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c
index 2f921ed397a1a4d9..7276fd8fef06d620 100644
--- a/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c
+++ b/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c
@@ -38,6 +38,7 @@
#include <sched.h>
#include <stdbool.h>
#include <stdio.h>
+#include <support/test-driver.h>
/* CPU set configuration determined. Can be used from early_test. */
struct conf
@@ -253,12 +254,12 @@ do_test (void)
if (getaffinity (sizeof (set), &set) < 0 && errno == ENOSYS)
{
puts ("warning: getaffinity not supported, test cannot run");
- return 0;
+ return EXIT_UNSUPPORTED;
}
if (sched_getcpu () < 0 && errno == ENOSYS)
{
puts ("warning: sched_getcpu not supported, test cannot run");
- return 0;
+ return EXIT_UNSUPPORTED;
}
}
diff --git a/sysdeps/unix/sysv/linux/tst-skeleton-thread-affinity.c b/sysdeps/unix/sysv/linux/tst-skeleton-thread-affinity.c
index 5a1e84431a30132d..507c5c94ba89e47b 100644
--- a/sysdeps/unix/sysv/linux/tst-skeleton-thread-affinity.c
+++ b/sysdeps/unix/sysv/linux/tst-skeleton-thread-affinity.c
@@ -45,10 +45,14 @@ static int still_running;
/* 0 if no scheduling failures, 1 if failures are encountered. */
static int failed;
+/* Used to synchronize the threads. */
+static pthread_barrier_t barrier;
+
static void *
thread_burn_one_cpu (void *closure)
{
int cpu = (uintptr_t) closure;
+ xpthread_barrier_wait (&barrier);
while (__atomic_load_n (&still_running, __ATOMIC_RELAXED) == 0)
{
int current = sched_getcpu ();
@@ -61,6 +65,11 @@ thread_burn_one_cpu (void *closure)
__atomic_store_n (&still_running, 1, __ATOMIC_RELAXED);
}
}
+ if (sched_yield () != 0)
+ {
+ printf ("error: sched_yield() failed for cpu %d\n", cpu);
+ __atomic_store_n (&failed, 1, __ATOMIC_RELAXED);
+ }
return NULL;
}
@@ -78,6 +87,7 @@ thread_burn_any_cpu (void *closure)
{
struct burn_thread *param = closure;
+ xpthread_barrier_wait (&barrier);
/* Schedule this thread around a bit to see if it lands on another
CPU. Run this for 2 seconds, once with sched_yield, once
without. */
@@ -99,7 +109,11 @@ thread_burn_any_cpu (void *closure)
CPU_SET_S (cpu, CPU_ALLOC_SIZE (param->conf->set_size),
param->seen_set);
if (pass == 1)
- sched_yield ();
+ if (sched_yield () != 0)
+ {
+ printf ("error: sched_yield() failed for cpu %d\n", cpu);
+ __atomic_store_n (&failed, 1, __ATOMIC_RELAXED);
+ }
}
}
return NULL;
@@ -156,6 +170,7 @@ early_test (struct conf *conf)
= calloc (conf->last_cpu + 1, sizeof (*other_threads));
cpu_set_t *initial_set = CPU_ALLOC (conf->set_size);
cpu_set_t *scratch_set = CPU_ALLOC (conf->set_size);
+ int num_available_cpus = 0;
if (pinned_threads == NULL || other_threads == NULL
|| initial_set == NULL || scratch_set == NULL)
@@ -172,6 +187,7 @@ early_test (struct conf *conf)
{
if (!CPU_ISSET_S (cpu, CPU_ALLOC_SIZE (conf->set_size), initial_set))
continue;
+ num_available_cpus ++;
other_threads[cpu].conf = conf;
other_threads[cpu].initial_set = initial_set;
other_threads[cpu].thread = cpu;
@@ -194,6 +210,15 @@ early_test (struct conf *conf)
}
support_set_small_thread_stack_size (&attr);
+ /* This count assumes that all the threads below are created
+ successfully, and call pthread_barrier_wait(). If any threads
+ fail to be created, this function will return FALSE (failure) and
+ the waiting threads will eventually time out the whole test.
+ This is acceptable because we're not testing thread creation and
+ assume all threads will be created, and failure here implies a
+ failure outside the test's scope. */
+ xpthread_barrier_init (&barrier, NULL, num_available_cpus * 2 + 1);
+
/* Spawn a thread pinned to each available CPU. */
for (int cpu = 0; cpu <= conf->last_cpu; ++cpu)
{
@@ -245,6 +270,15 @@ early_test (struct conf *conf)
}
}
+ /* Test that sched_yield() works correctly in the main thread. This
+ also gives the kernel an opportunity to run the other threads,
+ randomizing thread startup a bit. */
+ if (sched_yield () != 0)
+ {
+ printf ("error: sched_yield() failed for main thread\n");
+ __atomic_store_n (&failed, 1, __ATOMIC_RELAXED);
+ }
+
/* Main thread. */
struct burn_thread main_thread;
main_thread.conf = conf;

View File

@ -0,0 +1,62 @@
commit 10af00f7a135c85796a9c4c75228358b8898da5c
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Fri Mar 14 10:18:21 2025 -0400
tst-fopen-threaded: Only check EOF for failing read
The fread race checker looks for EOF in every thread, which is incorrect
since threads calling fread successfully could lag behind and read the
EOF condition, resulting in multiple threads thinking that they
encountered an EOF.
Only look for EOF condition if fread fails to read a char. Also drop
the clearerr() since it could mask the failure of another reader, thus
hiding a test failure.
Finally, also check for error in the stream for completeness.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/sysdeps/pthread/tst-fopen-threaded.c b/sysdeps/pthread/tst-fopen-threaded.c
index 5c792c93e3711621..ade58ad19eb209d1 100644
--- a/sysdeps/pthread/tst-fopen-threaded.c
+++ b/sysdeps/pthread/tst-fopen-threaded.c
@@ -64,19 +64,27 @@ threadReadRoutine (void *argv)
/* Wait for all threads to be ready to read. */
xpthread_barrier_wait (&barrier);
- ret =
- fread (&read_buffer, sizeof (char), sizeof (read_buffer), my_data->fd);
- if (feof (my_data->fd) != 0)
+ ret = fread (&read_buffer, 1, sizeof (read_buffer), my_data->fd);
+ /* If no data is returned (we read only 1 byte, so there's no short read
+ situation here), look for EOF flag and record it in MY_DATA. The EOF flag
+ is not cleared because that could result in a test failure being masked
+ when two threads fail to read and one of them clears error/EOF flags
+ before the second one has the chance to observe it.
+
+ Successful readers could still see the EOF if they fall behind the failing
+ read when calling feof(), which could result in a false test failure. To
+ avoid this race, we only make the failing reader check for EOF or
+ error. */
+ if (ret == 0)
{
- clearerr (my_data->fd);
- my_data->eof = true;
+ if (feof (my_data->fd) != 0)
+ my_data->eof = true;
+ else
+ FAIL_EXIT1 ("fread failed (ferror: %d): %m", ferror (my_data->fd));
}
else
- {
- TEST_COMPARE (ret, 1);
- /* Save the read value. */
- my_data->value = read_buffer;
- }
+ /* Save the read value. */
+ my_data->value = read_buffer;
TEST_COMPARE (ferror (my_data->fd), 0);
return NULL;
}

121
glibc-RHEL-106562-22.patch Normal file
View File

@ -0,0 +1,121 @@
commit 81e74c8676479811601b5894d72bb3d7e05f68dd
Author: DJ Delorie <dj@redhat.com>
Date: Fri Mar 14 16:08:12 2025 -0400
add ptmx support to test-container
diff --git a/support/Makefile b/support/Makefile
index 6e3c55394fa212b6..23ce2ccec89743bb 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -313,6 +313,7 @@ tests = \
README-testing \
tst-support-namespace \
tst-support-open-dev-null-range \
+ tst-support-openpty \
tst-support-process_state \
tst-support_blob_repeat \
tst-support_capture_subprocess \
@@ -331,6 +332,10 @@ tests = \
tst-xsigstack \
# tests
+tests-container = \
+ tst-support-openpty-c \
+ # tests-container
+
ifeq ($(run-built-tests),yes)
tests-special = \
$(objpfx)tst-support_record_failure-2.out
diff --git a/support/test-container.c b/support/test-container.c
index adf2b30215273936..1696d676fd101d42 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -1148,6 +1148,9 @@ main (int argc, char **argv)
devmount (new_root_path, "null");
devmount (new_root_path, "zero");
devmount (new_root_path, "urandom");
+#ifdef __linux__
+ devmount (new_root_path, "ptmx");
+#endif
/* We're done with the "old" root, switch to the new one. */
if (chroot (new_root_path) < 0)
@@ -1214,6 +1217,14 @@ main (int argc, char **argv)
maybe_xmkdir ("/tmp", 0755);
+#ifdef __linux__
+ maybe_xmkdir ("/dev/pts", 0777);
+ if (mount ("/dev/pts", "/dev/pts", "devpts", 0, "newinstance,ptmxmode=0666,mode=0666") < 0)
+ FAIL_EXIT1 ("can't mount /dev/pts: %m\n");
+ if (mount ("/dev/pts/ptmx", "/dev/ptmx", "", MS_BIND | MS_REC, NULL) < 0)
+ FAIL_EXIT1 ("can't mount /dev/ptmx\n");
+#endif
+
if (require_pidns)
{
/* Now that we're pid 1 (effectively "root") we can mount /proc */
diff --git a/support/tst-support-openpty-c.c b/support/tst-support-openpty-c.c
new file mode 100644
index 0000000000000000..0a6a428fc3cd3400
--- /dev/null
+++ b/support/tst-support-openpty-c.c
@@ -0,0 +1,2 @@
+/* Same test, but in a test-container. */
+#include "tst-support-openpty.c"
diff --git a/support/tst-support-openpty.c b/support/tst-support-openpty.c
new file mode 100644
index 0000000000000000..1222d7018f9b224f
--- /dev/null
+++ b/support/tst-support-openpty.c
@@ -0,0 +1,49 @@
+/* Basic test for support_openpty support in test-container.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <termios.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+
+#include <support/tty.h>
+#include <support/check.h>
+#include <support/support.h>
+
+/* Note: the purpose of this test isn't to test if ptys function
+ correctly, but only to verify that test-container's support for
+ them is correct. The many checks in support_openpty.c are
+ sufficient for this. */
+
+int
+do_test (void)
+{
+ int outer, inner;
+ char *name;
+ struct termios term;
+ struct winsize win;
+
+ cfmakeraw (&term);
+ win.ws_row = 24;
+ win.ws_col = 80;
+
+ support_openpty (&outer, &inner, &name, &term, &win);
+
+ return 0;
+}
+
+#include <support/test-driver.c>

1084
glibc-RHEL-106562-23.patch Normal file

File diff suppressed because it is too large Load Diff

112
glibc-RHEL-106562-24.patch Normal file
View File

@ -0,0 +1,112 @@
commit 4fa959d13d21b8f56a43aa0a416100303736c55c
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Apr 8 10:39:44 2025 +0200
stdio-common: In tst-setvbuf2, close helper thread descriptor only if opened
The helper thread may get canceled before the open system
call succeds. Then ThreadData.fd remains zero, and eventually
the xclose call in end_reader_thread fails because descriptor 0
is not open.
Instead, initialize the fd member to -1 (not a valid descriptor)
and close the descriptor only if valid. Do this in a new end_thread
helper routine.
Also add more error checking to close operations.
Fixes commit 95b780c1d0549678c0a244c6e2112ec97edf0839 ("stdio: Add
more setvbuf tests").
diff --git a/stdio-common/tst-setvbuf2.c b/stdio-common/tst-setvbuf2.c
index 6cc83355f391afab..84d8b43a5811b4be 100644
--- a/stdio-common/tst-setvbuf2.c
+++ b/stdio-common/tst-setvbuf2.c
@@ -240,6 +240,21 @@ typedef struct {
/* It's OK if this is static, we only run one at a time. */
ThreadData thread_data;
+static void
+end_thread (pthread_t *ptid)
+{
+ if (*ptid)
+ {
+ pthread_cancel (*ptid);
+ xpthread_join (*ptid);
+ /* The descriptor was passed in, or the helper thread made
+ sufficient progress and opened the file. */
+ if (thread_data.fd >= 0)
+ xclose (thread_data.fd);
+ *ptid = 0;
+ }
+}
+
static void *
writer_thread_proc (void *closure)
{
@@ -306,7 +321,7 @@ static void
start_writer_thread_n (const char *fname)
{
debug;
- thread_data.fd = 0;
+ thread_data.fd = -1;
thread_data.fname = fname;
writer_thread_tid = xpthread_create (NULL, writer_thread_proc,
(void *)&thread_data);
@@ -316,13 +331,7 @@ static void
end_writer_thread (void)
{
debug;
- if (writer_thread_tid)
- {
- pthread_cancel (writer_thread_tid);
- xpthread_join (writer_thread_tid);
- xclose (thread_data.fd);
- writer_thread_tid = 0;
- }
+ end_thread (&writer_thread_tid);
}
static void
@@ -339,7 +348,7 @@ static void
start_reader_thread_n (const char *fname)
{
debug;
- thread_data.fd = 0;
+ thread_data.fd = -1;
thread_data.fname = fname;
reader_thread_tid = xpthread_create (NULL, reader_thread_proc,
(void *)&thread_data);
@@ -349,13 +358,7 @@ static void
end_reader_thread (void)
{
debug;
- if (reader_thread_tid)
- {
- pthread_cancel (reader_thread_tid);
- xpthread_join (reader_thread_tid);
- xclose (thread_data.fd);
- reader_thread_tid = 0;
- }
+ end_thread (&reader_thread_tid);
}
/*------------------------------------------------------------*/
@@ -852,7 +855,7 @@ do_second_part (FILE *fp,
}
- fclose (fp);
+ xfclose (fp);
return rv;
}
@@ -939,7 +942,7 @@ recurse (FILE *fp,
break;
default: /* parent */
- fclose (fp);
+ xfclose (fp);
xwaitpid (pid, &status, 0);
if (WIFEXITED (status)
&& WEXITSTATUS (status) == 0)

60
glibc-RHEL-106562-3.patch Normal file
View File

@ -0,0 +1,60 @@
commit 3f54e459a633b4247be91b9d0f68a7e08720b8d8
Author: Frédéric Bérat <fberat@redhat.com>
Date: Tue Aug 13 12:01:26 2024 +0200
libio/tst-getdelim: Add new test covering NUL as a delimiter
Add a new test to getdelim to verify that '\0' can be set as a
delimiter.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/libio/tst-getdelim.c b/libio/tst-getdelim.c
index e6dd964b4918b02a..db15bf92855ee9e1 100644
--- a/libio/tst-getdelim.c
+++ b/libio/tst-getdelim.c
@@ -1,4 +1,6 @@
-/* Check that getdelim sets error indicator on error (BZ #29917)
+/* Test getdelim conforming to POSIX specifications.
+
+ Note: Most getdelim use cases are covered by stdio-common/tst-getline.
Copyright (C) 2023-2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -18,18 +20,36 @@
<https://www.gnu.org/licenses/>. */
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#include <support/check.h>
+#include <support/support.h>
+#include <support/test-driver.h>
static int
do_test (void)
{
+ /* Check that getdelim sets error indicator on error (BZ #29917) */
clearerr (stdin);
TEST_VERIFY (getdelim (0, 0, '\n', stdin) == -1);
TEST_VERIFY (ferror (stdin) != 0);
TEST_VERIFY (errno == EINVAL);
+ /* Test getdelim with NUL as delimiter */
+ verbose_printf ("Testing NUL delimiter\n");
+ char *lineptr = NULL;
+ size_t linelen = 0;
+ char membuf[] = "abc\0d\nef\0";
+ FILE *memstream = fmemopen (membuf, sizeof (membuf), "r");
+ TEST_VERIFY_EXIT (memstream != NULL);
+ TEST_VERIFY (getdelim (&lineptr, &linelen, '\0', memstream) != -1);
+ TEST_COMPARE_BLOB (lineptr, 4, "abc\0", 4);
+ TEST_VERIFY (getdelim (&lineptr, &linelen, '\0', memstream) != -1);
+ TEST_COMPARE_BLOB (lineptr, 5, "d\nef\0", 5);
+ fclose (memstream);
+ free (lineptr);
+
return 0;
}

29
glibc-RHEL-106562-4.patch Normal file
View File

@ -0,0 +1,29 @@
commit b22923abb046311ac9097a36b97b9b97342bac44
Author: Carlos O'Donell <carlos@redhat.com>
Date: Thu Aug 15 08:12:35 2024 -0400
Report error if setaffinity wrapper fails (Bug 32040)
Previously if the setaffinity wrapper failed the rest of the subtest
would not execute and the current subtest would be reported as passing.
Now if the setaffinity wrapper fails the subtest is correctly reported
as faling. Tested manually by changing the conditions of the affinity
call including setting size to zero, or checking the wrong condition.
No regressions on x86_64.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c b/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c
index 31a15b3ad789a287..2f921ed397a1a4d9 100644
--- a/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c
+++ b/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c
@@ -157,7 +157,7 @@ test_size (const struct conf *conf, size_t size)
if (setaffinity (kernel_size, initial_set) < 0)
{
printf ("error: size %zu: setaffinity: %m\n", size);
- return true;
+ return false;
}
/* Use one-CPU set to test switching between CPUs. */

78
glibc-RHEL-106562-5.patch Normal file
View File

@ -0,0 +1,78 @@
commit 921690512946d73bf66a8c495baff31316e4489f
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Aug 16 16:05:19 2024 +0200
support: Add the xstatx function
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/support/Makefile b/support/Makefile
index aa57207bdccc852d..5b1c96a49e9410f4 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -210,6 +210,7 @@ libsupport-routines = \
xsignal \
xsigstack \
xsocket \
+ xstatx \
xstrdup \
xstrndup \
xsymlink \
diff --git a/support/xstatx.c b/support/xstatx.c
new file mode 100644
index 0000000000000000..621f2440f83b598d
--- /dev/null
+++ b/support/xstatx.c
@@ -0,0 +1,32 @@
+/* Error-checking wrapper for statx.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xunistd.h>
+
+#include <fcntl.h>
+#include <support/check.h>
+#include <sys/stat.h>
+
+void
+xstatx (int fd, const char *path, int flags, unsigned int mask,
+ struct statx *stx)
+{
+ if (statx (fd, path, flags, mask, stx) != 0)
+ FAIL_EXIT1 ("statx (AT_FDCWD, \"%s\", 0x%x, 0x%x): %m",
+ path, (unsigned int) flags, mask);
+}
diff --git a/support/xunistd.h b/support/xunistd.h
index 13be9a46a3e6b07b..cc74c4fad07dd088 100644
--- a/support/xunistd.h
+++ b/support/xunistd.h
@@ -30,6 +30,7 @@
__BEGIN_DECLS
struct stat64;
+struct statx;
pid_t xfork (void);
pid_t xwaitpid (pid_t, int *status, int flags);
@@ -51,6 +52,7 @@ void __REDIRECT (xstat, (const char *path, struct stat *), xstat_time64);
void __REDIRECT (xlstat, (const char *path, struct stat *), xlstat_time64);
void __REDIRECT (xfstat, (int fd, struct stat *), xfstat_time64);
#endif
+void xstatx (int, const char *, int, unsigned int, struct statx *);
void xmkdir (const char *path, mode_t);
void xchroot (const char *path);
void xunlink (const char *path);

391
glibc-RHEL-106562-6.patch Normal file
View File

@ -0,0 +1,391 @@
commit bf2927484152e12996af60ea439cf94b66fcd81d
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Aug 16 16:05:20 2024 +0200
io: Use struct statx and xstatx in tests
This avoids the need to define struct_statx to an appropriate
struct stat type variant because struct statx does not change
based on time/file offset flags.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/io/tst-futimens-time64.c b/io/tst-futimens-time64.c
index 88fcb38489b160de..71204a6166eaba56 100644
--- a/io/tst-futimens-time64.c
+++ b/io/tst-futimens-time64.c
@@ -1,2 +1 @@
-#define struct_stat struct stat
#include "tst-futimens.c"
diff --git a/io/tst-futimens.c b/io/tst-futimens.c
index 6204befedd869bb6..075ca42b9378d98f 100644
--- a/io/tst-futimens.c
+++ b/io/tst-futimens.c
@@ -18,26 +18,23 @@
#include <support/check.h>
#include <support/xunistd.h>
+#include <fcntl.h>
#include <sys/stat.h>
-#ifndef struct_stat
-# define struct_stat struct stat64
-#endif
-
static int
test_futimens_helper (const char *file, int fd, const struct timespec *ts)
{
int result = futimens (fd, ts);
TEST_VERIFY_EXIT (result == 0);
- struct_stat st;
- xfstat (fd, &st);
+ struct statx st;
+ xstatx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &st);
/* Check if seconds for atime match */
- TEST_COMPARE (st.st_atime, ts[0].tv_sec);
+ TEST_COMPARE (st.stx_atime.tv_sec, ts[0].tv_sec);
/* Check if seconds for mtime match */
- TEST_COMPARE (st.st_mtime, ts[1].tv_sec);
+ TEST_COMPARE (st.stx_mtime.tv_sec, ts[1].tv_sec);
return 0;
}
diff --git a/io/tst-futimes-time64.c b/io/tst-futimes-time64.c
index d489c265d1964196..eeb4bed7c4f5fb12 100644
--- a/io/tst-futimes-time64.c
+++ b/io/tst-futimes-time64.c
@@ -1,2 +1 @@
-#define struct_stat struct stat
#include "tst-futimes.c"
diff --git a/io/tst-futimes.c b/io/tst-futimes.c
index d21acf6a24715a10..612fe460cf505547 100644
--- a/io/tst-futimes.c
+++ b/io/tst-futimes.c
@@ -18,27 +18,24 @@
#include <support/check.h>
#include <support/xunistd.h>
+#include <fcntl.h>
#include <sys/stat.h>
#include <sys/time.h>
-#ifndef struct_stat
-# define struct_stat struct stat64
-#endif
-
static int
test_futimens_helper (const char *file, int fd, const struct timeval *tv)
{
int r = futimes (fd, tv);
TEST_VERIFY_EXIT (r == 0);
- struct_stat st;
- xfstat (fd, &st);
+ struct statx st;
+ xstatx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &st);
/* Check if seconds for atime match */
- TEST_COMPARE (st.st_atime, tv[0].tv_sec);
+ TEST_COMPARE (st.stx_atime.tv_sec, tv[0].tv_sec);
/* Check if seconds for mtime match */
- TEST_COMPARE (st.st_mtime, tv[1].tv_sec);
+ TEST_COMPARE (st.stx_mtime.tv_sec, tv[1].tv_sec);
return 0;
}
diff --git a/io/tst-futimesat-time64.c b/io/tst-futimesat-time64.c
index f6c0500eefb9c98b..15853175796e59dd 100644
--- a/io/tst-futimesat-time64.c
+++ b/io/tst-futimesat-time64.c
@@ -1,4 +1 @@
-#define struct_stat struct stat
-#define fstat fstat
-#define fstatat fstatat
#include "io/tst-futimesat.c"
diff --git a/io/tst-futimesat.c b/io/tst-futimesat.c
index 67a8551bebf23190..feae4e7aa76ddee7 100644
--- a/io/tst-futimesat.c
+++ b/io/tst-futimesat.c
@@ -30,12 +30,6 @@
#include <support/temp_file.h>
#include <support/xunistd.h>
-#ifndef struct_stat
-# define struct_stat struct stat64
-# define fstat fstat64
-# define fstatat fstatat64
-#endif
-
static int dir_fd;
static void
@@ -118,19 +112,15 @@ do_test (void)
xwrite (fd, "hello", 5);
puts ("file created");
- struct_stat st1;
- if (fstat (fd, &st1) != 0)
- {
- puts ("fstat64 failed");
- return 1;
- }
+ struct statx st1;
+ xstatx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &st1);
close (fd);
struct timeval tv[2];
- tv[0].tv_sec = st1.st_atime + 1;
+ tv[0].tv_sec = st1.stx_atime.tv_sec + 1;
tv[0].tv_usec = 0;
- tv[1].tv_sec = st1.st_mtime + 1;
+ tv[1].tv_sec = st1.stx_mtime.tv_sec + 1;
tv[1].tv_usec = 0;
if (futimesat (dir_fd, "some-file", tv) != 0)
{
@@ -138,16 +128,12 @@ do_test (void)
return 1;
}
- struct_stat st2;
- if (fstatat (dir_fd, "some-file", &st2, 0) != 0)
- {
- puts ("fstatat64 failed");
- return 1;
- }
+ struct statx st2;
+ xstatx (dir_fd, "some-file", 0, STATX_BASIC_STATS, &st2);
- if (st2.st_mtime != tv[1].tv_sec
+ if (st2.stx_mtime.tv_sec != tv[1].tv_sec
#ifdef _STATBUF_ST_NSEC
- || st2.st_mtim.tv_nsec != 0
+ || st2.stx_mtime.tv_nsec != 0
#endif
)
{
diff --git a/io/tst-lutimes-time64.c b/io/tst-lutimes-time64.c
index 06caec0a91d91b6c..c5bea965dabe6cd7 100644
--- a/io/tst-lutimes-time64.c
+++ b/io/tst-lutimes-time64.c
@@ -1,2 +1 @@
-#define struct_stat struct stat
#include "tst-lutimes.c"
diff --git a/io/tst-lutimes.c b/io/tst-lutimes.c
index edef5ab90e8681c7..78bcc58291fdcdc8 100644
--- a/io/tst-lutimes.c
+++ b/io/tst-lutimes.c
@@ -18,34 +18,32 @@
#include <support/check.h>
#include <support/xunistd.h>
+#include <fcntl.h>
#include <sys/stat.h>
#include <sys/time.h>
-#ifndef struct_stat
-# define struct_stat struct stat64
-#endif
-
static int
test_lutimes_helper (const char *testfile, int fd, const char *testlink,
const struct timeval *tv)
{
- struct_stat stfile_orig;
- xlstat (testfile, &stfile_orig);
+ struct statx stfile_orig;
+ xstatx (AT_FDCWD, testfile, AT_SYMLINK_NOFOLLOW, STATX_BASIC_STATS,
+ &stfile_orig);
TEST_VERIFY_EXIT (lutimes (testlink, tv) == 0);
- struct_stat stlink;
- xlstat (testlink, &stlink);
+ struct statx stlink;
+ xstatx (AT_FDCWD, testlink, AT_SYMLINK_NOFOLLOW, STATX_BASIC_STATS, &stlink);
- TEST_COMPARE (stlink.st_atime, tv[0].tv_sec);
- TEST_COMPARE (stlink.st_mtime, tv[1].tv_sec);
+ TEST_COMPARE (stlink.stx_atime.tv_sec, tv[0].tv_sec);
+ TEST_COMPARE (stlink.stx_mtime.tv_sec, tv[1].tv_sec);
/* Check if the timestamp from original file is not changed. */
- struct_stat stfile;
- xlstat (testfile, &stfile);
+ struct statx stfile;
+ xstatx (AT_FDCWD, testfile, AT_SYMLINK_NOFOLLOW, STATX_BASIC_STATS, &stfile);
- TEST_COMPARE (stfile_orig.st_atime, stfile.st_atime);
- TEST_COMPARE (stfile_orig.st_mtime, stfile.st_mtime);
+ TEST_COMPARE (stfile_orig.stx_atime.tv_sec, stfile.stx_atime.tv_sec);
+ TEST_COMPARE (stfile_orig.stx_mtime.tv_sec, stfile.stx_mtime.tv_sec);
return 0;
}
diff --git a/io/tst-utime-time64.c b/io/tst-utime-time64.c
index eb62f59126564896..8894592a1570a366 100644
--- a/io/tst-utime-time64.c
+++ b/io/tst-utime-time64.c
@@ -1,2 +1 @@
-#define struct_stat struct stat
#include "tst-utime.c"
diff --git a/io/tst-utime.c b/io/tst-utime.c
index e2e6dcd04cebb7fc..f32935828923a47f 100644
--- a/io/tst-utime.c
+++ b/io/tst-utime.c
@@ -19,26 +19,23 @@
#include <utime.h>
#include <support/check.h>
#include <support/xunistd.h>
+#include <fcntl.h>
#include <sys/stat.h>
-#ifndef struct_stat
-# define struct_stat struct stat64
-#endif
-
static int
test_utime_helper (const char *file, int fd, const struct utimbuf *ut)
{
int result = utime (file, ut);
TEST_VERIFY_EXIT (result == 0);
- struct_stat st;
- xfstat (fd, &st);
+ struct statx st;
+ xstatx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &st);
/* Check if seconds for actime match */
- TEST_COMPARE (st.st_atime, ut->actime);
+ TEST_COMPARE (st.stx_atime.tv_sec, ut->actime);
/* Check if seconds for modtime match */
- TEST_COMPARE (st.st_mtime, ut->modtime);
+ TEST_COMPARE (st.stx_mtime.tv_sec, ut->modtime);
return 0;
}
diff --git a/io/tst-utimensat-time64.c b/io/tst-utimensat-time64.c
index 7ac7d8df1d48f0a0..5d60fce8818f7545 100644
--- a/io/tst-utimensat-time64.c
+++ b/io/tst-utimensat-time64.c
@@ -1,2 +1 @@
-#define struct_stat struct stat
#include "tst-utimensat.c"
diff --git a/io/tst-utimensat.c b/io/tst-utimensat.c
index 3d9a72c4719cc6c9..2a756d7b07b6b07f 100644
--- a/io/tst-utimensat.c
+++ b/io/tst-utimensat.c
@@ -22,10 +22,6 @@
#include <sys/stat.h>
#include <sys/time.h>
-#ifndef struct_stat
-# define struct_stat struct stat64
-#endif
-
static int
test_utimesat_helper (const char *testfile, int fd, const char *testlink,
const struct timespec *ts)
@@ -33,35 +29,38 @@ test_utimesat_helper (const char *testfile, int fd, const char *testlink,
{
TEST_VERIFY_EXIT (utimensat (fd, testfile, ts, 0) == 0);
- struct_stat st;
- xfstat (fd, &st);
+ struct statx st;
+ xstatx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &st);
/* Check if seconds for atime match */
- TEST_COMPARE (st.st_atime, ts[0].tv_sec);
+ TEST_COMPARE (st.stx_atime.tv_sec, ts[0].tv_sec);
/* Check if seconds for mtime match */
- TEST_COMPARE (st.st_mtime, ts[1].tv_sec);
+ TEST_COMPARE (st.stx_mtime.tv_sec, ts[1].tv_sec);
}
{
- struct_stat stfile_orig;
- xlstat (testfile, &stfile_orig);
+ struct statx stfile_orig;
+ xstatx (AT_FDCWD, testfile, AT_SYMLINK_NOFOLLOW, STATX_BASIC_STATS,
+ &stfile_orig);
TEST_VERIFY_EXIT (utimensat (0 /* ignored */, testlink, ts,
AT_SYMLINK_NOFOLLOW)
== 0);
- struct_stat stlink;
- xlstat (testlink, &stlink);
+ struct statx stlink;
+ xstatx (AT_FDCWD, testlink, AT_SYMLINK_NOFOLLOW, STATX_BASIC_STATS,
+ &stlink);
- TEST_COMPARE (stlink.st_atime, ts[0].tv_sec);
- TEST_COMPARE (stlink.st_mtime, ts[1].tv_sec);
+ TEST_COMPARE (stlink.stx_atime.tv_sec, ts[0].tv_sec);
+ TEST_COMPARE (stlink.stx_mtime.tv_sec, ts[1].tv_sec);
/* Check if the timestamp from original file is not changed. */
- struct_stat stfile;
- xlstat (testfile, &stfile);
+ struct statx stfile;
+ xstatx (AT_FDCWD, testfile, AT_SYMLINK_NOFOLLOW, STATX_BASIC_STATS,
+ &stfile);
- TEST_COMPARE (stfile_orig.st_atime, stfile.st_atime);
- TEST_COMPARE (stfile_orig.st_mtime, stfile.st_mtime);
+ TEST_COMPARE (stfile_orig.stx_atime.tv_sec, stfile.stx_atime.tv_sec);
+ TEST_COMPARE (stfile_orig.stx_mtime.tv_sec, stfile.stx_mtime.tv_sec);
}
return 0;
diff --git a/io/tst-utimes-time64.c b/io/tst-utimes-time64.c
index 234ec02541032017..026ef5f78dd4616c 100644
--- a/io/tst-utimes-time64.c
+++ b/io/tst-utimes-time64.c
@@ -1,2 +1 @@
-#define struct_stat struct stat
#include "tst-utimes.c"
diff --git a/io/tst-utimes.c b/io/tst-utimes.c
index 8edcfabebfbd978d..6cd436c5a0f94d84 100644
--- a/io/tst-utimes.c
+++ b/io/tst-utimes.c
@@ -18,28 +18,25 @@
#include <support/check.h>
#include <support/xunistd.h>
+#include <fcntl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
-#ifndef struct_stat
-# define struct_stat struct stat64
-#endif
-
static int
test_utimes_helper (const char *file, int fd, const struct timeval *tv)
{
int result = utimes (file, tv);
TEST_VERIFY_EXIT (result == 0);
- struct_stat st;
- xfstat (fd, &st);
+ struct statx st;
+ xstatx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &st);
/* Check if seconds for atime match */
- TEST_COMPARE (st.st_atime, tv[0].tv_sec);
+ TEST_COMPARE (st.stx_atime.tv_sec, tv[0].tv_sec);
/* Check if seconds for mtime match */
- TEST_COMPARE (st.st_mtime, tv[1].tv_sec);
+ TEST_COMPARE (st.stx_mtime.tv_sec, tv[1].tv_sec);
return 0;
}

415
glibc-RHEL-106562-7.patch Normal file
View File

@ -0,0 +1,415 @@
commit e7c14e542d8d858b824b5df4f4e3dc93695e6171
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Aug 16 16:05:20 2024 +0200
support: Use macros for *stat wrappers
Macros will automatically use the correct types, without
having to fiddle with internal glibc macros. It's also
impossible to get the types wrong due to aliasing because
support_check_stat_fd and support_check_stat_path do not
depend on the struct stat* types.
The changes reveal some inconsistencies in tests.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/elf/tst-ldconfig-bad-aux-cache.c b/elf/tst-ldconfig-bad-aux-cache.c
index 7f1fbb52523ac1ac..8c2e62ecc2c54c04 100644
--- a/elf/tst-ldconfig-bad-aux-cache.c
+++ b/elf/tst-ldconfig-bad-aux-cache.c
@@ -85,7 +85,7 @@ do_test (void)
support_capture_subprocess_check (&result, "execv", 0, sc_allow_none);
support_capture_subprocess_free (&result);
- xstat (path, &fs);
+ xstat64 (path, &fs);
size = fs.st_size;
/* Run 3 tests, each truncating aux-cache shorter and shorter. */
diff --git a/io/tst-copy_file_range.c b/io/tst-copy_file_range.c
index 9837b7c3395725a5..3d7b0aa90160190a 100644
--- a/io/tst-copy_file_range.c
+++ b/io/tst-copy_file_range.c
@@ -117,7 +117,7 @@ simple_file_copy (void)
TEST_COMPARE (xlseek (outfd, 0, SEEK_CUR), 6 + length);
struct stat64 st;
- xfstat (outfd, &st);
+ xfstat64 (outfd, &st);
if (length > 0)
TEST_COMPARE (st.st_size, out_skipped + length);
else
diff --git a/io/tst-statx.c b/io/tst-statx.c
index d84568859eb5c604..685924ae76245676 100644
--- a/io/tst-statx.c
+++ b/io/tst-statx.c
@@ -78,7 +78,7 @@ both_implementations_tests (statx_function impl, const char *path, int fd)
struct statx stx = { 0, };
TEST_COMPARE (statx (fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, &stx), 0);
struct stat64 st;
- xfstat (fd, &st);
+ xfstat64 (fd, &st);
TEST_COMPARE (stx.stx_mode, st.st_mode);
TEST_COMPARE (stx.stx_dev_major, major (st.st_dev));
TEST_COMPARE (stx.stx_dev_minor, minor (st.st_dev));
@@ -88,7 +88,7 @@ both_implementations_tests (statx_function impl, const char *path, int fd)
TEST_COMPARE (statx (AT_FDCWD, "/dev/null", 0, STATX_BASIC_STATS, &stx),
0);
struct stat64 st;
- xstat ("/dev/null", &st);
+ xstat64 ("/dev/null", &st);
TEST_COMPARE (stx.stx_mode, st.st_mode);
TEST_COMPARE (stx.stx_dev_major, major (st.st_dev));
TEST_COMPARE (stx.stx_dev_minor, minor (st.st_dev));
diff --git a/locale/tst-localedef-path-norm.c b/locale/tst-localedef-path-norm.c
index ffe8cbd46732386f..f592b9a9605bff94 100644
--- a/locale/tst-localedef-path-norm.c
+++ b/locale/tst-localedef-path-norm.c
@@ -84,7 +84,7 @@ run_test (void *closure)
support_capture_subprocess_free (&result);
/* Verify path is present and is a directory. */
- xstat (path, &fs);
+ xstat64 (path, &fs);
if (!S_ISDIR (fs.st_mode))
{
support_record_failure ();
diff --git a/localedata/tst-localedef-hardlinks.c b/localedata/tst-localedef-hardlinks.c
index e88215a1507bb30a..23927b462fc2224a 100644
--- a/localedata/tst-localedef-hardlinks.c
+++ b/localedata/tst-localedef-hardlinks.c
@@ -62,7 +62,7 @@ check_link (struct test_data step)
char *output;
output = xasprintf ("%s/%s", support_complocaledir_prefix, step.output);
- xstat (output, &locale);
+ xstat64 (output, &locale);
free (output);
TEST_COMPARE (locale.st_nlink, step.st_nlink);
}
diff --git a/posix/tst-execveat.c b/posix/tst-execveat.c
index 4565d6b19f41ca63..dde034a9f1356453 100644
--- a/posix/tst-execveat.c
+++ b/posix/tst-execveat.c
@@ -155,7 +155,7 @@ do_test (void)
tmp_sh = xasprintf ("%s/tmp_sh", tmp_dir);
add_temp_file (tmp_sh);
fd_out = xopen (symlink_name, O_CREAT | O_WRONLY, 0);
- xstat ("/bin/sh", &st);
+ xstat64 ("/bin/sh", &st);
fd = xopen ("/bin/sh", O_RDONLY, 0);
xcopy_file_range (fd, 0, fd_out, 0, st.st_size, 0);
xfchmod (fd_out, 0700);
diff --git a/stdio-common/tst-renameat2.c b/stdio-common/tst-renameat2.c
index b65afed75ec65ca4..7f4345f716182552 100644
--- a/stdio-common/tst-renameat2.c
+++ b/stdio-common/tst-renameat2.c
@@ -82,7 +82,7 @@ static void
check_size (const char *path, off64_t expected_size)
{
struct stat64 st;
- xstat (path, &st);
+ xstat64 (path, &st);
if (st.st_size != expected_size)
FAIL_EXIT1 ("file \"%s\": expected size %lld, actual size %lld",
path, (unsigned long long int) expected_size,
diff --git a/stdlib/tst-system.c b/stdlib/tst-system.c
index 47c742f963a1b6b4..b5b630a41b9e4663 100644
--- a/stdlib/tst-system.c
+++ b/stdlib/tst-system.c
@@ -169,7 +169,7 @@ do_test (void)
{
struct stat64 st;
- xstat (_PATH_BSHELL, &st);
+ xstat64 (_PATH_BSHELL, &st);
mode_t mode = st.st_mode;
xchmod (_PATH_BSHELL, mode & ~(S_IXUSR | S_IXGRP | S_IXOTH));
diff --git a/support/Makefile b/support/Makefile
index 5b1c96a49e9410f4..6e3c55394fa212b6 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -42,14 +42,12 @@ libsupport-routines = \
resolv_test \
set_fortify_handler \
support-open-dev-null-range \
- support-xfstat \
- support-xfstat-time64 \
- support-xstat \
- support-xstat-time64 \
support_become_root \
support_can_chroot \
support_capture_subprocess \
support_capture_subprocess_check \
+ support_check_stat_fd \
+ support_check_stat_path \
support_chroot \
support_copy_file \
support_copy_file_range \
@@ -135,8 +133,6 @@ libsupport-routines = \
xgetsockname \
xlisten \
xlseek \
- xlstat \
- xlstat-time64 \
xmalloc \
xmemstream \
xmkdir \
diff --git a/support/support-xfstat-time64.c b/support/support-xfstat-time64.c
deleted file mode 100644
index 589a69bb3e04857d..0000000000000000
--- a/support/support-xfstat-time64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 64-bit time_t stat with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-/* NB: Non-standard file name to avoid sysdeps override for xstat. */
-
-#include <support/check.h>
-#include <support/xunistd.h>
-#include <sys/stat.h>
-
-#if __TIMESIZE != 64
-void
-xfstat_time64 (int fd, struct __stat64_t64 *result)
-{
- if (__fstat64_time64 (fd, result) != 0)
- FAIL_EXIT1 ("__fstat64_time64 (%d): %m", fd);
-}
-#endif
diff --git a/support/support-xstat-time64.c b/support/support-xstat-time64.c
deleted file mode 100644
index 451948734ae0de0f..0000000000000000
--- a/support/support-xstat-time64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 64-bit time_t stat with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-/* NB: Non-standard file name to avoid sysdeps override for xstat. */
-
-#include <support/check.h>
-#include <support/xunistd.h>
-#include <sys/stat.h>
-
-#if __TIMESIZE != 64
-void
-xstat_time64 (const char *path, struct __stat64_t64 *result)
-{
- if (__stat64_time64 (path, result) != 0)
- FAIL_EXIT1 ("__stat64_time64 (\"%s\"): %m", path);
-}
-#endif
diff --git a/support/support-xstat.c b/support/support-xstat.c
deleted file mode 100644
index ce866f74d242c07a..0000000000000000
--- a/support/support-xstat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* stat64 with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-/* NB: Non-standard file name to avoid sysdeps override for xstat. */
-
-#include <support/check.h>
-#include <support/xunistd.h>
-#include <sys/stat.h>
-
-void
-xstat (const char *path, struct stat64 *result)
-{
- if (stat64 (path, result) != 0)
- FAIL_EXIT1 ("stat64 (\"%s\"): %m", path);
-}
diff --git a/support/xlstat.c b/support/support_check_stat_fd.c
similarity index 76%
rename from support/xlstat.c
rename to support/support_check_stat_fd.c
index 87df988879094d5b..4c12adf6b7f68d0c 100644
--- a/support/xlstat.c
+++ b/support/support_check_stat_fd.c
@@ -1,5 +1,5 @@
-/* lstat64 with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Error checking for descriptor-based stat functions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,11 +18,10 @@
#include <support/check.h>
#include <support/xunistd.h>
-#include <sys/stat.h>
void
-xlstat (const char *path, struct stat64 *result)
+support_check_stat_fd (const char *name, int fd, int result)
{
- if (lstat64 (path, result) != 0)
- FAIL_EXIT1 ("lstat64 (\"%s\"): %m", path);
+ if (result != 0)
+ FAIL_EXIT1 ("%s (%d): %m", name, fd);
}
diff --git a/support/support-xfstat.c b/support/support_check_stat_path.c
similarity index 81%
rename from support/support-xfstat.c
rename to support/support_check_stat_path.c
index ab4b01c97d7b5f2f..3cf72afe5901dcd5 100644
--- a/support/support-xfstat.c
+++ b/support/support_check_stat_path.c
@@ -1,4 +1,4 @@
-/* fstat64 with error checking.
+/* Error checking for path-based stat functions.
Copyright (C) 2017-2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -18,11 +18,10 @@
#include <support/check.h>
#include <support/xunistd.h>
-#include <sys/stat.h>
void
-xfstat (int fd, struct stat64 *result)
+support_check_stat_path (const char *name, const char *path, int result)
{
- if (fstat64 (fd, result) != 0)
- FAIL_EXIT1 ("fstat64 (%d): %m", fd);
+ if (result != 0)
+ FAIL_EXIT1 ("%s (\"%s\"): %m", name, path);
}
diff --git a/support/xlstat-time64.c b/support/xlstat-time64.c
deleted file mode 100644
index 2bc3ca6593bd397d..0000000000000000
--- a/support/xlstat-time64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 64-bit time_t stat with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-/* NB: Non-standard file name to avoid sysdeps override for xstat. */
-
-#include <support/check.h>
-#include <support/xunistd.h>
-#include <sys/stat.h>
-
-#if __TIMESIZE != 64
-void
-xlstat_time64 (const char *path, struct __stat64_t64 *result)
-{
- if (__lstat64_time64 (path, result) != 0)
- FAIL_EXIT1 ("__lstat64_time64 (\"%s\"): %m", path);
-}
-#endif
diff --git a/support/xunistd.h b/support/xunistd.h
index cc74c4fad07dd088..204951bce75f576b 100644
--- a/support/xunistd.h
+++ b/support/xunistd.h
@@ -29,7 +29,6 @@
__BEGIN_DECLS
-struct stat64;
struct statx;
pid_t xfork (void);
@@ -37,21 +36,20 @@ pid_t xwaitpid (pid_t, int *status, int flags);
void xpipe (int[2]);
void xdup2 (int, int);
int xopen (const char *path, int flags, mode_t);
-#ifndef __USE_TIME64_REDIRECTS
-# ifdef __USE_FILE_OFFSET64
-void xstat (const char *path, struct stat *);
-void xlstat (const char *path, struct stat *);
-void xfstat (int fd, struct stat *);
-# else
-void xstat (const char *path, struct stat64 *);
-void xlstat (const char *path, struct stat64 *);
-void xfstat (int fd, struct stat64 *);
-# endif
-#else
-void __REDIRECT (xstat, (const char *path, struct stat *), xstat_time64);
-void __REDIRECT (xlstat, (const char *path, struct stat *), xlstat_time64);
-void __REDIRECT (xfstat, (int fd, struct stat *), xfstat_time64);
-#endif
+void support_check_stat_fd (const char *name, int fd, int result);
+void support_check_stat_path (const char *name, const char *path, int result);
+#define xstat(path, st) \
+ (support_check_stat_path ("stat", (path), stat ((path), (st))))
+#define xfstat(fd, st) \
+ (support_check_stat_fd ("fstat", (fd), fstat ((fd), (st))))
+#define xlstat(path, st) \
+ (support_check_stat_path ("lstat", (path), lstat ((path), (st))))
+#define xstat64(path, st) \
+ (support_check_stat_path ("stat64", (path), stat64 ((path), (st))))
+#define xfstat64(fd, st) \
+ (support_check_stat_fd ("fstat64", (fd), fstat64 ((fd), (st))))
+#define xlstat64(path, st) \
+ (support_check_stat_path ("lstat64", (path), lstat64 ((path), (st))))
void xstatx (int, const char *, int, unsigned int, struct statx *);
void xmkdir (const char *path, mode_t);
void xchroot (const char *path);

148
glibc-RHEL-106562-8.patch Normal file
View File

@ -0,0 +1,148 @@
commit 2eee835eca960c9d4119279804214b7a1ed5d156
Author: DJ Delorie <dj@redhat.com>
Date: Thu Aug 8 22:44:56 2024 -0400
inet: test if_nametoindex and if_indextoname
Tests for if_nameindex, if_name2index, and if_index2name
Tests that valid results are consistent.
Tests that invalid parameters fail correctly.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/inet/Makefile b/inet/Makefile
index 2f03e6f7ee211525..cb97b45f0f9d223f 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -91,6 +91,7 @@ tests := \
tst-getni1 \
tst-getni2 \
tst-if_index-long \
+ tst-if_nameindex \
tst-inet6_rth \
tst-network \
tst-ntoa \
diff --git a/inet/tst-if_nameindex.c b/inet/tst-if_nameindex.c
new file mode 100644
index 0000000000000000..b025cdb3a7c6b68c
--- /dev/null
+++ b/inet/tst-if_nameindex.c
@@ -0,0 +1,116 @@
+/* Tests for if_nameindex et al.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <net/if.h>
+#include <netdb.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/descriptors.h>
+#include <support/support.h>
+
+static char *buffer;
+
+static const char *test_names[] = {
+ "testing",
+ "invalid",
+ "dont-match",
+ "",
+ "\001\001\001\177",
+ NULL
+};
+
+static void
+checki (int i)
+{
+ char *ifname;
+
+ /* Test that a known-invalid index returns NULL. */
+ /* BUFFER should not be accessed. */
+
+ printf ("Testing if_indextoname (%d) == NULL\n", i);
+ ifname = if_indextoname (i, NULL);
+ TEST_VERIFY (ifname == NULL);
+ TEST_VERIFY (errno == ENXIO);
+}
+
+static int
+do_test (void)
+{
+ struct if_nameindex *if_ni, *ifp;
+ int min_idx, max_idx, buflen = 0;
+ int i;
+
+ if_ni = if_nameindex ();
+ TEST_VERIFY (if_ni != NULL);
+
+ min_idx = max_idx = if_ni->if_index;
+
+ for (ifp = if_ni; !(ifp->if_index == 0 && ifp->if_name == NULL); ifp++)
+ {
+ printf ("%u: %s\n", ifp->if_index, ifp->if_name);
+ if (ifp->if_index < min_idx)
+ min_idx = ifp->if_index;
+ if (ifp->if_index > max_idx)
+ max_idx = ifp->if_index;
+ if (strlen (ifp->if_name) + 1 > buflen)
+ buflen = strlen (ifp->if_name) + 1;
+ }
+ buffer = (char *) xmalloc (buflen);
+
+ /* Check normal operation. */
+ for (ifp = if_ni; !(ifp->if_index == 0 && ifp->if_name == NULL); ifp++)
+ {
+ unsigned int idx = if_nametoindex (ifp->if_name);
+ TEST_VERIFY (idx == ifp->if_index);
+
+ char *fn = if_indextoname (ifp->if_index, buffer);
+ TEST_VERIFY (strcmp (fn, ifp->if_name) == 0);
+ }
+
+ for (i=-2; i<min_idx; i++)
+ checki (i);
+ for (i=max_idx+1; i<max_idx+3; i++)
+ checki (i);
+
+ /* Check that a known-invalid name returns 0. */
+
+ for (i=0; test_names[i] != NULL; i++)
+ {
+ /* Make sure our "invalid" name is really invalid. */
+ for (ifp = if_ni; !(ifp->if_index == 0 && ifp->if_name == NULL); ifp++)
+ if (strcmp (test_names[i], ifp->if_name) == 0)
+ goto not_this_one;
+
+ printf ("Testing if_nametoindex (%s) == 0\n", test_names[i]);
+
+ unsigned int idx = if_nametoindex (test_names[i]);
+ TEST_VERIFY (idx == 0);
+ TEST_VERIFY (errno == ENODEV);
+
+ not_this_one:
+ }
+
+
+ if_freenameindex (if_ni);
+
+ return 0;
+}
+
+#include <support/test-driver.c>

79
glibc-RHEL-106562-9.patch Normal file
View File

@ -0,0 +1,79 @@
commit 55cd51d971b84fbb2cc0fe8140cc8581f98582c7
Author: Joseph Myers <josmyers@redhat.com>
Date: Thu Aug 22 11:25:14 2024 +0000
Test mkdirat use of mode argument
The test io/tst-mkdirat doesn't verify the permissions on the created
directory (thus, doesn't verify at all anything about how mkdirat uses
the mode argument). Add checks of this to the existing test.
Tested for x86_64.
diff --git a/io/tst-mkdirat.c b/io/tst-mkdirat.c
index 605e51ef1e966b42..b97bc3ca6d0cdf23 100644
--- a/io/tst-mkdirat.c
+++ b/io/tst-mkdirat.c
@@ -53,6 +53,10 @@ prepare (void)
static int
do_test (void)
{
+ /* Find the current umask. */
+ mode_t mask = umask (022);
+ umask (mask);
+
/* fdopendir takes over the descriptor, make a copy. */
int dupfd = dup (dir_fd);
if (dupfd == -1)
@@ -107,6 +111,13 @@ do_test (void)
puts ("mkdirat did not create a directory");
return 1;
}
+ if ((st1.st_mode & 01777) != (~mask & 0777))
+ {
+ printf ("mkdirat created directory with wrong mode %o, expected %o\n",
+ (unsigned int) (st1.st_mode & 01777),
+ (unsigned int) (~mask & 0777));
+ return 1;
+ }
dupfd = dup (dir_fd);
if (dupfd == -1)
@@ -156,6 +167,37 @@ do_test (void)
return 1;
}
+ /* Test again with a different mode. */
+ umask (0);
+ e = mkdirat (dir_fd, "some-dir", 01755);
+ umask (mask);
+ if (e == -1)
+ {
+ puts ("directory creation (different mode) failed");
+ return 1;
+ }
+ if (fstatat64 (dir_fd, "some-dir", &st1, 0) != 0)
+ {
+ puts ("fstat64 (different mode) failed");
+ return 1;
+ }
+ if (!S_ISDIR (st1.st_mode))
+ {
+ puts ("mkdirat (different mode) did not create a directory");
+ return 1;
+ }
+ if ((st1.st_mode & 01777) != 01755)
+ {
+ printf ("mkdirat (different mode) created directory with wrong mode %o\n",
+ (unsigned int) (st1.st_mode & 01777));
+ return 1;
+ }
+ if (unlinkat (dir_fd, "some-dir", AT_REMOVEDIR) != 0)
+ {
+ puts ("unlinkat (different mode) failed");
+ return 1;
+ }
+
close (dir_fd);
return 0;

262
glibc-RHEL-107540-1.patch Normal file
View File

@ -0,0 +1,262 @@
commit 5653ccd847f0cd3a98906e44c97c71d68652d326
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Apr 8 16:48:55 2024 +0200
elf: Add CPU iteration support for future use in ld.so diagnostics
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
diff --git a/elf/dl-iterate_cpu.h b/elf/dl-iterate_cpu.h
new file mode 100644
index 0000000000000000..60db167b13e2d377
--- /dev/null
+++ b/elf/dl-iterate_cpu.h
@@ -0,0 +1,136 @@
+/* Iterate over all CPUs, for CPU-specific diagnostics.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef DL_ITERATE_CPU_H
+#define DL_ITERATE_CPU_H
+
+#include <dl-affinity.h>
+#include <stdbool.h>
+
+struct dl_iterate_cpu
+{
+ /* Sequential iteration count, starting at 0. */
+ unsigned int processor_index;
+
+ /* Requested CPU. Can be -1 if affinity could not be set. */
+ int requested_cpu;
+
+ /* Observed current CPU. -1 if unavailable. */
+ int actual_cpu;
+
+ /* Observed node ID for the CPU. -1 if unavailable. */
+ int actual_node;
+
+ /* Internal fields to implement the iteration. */
+
+ /* Affinity as obtained by _dl_iterate_cpu_init, using
+ _dl_getaffinity. Space for 8,192 CPUs. */
+ unsigned long int mask_reference[8192 / sizeof (unsigned long int) / 8];
+
+ /* This array is used by _dl_setaffinity calls. */
+ unsigned long int mask_request[8192 / sizeof (unsigned long int) / 8];
+
+ /* Return value from the initial _dl_getaffinity call. */
+ int length_reference;
+};
+
+static void
+_dl_iterate_cpu_init (struct dl_iterate_cpu *dic)
+{
+ dic->length_reference
+ = _dl_getaffinity (dic->mask_reference, sizeof (dic->mask_reference));
+ /* Prepare for the first _dl_iterate_cpu_next call. */
+ dic->processor_index = -1;
+ dic->requested_cpu = -1;
+}
+
+static bool
+_dl_iterate_cpu_next (struct dl_iterate_cpu *dic)
+{
+ ++dic->processor_index;
+
+ if (dic->length_reference > 0)
+ {
+ /* Search for the next CPU to switch to. */
+ while (true)
+ {
+ ++dic->requested_cpu;
+
+ /* Array index and bit number within the array. */
+ unsigned int long_index
+ = dic->requested_cpu / sizeof (unsigned long int) / 8;
+ unsigned int bit_index
+ = dic->requested_cpu % (sizeof (unsigned long int) * 8);
+
+ if (long_index * sizeof (unsigned long int) >= dic->length_reference)
+ /* All possible CPUs have been covered. */
+ return false;
+
+ unsigned long int bit = 1UL << bit_index;
+ if (dic->mask_reference[long_index] & bit)
+ {
+ /* The CPU is available. Try to select it. */
+ dic->mask_request[long_index] = bit;
+ if (_dl_setaffinity (dic->mask_request,
+ (long_index + 1)
+ * sizeof (unsigned long int)) < 0)
+ {
+ /* Record that we could not perform a CPU request. */
+ dic->length_reference = -1;
+
+ if (dic->processor_index > 0)
+ /* We already reported something. There is no need to
+ continue because the new data is probably not useful. */
+ return false;
+ }
+
+ /* Clear the bit in case the next iteration switches to the
+ next long value. */
+ dic->mask_request[long_index] = 0;
+
+ /* We found a CPU to run on. */
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* No way to set CPU affinity. Iterate just once. */
+ if (dic->processor_index > 0)
+ return false;
+ }
+
+ /* Fill in the actual CPU information. CPU pinning may not actually
+ be effective, depending on the container host. */
+ unsigned int cpu, node;
+ if (_dl_getcpu (&cpu, &node) < 0)
+ {
+ /* No CPU information available. */
+ dic->actual_cpu = -1;
+ dic->actual_node = -1;
+ }
+ else
+ {
+ dic->actual_cpu = cpu;
+ dic->actual_node = node;
+ }
+
+ return true;
+}
+
+#endif /* DL_ITERATE_CPU_H */
diff --git a/sysdeps/generic/dl-affinity.h b/sysdeps/generic/dl-affinity.h
new file mode 100644
index 0000000000000000..d117f737e98712e0
--- /dev/null
+++ b/sysdeps/generic/dl-affinity.h
@@ -0,0 +1,54 @@
+/* CPU affinity handling for the dynamic linker. Stub version.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef DL_AFFINITY_H
+#define DL_AFFINITY_H
+
+#include <errno.h>
+#include <stddef.h>
+
+/* On success, write the current CPU ID to *CPU, and the current node
+ ID to *NODE, and return 0. Return a negative error code on
+ failure. */
+static inline int
+_dl_getcpu (unsigned int *cpu, unsigned int *node)
+{
+ return -ENOSYS;
+}
+
+/* On success, write CPU ID affinity bits for the current thread to
+ *BITS, which must be SIZE bytes long, and return the number of
+ bytes updated, a multiple of sizeof (unsigned long int). On
+ failure, return a negative error code. */
+static int
+_dl_getaffinity (unsigned long int *bits, size_t size)
+{
+ return -ENOSYS;
+}
+
+/* Set the CPU affinity mask for the current thread to *BITS, using
+ the SIZE bytes from that array, which should be a multiple of
+ sizeof (unsigned long int). Return 0 on success, and a negative
+ error code on failure. */
+static int
+_dl_setaffinity (const unsigned long int *bits, size_t size)
+{
+ return -ENOSYS;
+}
+
+#endif /* DL_AFFINITY_H */
diff --git a/sysdeps/unix/sysv/linux/dl-affinity.h b/sysdeps/unix/sysv/linux/dl-affinity.h
new file mode 100644
index 0000000000000000..bbfede7750a3037f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/dl-affinity.h
@@ -0,0 +1,46 @@
+/* CPU affinity handling for the dynamic linker. Linux version.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+/* See sysdeps/generic/dl-affinity.h for documentation of these interfaces. */
+
+#ifndef DL_AFFINITY_H
+#define DL_AFFINITY_H
+
+#include <sysdep.h>
+#include <stddef.h>
+#include <unistd.h>
+
+static inline int
+_dl_getcpu (unsigned int *cpu, unsigned int *node)
+{
+ return INTERNAL_SYSCALL_CALL (getcpu, cpu, node);
+}
+
+static int
+_dl_getaffinity (unsigned long int *bits, size_t size)
+{
+ return INTERNAL_SYSCALL_CALL (sched_getaffinity, /* TID */ 0, size, bits);
+}
+
+static int
+_dl_setaffinity (const unsigned long int *bits, size_t size)
+{
+ return INTERNAL_SYSCALL_CALL (sched_setaffinity, /* TID */ 0, size, bits);
+}
+
+#endif /* DL_AFFINITY_H */

512
glibc-RHEL-107540-2.patch Normal file
View File

@ -0,0 +1,512 @@
commit 7a430f40c46acfa7ce4c3bff193b278c190b2efc
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Apr 8 16:48:55 2024 +0200
x86: Add generic CPUID data dumper to ld.so --list-diagnostics
This is surprisingly difficult to implement if the goal is to produce
reasonably sized output. With the current approaches to output
compression (suppressing zeros and repeated results between CPUs,
folding ranges of identical subleaves, dealing with the %ecx
reflection issue), the output is less than 600 KiB even for systems
with 256 logical CPUs.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
diff --git a/manual/dynlink.texi b/manual/dynlink.texi
index 5a93de0df6b60214..d71f7a30d6f46808 100644
--- a/manual/dynlink.texi
+++ b/manual/dynlink.texi
@@ -262,7 +262,90 @@ The value of the @code{dczid_el0} system register on the processor
@item x86.cpu_features.@dots{}
These items are specific to the i386 and x86-64 architectures. They
reflect supported CPU features and information on cache geometry, mostly
-collected using the @code{CPUID} instruction.
+collected using the CPUID instruction.
+
+@item x86.processor[@var{index}].@dots{}
+These are additional items for the i386 and x86-64 architectures, as
+described below. They mostly contain raw data from the CPUID
+instruction. The probes are performed for each active CPU for the
+@code{ld.so} process, and data for different probed CPUs receives a
+uniqe @var{index} value. Some CPUID data is expected to differ from CPU
+core to CPU core. In some cases, CPUs are not correctly initialized and
+indicate the presence of different feature sets.
+
+@item x86.processor[@var{index}].requested=@var{kernel-cpu}
+The kernel is told to run the subsequent probing on the CPU numbered
+@var{kernel-cpu}. The values @var{kernel-cpu} and @var{index} can be
+distinct if there are gaps in the process CPU affinity mask. This line
+is not included if CPU affinity mask information is not available.
+
+@item x86.processor[@var{index}].observed=@var{kernel-cpu}
+This line reports the kernel CPU number @var{kernel-cpu} on which the
+probing code initially ran. If the CPU number cannot be obtained,
+this line is not printed.
+
+@item x86.processor[@var{index}].observed_node=@var{node}
+This reports the observed NUMA node number, as reported by the
+@code{getcpu} system call. If this information cannot be obtained, this
+line is not printed.
+
+@item x86.processor[@var{index}].cpuid_leaves=@var{count}
+This line indicates that @var{count} distinct CPUID leaves were
+encountered. (This reflects internal @code{ld.so} storage space, it
+does not directly correspond to @code{CPUID} enumeration ranges.)
+
+@item x86.processor[@var{index}].ecx_limit=@var{value}
+The CPUID data extraction code uses a brute-force approach to enumerate
+subleaves (see the @samp{.subleaf_eax} lines below). The last
+@code{%rcx} value used in a CPUID query on this probed CPU was
+@var{value}.
+
+@item x86.processor[@var{index}].cpuid.eax[@var{query_eax}].eax=@var{eax}
+@itemx x86.processor[@var{index}].cpuid.eax[@var{query_eax}].ebx=@var{ebx}
+@itemx x86.processor[@var{index}].cpuid.eax[@var{query_eax}].ecx=@var{ecx}
+@itemx x86.processor[@var{index}].cpuid.eax[@var{query_eax}].edx=@var{edx}
+These lines report the register contents after executing the CPUID
+instruction with @samp{%rax == @var{query_eax}} and @samp{%rcx == 0} (a
+@dfn{leaf}). For the first probed CPU (with a zero @var{index}), only
+leaves with non-zero register contents are reported. For subsequent
+CPUs, only leaves whose register contents differs from the previously
+probed CPUs (with @var{index} one less) are reported.
+
+Basic and extended leaves are reported using the same syntax. This
+means there is a large jump in @var{query_eax} for the first reported
+extended leaf.
+
+@item x86.processor[@var{index}].cpuid.subleaf_eax[@var{query_eax}].ecx[@var{query_ecx}].eax=@var{eax}
+@itemx x86.processor[@var{index}].cpuid.subleaf_eax[@var{query_eax}].ecx[@var{query_ecx}].ebx=@var{ebx}
+@itemx x86.processor[@var{index}].cpuid.subleaf_eax[@var{query_eax}].ecx[@var{query_ecx}].ecx=@var{ecx}
+@itemx x86.processor[@var{index}].cpuid.subleaf_eax[@var{query_eax}].ecx[@var{query_ecx}].edx=@var{edx}
+This is similar to the leaves above, but for a @dfn{subleaf}. For
+subleaves, the CPUID instruction is executed with @samp{%rax ==
+@var{query_eax}} and @samp{%rcx == @var{query_ecx}}, so the result
+depends on both register values. The same rules about filtering zero
+and identical results apply.
+
+@item x86.processor[@var{index}].cpuid.subleaf_eax[@var{query_eax}].ecx[@var{query_ecx}].until_ecx=@var{ecx_limit}
+Some CPUID results are the same regardless the @var{query_ecx} value.
+If this situation is detected, a line with the @samp{.until_ecx}
+selector ins included, and this indicates that the CPUID register
+contents is the same for @code{%rcx} values between @var{query_ecx}
+and @var{ecx_limit} (inclusive).
+
+@item x86.processor[@var{index}].cpuid.subleaf_eax[@var{query_eax}].ecx[@var{query_ecx}].ecx_query_mask=0xff
+This line indicates that in an @samp{.until_ecx} range, the CPUID
+instruction preserved the lowested 8 bits of the input @code{%rcx} in
+the output @code{%rcx} registers. Otherwise, the subleaves in the range
+have identical values. This special treatment is necessary to report
+compact range information in case such copying occurs (because the
+subleaves would otherwise be all different).
+
+@item x86.processor[@var{index}].xgetbv.ecx[@var{query_ecx}]=@var{result}
+This line shows the 64-bit @var{result} value in the @code{%rdx:%rax}
+register pair after executing the XGETBV instruction with @code{%rcx}
+set to @var{query_ecx}. Zero values and values matching the previously
+probed CPU are omitted. Nothing is printed if the system does not
+support the XGETBV instruction.
@end table
@node Dynamic Linker Introspection
diff --git a/sysdeps/x86/dl-diagnostics-cpu.c b/sysdeps/x86/dl-diagnostics-cpu.c
index 9a3e0ec8b9214a9c..7fe2c2dfd6668223 100644
--- a/sysdeps/x86/dl-diagnostics-cpu.c
+++ b/sysdeps/x86/dl-diagnostics-cpu.c
@@ -17,7 +17,18 @@
<https://www.gnu.org/licenses/>. */
#include <dl-diagnostics.h>
+
+#include <array_length.h>
+#include <cpu-features.h>
+#include <cpuid.h>
+#include <dl-iterate_cpu.h>
#include <ldsodefs.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sysdep.h>
+
+/* The generic CPUID dumping code. */
+static void _dl_diagnostics_cpuid (void);
static void
print_cpu_features_value (const char *label, uint64_t value)
@@ -124,4 +135,377 @@ _dl_diagnostics_cpu (void)
+ sizeof (cpu_features->cachesize_non_temporal_divisor)
== sizeof (*cpu_features),
"last cpu_features field has been printed");
+
+ _dl_diagnostics_cpuid ();
+}
+
+/* The following code implements a generic CPUID dumper that tries to
+ gather CPUID data without knowing about CPUID implementation
+ details. */
+
+/* Register arguments to CPUID. Multiple ECX subleaf values yielding
+ the same result are combined, to shorten the output. Both
+ identical matches (EAX to EDX are the same) and matches where EAX,
+ EBX, EDX, and ECX are equal except in the lower byte, which must
+ match the query ECX value. The latter is needed to compress ranges
+ on CPUs which preserve the lowest byte in ECX if an unknown leaf is
+ queried. */
+struct cpuid_query
+{
+ unsigned int eax;
+ unsigned ecx_first;
+ unsigned ecx_last;
+ bool ecx_preserves_query_byte;
+};
+
+/* Single integer value that can be used for sorting/ordering
+ comparisons. Uses Q->eax and Q->ecx_first only because ecx_last is
+ always greater than the previous ecx_first value and less than the
+ subsequent one. */
+static inline unsigned long long int
+cpuid_query_combined (struct cpuid_query *q)
+{
+ /* ecx can be -1 (that is, ~0U). If this happens, this the only ecx
+ value for this eax value, so the ordering does not matter. */
+ return ((unsigned long long int) q->eax << 32) | (unsigned int) q->ecx_first;
+};
+
+/* Used for differential reporting of zero/non-zero values. */
+static const struct cpuid_registers cpuid_registers_zero;
+
+/* Register arguments to CPUID paired with the results that came back. */
+struct cpuid_query_result
+{
+ struct cpuid_query q;
+ struct cpuid_registers r;
+};
+
+/* During a first enumeration pass, we try to collect data for
+ cpuid_initial_subleaf_limit subleaves per leaf/EAX value. If we run
+ out of space, we try once more with applying the lower limit. */
+enum { cpuid_main_leaf_limit = 128 };
+enum { cpuid_initial_subleaf_limit = 512 };
+enum { cpuid_subleaf_limit = 32 };
+
+/* Offset of the extended leaf area. */
+enum {cpuid_extended_leaf_offset = 0x80000000 };
+
+/* Collected CPUID data. Everything is stored in a statically sized
+ array that is sized so that the second pass will collect some data
+ for all leaves, after the limit is applied. On the second pass,
+ ecx_limit is set to cpuid_subleaf_limit. */
+struct cpuid_collected_data
+{
+ unsigned int used;
+ unsigned int ecx_limit;
+ uint64_t xgetbv_ecx_0;
+ struct cpuid_query_result qr[cpuid_main_leaf_limit
+ * 2 * cpuid_subleaf_limit];
+};
+
+/* Fill in the result of a CPUID query. Returns true if there is
+ room, false if nothing could be stored. */
+static bool
+_dl_diagnostics_cpuid_store (struct cpuid_collected_data *ccd,
+ unsigned eax, int ecx)
+{
+ if (ccd->used >= array_length (ccd->qr))
+ return false;
+
+ /* Tentatively fill in the next value. */
+ __cpuid_count (eax, ecx,
+ ccd->qr[ccd->used].r.eax,
+ ccd->qr[ccd->used].r.ebx,
+ ccd->qr[ccd->used].r.ecx,
+ ccd->qr[ccd->used].r.edx);
+
+ /* If the ECX subleaf is next subleaf after the previous one (for
+ the same leaf), and the values are the same, merge the result
+ with the already-stored one. Do this before skipping zero
+ leaves, which avoids artifiacts for ECX == 256 queries. */
+ if (ccd->used > 0
+ && ccd->qr[ccd->used - 1].q.eax == eax
+ && ccd->qr[ccd->used - 1].q.ecx_last + 1 == ecx)
+ {
+ /* Exact match of the previous result. Ignore the value of
+ ecx_preserves_query_byte if this is a singleton range so far
+ because we can treat ECX as fixed if the same value repeats. */
+ if ((!ccd->qr[ccd->used - 1].q.ecx_preserves_query_byte
+ || (ccd->qr[ccd->used - 1].q.ecx_first
+ == ccd->qr[ccd->used - 1].q.ecx_last))
+ && memcmp (&ccd->qr[ccd->used - 1].r, &ccd->qr[ccd->used].r,
+ sizeof (ccd->qr[ccd->used].r)) == 0)
+ {
+ ccd->qr[ccd->used - 1].q.ecx_last = ecx;
+ /* ECX is now fixed because the same value has been observed
+ twice, even if we had a low-byte match before. */
+ ccd->qr[ccd->used - 1].q.ecx_preserves_query_byte = false;
+ return true;
+ }
+ /* Match except for the low byte in ECX, which must match the
+ incoming ECX value. */
+ if (ccd->qr[ccd->used - 1].q.ecx_preserves_query_byte
+ && (ecx & 0xff) == (ccd->qr[ccd->used].r.ecx & 0xff)
+ && ccd->qr[ccd->used].r.eax == ccd->qr[ccd->used - 1].r.eax
+ && ccd->qr[ccd->used].r.ebx == ccd->qr[ccd->used - 1].r.ebx
+ && ((ccd->qr[ccd->used].r.ecx & 0xffffff00)
+ == (ccd->qr[ccd->used - 1].r.ecx & 0xffffff00))
+ && ccd->qr[ccd->used].r.edx == ccd->qr[ccd->used - 1].r.edx)
+ {
+ ccd->qr[ccd->used - 1].q.ecx_last = ecx;
+ return true;
+ }
+ }
+
+ /* Do not store zero results. All-zero values usually mean that the
+ subleaf is unsupported. */
+ if (ccd->qr[ccd->used].r.eax == 0
+ && ccd->qr[ccd->used].r.ebx == 0
+ && ccd->qr[ccd->used].r.ecx == 0
+ && ccd->qr[ccd->used].r.edx == 0)
+ return true;
+
+ /* The result needs to be stored. Fill in the query parameters and
+ consume the storage. */
+ ccd->qr[ccd->used].q.eax = eax;
+ ccd->qr[ccd->used].q.ecx_first = ecx;
+ ccd->qr[ccd->used].q.ecx_last = ecx;
+ ccd->qr[ccd->used].q.ecx_preserves_query_byte
+ = (ecx & 0xff) == (ccd->qr[ccd->used].r.ecx & 0xff);
+ ++ccd->used;
+ return true;
+}
+
+/* Collected CPUID data into *CCD. If LIMIT, apply per-leaf limits to
+ avoid exceeding the pre-allocated space. Return true if all data
+ could be stored, false if the retrying without a limit is
+ requested. */
+static bool
+_dl_diagnostics_cpuid_collect_1 (struct cpuid_collected_data *ccd, bool limit)
+{
+ ccd->used = 0;
+ ccd->ecx_limit
+ = (limit ? cpuid_subleaf_limit : cpuid_initial_subleaf_limit) - 1;
+ _dl_diagnostics_cpuid_store (ccd, 0x00, 0x00);
+ if (ccd->used == 0)
+ /* CPUID reported all 0. Should not happen. */
+ return true;
+ unsigned int maximum_leaf = ccd->qr[0x00].r.eax;
+ if (limit && maximum_leaf >= cpuid_main_leaf_limit)
+ maximum_leaf = cpuid_main_leaf_limit - 1;
+
+ for (unsigned int eax = 1; eax <= maximum_leaf; ++eax)
+ {
+ for (unsigned int ecx = 0; ecx <= ccd->ecx_limit; ++ecx)
+ if (!_dl_diagnostics_cpuid_store (ccd, eax, ecx))
+ return false;
+ }
+
+ if (!_dl_diagnostics_cpuid_store (ccd, cpuid_extended_leaf_offset, 0x00))
+ return false;
+ maximum_leaf = ccd->qr[ccd->used - 1].r.eax;
+ if (maximum_leaf < cpuid_extended_leaf_offset)
+ /* No extended CPUID information. */
+ return true;
+ if (limit
+ && maximum_leaf - cpuid_extended_leaf_offset >= cpuid_main_leaf_limit)
+ maximum_leaf = cpuid_extended_leaf_offset + cpuid_main_leaf_limit - 1;
+ for (unsigned int eax = cpuid_extended_leaf_offset + 1;
+ eax <= maximum_leaf; ++eax)
+ {
+ for (unsigned int ecx = 0; ecx <= ccd->ecx_limit; ++ecx)
+ if (!_dl_diagnostics_cpuid_store (ccd, eax, ecx))
+ return false;
+ }
+ return true;
+}
+
+/* Call _dl_diagnostics_cpuid_collect_1 twice if necessary, the
+ second time with the limit applied. */
+static void
+_dl_diagnostics_cpuid_collect (struct cpuid_collected_data *ccd)
+{
+ if (!_dl_diagnostics_cpuid_collect_1 (ccd, false))
+ _dl_diagnostics_cpuid_collect_1 (ccd, true);
+
+ /* Re-use the result of the official feature probing here. */
+ const struct cpu_features *cpu_features = __get_cpu_features ();
+ if (CPU_FEATURES_CPU_P (cpu_features, OSXSAVE))
+ {
+ unsigned int xcrlow;
+ unsigned int xcrhigh;
+ asm ("xgetbv" : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0));
+ ccd->xgetbv_ecx_0 = ((uint64_t) xcrhigh << 32) + xcrlow;
+ }
+ else
+ ccd->xgetbv_ecx_0 = 0;
+}
+
+/* Print a CPUID register value (passed as REG_VALUE) if it differs
+ from the expected REG_REFERENCE value. PROCESSOR_INDEX is the
+ process sequence number (always starting at zero; not a kernel ID). */
+static void
+_dl_diagnostics_cpuid_print_reg (unsigned int processor_index,
+ const struct cpuid_query *q,
+ const char *reg_label, unsigned int reg_value,
+ bool subleaf)
+{
+ if (subleaf)
+ _dl_printf ("x86.processor[0x%x].cpuid.subleaf_eax[0x%x]"
+ ".ecx[0x%x].%s=0x%x\n",
+ processor_index, q->eax, q->ecx_first, reg_label, reg_value);
+ else
+ _dl_printf ("x86.processor[0x%x].cpuid.eax[0x%x].%s=0x%x\n",
+ processor_index, q->eax, reg_label, reg_value);
+}
+
+/* Print CPUID result values in *RESULT for the query in
+ CCD->qr[CCD_IDX]. PROCESSOR_INDEX is the process sequence number
+ (always starting at zero; not a kernel ID). */
+static void
+_dl_diagnostics_cpuid_print_query (unsigned int processor_index,
+ struct cpuid_collected_data *ccd,
+ unsigned int ccd_idx,
+ const struct cpuid_registers *result)
+{
+ /* Treat this as a value if subleaves if ecx isn't zero (maybe
+ within the [ecx_fist, ecx_last] range), or if eax matches its
+ neighbors. If the range is [0, ecx_limit], then the subleaves
+ are not distinct (independently of ecx_preserves_query_byte),
+ so do not report them separately. */
+ struct cpuid_query *q = &ccd->qr[ccd_idx].q;
+ bool subleaf = (q->ecx_first > 0
+ || (q->ecx_first != q->ecx_last
+ && !(q->ecx_first == 0 && q->ecx_last == ccd->ecx_limit))
+ || (ccd_idx > 0 && q->eax == ccd->qr[ccd_idx - 1].q.eax)
+ || (ccd_idx + 1 < ccd->used
+ && q->eax == ccd->qr[ccd_idx + 1].q.eax));
+ _dl_diagnostics_cpuid_print_reg (processor_index, q, "eax", result->eax,
+ subleaf);
+ _dl_diagnostics_cpuid_print_reg (processor_index, q, "ebx", result->ebx,
+ subleaf);
+ _dl_diagnostics_cpuid_print_reg (processor_index, q, "ecx", result->ecx,
+ subleaf);
+ _dl_diagnostics_cpuid_print_reg (processor_index, q, "edx", result->edx,
+ subleaf);
+
+ if (subleaf && q->ecx_first != q->ecx_last)
+ {
+ _dl_printf ("x86.processor[0x%x].cpuid.subleaf_eax[0x%x]"
+ ".ecx[0x%x].until_ecx=0x%x\n",
+ processor_index, q->eax, q->ecx_first, q->ecx_last);
+ if (q->ecx_preserves_query_byte)
+ _dl_printf ("x86.processor[0x%x].cpuid.subleaf_eax[0x%x]"
+ ".ecx[0x%x].ecx_query_mask=0xff\n",
+ processor_index, q->eax, q->ecx_first);
+ }
+}
+
+/* Perform differential reporting of the data in *CURRENT against
+ *BASE. REQUESTED_CPU is the kernel CPU ID the thread was
+ configured to run on, or -1 if no configuration was possible.
+ PROCESSOR_INDEX is the process sequence number (always starting at
+ zero; not a kernel ID). */
+static void
+_dl_diagnostics_cpuid_report (struct dl_iterate_cpu *dci,
+ struct cpuid_collected_data *current,
+ struct cpuid_collected_data *base)
+{
+ if (dci->requested_cpu >= 0)
+ _dl_printf ("x86.processor[0x%x].requested=0x%x\n",
+ dci->processor_index, dci->requested_cpu);
+ if (dci->actual_cpu >= 0)
+ _dl_printf ("x86.processor[0x%x].observed=0x%x\n",
+ dci->processor_index, dci->actual_cpu);
+ if (dci->actual_node >= 0)
+ _dl_printf ("x86.processor[0x%x].observed_node=0x%x\n",
+ dci->processor_index, dci->actual_node);
+
+ _dl_printf ("x86.processor[0x%x].cpuid_leaves=0x%x\n",
+ dci->processor_index, current->used);
+ _dl_printf ("x86.processor[0x%x].ecx_limit=0x%x\n",
+ dci->processor_index, current->ecx_limit);
+
+ unsigned int base_idx = 0;
+ for (unsigned int current_idx = 0; current_idx < current->used;
+ ++current_idx)
+ {
+ /* Report missing data on the current CPU as 0. */
+ unsigned long long int current_query
+ = cpuid_query_combined (&current->qr[current_idx].q);
+ while (base_idx < base->used
+ && cpuid_query_combined (&base->qr[base_idx].q) < current_query)
+ {
+ _dl_diagnostics_cpuid_print_query (dci->processor_index,
+ base, base_idx,
+ &cpuid_registers_zero);
+ ++base_idx;
+ }
+
+ if (base_idx < base->used
+ && cpuid_query_combined (&base->qr[base_idx].q) == current_query)
+ {
+ _Static_assert (sizeof (struct cpuid_registers) == 4 * 4,
+ "no padding in struct cpuid_registers");
+ if (current->qr[current_idx].q.ecx_last
+ != base->qr[base_idx].q.ecx_last
+ || memcmp (&current->qr[current_idx].r,
+ &base->qr[base_idx].r,
+ sizeof (struct cpuid_registers)) != 0)
+ /* The ECX range or the values have changed. Show the
+ new values. */
+ _dl_diagnostics_cpuid_print_query (dci->processor_index,
+ current, current_idx,
+ &current->qr[current_idx].r);
+ ++base_idx;
+ }
+ else
+ /* Data is absent in the base reference. Report the new data. */
+ _dl_diagnostics_cpuid_print_query (dci->processor_index,
+ current, current_idx,
+ &current->qr[current_idx].r);
+ }
+
+ if (current->xgetbv_ecx_0 != base->xgetbv_ecx_0)
+ {
+ /* Re-use the 64-bit printing routine. */
+ _dl_printf ("x86.processor[0x%x].", dci->processor_index);
+ _dl_diagnostics_print_labeled_value ("xgetbv.ecx[0x0]",
+ current->xgetbv_ecx_0);
+ }
+}
+
+static void
+_dl_diagnostics_cpuid (void)
+{
+#if !HAS_CPUID
+ /* CPUID is not supported, so there is nothing to dump. */
+ if (__get_cpuid_max (0, 0) == 0)
+ return;
+#endif
+
+ struct dl_iterate_cpu dic;
+ _dl_iterate_cpu_init (&dic);
+
+ /* Two copies of the data are used. Data is written to the index
+ (dic.processor_index & 1). The previous version against which the
+ data dump is reported is at index !(processor_index & 1). */
+ struct cpuid_collected_data ccd[2];
+
+ /* The initial data is presumed to be all zero. Zero results are
+ not recorded. */
+ ccd[1].used = 0;
+ ccd[1].xgetbv_ecx_0 = 0;
+
+ /* Run the CPUID probing on a specific CPU. There are expected
+ differences for encoding core IDs and topology information in
+ CPUID output, but some firmware/kernel bugs also may result in
+ asymmetric data across CPUs in some cases. */
+ while (_dl_iterate_cpu_next (&dic))
+ {
+ _dl_diagnostics_cpuid_collect (&ccd[dic.processor_index & 1]);
+ _dl_diagnostics_cpuid_report
+ (&dic, &ccd[dic.processor_index & 1],
+ &ccd[!(dic.processor_index & 1)]);
+ }
}

146
glibc-RHEL-107540-3.patch Normal file
View File

@ -0,0 +1,146 @@
commit f8d8b1b1e6d3b8b93f224efc796b7ea083fdb83f
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Apr 8 16:48:55 2024 +0200
aarch64: Enhanced CPU diagnostics for ld.so
This prints some information from struct cpu_features, and the midr_el1
and dczid_el0 system register contents on every CPU.
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
diff --git a/manual/dynlink.texi b/manual/dynlink.texi
index f2f2341818fb9d18..d71f7a30d6f46808 100644
--- a/manual/dynlink.texi
+++ b/manual/dynlink.texi
@@ -224,6 +224,40 @@ reflect adjustment by @theglibc{}.
These Linux-specific items show the values of @code{struct utsname}, as
reported by the @code{uname} function. @xref{Platform Type}.
+@item aarch64.cpu_features.@dots{}
+These items are specific to the AArch64 architectures. They report data
+@theglibc{} uses to activate conditionally supported features such as
+BTI and MTE, and to select alternative function implementations.
+
+@item aarch64.processor[@var{index}].@dots{}
+These are additional items for the AArch64 architecture and are
+described below.
+
+@item aarch64.processor[@var{index}].requested=@var{kernel-cpu}
+The kernel is told to run the subsequent probing on the CPU numbered
+@var{kernel-cpu}. The values @var{kernel-cpu} and @var{index} can be
+distinct if there are gaps in the process CPU affinity mask. This line
+is not included if CPU affinity mask information is not available.
+
+@item aarch64.processor[@var{index}].observed=@var{kernel-cpu}
+This line reports the kernel CPU number @var{kernel-cpu} on which the
+probing code initially ran. If the CPU number cannot be obtained,
+this line is not printed.
+
+@item aarch64.processor[@var{index}].observed_node=@var{node}
+This reports the observed NUMA node number, as reported by the
+@code{getcpu} system call. If this information cannot be obtained, this
+line is not printed.
+
+@item aarch64.processor[@var{index}].midr_el1=@var{value}
+The value of the @code{midr_el1} system register on the processor
+@var{index}. This line is only printed if the kernel indicates that
+this system register is supported.
+
+@item aarch64.processor[@var{index}].dczid_el0=@var{value}
+The value of the @code{dczid_el0} system register on the processor
+@var{index}.
+
@cindex CPUID (diagnostics)
@item x86.cpu_features.@dots{}
These items are specific to the i386 and x86-64 architectures. They
diff --git a/sysdeps/aarch64/dl-diagnostics-cpu.c b/sysdeps/aarch64/dl-diagnostics-cpu.c
new file mode 100644
index 0000000000000000..e037e6ea8c43df72
--- /dev/null
+++ b/sysdeps/aarch64/dl-diagnostics-cpu.c
@@ -0,0 +1,84 @@
+/* Print CPU diagnostics data in ld.so. AArch64 version.
+ Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <dl-diagnostics.h>
+
+#include <cpu-features.h>
+#include <dl-iterate_cpu.h>
+#include <ldsodefs.h>
+#include <sys/auxv.h>
+
+static void
+print_cpu_features_value (const char *label, uint64_t value)
+{
+ _dl_printf ("aarch64.cpu_features.");
+ _dl_diagnostics_print_labeled_value (label, value);
+}
+
+static void
+print_per_cpu_value (const struct dl_iterate_cpu *dic,
+ const char *label, uint64_t value)
+{
+ _dl_printf ("aarch64.processor[0x%x].", dic->processor_index);
+ _dl_diagnostics_print_labeled_value (label, value);
+}
+
+void
+_dl_diagnostics_cpu (void)
+{
+ print_cpu_features_value ("bti", GLRO (dl_aarch64_cpu_features).bti);
+ print_cpu_features_value ("midr_el1",
+ GLRO (dl_aarch64_cpu_features).midr_el1);
+ print_cpu_features_value ("mops", GLRO (dl_aarch64_cpu_features).mops);
+ print_cpu_features_value ("mte_state",
+ GLRO (dl_aarch64_cpu_features).mte_state);
+ print_cpu_features_value ("prefer_sve_ifuncs",
+ GLRO (dl_aarch64_cpu_features).prefer_sve_ifuncs);
+ print_cpu_features_value ("sve", GLRO (dl_aarch64_cpu_features).sve);
+ print_cpu_features_value ("zva_size",
+ GLRO (dl_aarch64_cpu_features).zva_size);
+
+ struct dl_iterate_cpu dic;
+ _dl_iterate_cpu_init (&dic);
+
+ while (_dl_iterate_cpu_next (&dic))
+ {
+ if (dic.requested_cpu >= 0)
+ _dl_printf ("aarch64.processor[0x%x].requested=0x%x\n",
+ dic.processor_index, dic.requested_cpu);
+ if (dic.actual_cpu >= 0)
+ _dl_printf ("aarch64.processor[0x%x].observed=0x%x\n",
+ dic.processor_index, dic.actual_cpu);
+ if (dic.actual_node >= 0)
+ _dl_printf ("aarch64.processor[0x%x].observed_node=0x%x\n",
+ dic.processor_index, dic.actual_node);
+
+ if (GLRO (dl_hwcap) & HWCAP_CPUID)
+ {
+ uint64_t midr_el1;
+ asm ("mrs %0, midr_el1" : "=r" (midr_el1));
+ print_per_cpu_value (&dic, "midr_el1", midr_el1);
+ }
+
+ {
+ uint64_t dczid_el0;
+ asm ("mrs %0, dczid_el0" : "=r" (dczid_el0));
+ print_per_cpu_value (&dic, "dczid_el0", dczid_el0);
+ }
+ }
+}

812
glibc-RHEL-107695-1.patch Normal file
View File

@ -0,0 +1,812 @@
commit 3de2f8755c6c036dcd0b1f4acd6bcdefe0e775c0
Author: Joseph Myers <josmyers@redhat.com>
Date: Wed Mar 13 13:57:56 2024 +0000
Update syscall lists for Linux 6.8
Linux 6.8 adds five new syscalls. Update syscall-names.list and
regenerate the arch-syscall.h headers with build-many-glibcs.py
update-syscalls.
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
index 1713897f85551c50..7ee8a2167aaae172 100644
--- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
@@ -122,12 +122,16 @@
#define __NR_lgetxattr 9
#define __NR_linkat 37
#define __NR_listen 201
+#define __NR_listmount 458
#define __NR_listxattr 11
#define __NR_llistxattr 12
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
#define __NR_lseek 62
#define __NR_lsetxattr 6
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_madvise 233
#define __NR_map_shadow_stack 453
#define __NR_mbind 235
@@ -276,6 +280,7 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs 43
+#define __NR_statmount 457
#define __NR_statx 291
#define __NR_swapoff 225
#define __NR_swapon 224
diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
index 5457d2d8ae45e8ec..0f4ea7670be610be 100644
--- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
@@ -150,12 +150,16 @@
#define __NR_link 9
#define __NR_linkat 458
#define __NR_listen 106
+#define __NR_listmount 568
#define __NR_listxattr 388
#define __NR_llistxattr 389
#define __NR_lookup_dcookie 406
#define __NR_lremovexattr 392
#define __NR_lseek 19
#define __NR_lsetxattr 383
+#define __NR_lsm_get_self_attr 569
+#define __NR_lsm_list_modules 571
+#define __NR_lsm_set_self_attr 570
#define __NR_lstat 68
#define __NR_lstat64 426
#define __NR_madvise 75
@@ -441,6 +445,7 @@
#define __NR_stat64 425
#define __NR_statfs 328
#define __NR_statfs64 528
+#define __NR_statmount 567
#define __NR_statx 522
#define __NR_swapoff 304
#define __NR_swapon 322
diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
index a66471c83ae56383..90359482a814b3f8 100644
--- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
@@ -126,12 +126,16 @@
#define __NR_lgetxattr 9
#define __NR_linkat 37
#define __NR_listen 201
+#define __NR_listmount 458
#define __NR_listxattr 11
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
#define __NR_lsetxattr 6
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_madvise 233
#define __NR_map_shadow_stack 453
#define __NR_mbind 235
@@ -278,6 +282,7 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs64 43
+#define __NR_statmount 457
#define __NR_statx 291
#define __NR_swapoff 225
#define __NR_swapon 224
diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
index 74a57f4520dab365..4930167a03c97df2 100644
--- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
@@ -164,12 +164,16 @@
#define __NR_link 9
#define __NR_linkat 330
#define __NR_listen 284
+#define __NR_listmount 458
#define __NR_listxattr 232
#define __NR_llistxattr 233
#define __NR_lookup_dcookie 249
#define __NR_lremovexattr 236
#define __NR_lseek 19
#define __NR_lsetxattr 227
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_lstat64 196
#define __NR_madvise 220
@@ -361,6 +365,7 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 266
+#define __NR_statmount 457
#define __NR_statx 397
#define __NR_swapoff 115
#define __NR_swapon 87
diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
index ba7632e0182573d0..3f16a29f5753e7a8 100644
--- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
@@ -131,12 +131,16 @@
#define __NR_lgetxattr 9
#define __NR_linkat 37
#define __NR_listen 201
+#define __NR_listmount 458
#define __NR_listxattr 11
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
#define __NR_lsetxattr 6
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_madvise 233
#define __NR_map_shadow_stack 453
#define __NR_mbind 235
@@ -291,6 +295,7 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs64 43
+#define __NR_statmount 457
#define __NR_statx 291
#define __NR_swapoff 225
#define __NR_swapon 224
diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
index 483706de9bec060c..a1b2c819d6522018 100644
--- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
@@ -155,12 +155,16 @@
#define __NR_link 9
#define __NR_linkat 283
#define __NR_listen 32
+#define __NR_listmount 458
#define __NR_listxattr 244
#define __NR_llistxattr 245
#define __NR_lookup_dcookie 223
#define __NR_lremovexattr 248
#define __NR_lseek 19
#define __NR_lsetxattr 239
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 84
#define __NR_lstat64 198
#define __NR_madvise 119
@@ -339,6 +343,7 @@
#define __NR_stat64 101
#define __NR_statfs 99
#define __NR_statfs64 298
+#define __NR_statmount 457
#define __NR_statx 349
#define __NR_stime 25
#define __NR_swapoff 115
diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
index 21c1308bb327a1b3..cc775432d663a745 100644
--- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
@@ -176,6 +176,7 @@
#define __NR_link 9
#define __NR_linkat 303
#define __NR_listen 363
+#define __NR_listmount 458
#define __NR_listxattr 232
#define __NR_llistxattr 233
#define __NR_lock 53
@@ -183,6 +184,9 @@
#define __NR_lremovexattr 236
#define __NR_lseek 19
#define __NR_lsetxattr 227
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_lstat64 196
#define __NR_madvise 219
@@ -386,6 +390,7 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 268
+#define __NR_statmount 457
#define __NR_statx 383
#define __NR_stime 25
#define __NR_stty 31
diff --git a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
index f6a434630ebaa542..56bb08718ad32c04 100644
--- a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
@@ -120,12 +120,16 @@
#define __NR_lgetxattr 9
#define __NR_linkat 37
#define __NR_listen 201
+#define __NR_listmount 458
#define __NR_listxattr 11
#define __NR_llistxattr 12
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
#define __NR_lseek 62
#define __NR_lsetxattr 6
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_madvise 233
#define __NR_map_shadow_stack 453
#define __NR_mbind 235
@@ -270,6 +274,7 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs 43
+#define __NR_statmount 457
#define __NR_statx 291
#define __NR_swapoff 225
#define __NR_swapon 224
diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
index 6d788e3440b1082c..79f277dd5b8eda7b 100644
--- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
@@ -171,12 +171,16 @@
#define __NR_link 9
#define __NR_linkat 296
#define __NR_listen 360
+#define __NR_listmount 458
#define __NR_listxattr 229
#define __NR_llistxattr 230
#define __NR_lookup_dcookie 248
#define __NR_lremovexattr 233
#define __NR_lseek 19
#define __NR_lsetxattr 224
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_lstat64 196
#define __NR_madvise 238
@@ -373,6 +377,7 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 263
+#define __NR_statmount 457
#define __NR_statx 379
#define __NR_stime 25
#define __NR_swapoff 115
diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
index 91e1630f7b2e07a4..779d5d5d7029d8ff 100644
--- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
@@ -176,6 +176,7 @@
#define __NR_link 9
#define __NR_linkat 303
#define __NR_listen 348
+#define __NR_listmount 458
#define __NR_listxattr 232
#define __NR_llistxattr 233
#define __NR_lock 53
@@ -183,6 +184,9 @@
#define __NR_lremovexattr 236
#define __NR_lseek 19
#define __NR_lsetxattr 227
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_lstat64 196
#define __NR_madvise 219
@@ -389,6 +393,7 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 268
+#define __NR_statmount 457
#define __NR_statx 398
#define __NR_stime 25
#define __NR_stty 31
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
index d75af9746764cc0a..86ffd5ce84556c20 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
@@ -166,6 +166,7 @@
#define __NR_link 4009
#define __NR_linkat 4296
#define __NR_listen 4174
+#define __NR_listmount 4458
#define __NR_listxattr 4230
#define __NR_llistxattr 4231
#define __NR_lock 4053
@@ -173,6 +174,9 @@
#define __NR_lremovexattr 4234
#define __NR_lseek 4019
#define __NR_lsetxattr 4225
+#define __NR_lsm_get_self_attr 4459
+#define __NR_lsm_list_modules 4461
+#define __NR_lsm_set_self_attr 4460
#define __NR_lstat 4107
#define __NR_lstat64 4214
#define __NR_madvise 4218
@@ -362,6 +366,7 @@
#define __NR_stat64 4213
#define __NR_statfs 4099
#define __NR_statfs64 4255
+#define __NR_statmount 4457
#define __NR_statx 4366
#define __NR_stime 4025
#define __NR_stty 4031
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
index 05bf7d251da60f51..5d37a686e511a499 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
@@ -154,12 +154,16 @@
#define __NR_link 6084
#define __NR_linkat 6259
#define __NR_listen 6049
+#define __NR_listmount 6458
#define __NR_listxattr 6186
#define __NR_llistxattr 6187
#define __NR_lookup_dcookie 6206
#define __NR_lremovexattr 6190
#define __NR_lseek 6008
#define __NR_lsetxattr 6181
+#define __NR_lsm_get_self_attr 6459
+#define __NR_lsm_list_modules 6461
+#define __NR_lsm_set_self_attr 6460
#define __NR_lstat 6006
#define __NR_madvise 6027
#define __NR_map_shadow_stack 6453
@@ -332,6 +336,7 @@
#define __NR_stat 6004
#define __NR_statfs 6134
#define __NR_statfs64 6217
+#define __NR_statmount 6457
#define __NR_statx 6330
#define __NR_swapoff 6163
#define __NR_swapon 6162
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
index 41ffaf32550a6609..9b1e846e7646d791 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
@@ -145,12 +145,16 @@
#define __NR_link 5084
#define __NR_linkat 5255
#define __NR_listen 5049
+#define __NR_listmount 5458
#define __NR_listxattr 5186
#define __NR_llistxattr 5187
#define __NR_lookup_dcookie 5206
#define __NR_lremovexattr 5190
#define __NR_lseek 5008
#define __NR_lsetxattr 5181
+#define __NR_lsm_get_self_attr 5459
+#define __NR_lsm_list_modules 5461
+#define __NR_lsm_set_self_attr 5460
#define __NR_lstat 5006
#define __NR_madvise 5027
#define __NR_map_shadow_stack 5453
@@ -313,6 +317,7 @@
#define __NR_splice 5263
#define __NR_stat 5004
#define __NR_statfs 5134
+#define __NR_statmount 5457
#define __NR_statx 5326
#define __NR_swapoff 5163
#define __NR_swapon 5162
diff --git a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
index d94e7e9ee987a349..abbc9ab6b083be80 100644
--- a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
@@ -130,12 +130,16 @@
#define __NR_lgetxattr 9
#define __NR_linkat 37
#define __NR_listen 201
+#define __NR_listmount 458
#define __NR_listxattr 11
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
#define __NR_lsetxattr 6
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_madvise 233
#define __NR_map_shadow_stack 453
#define __NR_mbind 235
@@ -290,6 +294,7 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs64 43
+#define __NR_statmount 457
#define __NR_statx 291
#define __NR_swapoff 225
#define __NR_swapon 224
diff --git a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
index 39295a6f94c6f5b0..7223a93673d9c6f7 100644
--- a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
@@ -130,12 +130,16 @@
#define __NR_lgetxattr 9
#define __NR_linkat 37
#define __NR_listen 201
+#define __NR_listmount 458
#define __NR_listxattr 11
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
#define __NR_lsetxattr 6
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_madvise 233
#define __NR_map_shadow_stack 453
#define __NR_mbind 235
@@ -291,6 +295,7 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs64 43
+#define __NR_statmount 457
#define __NR_statx 291
#define __NR_swapoff 225
#define __NR_swapon 224
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
index b5522e8889d505a8..af0d2b121ebc7dc7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
@@ -166,6 +166,7 @@
#define __NR_link 9
#define __NR_linkat 294
#define __NR_listen 329
+#define __NR_listmount 458
#define __NR_listxattr 215
#define __NR_llistxattr 216
#define __NR_lock 53
@@ -173,6 +174,9 @@
#define __NR_lremovexattr 219
#define __NR_lseek 19
#define __NR_lsetxattr 210
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_lstat64 196
#define __NR_madvise 205
@@ -374,6 +378,7 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 252
+#define __NR_statmount 457
#define __NR_statx 383
#define __NR_stime 25
#define __NR_stty 31
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
index 162d782ae6f48975..a4c70aa7fe719cb9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
@@ -154,6 +154,7 @@
#define __NR_link 9
#define __NR_linkat 294
#define __NR_listen 329
+#define __NR_listmount 458
#define __NR_listxattr 215
#define __NR_llistxattr 216
#define __NR_lock 53
@@ -161,6 +162,9 @@
#define __NR_lremovexattr 219
#define __NR_lseek 19
#define __NR_lsetxattr 210
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_madvise 205
#define __NR_map_shadow_stack 453
@@ -352,6 +356,7 @@
#define __NR_stat 106
#define __NR_statfs 99
#define __NR_statfs64 252
+#define __NR_statmount 457
#define __NR_statx 383
#define __NR_stime 25
#define __NR_stty 31
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
index 013222e5deb65c8d..7315d164d64c89fa 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
@@ -117,12 +117,16 @@
#define __NR_lgetxattr 9
#define __NR_linkat 37
#define __NR_listen 201
+#define __NR_listmount 458
#define __NR_listxattr 11
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
#define __NR_lsetxattr 6
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_madvise 233
#define __NR_map_shadow_stack 453
#define __NR_mbind 235
@@ -268,6 +272,7 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs64 43
+#define __NR_statmount 457
#define __NR_statx 291
#define __NR_swapoff 225
#define __NR_swapon 224
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
index d03dad82008fb2a1..31a1130db9404e60 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
@@ -122,12 +122,16 @@
#define __NR_lgetxattr 9
#define __NR_linkat 37
#define __NR_listen 201
+#define __NR_listmount 458
#define __NR_listxattr 11
#define __NR_llistxattr 12
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
#define __NR_lseek 62
#define __NR_lsetxattr 6
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_madvise 233
#define __NR_map_shadow_stack 453
#define __NR_mbind 235
@@ -277,6 +281,7 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs 43
+#define __NR_statmount 457
#define __NR_statx 291
#define __NR_swapoff 225
#define __NR_swapon 224
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
index 98e6b68b3153b89b..cf8569304d9e6a16 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
@@ -171,12 +171,16 @@
#define __NR_link 9
#define __NR_linkat 296
#define __NR_listen 363
+#define __NR_listmount 458
#define __NR_listxattr 230
#define __NR_llistxattr 231
#define __NR_lookup_dcookie 110
#define __NR_lremovexattr 234
#define __NR_lseek 19
#define __NR_lsetxattr 225
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_lstat64 196
#define __NR_madvise 219
@@ -372,6 +376,7 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 265
+#define __NR_statmount 457
#define __NR_statx 379
#define __NR_stime 25
#define __NR_swapoff 115
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
index 951fbd7c97ff71d3..f3536ed03f4b7d85 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
@@ -146,12 +146,16 @@
#define __NR_link 9
#define __NR_linkat 296
#define __NR_listen 363
+#define __NR_listmount 458
#define __NR_listxattr 230
#define __NR_llistxattr 231
#define __NR_lookup_dcookie 110
#define __NR_lremovexattr 234
#define __NR_lseek 19
#define __NR_lsetxattr 225
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_madvise 219
#define __NR_map_shadow_stack 453
@@ -329,6 +333,7 @@
#define __NR_stat 106
#define __NR_statfs 99
#define __NR_statfs64 265
+#define __NR_statmount 457
#define __NR_statx 379
#define __NR_swapoff 115
#define __NR_swapon 87
diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
index 6b4418bcae4390ae..0c88bf10c77bef3a 100644
--- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
@@ -164,12 +164,16 @@
#define __NR_link 9
#define __NR_linkat 303
#define __NR_listen 343
+#define __NR_listmount 458
#define __NR_listxattr 232
#define __NR_llistxattr 233
#define __NR_lookup_dcookie 253
#define __NR_lremovexattr 236
#define __NR_lseek 19
#define __NR_lsetxattr 227
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 107
#define __NR_lstat64 196
#define __NR_madvise 219
@@ -365,6 +369,7 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 268
+#define __NR_statmount 457
#define __NR_statx 383
#define __NR_stime 25
#define __NR_swapoff 115
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
index 4f9460b1a3e1a353..19fa614624dc2b85 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
@@ -169,12 +169,16 @@
#define __NR_link 9
#define __NR_linkat 292
#define __NR_listen 354
+#define __NR_listmount 458
#define __NR_listxattr 178
#define __NR_llistxattr 179
#define __NR_lookup_dcookie 208
#define __NR_lremovexattr 182
#define __NR_lseek 19
#define __NR_lsetxattr 170
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 40
#define __NR_lstat64 132
#define __NR_madvise 75
@@ -370,6 +374,7 @@
#define __NR_stat64 139
#define __NR_statfs 157
#define __NR_statfs64 234
+#define __NR_statmount 457
#define __NR_statx 360
#define __NR_stime 233
#define __NR_swapoff 213
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
index 129ce50646596a95..18516f20cbf25d77 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
@@ -152,12 +152,16 @@
#define __NR_link 9
#define __NR_linkat 292
#define __NR_listen 354
+#define __NR_listmount 458
#define __NR_listxattr 178
#define __NR_llistxattr 179
#define __NR_lookup_dcookie 208
#define __NR_lremovexattr 182
#define __NR_lseek 19
#define __NR_lsetxattr 170
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 40
#define __NR_lstat64 132
#define __NR_madvise 75
@@ -339,6 +343,7 @@
#define __NR_stat64 139
#define __NR_statfs 157
#define __NR_statfs64 234
+#define __NR_statmount 457
#define __NR_statx 360
#define __NR_stime 233
#define __NR_swapoff 213
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index aac065e7b327528e..6557bcfde4636158 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -21,8 +21,8 @@
# This file can list all potential system calls. The names are only
# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 6.7.
-kernel 6.7
+# The list of system calls is current as of Linux 6.8.
+kernel 6.8
FAST_atomic_update
FAST_cmpxchg
@@ -239,6 +239,7 @@ lgetxattr
link
linkat
listen
+listmount
listxattr
llistxattr
llseek
@@ -247,6 +248,9 @@ lookup_dcookie
lremovexattr
lseek
lsetxattr
+lsm_get_self_attr
+lsm_list_modules
+lsm_set_self_attr
lstat
lstat64
madvise
@@ -593,6 +597,7 @@ stat
stat64
statfs
statfs64
+statmount
statx
stime
stty
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
index 4fa5b942c5f8e9b7..b1222160135310ec 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
@@ -149,12 +149,16 @@
#define __NR_link 86
#define __NR_linkat 265
#define __NR_listen 50
+#define __NR_listmount 458
#define __NR_listxattr 194
#define __NR_llistxattr 195
#define __NR_lookup_dcookie 212
#define __NR_lremovexattr 198
#define __NR_lseek 8
#define __NR_lsetxattr 189
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_list_modules 461
+#define __NR_lsm_set_self_attr 460
#define __NR_lstat 6
#define __NR_madvise 28
#define __NR_map_shadow_stack 453
@@ -321,6 +325,7 @@
#define __NR_splice 275
#define __NR_stat 4
#define __NR_statfs 137
+#define __NR_statmount 457
#define __NR_statx 332
#define __NR_swapoff 168
#define __NR_swapon 167
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
index 645e85802f95a78c..df3e22236dd3bb0e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
@@ -143,12 +143,16 @@
#define __NR_link 1073741910
#define __NR_linkat 1073742089
#define __NR_listen 1073741874
+#define __NR_listmount 1073742282
#define __NR_listxattr 1073742018
#define __NR_llistxattr 1073742019
#define __NR_lookup_dcookie 1073742036
#define __NR_lremovexattr 1073742022
#define __NR_lseek 1073741832
#define __NR_lsetxattr 1073742013
+#define __NR_lsm_get_self_attr 1073742283
+#define __NR_lsm_list_modules 1073742285
+#define __NR_lsm_set_self_attr 1073742284
#define __NR_lstat 1073741830
#define __NR_madvise 1073741852
#define __NR_map_shadow_stack 1073742277
@@ -313,6 +317,7 @@
#define __NR_splice 1073742099
#define __NR_stat 1073741828
#define __NR_statfs 1073741961
+#define __NR_statmount 1073742281
#define __NR_statx 1073742156
#define __NR_swapoff 1073741992
#define __NR_swapon 1073741991

View File

@ -0,0 +1,59 @@
commit 86f06282ccb1b11de7a07fc10f7b77991b7d121a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Oct 8 15:45:25 2024 -0300
Update PIDFD_* constants for Linux 6.11
Linux 6.11 adds some more PIDFD_* constants for 'pidfs: allow retrieval
of namespace file descriptors'
(5b08bd408534bfb3a7cf5778da5b27d4e4fffe12).
Tested with build-many-glibcs.py.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
diff --git a/sysdeps/unix/sysv/linux/sys/pidfd.h b/sysdeps/unix/sysv/linux/sys/pidfd.h
index 9f88d297e884c348..85d976939b6f01fa 100644
--- a/sysdeps/unix/sysv/linux/sys/pidfd.h
+++ b/sysdeps/unix/sysv/linux/sys/pidfd.h
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <bits/types/siginfo_t.h>
+#include <sys/ioctl.h>
#define PIDFD_NONBLOCK O_NONBLOCK
#define PIDFD_THREAD O_EXCL
@@ -28,6 +29,19 @@
#define PIDFD_SIGNAL_THREAD_GROUP (1UL << 1)
#define PIDFD_SIGNAL_PROCESS_GROUP (1UL << 2)
+#define PIDFS_IOCTL_MAGIC 0xFF
+
+#define PIDFD_GET_CGROUP_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 1)
+#define PIDFD_GET_IPC_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 2)
+#define PIDFD_GET_MNT_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 3)
+#define PIDFD_GET_NET_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 4)
+#define PIDFD_GET_PID_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 5)
+#define PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 6)
+#define PIDFD_GET_TIME_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 7)
+#define PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 8)
+#define PIDFD_GET_USER_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 9)
+#define PIDFD_GET_UTS_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 10)
+
/* Returns a file descriptor that refers to the process PID. The
close-on-exec is set on the file descriptor. */
extern int pidfd_open (__pid_t __pid, unsigned int __flags) __THROW;
diff --git a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
index 9824fd214d477fd0..9d53102cbd73dc84 100644
--- a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
@@ -39,7 +39,7 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 10)
+ linux_version_glibc = (6, 11)
sys.exit(glibcextract.compare_macro_consts(
'#include <sys/pidfd.h>\n',
'#include <asm/fcntl.h>\n'

View File

@ -0,0 +1,61 @@
commit f6e849fd7ce2a8954022bd23b94703975b3db0d1
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Oct 8 15:45:26 2024 -0300
linux: Add MAP_DROPPABLE from Linux 6.11
This request the page to be never written out to swap, it will be zeroed
under memory pressure (so kernel can just drop the page), it is inherited
by fork, it is not counted against @code{mlock} budget, and if there is
no enough memory to service a page faults there is no fatal error (so not
signal is sent).
Tested with build-many-glibcs.py.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
diff --git a/manual/llio.texi b/manual/llio.texi
index 17fe1181d5cc2cef..a8ed72c5db6ecba9 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -1647,6 +1647,15 @@ The @code{MAP_HUGETLB} flag is specific to Linux.
@c user programs (and I don't understand the last two). MAP_LOCKED does
@c not appear to be implemented.
+@item MAP_DROPPABLE
+Request the page to be never written out to swap, it will be zeroed
+under memory pressure (so kernel can just drop the page), it is inherited
+by fork, it is not counted against @code{mlock} budget, and if there is
+not enough memory to service a page fault there is no fatal error (so no
+signal is sent).
+
+The @code{MAP_DROPPABLE} flag is specific to Linux.
+
@end vtable
@code{mmap} returns the address of the new mapping, or
diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h
index 522333c50a04481d..161a88509682cf69 100644
--- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
+++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
@@ -43,6 +43,7 @@
#define MAP_PRIVATE 0x02 /* Changes are private. */
#define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate
extension flags. */
+#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */
#define MAP_TYPE 0x0f /* Mask for type of mapping. */
/* Other flags. */
diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
index a1137eb1d59d95ec..2191bea36f8f69e0 100644
--- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 10)
+ linux_version_glibc = (6, 11)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sys/mman.h>\n',

View File

@ -0,0 +1,41 @@
commit 934d0bf426ffa58f88cebd219b08742ca21e3365
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Oct 8 15:45:27 2024 -0300
Update kernel version to 6.11 in header constant tests
This patch updates the kernel version in the tests tst-mount-consts.py,
and tst-sched-consts.py to 6.11.
There are no new constants covered by these tests in 6.11.
Tested with build-many-glibcs.py.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py
index 675f1790b64dd34e..b71d8a489daf0865 100755
--- a/sysdeps/unix/sysv/linux/tst-mount-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py
@@ -42,7 +42,7 @@ def main():
# Constants in glibc were updated to match Linux v6.10. When glibc
# constants are updated this value should be updated to match the
# released kernel version from which the constants were taken.
- linux_version_glibc = (6, 10)
+ linux_version_glibc = (6, 11)
def check(cte, exclude=None):
return glibcextract.compare_macro_consts(
'#include <sys/mount.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-sched-consts.py b/sysdeps/unix/sysv/linux/tst-sched-consts.py
index 70071dcd974fe064..f06ac400bddc7339 100644
--- a/sysdeps/unix/sysv/linux/tst-sched-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-sched-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 10)
+ linux_version_glibc = (6, 11)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sched.h>\n',

View File

@ -0,0 +1,26 @@
commit e0a0fd64b5b223fce87061fe23dbb0b30053060c
Author: Joseph Myers <josmyers@redhat.com>
Date: Wed Dec 18 15:12:36 2024 +0000
Update syscall lists for Linux 6.12
Linux 6.12 has no new syscalls. Update the version number in
syscall-names.list to reflect that it is still current for 6.12.
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index aa5b479e2a08e7bb..d31938a002629784 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -21,8 +21,8 @@
# This file can list all potential system calls. The names are only
# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 6.11.
-kernel 6.11
+# The list of system calls is current as of Linux 6.12.
+kernel 6.12
FAST_atomic_update
FAST_cmpxchg

View File

@ -0,0 +1,57 @@
commit 5fcee06dc7f368770c17f9a69b59fa68119a1cec
Author: Joseph Myers <josmyers@redhat.com>
Date: Thu Dec 19 15:38:59 2024 +0000
Update kernel version to 6.12 in header constant tests
There are no new constants covered by tst-mman-consts.py,
tst-mount-consts.py or tst-pidfd-consts.py in Linux 6.12 that need any
header changes, so update the kernel version in those tests.
(tst-sched-consts.py will need updating separately along with adding
SCHED_EXT.)
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
index 2191bea36f8f69e0..584936efecbf7755 100644
--- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 11)
+ linux_version_glibc = (6, 12)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sys/mman.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py
index b71d8a489daf0865..e77579033b0fd8ec 100755
--- a/sysdeps/unix/sysv/linux/tst-mount-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py
@@ -39,10 +39,10 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- # Constants in glibc were updated to match Linux v6.10. When glibc
+ # Constants in glibc were updated to match Linux v6.12. When glibc
# constants are updated this value should be updated to match the
# released kernel version from which the constants were taken.
- linux_version_glibc = (6, 11)
+ linux_version_glibc = (6, 12)
def check(cte, exclude=None):
return glibcextract.compare_macro_consts(
'#include <sys/mount.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
index 9d53102cbd73dc84..ef896394bdb12a25 100644
--- a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
@@ -39,7 +39,7 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 11)
+ linux_version_glibc = (6, 12)
sys.exit(glibcextract.compare_macro_consts(
'#include <sys/pidfd.h>\n',
'#include <asm/fcntl.h>\n'

View File

@ -0,0 +1,36 @@
commit 29ae632e76e5dcb89bdbb38402af47a5040fe1d4
Author: Joseph Myers <josmyers@redhat.com>
Date: Thu Dec 19 17:08:38 2024 +0000
Add SCHED_EXT from Linux 6.12 to bits/sched.h
Linux 6.12 adds the SCHED_EXT constant. Add it to glibc's
bits/sched.h and update the kernel version in tst-sched-consts.py.
Tested for x86_64.
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index 7c75303b80c18de2..e60cb05a60027a30 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -34,6 +34,7 @@
# define SCHED_ISO 4
# define SCHED_IDLE 5
# define SCHED_DEADLINE 6
+# define SCHED_EXT 7
/* Flags that can be used in policy values. */
# define SCHED_RESET_ON_FORK 0x40000000
diff --git a/sysdeps/unix/sysv/linux/tst-sched-consts.py b/sysdeps/unix/sysv/linux/tst-sched-consts.py
index f06ac400bddc7339..6a5b837334ab45f8 100644
--- a/sysdeps/unix/sysv/linux/tst-sched-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-sched-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 11)
+ linux_version_glibc = (6, 12)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sched.h>\n',

959
glibc-RHEL-107695-16.patch Normal file
View File

@ -0,0 +1,959 @@
commit eea6f1e079a301dfd5c7b7f4faf38b4d6e7ea059
Author: Joseph Myers <josmyers@redhat.com>
Date: Wed Mar 12 12:51:28 2025 +0000
Update syscall lists for Linux 6.13
Linux 6.13 adds four new syscalls. Update syscall-names.list and
regenerate the arch-syscall.h headers with build-many-glibcs.py
update-syscalls.
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
index 19b6316cb6ffae26..89aced0b453609e3 100644
--- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
@@ -95,6 +95,7 @@
#define __NR_gettimeofday 169
#define __NR_getuid 174
#define __NR_getxattr 8
+#define __NR_getxattrat 464
#define __NR_init_module 105
#define __NR_inotify_add_watch 27
#define __NR_inotify_init1 26
@@ -124,6 +125,7 @@
#define __NR_listen 201
#define __NR_listmount 458
#define __NR_listxattr 11
+#define __NR_listxattrat 465
#define __NR_llistxattr 12
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
@@ -212,6 +214,7 @@
#define __NR_recvmsg 212
#define __NR_remap_file_pages 234
#define __NR_removexattr 14
+#define __NR_removexattrat 466
#define __NR_renameat 38
#define __NR_renameat2 276
#define __NR_request_key 218
@@ -270,6 +273,7 @@
#define __NR_settimeofday 170
#define __NR_setuid 146
#define __NR_setxattr 5
+#define __NR_setxattrat 463
#define __NR_shmat 196
#define __NR_shmctl 195
#define __NR_shmdt 197
diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
index 216a5575c69d0ff3..455da93b478ab037 100644
--- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
@@ -119,6 +119,7 @@
#define __NR_gettimeofday 359
#define __NR_getuid 24
#define __NR_getxattr 385
+#define __NR_getxattrat 574
#define __NR_getxgid 47
#define __NR_getxpid 20
#define __NR_getxuid 24
@@ -153,6 +154,7 @@
#define __NR_listen 106
#define __NR_listmount 568
#define __NR_listxattr 388
+#define __NR_listxattrat 575
#define __NR_llistxattr 389
#define __NR_lookup_dcookie 406
#define __NR_lremovexattr 392
@@ -364,6 +366,7 @@
#define __NR_recvmsg 113
#define __NR_remap_file_pages 410
#define __NR_removexattr 391
+#define __NR_removexattrat 576
#define __NR_rename 128
#define __NR_renameat 457
#define __NR_renameat2 510
@@ -428,6 +431,7 @@
#define __NR_settimeofday 360
#define __NR_setuid 23
#define __NR_setxattr 382
+#define __NR_setxattrat 573
#define __NR_shmat 209
#define __NR_shmctl 210
#define __NR_shmdt 211
diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
index ea581b0a6dc0f2d4..01075e8cdfd7cd30 100644
--- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
@@ -98,6 +98,7 @@
#define __NR_gettimeofday 169
#define __NR_getuid 174
#define __NR_getxattr 8
+#define __NR_getxattrat 464
#define __NR_init_module 105
#define __NR_inotify_add_watch 27
#define __NR_inotify_init1 26
@@ -128,6 +129,7 @@
#define __NR_listen 201
#define __NR_listmount 458
#define __NR_listxattr 11
+#define __NR_listxattrat 465
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
@@ -214,6 +216,7 @@
#define __NR_recvmsg 212
#define __NR_remap_file_pages 234
#define __NR_removexattr 14
+#define __NR_removexattrat 466
#define __NR_renameat 38
#define __NR_renameat2 276
#define __NR_request_key 218
@@ -272,6 +275,7 @@
#define __NR_settimeofday 170
#define __NR_setuid 146
#define __NR_setxattr 5
+#define __NR_setxattrat 463
#define __NR_shmat 196
#define __NR_shmctl 195
#define __NR_shmdt 197
diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
index 2809f52f94e9ee16..97044727fc1e24bf 100644
--- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
@@ -132,6 +132,7 @@
#define __NR_getuid 24
#define __NR_getuid32 199
#define __NR_getxattr 229
+#define __NR_getxattrat 464
#define __NR_init_module 128
#define __NR_inotify_add_watch 317
#define __NR_inotify_init 316
@@ -166,6 +167,7 @@
#define __NR_listen 284
#define __NR_listmount 458
#define __NR_listxattr 232
+#define __NR_listxattrat 465
#define __NR_llistxattr 233
#define __NR_lookup_dcookie 249
#define __NR_lremovexattr 236
@@ -271,6 +273,7 @@
#define __NR_recvmsg 297
#define __NR_remap_file_pages 253
#define __NR_removexattr 235
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 329
#define __NR_renameat2 382
@@ -346,6 +349,7 @@
#define __NR_setuid 23
#define __NR_setuid32 213
#define __NR_setxattr 226
+#define __NR_setxattrat 463
#define __NR_shmat 305
#define __NR_shmctl 308
#define __NR_shmdt 306
diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
index ede3551a00dc81c6..a719a55647383d4e 100644
--- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
@@ -103,6 +103,7 @@
#define __NR_gettimeofday 169
#define __NR_getuid 174
#define __NR_getxattr 8
+#define __NR_getxattrat 464
#define __NR_init_module 105
#define __NR_inotify_add_watch 27
#define __NR_inotify_init1 26
@@ -133,6 +134,7 @@
#define __NR_listen 201
#define __NR_listmount 458
#define __NR_listxattr 11
+#define __NR_listxattrat 465
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
@@ -224,6 +226,7 @@
#define __NR_recvmsg 212
#define __NR_remap_file_pages 234
#define __NR_removexattr 14
+#define __NR_removexattrat 466
#define __NR_renameat2 276
#define __NR_request_key 218
#define __NR_restart_syscall 128
@@ -285,6 +288,7 @@
#define __NR_settimeofday 170
#define __NR_setuid 146
#define __NR_setxattr 5
+#define __NR_setxattrat 463
#define __NR_shmat 196
#define __NR_shmctl 195
#define __NR_shmdt 197
diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
index 08b153f2ccdf6f45..dc592c58364a1804 100644
--- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
@@ -124,6 +124,7 @@
#define __NR_gettimeofday 78
#define __NR_getuid 24
#define __NR_getxattr 241
+#define __NR_getxattrat 464
#define __NR_init_module 128
#define __NR_inotify_add_watch 270
#define __NR_inotify_init 269
@@ -157,6 +158,7 @@
#define __NR_listen 32
#define __NR_listmount 458
#define __NR_listxattr 244
+#define __NR_listxattrat 465
#define __NR_llistxattr 245
#define __NR_lookup_dcookie 223
#define __NR_lremovexattr 248
@@ -259,6 +261,7 @@
#define __NR_recvmsg 184
#define __NR_remap_file_pages 227
#define __NR_removexattr 247
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 282
#define __NR_renameat2 337
@@ -324,6 +327,7 @@
#define __NR_settimeofday 79
#define __NR_setuid 23
#define __NR_setxattr 238
+#define __NR_setxattrat 463
#define __NR_sgetmask 68
#define __NR_shmat 192
#define __NR_shmctl 195
diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
index 500ca1ec70e2c5fc..c10897f7b032c9fb 100644
--- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
@@ -140,6 +140,7 @@
#define __NR_getuid 24
#define __NR_getuid32 199
#define __NR_getxattr 229
+#define __NR_getxattrat 464
#define __NR_gtty 32
#define __NR_idle 112
#define __NR_init_module 128
@@ -178,6 +179,7 @@
#define __NR_listen 363
#define __NR_listmount 458
#define __NR_listxattr 232
+#define __NR_listxattrat 465
#define __NR_llistxattr 233
#define __NR_lock 53
#define __NR_lookup_dcookie 253
@@ -294,6 +296,7 @@
#define __NR_recvmsg 372
#define __NR_remap_file_pages 257
#define __NR_removexattr 235
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 302
#define __NR_renameat2 353
@@ -367,6 +370,7 @@
#define __NR_setuid 23
#define __NR_setuid32 213
#define __NR_setxattr 226
+#define __NR_setxattrat 463
#define __NR_sgetmask 68
#define __NR_shmat 397
#define __NR_shmctl 396
diff --git a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
index 7e732256fd4c6da7..a0d0d91a09fa57fb 100644
--- a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
@@ -94,6 +94,7 @@
#define __NR_gettimeofday 169
#define __NR_getuid 174
#define __NR_getxattr 8
+#define __NR_getxattrat 464
#define __NR_init_module 105
#define __NR_inotify_add_watch 27
#define __NR_inotify_init1 26
@@ -123,6 +124,7 @@
#define __NR_listen 201
#define __NR_listmount 458
#define __NR_listxattr 11
+#define __NR_listxattrat 465
#define __NR_llistxattr 12
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
@@ -210,6 +212,7 @@
#define __NR_recvmsg 212
#define __NR_remap_file_pages 234
#define __NR_removexattr 14
+#define __NR_removexattrat 466
#define __NR_renameat2 276
#define __NR_request_key 218
#define __NR_restart_syscall 128
@@ -266,6 +269,7 @@
#define __NR_settimeofday 170
#define __NR_setuid 146
#define __NR_setxattr 5
+#define __NR_setxattrat 463
#define __NR_shmat 196
#define __NR_shmctl 195
#define __NR_shmdt 197
diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
index 4ab34f6228594c9f..715809acaf112852 100644
--- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
@@ -140,6 +140,7 @@
#define __NR_getuid 24
#define __NR_getuid32 199
#define __NR_getxattr 226
+#define __NR_getxattrat 464
#define __NR_init_module 128
#define __NR_inotify_add_watch 285
#define __NR_inotify_init 284
@@ -173,6 +174,7 @@
#define __NR_listen 360
#define __NR_listmount 458
#define __NR_listxattr 229
+#define __NR_listxattrat 465
#define __NR_llistxattr 230
#define __NR_lookup_dcookie 248
#define __NR_lremovexattr 233
@@ -281,6 +283,7 @@
#define __NR_recvmsg 369
#define __NR_remap_file_pages 252
#define __NR_removexattr 232
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 295
#define __NR_renameat2 351
@@ -354,6 +357,7 @@
#define __NR_setuid 23
#define __NR_setuid32 213
#define __NR_setxattr 223
+#define __NR_setxattrat 463
#define __NR_sgetmask 68
#define __NR_shmat 397
#define __NR_shmctl 396
diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
index 79e225e50c6d30b4..24e218fc86b984cc 100644
--- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
@@ -140,6 +140,7 @@
#define __NR_getuid 24
#define __NR_getuid32 199
#define __NR_getxattr 229
+#define __NR_getxattrat 464
#define __NR_gtty 32
#define __NR_idle 112
#define __NR_init_module 128
@@ -178,6 +179,7 @@
#define __NR_listen 348
#define __NR_listmount 458
#define __NR_listxattr 232
+#define __NR_listxattrat 465
#define __NR_llistxattr 233
#define __NR_lock 53
#define __NR_lookup_dcookie 253
@@ -294,6 +296,7 @@
#define __NR_recvmsg 361
#define __NR_remap_file_pages 257
#define __NR_removexattr 235
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 302
#define __NR_renameat2 383
@@ -370,6 +373,7 @@
#define __NR_setuid 23
#define __NR_setuid32 213
#define __NR_setxattr 226
+#define __NR_setxattrat 463
#define __NR_sgetmask 68
#define __NR_shmat 335
#define __NR_shmctl 336
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
index dadd7f3130a55625..a7615cb7a0c66df6 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
@@ -131,6 +131,7 @@
#define __NR_gettimeofday 4078
#define __NR_getuid 4024
#define __NR_getxattr 4227
+#define __NR_getxattrat 4464
#define __NR_gtty 4032
#define __NR_idle 4112
#define __NR_init_module 4128
@@ -168,6 +169,7 @@
#define __NR_listen 4174
#define __NR_listmount 4458
#define __NR_listxattr 4230
+#define __NR_listxattrat 4465
#define __NR_llistxattr 4231
#define __NR_lock 4053
#define __NR_lookup_dcookie 4247
@@ -279,6 +281,7 @@
#define __NR_recvmsg 4177
#define __NR_remap_file_pages 4251
#define __NR_removexattr 4233
+#define __NR_removexattrat 4466
#define __NR_rename 4038
#define __NR_renameat 4295
#define __NR_renameat2 4351
@@ -343,6 +346,7 @@
#define __NR_settimeofday 4079
#define __NR_setuid 4023
#define __NR_setxattr 4224
+#define __NR_setxattrat 4463
#define __NR_sgetmask 4068
#define __NR_shmat 4397
#define __NR_shmctl 4396
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
index db6b2d4609d87d3e..4d863c2dd29c3f3e 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
@@ -124,6 +124,7 @@
#define __NR_gettimeofday 6094
#define __NR_getuid 6100
#define __NR_getxattr 6183
+#define __NR_getxattrat 6464
#define __NR_init_module 6168
#define __NR_inotify_add_watch 6248
#define __NR_inotify_init 6247
@@ -156,6 +157,7 @@
#define __NR_listen 6049
#define __NR_listmount 6458
#define __NR_listxattr 6186
+#define __NR_listxattrat 6465
#define __NR_llistxattr 6187
#define __NR_lookup_dcookie 6206
#define __NR_lremovexattr 6190
@@ -258,6 +260,7 @@
#define __NR_recvmsg 6046
#define __NR_remap_file_pages 6210
#define __NR_removexattr 6189
+#define __NR_removexattrat 6466
#define __NR_rename 6080
#define __NR_renameat 6258
#define __NR_renameat2 6315
@@ -323,6 +326,7 @@
#define __NR_settimeofday 6159
#define __NR_setuid 6103
#define __NR_setxattr 6180
+#define __NR_setxattrat 6463
#define __NR_shmat 6029
#define __NR_shmctl 6030
#define __NR_shmdt 6065
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
index b4129a4dbdf71aec..9b6683e4c1ca9312 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
@@ -116,6 +116,7 @@
#define __NR_gettimeofday 5094
#define __NR_getuid 5100
#define __NR_getxattr 5183
+#define __NR_getxattrat 5464
#define __NR_init_module 5168
#define __NR_inotify_add_watch 5244
#define __NR_inotify_init 5243
@@ -147,6 +148,7 @@
#define __NR_listen 5049
#define __NR_listmount 5458
#define __NR_listxattr 5186
+#define __NR_listxattrat 5465
#define __NR_llistxattr 5187
#define __NR_lookup_dcookie 5206
#define __NR_lremovexattr 5190
@@ -244,6 +246,7 @@
#define __NR_recvmsg 5046
#define __NR_remap_file_pages 5210
#define __NR_removexattr 5189
+#define __NR_removexattrat 5466
#define __NR_rename 5080
#define __NR_renameat 5254
#define __NR_renameat2 5311
@@ -305,6 +308,7 @@
#define __NR_settimeofday 5159
#define __NR_setuid 5103
#define __NR_setxattr 5180
+#define __NR_setxattrat 5463
#define __NR_shmat 5029
#define __NR_shmctl 5030
#define __NR_shmdt 5065
diff --git a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
index 2d21fa208576f795..a071c76aaf82d9b6 100644
--- a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
@@ -102,6 +102,7 @@
#define __NR_gettimeofday 169
#define __NR_getuid 174
#define __NR_getxattr 8
+#define __NR_getxattrat 464
#define __NR_init_module 105
#define __NR_inotify_add_watch 27
#define __NR_inotify_init1 26
@@ -132,6 +133,7 @@
#define __NR_listen 201
#define __NR_listmount 458
#define __NR_listxattr 11
+#define __NR_listxattrat 465
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
@@ -224,6 +226,7 @@
#define __NR_recvmsg 212
#define __NR_remap_file_pages 234
#define __NR_removexattr 14
+#define __NR_removexattrat 466
#define __NR_renameat 38
#define __NR_renameat2 276
#define __NR_request_key 218
@@ -285,6 +288,7 @@
#define __NR_settimeofday 170
#define __NR_setuid 146
#define __NR_setxattr 5
+#define __NR_setxattrat 463
#define __NR_shmat 196
#define __NR_shmctl 195
#define __NR_shmdt 197
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
index 206d9fd65697d152..b3481e4c242257e0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
@@ -130,6 +130,7 @@
#define __NR_gettimeofday 78
#define __NR_getuid 24
#define __NR_getxattr 212
+#define __NR_getxattrat 464
#define __NR_gtty 32
#define __NR_idle 112
#define __NR_init_module 128
@@ -168,6 +169,7 @@
#define __NR_listen 329
#define __NR_listmount 458
#define __NR_listxattr 215
+#define __NR_listxattrat 465
#define __NR_llistxattr 216
#define __NR_lock 53
#define __NR_lookup_dcookie 235
@@ -288,6 +290,7 @@
#define __NR_recvmsg 342
#define __NR_remap_file_pages 239
#define __NR_removexattr 218
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 293
#define __NR_renameat2 357
@@ -353,6 +356,7 @@
#define __NR_settimeofday 79
#define __NR_setuid 23
#define __NR_setxattr 209
+#define __NR_setxattrat 463
#define __NR_sgetmask 68
#define __NR_shmat 397
#define __NR_shmctl 396
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
index 19f72a7f694a5322..45108e8f6f5c7b6c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
@@ -119,6 +119,7 @@
#define __NR_gettimeofday 78
#define __NR_getuid 24
#define __NR_getxattr 212
+#define __NR_getxattrat 464
#define __NR_gtty 32
#define __NR_idle 112
#define __NR_init_module 128
@@ -156,6 +157,7 @@
#define __NR_listen 329
#define __NR_listmount 458
#define __NR_listxattr 215
+#define __NR_listxattrat 465
#define __NR_llistxattr 216
#define __NR_lock 53
#define __NR_lookup_dcookie 235
@@ -270,6 +272,7 @@
#define __NR_recvmsg 342
#define __NR_remap_file_pages 239
#define __NR_removexattr 218
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 293
#define __NR_renameat2 357
@@ -332,6 +335,7 @@
#define __NR_settimeofday 79
#define __NR_setuid 23
#define __NR_setxattr 209
+#define __NR_setxattrat 463
#define __NR_sgetmask 68
#define __NR_shmat 397
#define __NR_shmctl 396
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
index eb9e57b02898cb79..53338790a7a9837c 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
@@ -91,6 +91,7 @@
#define __NR_gettid 178
#define __NR_getuid 174
#define __NR_getxattr 8
+#define __NR_getxattrat 464
#define __NR_init_module 105
#define __NR_inotify_add_watch 27
#define __NR_inotify_init1 26
@@ -119,6 +120,7 @@
#define __NR_listen 201
#define __NR_listmount 458
#define __NR_listxattr 11
+#define __NR_listxattrat 465
#define __NR_llistxattr 12
#define __NR_llseek 62
#define __NR_lookup_dcookie 18
@@ -205,6 +207,7 @@
#define __NR_recvmsg 212
#define __NR_remap_file_pages 234
#define __NR_removexattr 14
+#define __NR_removexattrat 466
#define __NR_renameat2 276
#define __NR_request_key 218
#define __NR_restart_syscall 128
@@ -262,6 +265,7 @@
#define __NR_setsockopt 208
#define __NR_setuid 146
#define __NR_setxattr 5
+#define __NR_setxattrat 463
#define __NR_shmat 196
#define __NR_shmctl 195
#define __NR_shmdt 197
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
index 1eac18e5822d8b3e..eed1dffc321200d8 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
@@ -95,6 +95,7 @@
#define __NR_gettimeofday 169
#define __NR_getuid 174
#define __NR_getxattr 8
+#define __NR_getxattrat 464
#define __NR_init_module 105
#define __NR_inotify_add_watch 27
#define __NR_inotify_init1 26
@@ -124,6 +125,7 @@
#define __NR_listen 201
#define __NR_listmount 458
#define __NR_listxattr 11
+#define __NR_listxattrat 465
#define __NR_llistxattr 12
#define __NR_lookup_dcookie 18
#define __NR_lremovexattr 15
@@ -212,6 +214,7 @@
#define __NR_recvmsg 212
#define __NR_remap_file_pages 234
#define __NR_removexattr 14
+#define __NR_removexattrat 466
#define __NR_renameat2 276
#define __NR_request_key 218
#define __NR_restart_syscall 128
@@ -271,6 +274,7 @@
#define __NR_settimeofday 170
#define __NR_setuid 146
#define __NR_setxattr 5
+#define __NR_setxattrat 463
#define __NR_shmat 196
#define __NR_shmctl 195
#define __NR_shmdt 197
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
index 464eca58b28ef5e0..0bf8f9582cef0fab 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
@@ -136,6 +136,7 @@
#define __NR_getuid 24
#define __NR_getuid32 199
#define __NR_getxattr 227
+#define __NR_getxattrat 464
#define __NR_idle 112
#define __NR_init_module 128
#define __NR_inotify_add_watch 285
@@ -173,6 +174,7 @@
#define __NR_listen 363
#define __NR_listmount 458
#define __NR_listxattr 230
+#define __NR_listxattrat 465
#define __NR_llistxattr 231
#define __NR_lookup_dcookie 110
#define __NR_lremovexattr 234
@@ -279,6 +281,7 @@
#define __NR_recvmsg 372
#define __NR_remap_file_pages 267
#define __NR_removexattr 233
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 295
#define __NR_renameat2 347
@@ -355,6 +358,7 @@
#define __NR_setuid 23
#define __NR_setuid32 213
#define __NR_setxattr 224
+#define __NR_setxattrat 463
#define __NR_shmat 397
#define __NR_shmctl 396
#define __NR_shmdt 398
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
index 57842702fd389edd..061f8db0cab0d0e9 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
@@ -114,6 +114,7 @@
#define __NR_gettimeofday 78
#define __NR_getuid 199
#define __NR_getxattr 227
+#define __NR_getxattrat 464
#define __NR_idle 112
#define __NR_init_module 128
#define __NR_inotify_add_watch 285
@@ -148,6 +149,7 @@
#define __NR_listen 363
#define __NR_listmount 458
#define __NR_listxattr 230
+#define __NR_listxattrat 465
#define __NR_llistxattr 231
#define __NR_lookup_dcookie 110
#define __NR_lremovexattr 234
@@ -248,6 +250,7 @@
#define __NR_recvmsg 372
#define __NR_remap_file_pages 267
#define __NR_removexattr 233
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 295
#define __NR_renameat2 347
@@ -313,6 +316,7 @@
#define __NR_settimeofday 79
#define __NR_setuid 213
#define __NR_setxattr 224
+#define __NR_setxattrat 463
#define __NR_shmat 397
#define __NR_shmctl 396
#define __NR_shmdt 398
diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
index 165ba017c7411aef..52cc320a9378e324 100644
--- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
@@ -133,6 +133,7 @@
#define __NR_getuid 24
#define __NR_getuid32 199
#define __NR_getxattr 229
+#define __NR_getxattrat 464
#define __NR_init_module 128
#define __NR_inotify_add_watch 291
#define __NR_inotify_init 290
@@ -166,6 +167,7 @@
#define __NR_listen 343
#define __NR_listmount 458
#define __NR_listxattr 232
+#define __NR_listxattrat 465
#define __NR_llistxattr 233
#define __NR_lookup_dcookie 253
#define __NR_lremovexattr 236
@@ -274,6 +276,7 @@
#define __NR_recvmsg 356
#define __NR_remap_file_pages 257
#define __NR_removexattr 235
+#define __NR_removexattrat 466
#define __NR_rename 38
#define __NR_renameat 302
#define __NR_renameat2 371
@@ -346,6 +349,7 @@
#define __NR_setuid 23
#define __NR_setuid32 213
#define __NR_setxattr 226
+#define __NR_setxattrat 463
#define __NR_sgetmask 68
#define __NR_shmat 397
#define __NR_shmctl 396
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
index 3bad6f102ffaafb2..ee870bc7b890e0b6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
@@ -136,6 +136,7 @@
#define __NR_getuid 24
#define __NR_getuid32 44
#define __NR_getxattr 172
+#define __NR_getxattrat 464
#define __NR_init_module 190
#define __NR_inotify_add_watch 152
#define __NR_inotify_init 151
@@ -171,6 +172,7 @@
#define __NR_listen 354
#define __NR_listmount 458
#define __NR_listxattr 178
+#define __NR_listxattrat 465
#define __NR_llistxattr 179
#define __NR_lookup_dcookie 208
#define __NR_lremovexattr 182
@@ -279,6 +281,7 @@
#define __NR_recvmsg 113
#define __NR_remap_file_pages 192
#define __NR_removexattr 181
+#define __NR_removexattrat 466
#define __NR_rename 128
#define __NR_renameat 291
#define __NR_renameat2 345
@@ -351,6 +354,7 @@
#define __NR_setuid 23
#define __NR_setuid32 87
#define __NR_setxattr 169
+#define __NR_setxattrat 463
#define __NR_sgetmask 199
#define __NR_shmat 397
#define __NR_shmctl 396
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
index 98e143792026d0e8..3acbebefa95fbbc6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
@@ -121,6 +121,7 @@
#define __NR_gettimeofday 116
#define __NR_getuid 24
#define __NR_getxattr 172
+#define __NR_getxattrat 464
#define __NR_init_module 190
#define __NR_inotify_add_watch 152
#define __NR_inotify_init 151
@@ -154,6 +155,7 @@
#define __NR_listen 354
#define __NR_listmount 458
#define __NR_listxattr 178
+#define __NR_listxattrat 465
#define __NR_llistxattr 179
#define __NR_lookup_dcookie 208
#define __NR_lremovexattr 182
@@ -257,6 +259,7 @@
#define __NR_recvmsg 113
#define __NR_remap_file_pages 192
#define __NR_removexattr 181
+#define __NR_removexattrat 466
#define __NR_rename 128
#define __NR_renameat 291
#define __NR_renameat2 345
@@ -320,6 +323,7 @@
#define __NR_settimeofday 122
#define __NR_setuid 23
#define __NR_setxattr 169
+#define __NR_setxattrat 463
#define __NR_sgetmask 199
#define __NR_shmat 397
#define __NR_shmctl 396
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index d31938a002629784..a0c65be7a5c49160 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -21,8 +21,8 @@
# This file can list all potential system calls. The names are only
# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 6.12.
-kernel 6.12
+# The list of system calls is current as of Linux 6.13.
+kernel 6.13
FAST_atomic_update
FAST_cmpxchg
@@ -198,6 +198,7 @@ getuid
getuid32
getunwind
getxattr
+getxattrat
getxgid
getxpid
getxuid
@@ -241,6 +242,7 @@ linkat
listen
listmount
listxattr
+listxattrat
llistxattr
llseek
lock
@@ -482,6 +484,7 @@ recvmmsg_time64
recvmsg
remap_file_pages
removexattr
+removexattrat
rename
renameat
renameat2
@@ -572,6 +575,7 @@ settimeofday
setuid
setuid32
setxattr
+setxattrat
sgetmask
shmat
shmctl
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
index dfc10d0c7e8a8f1e..17b84c70f58ac276 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
@@ -117,6 +117,7 @@
#define __NR_gettimeofday 96
#define __NR_getuid 102
#define __NR_getxattr 191
+#define __NR_getxattrat 464
#define __NR_init_module 175
#define __NR_inotify_add_watch 254
#define __NR_inotify_init 253
@@ -151,6 +152,7 @@
#define __NR_listen 50
#define __NR_listmount 458
#define __NR_listxattr 194
+#define __NR_listxattrat 465
#define __NR_llistxattr 195
#define __NR_lookup_dcookie 212
#define __NR_lremovexattr 198
@@ -250,6 +252,7 @@
#define __NR_recvmsg 47
#define __NR_remap_file_pages 216
#define __NR_removexattr 197
+#define __NR_removexattrat 466
#define __NR_rename 82
#define __NR_renameat 264
#define __NR_renameat2 316
@@ -313,6 +316,7 @@
#define __NR_settimeofday 164
#define __NR_setuid 105
#define __NR_setxattr 188
+#define __NR_setxattrat 463
#define __NR_shmat 30
#define __NR_shmctl 31
#define __NR_shmdt 67
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
index 9340daa967425c4a..1dcd6ab0e6b229ed 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
@@ -111,6 +111,7 @@
#define __NR_gettimeofday 1073741920
#define __NR_getuid 1073741926
#define __NR_getxattr 1073742015
+#define __NR_getxattrat 1073742288
#define __NR_init_module 1073741999
#define __NR_inotify_add_watch 1073742078
#define __NR_inotify_init 1073742077
@@ -145,6 +146,7 @@
#define __NR_listen 1073741874
#define __NR_listmount 1073742282
#define __NR_listxattr 1073742018
+#define __NR_listxattrat 1073742289
#define __NR_llistxattr 1073742019
#define __NR_lookup_dcookie 1073742036
#define __NR_lremovexattr 1073742022
@@ -242,6 +244,7 @@
#define __NR_recvmsg 1073742343
#define __NR_remap_file_pages 1073742040
#define __NR_removexattr 1073742021
+#define __NR_removexattrat 1073742290
#define __NR_rename 1073741906
#define __NR_renameat 1073742088
#define __NR_renameat2 1073742140
@@ -305,6 +308,7 @@
#define __NR_settimeofday 1073741988
#define __NR_setuid 1073741929
#define __NR_setxattr 1073742012
+#define __NR_setxattrat 1073742287
#define __NR_shmat 1073741854
#define __NR_shmctl 1073741855
#define __NR_shmdt 1073741891

View File

@ -0,0 +1,57 @@
commit 2fb0009ff1994db2848fd2becd9e7eaaefd7b673
Author: Joseph Myers <josmyers@redhat.com>
Date: Mon Mar 24 15:51:23 2025 +0000
Update kernel version to 6.13 in header constant tests
There are no new constants covered by tst-mman-consts.py,
tst-mount-consts.py or tst-sched-consts.py in Linux 6.13 that need any
header changes, so update the kernel version in those tests.
(tst-pidfd-consts.py will need updating separately along with adding
new constants to glibc.)
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
index 584936efecbf7755..ce07bc772e359ffd 100644
--- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 12)
+ linux_version_glibc = (6, 13)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sys/mman.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py
index e77579033b0fd8ec..91c99bb7a89715eb 100755
--- a/sysdeps/unix/sysv/linux/tst-mount-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py
@@ -39,10 +39,10 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- # Constants in glibc were updated to match Linux v6.12. When glibc
+ # Constants in glibc were updated to match Linux v6.13. When glibc
# constants are updated this value should be updated to match the
# released kernel version from which the constants were taken.
- linux_version_glibc = (6, 12)
+ linux_version_glibc = (6, 13)
def check(cte, exclude=None):
return glibcextract.compare_macro_consts(
'#include <sys/mount.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-sched-consts.py b/sysdeps/unix/sysv/linux/tst-sched-consts.py
index 6a5b837334ab45f8..90693f8156e338f1 100644
--- a/sysdeps/unix/sysv/linux/tst-sched-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-sched-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 12)
+ linux_version_glibc = (6, 13)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sched.h>\n',

View File

@ -0,0 +1,26 @@
commit 7f163bd2106f96e2925e9bb3e0e545cfae7ba1af
Author: Joseph Myers <josmyers@redhat.com>
Date: Tue Apr 1 12:44:26 2025 +0000
Update syscall lists for Linux 6.14
Linux 6.14 has no new syscalls. Update the version number in
syscall-names.list to reflect that it is still current for 6.14.
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index a0c65be7a5c49160..28bd84404cf83692 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -21,8 +21,8 @@
# This file can list all potential system calls. The names are only
# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 6.13.
-kernel 6.13
+# The list of system calls is current as of Linux 6.14.
+kernel 6.14
FAST_atomic_update
FAST_cmpxchg

337
glibc-RHEL-107695-19.patch Normal file
View File

@ -0,0 +1,337 @@
commit eaf88c10250b917ba64c9d5567457c4b82558ed1
Author: Joseph Myers <josmyers@redhat.com>
Date: Thu May 29 19:21:46 2025 +0000
Update syscall lists for Linux 6.15
Linux 6.15 adds the new syscall open_tree_attr. Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.
Tested with build-many-glibcs.py.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
index 89aced0b453609e3..ba4a461e90ea1709 100644
--- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
@@ -175,6 +175,7 @@
#define __NR_nfsservctl 42
#define __NR_open_by_handle_at 265
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 56
#define __NR_openat2 437
#define __NR_perf_event_open 241
diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
index 455da93b478ab037..840d6fed9eb0c3de 100644
--- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
@@ -209,6 +209,7 @@
#define __NR_open 45
#define __NR_open_by_handle_at 498
#define __NR_open_tree 538
+#define __NR_open_tree_attr 577
#define __NR_openat 450
#define __NR_openat2 547
#define __NR_osf_adjtime 140
diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
index 01075e8cdfd7cd30..2534f0fa5c50704c 100644
--- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
@@ -177,6 +177,7 @@
#define __NR_nfsservctl 42
#define __NR_open_by_handle_at 265
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 56
#define __NR_openat2 437
#define __NR_perf_event_open 241
diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
index 97044727fc1e24bf..8e585a4f9ee07607 100644
--- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
@@ -223,6 +223,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 371
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 322
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
index a719a55647383d4e..73fdba14025a0836 100644
--- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
@@ -184,6 +184,7 @@
#define __NR_nfsservctl 42
#define __NR_open_by_handle_at 265
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 56
#define __NR_openat2 437
#define __NR_perf_event_open 241
diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
index dc592c58364a1804..d8ffab9b951bc261 100644
--- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
@@ -214,6 +214,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 326
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 275
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
index c10897f7b032c9fb..196dfec840521678 100644
--- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
@@ -245,6 +245,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 342
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 295
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
index a0d0d91a09fa57fb..9a0dc6e429a5bd4f 100644
--- a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
@@ -173,6 +173,7 @@
#define __NR_nfsservctl 42
#define __NR_open_by_handle_at 265
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 56
#define __NR_openat2 437
#define __NR_perf_event_open 241
diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
index 715809acaf112852..a95cb41f56db8deb 100644
--- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
@@ -234,6 +234,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 341
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 288
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
index 24e218fc86b984cc..fe08f5cc9e898463 100644
--- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
@@ -244,6 +244,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 372
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 295
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
index a7615cb7a0c66df6..7d76d6579d2e5a09 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
@@ -229,6 +229,7 @@
#define __NR_open 4005
#define __NR_open_by_handle_at 4340
#define __NR_open_tree 4428
+#define __NR_open_tree_attr 4467
#define __NR_openat 4288
#define __NR_openat2 4437
#define __NR_pause 4029
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
index 4d863c2dd29c3f3e..bca3ea69b3e9db42 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
@@ -212,6 +212,7 @@
#define __NR_open 6002
#define __NR_open_by_handle_at 6304
#define __NR_open_tree 6428
+#define __NR_open_tree_attr 6467
#define __NR_openat 6251
#define __NR_openat2 6437
#define __NR_pause 6033
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
index 9b6683e4c1ca9312..5bcd92982a7da06b 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
@@ -201,6 +201,7 @@
#define __NR_open 5002
#define __NR_open_by_handle_at 5299
#define __NR_open_tree 5428
+#define __NR_open_tree_attr 5467
#define __NR_openat 5247
#define __NR_openat2 5437
#define __NR_pause 5033
diff --git a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
index a071c76aaf82d9b6..c2a1d51552b3e1d8 100644
--- a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
@@ -183,6 +183,7 @@
#define __NR_nfsservctl 42
#define __NR_open_by_handle_at 265
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 56
#define __NR_openat2 437
#define __NR_or1k_atomic 244
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
index b3481e4c242257e0..c371df8e40d54b31 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
@@ -235,6 +235,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 346
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 286
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
index 45108e8f6f5c7b6c..df8844d3cacfc3f1 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
@@ -220,6 +220,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 346
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 286
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
index 53338790a7a9837c..1bae763c9e2bae37 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
@@ -168,6 +168,7 @@
#define __NR_nfsservctl 42
#define __NR_open_by_handle_at 265
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 56
#define __NR_openat2 437
#define __NR_perf_event_open 241
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
index eed1dffc321200d8..1a1ebf8e2f6da6fd 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
@@ -175,6 +175,7 @@
#define __NR_nfsservctl 42
#define __NR_open_by_handle_at 265
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 56
#define __NR_openat2 437
#define __NR_perf_event_open 241
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
index 0bf8f9582cef0fab..f77f39f1cce2e6fe 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
@@ -232,6 +232,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 336
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 288
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
index 061f8db0cab0d0e9..65d6644e33ccb468 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
@@ -204,6 +204,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 336
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 288
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
index 52cc320a9378e324..5948ab099a5f79d2 100644
--- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
@@ -228,6 +228,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 360
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 295
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
index ee870bc7b890e0b6..85828a8c1750a6ec 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
@@ -230,6 +230,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 333
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 284
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
index 3acbebefa95fbbc6..d83ecd15dca15268 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
@@ -211,6 +211,7 @@
#define __NR_open 5
#define __NR_open_by_handle_at 333
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 284
#define __NR_openat2 437
#define __NR_pause 29
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index 28bd84404cf83692..316f06695a6b378c 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -21,8 +21,8 @@
# This file can list all potential system calls. The names are only
# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 6.14.
-kernel 6.14
+# The list of system calls is current as of Linux 6.15.
+kernel 6.15
FAST_atomic_update
FAST_cmpxchg
@@ -316,6 +316,7 @@ olduname
open
open_by_handle_at
open_tree
+open_tree_attr
openat
openat2
or1k_atomic
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
index 17b84c70f58ac276..06fbae5334dbbd49 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
@@ -207,6 +207,7 @@
#define __NR_open 2
#define __NR_open_by_handle_at 304
#define __NR_open_tree 428
+#define __NR_open_tree_attr 467
#define __NR_openat 257
#define __NR_openat2 437
#define __NR_pause 34
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
index 1dcd6ab0e6b229ed..135ef3d7f28f50f3 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
@@ -200,6 +200,7 @@
#define __NR_open 1073741826
#define __NR_open_by_handle_at 1073742128
#define __NR_open_tree 1073742252
+#define __NR_open_tree_attr 1073742291
#define __NR_openat 1073742081
#define __NR_openat2 1073742261
#define __NR_pause 1073741858

56
glibc-RHEL-107695-2.patch Normal file
View File

@ -0,0 +1,56 @@
commit 2367bf468ce43801de987dcd54b0f99ba9d62827
Author: Joseph Myers <josmyers@redhat.com>
Date: Wed Mar 13 19:46:21 2024 +0000
Update kernel version to 6.8 in header constant tests
This patch updates the kernel version in the tests tst-mman-consts.py,
tst-mount-consts.py and tst-pidfd-consts.py to 6.8. (There are no new
constants covered by these tests in 6.8 that need any other header
changes.)
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
index a7e101532812cbd0..56c0cf3e228ad1ae 100644
--- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 7)
+ linux_version_glibc = (6, 8)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sys/mman.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py
index 175bd8d23a7f9826..8613db96d7e3bf33 100755
--- a/sysdeps/unix/sysv/linux/tst-mount-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py
@@ -39,10 +39,10 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- # Constants in glibc were updated to match Linux v6.7. When glibc
+ # Constants in glibc were updated to match Linux v6.8. When glibc
# constants are updated this value should be updated to match the
# released kernel version from which the constants were taken.
- linux_version_glibc = (6, 7)
+ linux_version_glibc = (6, 8)
def check(cte, exclude=None):
return glibcextract.compare_macro_consts(
'#include <sys/mount.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
index 2f877722ad3f8d64..96875ac2666575df 100644
--- a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
@@ -39,7 +39,7 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 7)
+ linux_version_glibc = (6, 8)
sys.exit(glibcextract.compare_macro_consts(
'#include <sys/pidfd.h>\n',
'#include <asm/fcntl.h>\n'

26
glibc-RHEL-107695-3.patch Normal file
View File

@ -0,0 +1,26 @@
commit cf0ca8d52e1653d4aa4311a4649af8dc541ce6b4
Author: Joseph Myers <josmyers@redhat.com>
Date: Mon May 20 13:10:31 2024 +0000
Update syscall lists for Linux 6.9
Linux 6.9 has no new syscalls. Update the version number in
syscall-names.list to reflect that it is still current for 6.9.
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index 6557bcfde4636158..672d39eaad4491f1 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -21,8 +21,8 @@
# This file can list all potential system calls. The names are only
# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 6.8.
-kernel 6.8
+# The list of system calls is current as of Linux 6.9.
+kernel 6.9
FAST_atomic_update
FAST_cmpxchg

60
glibc-RHEL-107695-4.patch Normal file
View File

@ -0,0 +1,60 @@
commit e9a37242f9cca80496aa934158b7e366b8b419fa
Author: Joseph Myers <josmyers@redhat.com>
Date: Thu May 23 12:22:40 2024 +0000
Update PIDFD_* constants for Linux 6.9
Linux 6.9 adds some more PIDFD_* constants. Add them to glibc's
sys/pidfd.h, including updating comments that said FLAGS was reserved
and must be 0, along with updating tst-pidfd-consts.py.
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/sys/pidfd.h b/sysdeps/unix/sysv/linux/sys/pidfd.h
index 10783220625f7a1d..9f88d297e884c348 100644
--- a/sysdeps/unix/sysv/linux/sys/pidfd.h
+++ b/sysdeps/unix/sysv/linux/sys/pidfd.h
@@ -22,12 +22,14 @@
#include <bits/types/siginfo_t.h>
#define PIDFD_NONBLOCK O_NONBLOCK
+#define PIDFD_THREAD O_EXCL
-/* Returns a file descriptor that refers to the process PID. The
- close-on-exec is set on the file descriptor.
+#define PIDFD_SIGNAL_THREAD (1UL << 0)
+#define PIDFD_SIGNAL_THREAD_GROUP (1UL << 1)
+#define PIDFD_SIGNAL_PROCESS_GROUP (1UL << 2)
- The FLAGS argument is reserved for future use, it must be specified
- as 0. */
+/* Returns a file descriptor that refers to the process PID. The
+ close-on-exec is set on the file descriptor. */
extern int pidfd_open (__pid_t __pid, unsigned int __flags) __THROW;
/* Duplicates an existing file descriptor TARGETFD in the process referred
@@ -39,10 +41,7 @@ extern int pidfd_getfd (int __pidfd, int __targetfd,
unsigned int __flags) __THROW;
/* Sends the signal SIG to the target process referred by the PIDFD. If
- INFO points to a siginfo_t buffer, it will be populated.
-
- The FLAGS argument is reserved for future use, it must be specified
- as 0. */
+ INFO points to a siginfo_t buffer, it will be populated. */
extern int pidfd_send_signal (int __pidfd, int __sig, siginfo_t *__info,
unsigned int __flags) __THROW;
diff --git a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
index 96875ac2666575df..6f05291949d00c62 100644
--- a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
@@ -39,7 +39,7 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 8)
+ linux_version_glibc = (6, 9)
sys.exit(glibcextract.compare_macro_consts(
'#include <sys/pidfd.h>\n',
'#include <asm/fcntl.h>\n'

44
glibc-RHEL-107695-5.patch Normal file
View File

@ -0,0 +1,44 @@
commit 84d2762922f74f5059d6179f503972c418153b91
Author: Joseph Myers <josmyers@redhat.com>
Date: Thu May 23 14:04:48 2024 +0000
Update kernel version to 6.9 in header constant tests
This patch updates the kernel version in the tests tst-mman-consts.py
and tst-mount-consts.py to 6.9. (There are no new constants covered
by these tests in 6.9 that need any other header changes;
tst-pidfd-consts.py was updated separately along with adding new
constants relevant to that test.)
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
index 56c0cf3e228ad1ae..4a8f4e8919aa6b3d 100644
--- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 8)
+ linux_version_glibc = (6, 9)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sys/mman.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py
index 8613db96d7e3bf33..c4a67221c1c5bc84 100755
--- a/sysdeps/unix/sysv/linux/tst-mount-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py
@@ -39,10 +39,10 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- # Constants in glibc were updated to match Linux v6.8. When glibc
+ # Constants in glibc were updated to match Linux v6.9. When glibc
# constants are updated this value should be updated to match the
# released kernel version from which the constants were taken.
- linux_version_glibc = (6, 8)
+ linux_version_glibc = (6, 9)
def check(cte, exclude=None):
return glibcextract.compare_macro_consts(
'#include <sys/mount.h>\n',

120
glibc-RHEL-107695-6.patch Normal file
View File

@ -0,0 +1,120 @@
commit 176671f6042912200ea9733bb6cc8212e06bc85e
Author: Carlos Llamas <cmllamas@google.com>
Date: Tue Jun 18 10:56:34 2024 +0200
linux: add definitions for hugetlb page size encodings
A desired hugetlb page size can be encoded in the flags parameter of
system calls such as mmap() and shmget(). The Linux UAPI headers have
included explicit definitions for these encodings since v4.14.
This patch adds these definitions that are used along with MAP_HUGETLB
and SHM_HUGETLB flags as specified in the corresponding man pages. This
relieves programs from having to duplicate and/or compute the encodings
manually.
Additionally, the filter on these definitions in tst-mman-consts.py is
removed, as suggested by Florian. I then ran this tests successfully,
confirming the alignment with the kernel headers.
PASS: misc/tst-mman-consts
original exit status 0
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Tested-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h
index 5c3d43b0f2b659fd..522333c50a04481d 100644
--- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
+++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
@@ -54,10 +54,29 @@
# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
#endif
#define MAP_ANON MAP_ANONYMOUS
-/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. */
+
+/* When MAP_HUGETLB is set, bits [26:31] encode the log2 of the huge page size.
+ The following definitions are associated with this huge page size encoding.
+ It is responsibility of the application to know which sizes are supported on
+ the running system. See mmap(2) man page for details. */
+
#define MAP_HUGE_SHIFT 26
#define MAP_HUGE_MASK 0x3f
+#define MAP_HUGE_16KB (14 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_64KB (16 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_512KB (19 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_1MB (20 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_8MB (23 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_16MB (24 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_32MB (25 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_256MB (28 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_512MB (29 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_2GB (31 << MAP_HUGE_SHIFT)
+#define MAP_HUGE_16GB (34U << MAP_HUGE_SHIFT)
+
/* Flags to `msync'. */
#define MS_ASYNC 1 /* Sync memory asynchronously. */
#define MS_SYNC 4 /* Synchronous memory sync. */
diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h
index 95f7863913ecebdb..76144f5ad4e52c21 100644
--- a/sysdeps/unix/sysv/linux/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
@@ -58,6 +58,28 @@ typedef __syscall_ulong_t shmatt_t;
# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
# define SHM_NORESERVE 010000 /* don't check for reservations */
+/* When SHM_HUGETLB is set, bits [26:31] encode the log2 of the huge page size.
+ The following definitions are associated with this huge page size encoding.
+ It is responsibility of the application to know which sizes are supported on
+ the running system. See shmget(2) man page for details. */
+
+#define SHM_HUGE_SHIFT 26
+#define SHM_HUGE_MASK 0x3f
+
+#define SHM_HUGE_16KB (14 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_64KB (16 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_512KB (19 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_1MB (20 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_8MB (23 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_16MB (24 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_32MB (25 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_256MB (28 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_512MB (29 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_2GB (31 << SHM_HUGE_SHIFT)
+#define SHM_HUGE_16GB (34U << SHM_HUGE_SHIFT)
+
struct shminfo
{
__syscall_ulong_t shmmax;
diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
index 4a8f4e8919aa6b3d..441261c9456b2595 100644
--- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
@@ -41,8 +41,7 @@ def main():
'#include <linux/mman.h>\n',
args.cc,
'MAP_.*',
- # A series of MAP_HUGE_<size> macros are defined by the kernel
- # but not by glibc. MAP_UNINITIALIZED is kernel-only.
+ # MAP_UNINITIALIZED is defined by the kernel but not by glibc.
# MAP_FAILED is not a MAP_* flag and is glibc-only, as is the
# MAP_ANON alias for MAP_ANONYMOUS. MAP_RENAME, MAP_AUTOGROW,
# MAP_LOCAL and MAP_AUTORSRV are in the kernel header for
@@ -50,9 +49,8 @@ def main():
# in the kernel header, but does not use it. The kernel
# header for HPPA removed a define of MAP_VARIABLE to 0 in
# Linux 6.2.
- 'MAP_HUGE_[0-9].*|MAP_UNINITIALIZED|MAP_FAILED|MAP_ANON'
- '|MAP_RENAME|MAP_AUTOGROW|MAP_LOCAL|MAP_AUTORSRV|MAP_INHERIT'
- '|MAP_VARIABLE',
+ 'MAP_UNINITIALIZED|MAP_FAILED|MAP_ANON|MAP_RENAME|MAP_AUTOGROW'
+ '|MAP_LOCAL|MAP_AUTORSRV|MAP_INHERIT|MAP_VARIABLE',
linux_version_glibc > linux_version_headers,
linux_version_headers > linux_version_glibc))

379
glibc-RHEL-107695-7.patch Normal file
View File

@ -0,0 +1,379 @@
commit eb0776d4e149ff0ccf9841a8073dbde658c59858
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Jul 16 17:08:46 2024 +0000
Update syscall lists for Linux 6.10
Linux 6.10 changes for syscall are:
* mseal for all architectures.
* map_shadow_stack for x32.
* Replace sync_file_range with sync_file_range2 for csky (which
fixes a broken sync_file_range usage).
Update syscall-names.list and regenerate the arch-syscall.h headers
with build-many-glibcs.py update-syscalls.
Tested with build-many-glibcs.py.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
index 7ee8a2167aaae172..19b6316cb6ffae26 100644
--- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
@@ -158,6 +158,7 @@
#define __NR_mq_timedsend 182
#define __NR_mq_unlink 181
#define __NR_mremap 216
+#define __NR_mseal 462
#define __NR_msgctl 187
#define __NR_msgget 186
#define __NR_msgrcv 188
diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
index 0f4ea7670be610be..216a5575c69d0ff3 100644
--- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
@@ -24,6 +24,7 @@
#define __NR_clock_nanosleep 422
#define __NR_clock_settime 419
#define __NR_clone 312
+#define __NR_clone3 545
#define __NR_close 6
#define __NR_close_range 546
#define __NR_connect 98
@@ -189,6 +190,7 @@
#define __NR_mq_timedsend 434
#define __NR_mq_unlink 433
#define __NR_mremap 341
+#define __NR_mseal 572
#define __NR_msgctl 200
#define __NR_msgget 201
#define __NR_msgrcv 202
diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
index 90359482a814b3f8..ea581b0a6dc0f2d4 100644
--- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
@@ -161,6 +161,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 181
#define __NR_mremap 216
+#define __NR_mseal 462
#define __NR_msgctl 187
#define __NR_msgget 186
#define __NR_msgrcv 188
diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
index 4930167a03c97df2..2809f52f94e9ee16 100644
--- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
@@ -205,6 +205,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 275
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 304
#define __NR_msgget 303
#define __NR_msgrcv 302
diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
index 3f16a29f5753e7a8..ede3551a00dc81c6 100644
--- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
@@ -168,6 +168,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 181
#define __NR_mremap 216
+#define __NR_mseal 462
#define __NR_msgctl 187
#define __NR_msgget 186
#define __NR_msgrcv 188
@@ -301,7 +302,7 @@
#define __NR_swapon 224
#define __NR_symlinkat 36
#define __NR_sync 81
-#define __NR_sync_file_range 84
+#define __NR_sync_file_range2 84
#define __NR_syncfs 267
#define __NR_sysinfo 179
#define __NR_syslog 116
diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
index a1b2c819d6522018..08b153f2ccdf6f45 100644
--- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
@@ -197,6 +197,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 230
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 191
#define __NR_msgget 190
#define __NR_msgrcv 189
diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
index cc775432d663a745..500ca1ec70e2c5fc 100644
--- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
@@ -222,6 +222,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 278
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
diff --git a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
index 56bb08718ad32c04..8bb82448a7570d54 100644
--- a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
@@ -155,6 +155,7 @@
#define __NR_mq_timedsend 182
#define __NR_mq_unlink 181
#define __NR_mremap 216
+#define __NR_mseal 462
#define __NR_msgctl 187
#define __NR_msgget 186
#define __NR_msgrcv 188
diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
index 79f277dd5b8eda7b..4ab34f6228594c9f 100644
--- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
@@ -213,6 +213,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 272
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
index 779d5d5d7029d8ff..79e225e50c6d30b4 100644
--- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
@@ -221,6 +221,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 278
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 331
#define __NR_msgget 332
#define __NR_msgrcv 333
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
index 86ffd5ce84556c20..dadd7f3130a55625 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
@@ -211,6 +211,7 @@
#define __NR_mq_timedsend_time64 4418
#define __NR_mq_unlink 4272
#define __NR_mremap 4167
+#define __NR_mseal 4462
#define __NR_msgctl 4402
#define __NR_msgget 4399
#define __NR_msgrcv 4401
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
index 5d37a686e511a499..db6b2d4609d87d3e 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
@@ -194,6 +194,7 @@
#define __NR_mq_timedsend_time64 6418
#define __NR_mq_unlink 6235
#define __NR_mremap 6024
+#define __NR_mseal 6462
#define __NR_msgctl 6069
#define __NR_msgget 6066
#define __NR_msgrcv 6068
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
index 9b1e846e7646d791..b4129a4dbdf71aec 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
@@ -183,6 +183,7 @@
#define __NR_mq_timedsend 5232
#define __NR_mq_unlink 5231
#define __NR_mremap 5024
+#define __NR_mseal 5462
#define __NR_msgctl 5069
#define __NR_msgget 5066
#define __NR_msgrcv 5068
diff --git a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
index abbc9ab6b083be80..f94e212995549062 100644
--- a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
@@ -167,6 +167,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 181
#define __NR_mremap 216
+#define __NR_mseal 462
#define __NR_msgctl 187
#define __NR_msgget 186
#define __NR_msgrcv 188
diff --git a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
index 7223a93673d9c6f7..2d21fa208576f795 100644
--- a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h
@@ -167,6 +167,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 181
#define __NR_mremap 216
+#define __NR_mseal 462
#define __NR_msgctl 187
#define __NR_msgget 186
#define __NR_msgrcv 188
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
index af0d2b121ebc7dc7..206d9fd65697d152 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
@@ -211,6 +211,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 263
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
index a4c70aa7fe719cb9..19f72a7f694a5322 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
@@ -195,6 +195,7 @@
#define __NR_mq_timedsend 264
#define __NR_mq_unlink 263
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
index 7315d164d64c89fa..eb9e57b02898cb79 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
@@ -153,6 +153,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 181
#define __NR_mremap 216
+#define __NR_mseal 462
#define __NR_msgctl 187
#define __NR_msgget 186
#define __NR_msgrcv 188
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
index 31a1130db9404e60..1eac18e5822d8b3e 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
@@ -158,6 +158,7 @@
#define __NR_mq_timedsend 182
#define __NR_mq_unlink 181
#define __NR_mremap 216
+#define __NR_mseal 462
#define __NR_msgctl 187
#define __NR_msgget 186
#define __NR_msgrcv 188
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
index cf8569304d9e6a16..464eca58b28ef5e0 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
@@ -214,6 +214,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 272
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
index f3536ed03f4b7d85..57842702fd389edd 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
@@ -185,6 +185,7 @@
#define __NR_mq_timedsend 273
#define __NR_mq_unlink 272
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
index 0c88bf10c77bef3a..165ba017c7411aef 100644
--- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
@@ -206,6 +206,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 278
#define __NR_mremap 163
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
@@ -378,6 +379,7 @@
#define __NR_symlinkat 304
#define __NR_sync 36
#define __NR_sync_file_range 314
+#define __NR_sync_file_range2 388
#define __NR_syncfs 362
#define __NR_sysfs 135
#define __NR_sysinfo 116
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
index 19fa614624dc2b85..3bad6f102ffaafb2 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
@@ -211,6 +211,7 @@
#define __NR_mq_timedsend_time64 418
#define __NR_mq_unlink 274
#define __NR_mremap 250
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
index 18516f20cbf25d77..98e143792026d0e8 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
@@ -192,6 +192,7 @@
#define __NR_mq_timedsend 275
#define __NR_mq_unlink 274
#define __NR_mremap 250
+#define __NR_mseal 462
#define __NR_msgctl 402
#define __NR_msgget 399
#define __NR_msgrcv 401
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index 672d39eaad4491f1..7871f93b94d731d2 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -21,8 +21,8 @@
# This file can list all potential system calls. The names are only
# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 6.9.
-kernel 6.9
+# The list of system calls is current as of Linux 6.10.
+kernel 6.10
FAST_atomic_update
FAST_cmpxchg
@@ -287,6 +287,7 @@ mq_timedsend
mq_timedsend_time64
mq_unlink
mremap
+mseal
msgctl
msgget
msgrcv
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
index b1222160135310ec..5d86e75dd556caad 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
@@ -189,6 +189,7 @@
#define __NR_mq_timedsend 242
#define __NR_mq_unlink 241
#define __NR_mremap 25
+#define __NR_mseal 462
#define __NR_msgctl 71
#define __NR_msgget 68
#define __NR_msgrcv 70
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
index df3e22236dd3bb0e..6c35068d8e8f4b05 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
@@ -183,6 +183,7 @@
#define __NR_mq_timedsend 1073742066
#define __NR_mq_unlink 1073742065
#define __NR_mremap 1073741849
+#define __NR_mseal 1073742286
#define __NR_msgctl 1073741895
#define __NR_msgget 1073741892
#define __NR_msgrcv 1073741894

57
glibc-RHEL-107695-8.patch Normal file
View File

@ -0,0 +1,57 @@
commit e433cdec9b4b50e66d2f93fa92f622df8f4b870f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Jul 16 17:08:47 2024 +0000
Update kernel version to 6.10 in header constant tests
This patch updates the kernel version in the tests tst-mman-consts.py,
tst-mount-consts.py, and tst-pidfd-consts.py to 6.9.
There are no new constants covered by these tests in 6.10.
Tested with build-many-glibcs.py.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
index 441261c9456b2595..a1137eb1d59d95ec 100644
--- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
@@ -33,7 +33,7 @@ def main():
help='C compiler (including options) to use')
args = parser.parse_args()
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 9)
+ linux_version_glibc = (6, 10)
sys.exit(glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <sys/mman.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py
index c4a67221c1c5bc84..675f1790b64dd34e 100755
--- a/sysdeps/unix/sysv/linux/tst-mount-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py
@@ -39,10 +39,10 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- # Constants in glibc were updated to match Linux v6.9. When glibc
+ # Constants in glibc were updated to match Linux v6.10. When glibc
# constants are updated this value should be updated to match the
# released kernel version from which the constants were taken.
- linux_version_glibc = (6, 9)
+ linux_version_glibc = (6, 10)
def check(cte, exclude=None):
return glibcextract.compare_macro_consts(
'#include <sys/mount.h>\n',
diff --git a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
index 6f05291949d00c62..9824fd214d477fd0 100644
--- a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
+++ b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py
@@ -39,7 +39,7 @@ def main():
sys.exit (77)
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
- linux_version_glibc = (6, 9)
+ linux_version_glibc = (6, 10)
sys.exit(glibcextract.compare_macro_consts(
'#include <sys/pidfd.h>\n',
'#include <asm/fcntl.h>\n'

100
glibc-RHEL-107695-9.patch Normal file
View File

@ -0,0 +1,100 @@
commit 02de16df481f15d5f6f2a8d98aa1bb2888aec13b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Oct 8 15:45:24 2024 -0300
Update syscall lists for Linux 6.11
Linux 6.11 changes for syscall are:
* fstat/newfstatat for loongarch (it should be safe to add since
255dc1e4ed8 that undefine them).
* clone3 for nios2, which only adds the entry point but defined
__ARCH_BROKEN_SYS_CLONE3 (the syscall will always return ENOSYS).
* uretprobe for x86_64 and x32.
Update syscall-names.list and regenerate the arch-syscall.h headers
with build-many-glibcs.py update-syscalls.
Tested with build-many-glibcs.py.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
diff --git a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
index 8bb82448a7570d54..7e732256fd4c6da7 100644
--- a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h
@@ -59,6 +59,7 @@
#define __NR_fsmount 432
#define __NR_fsopen 430
#define __NR_fspick 433
+#define __NR_fstat 80
#define __NR_fstatfs 44
#define __NR_fsync 82
#define __NR_ftruncate 46
@@ -166,6 +167,7 @@
#define __NR_munmap 215
#define __NR_name_to_handle_at 264
#define __NR_nanosleep 101
+#define __NR_newfstatat 79
#define __NR_nfsservctl 42
#define __NR_open_by_handle_at 265
#define __NR_open_tree 428
diff --git a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
index f94e212995549062..b1d0fb6f6ec99125 100644
--- a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
@@ -24,6 +24,7 @@
#define __NR_clock_settime 112
#define __NR_clock_settime64 404
#define __NR_clone 220
+#define __NR_clone3 435
#define __NR_close 57
#define __NR_close_range 436
#define __NR_connect 203
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index 7871f93b94d731d2..aa5b479e2a08e7bb 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -21,8 +21,8 @@
# This file can list all potential system calls. The names are only
# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 6.10.
-kernel 6.10
+# The list of system calls is current as of Linux 6.11.
+kernel 6.11
FAST_atomic_update
FAST_cmpxchg
@@ -653,6 +653,7 @@ uname
unlink
unlinkat
unshare
+uretprobe
uselib
userfaultfd
usr26
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
index 5d86e75dd556caad..dfc10d0c7e8a8f1e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
@@ -359,6 +359,7 @@
#define __NR_unlink 87
#define __NR_unlinkat 263
#define __NR_unshare 272
+#define __NR_uretprobe 335
#define __NR_uselib 134
#define __NR_userfaultfd 323
#define __NR_ustat 136
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
index 6c35068d8e8f4b05..9340daa967425c4a 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
@@ -351,6 +351,7 @@
#define __NR_unlink 1073741911
#define __NR_unlinkat 1073742087
#define __NR_unshare 1073742096
+#define __NR_uretprobe 1073742159
#define __NR_userfaultfd 1073742147
#define __NR_ustat 1073741960
#define __NR_utime 1073741956

27
glibc-RHEL-107861-1.patch Normal file
View File

@ -0,0 +1,27 @@
commit a07e000e82cb71238259e674529c37c12dc7d423
Author: DJ Delorie <dj@redhat.com>
Date: Fri May 10 17:34:29 2024 -0400
manual: add dup3
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/llio.texi b/manual/llio.texi
index a65230d612eba7bf..513ba9e8859b8e6e 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -3443,6 +3443,14 @@ middle of calling @code{dup2} at which @var{new} is closed and not yet a
duplicate of @var{old}.
@end deftypefun
+@deftypefun int dup3 (int @var{old}, int @var{new}, int @var{flags})
+@standards{Linux, unistd.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function is the same as @code{dup2} but creates the new
+descriptor as if it had been opened with flags @var{flags}. The only
+allowed flag is @code{O_CLOEXEC}.
+@end deftypefun
+
@deftypevr Macro int F_DUPFD
@standards{POSIX.1, fcntl.h}
This macro is used as the @var{command} argument to @code{fcntl}, to

348
glibc-RHEL-107861-2.patch Normal file
View File

@ -0,0 +1,348 @@
commit 6c0be74305745c8f78bcfb69442c8c379459d99b
Author: DJ Delorie <dj@redhat.com>
Date: Mon Jul 8 17:52:15 2024 -0400
manual: add syscalls
The purpose of this patch is to add some system calls that (1) aren't
otherwise documented, and (2) are merely redirected to the kernel, so
can refer to their documentation; and define a standard way of doing
so in the future. A more detailed explaination of how system calls
are wrapped is added along with reference to the Linux Man-Pages
project.
Default version of man-pages is in configure.ac but can be overridden
by --with-man-pages=X.Y
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Conflicts:
configure (skip unrelated configure changes, due to autoconf
call)
diff --git a/config.make.in b/config.make.in
index 55e8b7563b961dfc..36096881b7af4574 100644
--- a/config.make.in
+++ b/config.make.in
@@ -91,6 +91,7 @@ use-nscd = @use_nscd@
build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
build-pt-chown = @build_pt_chown@
pthread-in-libc = @pthread_in_libc@
+man-pages-version = @man_pages_version@
# Build tools.
CC = @CC@
diff --git a/configure b/configure
index 432e40a59295cffd..c25b93dd0b317e4e 100755
--- a/configure
+++ b/configure
@@ -706,6 +706,7 @@ force_install
bindnow
hardcoded_path_in_tests
enable_timezone_tools
+man_pages_version
rtld_early_cflags
extra_nonshared_cflags
sysheaders
@@ -787,6 +788,7 @@ with_headers
with_nonshared_cflags
with_rtld_early_cflags
with_timeoutfactor
+with_man_pages
enable_sanity_checks
enable_shared
enable_profile
@@ -1509,6 +1511,8 @@ Optional Packages:
build early initialization with additional CFLAGS
--with-timeoutfactor=NUM
specify an integer to scale the timeout
+ --with-man-pages=VERSION
+ tie manual to a specific man-pages version
--with-cpu=CPU select code for CPU variant
Some influential environment variables:
@@ -4374,6 +4378,17 @@ fi
printf "%s\n" "#define TIMEOUTFACTOR $timeoutfactor" >>confdefs.h
+man_pages_version=6.9.1
+
+
+# Check whether --with-man-pages was given.
+if test ${with_man_pages+y}
+then :
+ withval=$with_man_pages; man_pages_version=$withval
+fi
+
+
+
# Check whether --enable-sanity-checks was given.
if test ${enable_sanity_checks+y}
then :
diff --git a/configure.ac b/configure.ac
index bdc385d03c3dc7f5..f00fc36f387af09d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,6 +168,15 @@ AC_ARG_WITH([timeoutfactor],
[timeoutfactor=1])
AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
+man_pages_version=6.9.1
+
+AC_ARG_WITH([man-pages],
+ AS_HELP_STRING([--with-man-pages=VERSION],
+ [tie manual to a specific man-pages version]),
+ [man_pages_version=$withval],
+ [])
+AC_SUBST(man_pages_version)
+
AC_ARG_ENABLE([sanity-checks],
AS_HELP_STRING([--disable-sanity-checks],
[really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
diff --git a/manual/Makefile b/manual/Makefile
index b5fda4a7ae07a785..a6c05db540d6c1da 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -117,6 +117,7 @@ $(objpfx)stamp-pkgvers: $(common-objpfx)config.make
echo "@set PKGVERSION_DEFAULT" >> $(objpfx)pkgvers-tmp; \
fi
echo "@set REPORT_BUGS_TO $(REPORT_BUGS_TEXI)" >> $(objpfx)pkgvers-tmp
+ echo "@set man_pages_version $(man-pages-version)" >> $(objpfx)pkgvers-tmp; \
echo "@end ifclear" >> $(objpfx)pkgvers-tmp
$(move-if-change) $(objpfx)pkgvers-tmp $(objpfx)pkgvers.texi
touch $@
diff --git a/manual/intro.texi b/manual/intro.texi
index ff43c5a7fbb969a0..879c1b38d9b73a46 100644
--- a/manual/intro.texi
+++ b/manual/intro.texi
@@ -85,6 +85,7 @@ standards each function or symbol comes from.
* Berkeley Unix:: BSD and SunOS.
* SVID:: The System V Interface Description.
* XPG:: The X/Open Portability Guide.
+* Linux Kernel:: The Linux kernel.
@end menu
@node ISO C, POSIX, , Standards and Portability
@@ -941,7 +942,7 @@ inter-process communication and shared memory, the @code{hsearch} and
@code{drand48} families of functions, @code{fmtmsg} and several of the
mathematical functions.
-@node XPG, , SVID, Standards and Portability
+@node XPG, Linux Kernel, SVID, Standards and Portability
@subsection XPG (The X/Open Portability Guide)
The X/Open Portability Guide, published by the X/Open Company, Ltd., is
@@ -960,6 +961,20 @@ fulfilling the XPG standard with the Unix extensions is a
precondition for getting the Unix brand chances are good that the
functionality is available on commercial systems.
+@node Linux Kernel, , XPG, Standards and Portability
+@subsection Linux (The Linux Kernel)
+
+@Theglibc{} includes by reference the Linux man-pages
+@value{man_pages_version} documentation to document the listed
+syscalls for the Linux kernel. For reference purposes only the latest
+@uref{https://www.kernel.org/doc/man-pages/,Linux man-pages Project}
+documentation can be accessed from the
+@uref{https://www.kernel.org,Linux kernel} website. Where the syscall
+has more specific documentation in this manual that more specific
+documentation is considered authoritative.
+
+Additional details on the Linux system call interface can be found in
+@xref{System Calls}.
@node Using the Library, Roadmap to the Manual, Standards and Portability, Introduction
@section Using the Library
diff --git a/manual/llio.texi b/manual/llio.texi
index 513ba9e8859b8e6e..17fe1181d5cc2cef 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -65,6 +65,7 @@ directly.)
* Interrupt Input:: Getting an asynchronous signal when
input arrives.
* IOCTLs:: Generic I/O Control operations.
+* Other Low-Level I/O APIs:: Other low-level-I/O-related functions.
@end menu
@@ -2242,6 +2243,8 @@ file descriptor, or until the timeout period expires.
There is another example showing the use of @code{select} to multiplex
input from multiple sockets in @ref{Server Example}.
+For an alternate interface to this functionality, see @code{poll}
+(@pxref{Other Low-Level I/O APIs}).
@node Synchronizing I/O
@section Synchronizing I/O operations
@@ -3325,7 +3328,9 @@ require additional arguments to be supplied. These additional arguments
and the return value and error conditions are given in the detailed
descriptions of the individual commands.
-Briefly, here is a list of what the various commands are.
+Briefly, here is a list of what the various commands are. For an
+exhaustive list of kernel-specific options, please see @xref{System
+Calls}.
@vtable @code
@item F_DUPFD
@@ -4661,5 +4666,28 @@ Most IOCTLs are OS-specific and/or only used in special system utilities,
and are thus beyond the scope of this document. For an example of the use
of an IOCTL, see @ref{Out-of-Band Data}.
-@c FIXME this is undocumented:
-@c dup3
+@node Other Low-Level I/O APIs
+@section Other low-level-I/O-related functions
+
+@deftp {Data Type} {struct pollfd}
+@standards{POSIX.1,poll.h}
+@end deftp
+
+@deftp {Data Type} {struct epoll_event}
+@standards{Linux,sys/epoll.h}
+@end deftp
+
+@deftypefun int poll (struct pollfd *@var{fds}, nfds_t @var{nfds}, int @var{timeout})
+
+@manpagefunctionstub{poll,2}
+@end deftypefun
+
+@deftypefun int epoll_create(int @var{size})
+
+@manpagefunctionstub{epoll_create,2}
+@end deftypefun
+
+@deftypefun int epoll_wait(int @var{epfd}, struct epoll_event *@var{events}, int @var{maxevents}, int @var{timeout})
+
+@manpagefunctionstub{epoll_wait,2}
+@end deftypefun
diff --git a/manual/macros.texi b/manual/macros.texi
index 4a2e22f4730d2390..579da3fb81e59da0 100644
--- a/manual/macros.texi
+++ b/manual/macros.texi
@@ -282,4 +282,11 @@ cwd\comments\
@macro standardsx {element, standard, header}
@end macro
+@macro manpagefunctionstub {func,sec}
+This documentation is a stub. For additional information on this
+function, consult the manual page
+@url{https://man7.org/linux/man-pages/man\sec\/\func\.\sec\.html}.
+@xref{Linux Kernel}.
+@end macro
+
@end ifclear
diff --git a/manual/socket.texi b/manual/socket.texi
index f0e35d9e13175212..8708cbb07ca02b5c 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -41,6 +41,7 @@ aren't documented either so far.
is to make it work with Inetd.
* Socket Options:: Miscellaneous low-level socket options.
* Networks Database:: Accessing the database of network names.
+* Other Socket APIs:: Other socket-related functions.
@end menu
@node Socket Concepts
@@ -3134,38 +3135,8 @@ You can use plain @code{recv} (@pxref{Receiving Data}) instead of
treat all possible senders alike). Even @code{read} can be used if
you don't want to specify @var{flags} (@pxref{I/O Primitives}).
-@ignore
-@c sendmsg and recvmsg are like readv and writev in that they
-@c use a series of buffers. It's not clear this is worth
-@c supporting or that we support them.
-@c !!! they can do more; it is hairy
-
-@deftp {Data Type} {struct msghdr}
-@standards{BSD, sys/socket.h}
-@end deftp
-
-@deftypefun ssize_t sendmsg (int @var{socket}, const struct msghdr *@var{message}, int @var{flags})
-@standards{BSD, sys/socket.h}
-@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-
-This function is defined as a cancellation point in multi-threaded
-programs, so one has to be prepared for this and make sure that
-allocated resources (like memory, files descriptors, semaphores or
-whatever) are freed even if the thread is cancel.
-@c @xref{pthread_cleanup_push}, for a method how to do this.
-@end deftypefun
-
-@deftypefun ssize_t recvmsg (int @var{socket}, struct msghdr *@var{message}, int @var{flags})
-@standards{BSD, sys/socket.h}
-@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-
-This function is defined as a cancellation point in multi-threaded
-programs, so one has to be prepared for this and make sure that
-allocated resources (like memory, files descriptors, semaphores or
-whatever) are freed even if the thread is canceled.
-@c @xref{pthread_cleanup_push}, for a method how to do this.
-@end deftypefun
-@end ignore
+If you need more flexibility and/or control over sending and receiving
+packets, see @code{sendmsg} and @code{recvmsg} (@pxref{Other Socket APIs}).
@node Datagram Example
@subsection Datagram Socket Example
@@ -3664,3 +3635,20 @@ returns a null pointer if there are no more entries.
@c libc_lock_unlock @aculock
This function closes the networks database.
@end deftypefun
+
+@node Other Socket APIs
+@section Other Socket APIs
+
+@deftp {Data Type} {struct msghdr}
+@standards{BSD, sys/socket.h}
+@end deftp
+
+@deftypefun ssize_t sendmsg (int @var{socket}, const struct msghdr *@var{message}, int @var{flags})
+
+@manpagefunctionstub{sendmsg,2}
+@end deftypefun
+
+@deftypefun ssize_t recvmsg (int @var{socket}, struct msghdr *@var{message}, int @var{flags})
+
+@manpagefunctionstub{recvmsg,2}
+@end deftypefun
diff --git a/manual/startup.texi b/manual/startup.texi
index 9bf24123f562f75b..1426f5e1abfb2f51 100644
--- a/manual/startup.texi
+++ b/manual/startup.texi
@@ -690,7 +690,25 @@ you don't need to know about it because you can just use @theglibc{}'s
@code{chmod} function.
@cindex kernel call
-System calls are sometimes called kernel calls.
+System calls are sometimes called syscalls or kernel calls, and this
+interface is mostly a purely mechanical translation from the kernel's
+ABI to the C ABI. For the set of syscalls where we do not guarantee
+POSIX Thread cancellation the wrappers only organize the incoming
+arguments from the C calling convention to the calling convention of
+the target kernel. For the set of syscalls where we provided POSIX
+Thread cancellation the wrappers set some internal state in the
+library to support cancellation, but this does not impact the
+behaviour of the syscall provided by the kernel.
+
+In some cases, if @theglibc{} detects that a system call has been
+superseded by a more capable one, the wrapper may map the old call to
+the new one. For example, @code{dup2} is implemented via @code{dup3}
+by passing an additional empty flags argument, and @code{open} calls
+@code{openat} passing the additional @code{AT_FDCWD}. Sometimes even
+more is done, such as converting between 32-bit and 64-bit time
+values. In general, though, such processing is only to make the
+system call better match the C ABI, rather than change its
+functionality.
However, there are times when you want to make a system call explicitly,
and for that, @theglibc{} provides the @code{syscall} function.
@@ -712,6 +730,8 @@ we won't describe it here either because anyone who is coding
library source code as a specification of the interface between them
anyway.
+@code{syscall} does not provide cancellation logic, even if the system
+call you're calling is listed as cancellable above.
@code{syscall} is declared in @file{unistd.h}.

28
glibc-RHEL-108475-1.patch Normal file
View File

@ -0,0 +1,28 @@
commit b2c3ee3724900975deaf5eae57640bb0c2d7315e
Author: Andreas Schwab <schwab@suse.de>
Date: Tue Jun 4 11:01:11 2024 +0200
Remove memory leak in fdopen (bug 31840)
Deallocate the memory for the FILE structure when seeking to the end fails
in append mode.
Fixes: ea33158c96 ("Fix offset caching for streams and use it for ftell (BZ #16680)")
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index 2583fb825573aae4..14fbc7b257ad7724 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -156,7 +156,11 @@ _IO_new_fdopen (int fd, const char *mode)
{
off64_t new_pos = _IO_SYSSEEK (&new_f->fp.file, 0, _IO_seek_end);
if (new_pos == _IO_pos_BAD && errno != ESPIPE)
- return NULL;
+ {
+ _IO_un_link (&new_f->fp);
+ free (new_f);
+ return NULL;
+ }
}
return &new_f->fp.file;
}

120
glibc-RHEL-108475-2.patch Normal file
View File

@ -0,0 +1,120 @@
commit d0106b6ae26c8cc046269358a77188105c99d5e3
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Jun 4 14:37:35 2024 +0200
libio: Test for fdopen memory leak without SEEK_END support (bug 31840)
The bug report used /dev/mem, but /proc/self/mem works as well
(if available).
diff --git a/libio/Makefile b/libio/Makefile
index 92d6c6bcab1818d0..b189455bb9b8fd1b 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -94,6 +94,7 @@ tests = \
tst-eof \
tst-ext \
tst-ext2 \
+ tst-fdopen-seek-failure \
tst-fgetc-after-eof \
tst-fgetwc \
tst-fgetws \
@@ -253,6 +254,9 @@ tst_wprintf2-ARGS = "Some Text"
test-fmemopen-ENV = MALLOC_TRACE=$(objpfx)test-fmemopen.mtrace \
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
+tst-fdopen-seek-failure-ENV = \
+ MALLOC_TRACE=$(objpfx)tst-fdopen-seek-failure.mtrace \
+ LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
tst-fopenloc-ENV = MALLOC_TRACE=$(objpfx)tst-fopenloc.mtrace \
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
tst-bz22415-ENV = MALLOC_TRACE=$(objpfx)tst-bz22415.mtrace \
@@ -261,6 +265,7 @@ tst-bz24228-ENV = MALLOC_TRACE=$(objpfx)tst-bz24228.mtrace \
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
generated += test-fmemopen.mtrace test-fmemopen.check
+generated += tst-fdopen-seek-failure.mtrace tst-fdopen-seek-failure.check
generated += tst-fopenloc.mtrace tst-fopenloc.check
generated += tst-bz22415.mtrace tst-bz22415.check
@@ -283,8 +288,12 @@ shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \
oldiofsetpos64
ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)test-freopen.out $(objpfx)test-fmemopen-mem.out \
- $(objpfx)tst-bz22415-mem.out
+tests-special += \
+ $(objpfx)test-fmemopen-mem.out \
+ $(objpfx)test-freopen.out \
+ $(objpfx)tst-bz22415-mem.out \
+ $(objpfx)tst-fdopen-seek-failure-mem.out \
+ # tests-special
ifeq (yes,$(build-shared))
# Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
# library is enabled since they depend on tst-fopenloc.out.
@@ -372,6 +381,11 @@ $(objpfx)test-fmemopen-mem.out: $(objpfx)test-fmemopen.out
$(common-objpfx)malloc/mtrace $(objpfx)test-fmemopen.mtrace > $@; \
$(evaluate-test)
+$(objpfx)tst-fdopen-seek-failure-mem.out: $(objpfx)tst-fdopen-seek-failure.out
+ $(common-objpfx)malloc/mtrace \
+ $(objpfx)tst-fdopen-seek-failure.mtrace > $@; \
+ $(evaluate-test)
+
$(objpfx)tst-fopenloc-mem.out: $(objpfx)tst-fopenloc.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace > $@; \
$(evaluate-test)
diff --git a/libio/tst-fdopen-seek-failure.c b/libio/tst-fdopen-seek-failure.c
new file mode 100644
index 0000000000000000..5c4d40ab34158571
--- /dev/null
+++ b/libio/tst-fdopen-seek-failure.c
@@ -0,0 +1,48 @@
+/* Test for fdopen memory leak without SEEK_END support (bug 31840).
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+
+#include <errno.h>
+#include <fcntl.h>
+#include <mcheck.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <support/check.h>
+#include <support/xunistd.h>
+#include <unistd.h>
+
+static int
+do_test (void)
+{
+ mtrace ();
+
+ /* This file is special because it is seekable, but only
+ with SEEK_SET, not SEEK_END. */
+ int fd = open ("/proc/self/mem", O_RDWR);
+ if (fd < 0)
+ FAIL_UNSUPPORTED ("/proc/self/mem not found: %m");
+ FILE *fp = fdopen (fd, "a");
+ /* The fdopen call should have failed because it tried to use
+ SEEK_END. */
+ TEST_VERIFY (fp == NULL);
+ TEST_COMPARE (errno, EINVAL);
+ xclose (fd);
+ return 0;
+}
+
+#include <support/test-driver.c>

23
glibc-RHEL-108823-1.patch Normal file
View File

@ -0,0 +1,23 @@
commit 34bb581e7713589d38c797c214f4c6bf2b14b702
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Aug 16 16:05:19 2024 +0200
support: Include <string.h> for strcmp in support_format_addrinfo.c
This is currently implied by the internal headers, but it makes
sense not to rely on this.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/support/support_format_addrinfo.c b/support/support_format_addrinfo.c
index cbc72910a96a0e36..77f4db345c2912aa 100644
--- a/support/support_format_addrinfo.c
+++ b/support/support_format_addrinfo.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <support/support.h>
#include <support/xmemstream.h>

460
glibc-RHEL-108823-10.patch Normal file
View File

@ -0,0 +1,460 @@
commit e3db0a699c639e97deddcb15939fd9c162801c77
Author: Florian Weimer <fweimer@redhat.com>
Date: Sat Sep 21 19:25:35 2024 +0200
misc: FUSE-based tests for mkstemp
The tests check that O_EXCL is used properly, that 0600 is used
as the mode, that the characters used are as expected, and that
the distribution of names generated is reasonably random.
The tests run very slowly on some kernel versions, so make them
xtests.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/misc/Makefile b/misc/Makefile
index 235fc7eacb6a980d..a684fb1076fc2354 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -286,6 +286,12 @@ tests-static := tst-empty
tests-internal += tst-fd_to_filename
tests-static += tst-fd_to_filename
+# Tests with long run times.
+xtests += \
+ tst-mkstemp-fuse \
+ tst-mkstemp-fuse-parallel \
+ # xtests
+
ifeq ($(run-built-tests),yes)
tests-special += $(objpfx)tst-error1-mem.out \
$(objpfx)tst-allocate_once-mem.out
diff --git a/misc/tst-mkstemp-fuse-parallel.c b/misc/tst-mkstemp-fuse-parallel.c
new file mode 100644
index 0000000000000000..219f26cb3bf7c0ba
--- /dev/null
+++ b/misc/tst-mkstemp-fuse-parallel.c
@@ -0,0 +1,219 @@
+/* FUSE-based test for mkstemp. Parallel collision statistics.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+
+#include <array_length.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/fuse.h>
+#include <support/support.h>
+#include <support/xthread.h>
+#include <support/xunistd.h>
+
+/* The number of subprocesses that call mkstemp. */
+static pid_t processes[4];
+
+/* Enough space to record the expected number of replies (62**3) for
+ each process. */
+enum { results_allocated = array_length (processes) * 62 * 62 * 62 };
+
+/* The thread will store the results there. */
+static uint64_t *results;
+
+/* Currently used part of the results array. */
+static size_t results_used;
+
+/* Fail with EEXIST (so that mkstemp tries again). Record observed
+ names for later statistical analysis. */
+static void
+fuse_thread (struct support_fuse *f, void *closure)
+{
+ struct fuse_in_header *inh;
+ while ((inh = support_fuse_next (f)) != NULL)
+ {
+ if (support_fuse_handle_mountpoint (f)
+ || (inh->nodeid == 1 && support_fuse_handle_directory (f)))
+ continue;
+ if (inh->opcode != FUSE_LOOKUP || results_used >= results_allocated)
+ {
+ support_fuse_reply_error (f, EIO);
+ continue;
+ }
+
+ char *name = support_fuse_cast (LOOKUP, inh);
+ TEST_COMPARE_BLOB (name, 3, "new", 3);
+ TEST_COMPARE (strlen (name), 9);
+ /* Extract 8 bytes of the name: 'w', the X replacements, and the
+ null terminator. Treat it as an uint64_t for easy sorting
+ below. Endianess does not matter because the relative order
+ of the entries is not important; sorting is only used to find
+ duplicates. */
+ TEST_VERIFY_EXIT (results_used < results_allocated);
+ memcpy (&results[results_used], name + 2, 8);
+ ++results_used;
+ struct fuse_entry_out *out = support_fuse_prepare_entry (f, 2);
+ out->attr.mode = S_IFREG | 0600;
+ support_fuse_reply_prepared (f);
+ }
+}
+
+/* Used to sort the results array, to find duplicates. */
+static int
+results_sort (const void *a1, const void *b1)
+{
+ const uint64_t *a = a1;
+ const uint64_t *b = b1;
+ if (*a < *b)
+ return -1;
+ if (*a == *b)
+ return 0;
+ return 1;
+}
+
+/* Number of occurrences of certain streak lengths. */
+static size_t streak_lengths[6];
+
+/* Called for every encountered streak. */
+static inline void
+report_streak (uint64_t current, size_t length)
+{
+ if (length > 1)
+ {
+ printf ("info: name \"ne%.8s\" repeats: %zu\n",
+ (char *) &current, length);
+ TEST_VERIFY_EXIT (length < array_length (streak_lengths));
+ }
+ TEST_VERIFY_EXIT (length < array_length (streak_lengths));
+ ++streak_lengths[length];
+}
+
+static int
+do_test (void)
+{
+ support_fuse_init ();
+
+ results = xmalloc (results_allocated * sizeof (*results));
+
+ struct shared
+ {
+ /* Used to synchronize the start of all subprocesses, to make it
+ more likely to expose concurrency-related bugs. */
+ pthread_barrier_t barrier1;
+ pthread_barrier_t barrier2;
+
+ /* Filled in after fork. */
+ char mountpoint[4096];
+ };
+
+ /* Used to synchronize the start of all subprocesses, to make it
+ more likely to expose concurrency-related bugs. */
+ struct shared *pshared = support_shared_allocate (sizeof (*pshared));
+ {
+ pthread_barrierattr_t attr;
+ xpthread_barrierattr_init (&attr);
+ xpthread_barrierattr_setpshared (&attr, PTHREAD_PROCESS_SHARED);
+ xpthread_barrierattr_destroy (&attr);
+ xpthread_barrier_init (&pshared->barrier1, &attr,
+ array_length (processes) + 1);
+ xpthread_barrier_init (&pshared->barrier2, &attr,
+ array_length (processes) + 1);
+ xpthread_barrierattr_destroy (&attr);
+ }
+
+ for (int i = 0; i < array_length (processes); ++i)
+ {
+ processes[i] = xfork ();
+ if (processes[i] == 0)
+ {
+ /* Wait for mountpoint initialization. */
+ xpthread_barrier_wait (&pshared->barrier1);
+ char *path = xasprintf ("%s/newXXXXXX", pshared->mountpoint);
+
+ /* Park this process until all processes have started. */
+ xpthread_barrier_wait (&pshared->barrier2);
+ errno = 0;
+ TEST_COMPARE (mkstemp (path), -1);
+ TEST_COMPARE (errno, EEXIST);
+ free (path);
+ _exit (0);
+ }
+ }
+
+ /* Do this after the forking, to minimize initialization inteference. */
+ struct support_fuse *f = support_fuse_mount (fuse_thread, NULL);
+ TEST_VERIFY (strlcpy (pshared->mountpoint, support_fuse_mountpoint (f),
+ sizeof (pshared->mountpoint))
+ < sizeof (pshared->mountpoint));
+ xpthread_barrier_wait (&pshared->barrier1);
+
+ puts ("info: performing mkstemp calls");
+ xpthread_barrier_wait (&pshared->barrier2);
+
+ for (int i = 0; i < array_length (processes); ++i)
+ {
+ int status;
+ xwaitpid (processes[i], &status, 0);
+ TEST_COMPARE (status, 0);
+ }
+
+ support_fuse_unmount (f);
+ xpthread_barrier_destroy (&pshared->barrier2);
+ xpthread_barrier_destroy (&pshared->barrier1);
+
+ printf ("info: checking results (count %zu)\n", results_used);
+ qsort (results, results_used, sizeof (*results), results_sort);
+
+ uint64_t current = -1;
+ size_t streak = 0;
+ for (size_t i = 0; i < results_used; ++i)
+ if (results[i] == current)
+ ++streak;
+ else
+ {
+ report_streak (current, streak);
+ current = results[i];
+ streak = 1;
+ }
+ report_streak (current, streak);
+
+ puts ("info: repetition count distribution:");
+ for (int i = 1; i < array_length (streak_lengths); ++i)
+ printf (" length %d: %zu\n", i, streak_lengths[i]);
+ /* Some arbitrary threshold, hopefully unlikely enough. In over
+ 260,000 runs of a simulation of this test, at most 26 pairs were
+ observed, and only one three-way collisions. */
+ if (streak_lengths[2] > 30)
+ FAIL ("unexpected repetition count 2: %zu", streak_lengths[2]);
+ if (streak_lengths[3] > 2)
+ FAIL ("unexpected repetition count 3: %zu", streak_lengths[3]);
+ for (int i = 4; i < array_length (streak_lengths); ++i)
+ if (streak_lengths[i] > 0)
+ FAIL ("too many repeats of count %d: %zu", i, streak_lengths[i]);
+
+ free (results);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/misc/tst-mkstemp-fuse.c b/misc/tst-mkstemp-fuse.c
new file mode 100644
index 0000000000000000..5ac6a6872a9c513d
--- /dev/null
+++ b/misc/tst-mkstemp-fuse.c
@@ -0,0 +1,197 @@
+/* FUSE-based test for mkstemp.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/fuse.h>
+#include <support/support.h>
+#include <support/xunistd.h>
+
+/* Set to true in do_test to cause the first FUSE_CREATE attempt to fail. */
+static _Atomic bool simulate_creat_race;
+
+/* Basic tests with eventually successful creation. */
+static void
+fuse_thread_basic (struct support_fuse *f, void *closure)
+{
+ char *previous_name = NULL;
+ int state = 0;
+ struct fuse_in_header *inh;
+ while ((inh = support_fuse_next (f)) != NULL)
+ {
+ if (support_fuse_handle_mountpoint (f)
+ || (inh->nodeid == 1 && support_fuse_handle_directory (f)))
+ continue;
+
+ switch (inh->opcode)
+ {
+ case FUSE_LOOKUP:
+ /* File does not exist initially. */
+ TEST_COMPARE (inh->nodeid, 1);
+ if (simulate_creat_race)
+ {
+ if (state < 3)
+ ++state;
+ else
+ FAIL ("invalid state: %d", state);
+ }
+ else
+ {
+ TEST_COMPARE (state, 0);
+ state = 3;
+ }
+ support_fuse_reply_error (f, ENOENT);
+ break;
+ case FUSE_CREATE:
+ {
+ TEST_COMPARE (inh->nodeid, 1);
+ char *name;
+ struct fuse_create_in *p
+ = support_fuse_cast_name (CREATE, inh, &name);
+ /* Name follows after struct fuse_create_in. */
+ TEST_COMPARE (p->flags & O_ACCMODE, O_RDWR);
+ TEST_VERIFY (p->flags & O_EXCL);
+ TEST_VERIFY (p->flags & O_CREAT);
+ TEST_COMPARE (p->mode & 07777, 0600);
+ TEST_VERIFY (S_ISREG (p->mode));
+ TEST_COMPARE_BLOB (name, 3, "new", 3);
+
+ if (state != 3 && simulate_creat_race)
+ {
+ ++state;
+ support_fuse_reply_error (f, EEXIST);
+ }
+ else
+ {
+ if (previous_name != NULL)
+ /* This test has a very small probability of failure
+ due to a harmless collision (one in 62**6 tests). */
+ TEST_VERIFY (strcmp (name, previous_name) != 0);
+ TEST_COMPARE (state, 3);
+ ++state;
+ struct fuse_entry_out *entry;
+ struct fuse_open_out *open;
+ support_fuse_prepare_create (f, 2, &entry, &open);
+ entry->attr.mode = S_IFREG | 0600;
+ support_fuse_reply_prepared (f);
+ }
+ free (previous_name);
+ previous_name = xstrdup (name);
+ }
+ break;
+ case FUSE_FLUSH:
+ case FUSE_RELEASE:
+ TEST_COMPARE (state, 4);
+ TEST_COMPARE (inh->nodeid, 2);
+ support_fuse_reply_empty (f);
+ break;
+ default:
+ support_fuse_reply_error (f, EIO);
+ }
+ }
+ free (previous_name);
+}
+
+/* Reply that all files exist. */
+static void
+fuse_thread_eexist (struct support_fuse *f, void *closure)
+{
+ uint64_t counter = 0;
+ struct fuse_in_header *inh;
+ while ((inh = support_fuse_next (f)) != NULL)
+ {
+ if (support_fuse_handle_mountpoint (f)
+ || (inh->nodeid == 1 && support_fuse_handle_directory (f)))
+ continue;
+
+ switch (inh->opcode)
+ {
+ case FUSE_LOOKUP:
+ ++counter;
+ TEST_COMPARE (inh->nodeid, 1);
+ char *name = support_fuse_cast (LOOKUP, inh);
+ TEST_COMPARE_BLOB (name, 3, "new", 3);
+ TEST_COMPARE (strlen (name), 9);
+ for (int i = 3; i <= 8; ++i)
+ {
+ /* The glibc implementation uses letters and digits only. */
+ char ch = name[i];
+ TEST_VERIFY (('0' <= ch && ch <= '9')
+ || ('a' <= ch && ch <= 'z')
+ || ('A' <= ch && ch <= 'Z'));
+ }
+ struct fuse_entry_out out =
+ {
+ .nodeid = 2,
+ .attr = {
+ .mode = S_IFREG | 0600,
+ .ino = 2,
+ },
+ };
+ support_fuse_reply (f, &out, sizeof (out));
+ break;
+ default:
+ support_fuse_reply_error (f, EIO);
+ }
+ }
+ /* Verify that mkstemp has retried a lot. The current
+ implementation tries 62 * 62 * 62 times until it goves up. */
+ TEST_VERIFY (counter >= 200000);
+}
+
+static int
+do_test (void)
+{
+ support_fuse_init ();
+
+ for (int do_simulate_creat_race = 0; do_simulate_creat_race < 2;
+ ++do_simulate_creat_race)
+ {
+ simulate_creat_race = do_simulate_creat_race;
+ printf ("info: testing with simulate_creat_race == %d\n",
+ (int) simulate_creat_race);
+ struct support_fuse *f = support_fuse_mount (fuse_thread_basic, NULL);
+ char *path = xasprintf ("%s/newXXXXXX", support_fuse_mountpoint (f));
+ int fd = mkstemp (path);
+ TEST_VERIFY (fd > 2);
+ xclose (fd);
+ free (path);
+ support_fuse_unmount (f);
+ }
+
+ puts ("info: testing EEXIST failure case for mkstemp");
+ {
+ struct support_fuse *f = support_fuse_mount (fuse_thread_eexist, NULL);
+ char *path = xasprintf ("%s/newXXXXXX", support_fuse_mountpoint (f));
+ errno = 0;
+ TEST_COMPARE (mkstemp (path), -1);
+ TEST_COMPARE (errno, EEXIST);
+ free (path);
+ support_fuse_unmount (f);
+ }
+
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -0,0 +1,33 @@
commit 455c7622835d16c79e49fe75b8d3a1ae59a3d0ee
Author: Florian Weimer <fweimer@redhat.com>
Date: Sat Sep 21 19:25:35 2024 +0200
support: Fix memory leaks in FUSE tests
The internal read buffer (used by all FUSE tests) was not freed.
The support/tst-support_fuse test missed a deallocation.
diff --git a/support/support_fuse.c b/support/support_fuse.c
index 135dbf1198d5a4c7..f6c063b549e2c26c 100644
--- a/support/support_fuse.c
+++ b/support/support_fuse.c
@@ -659,6 +659,7 @@ support_fuse_unmount (struct support_fuse *f)
if (rmdir (f->mountpoint) != 0)
FAIL ("FUSE: rmdir (\"%s\"): %m", f->mountpoint);
xclose (f->fd);
+ free (f->buffer_start);
free (f->mountpoint);
free (f->readdir_buffer);
free (f);
diff --git a/support/tst-support_fuse.c b/support/tst-support_fuse.c
index c4075a6608d9dd65..9ee637cbab6f6b9e 100644
--- a/support/tst-support_fuse.c
+++ b/support/tst-support_fuse.c
@@ -331,6 +331,7 @@ do_test (void)
{
char *subdir_path = xasprintf ("%s/subdir", support_fuse_mountpoint (f));
xmkdir (subdir_path, 01234);
+ free (subdir_path);
}
{

View File

@ -0,0 +1,26 @@
commit 366cce74d2aa2e5753d8787d415b745fd57fda04
Author: Florian Weimer <fweimer@redhat.com>
Date: Sat Sep 21 19:29:13 2024 +0200
support: Add valgrind instructions to <support/fuse.h>
Replacing an outdated comment (namespace setup is now handled by
support_fuse_init).
diff --git a/support/fuse.h b/support/fuse.h
index 4c365fbc0c7408b9..1c862bedbe487ce6 100644
--- a/support/fuse.h
+++ b/support/fuse.h
@@ -16,8 +16,10 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* Before using this functionality, use support_enter_mount_namespace
- to ensure that mounts do not impact the overall system. */
+/* To run FUSE tests under valgrind, pass the
+ --sim-hints=fuse-compatible option to valgrind. This option tells
+ valgrind that additional system calls effectively call back into
+ the current program. */
#ifndef SUPPORT_FUSE_H
#define SUPPORT_FUSE_H

View File

@ -0,0 +1,17 @@
commit 3ef26b708725b528a1c69ab3eb523036c50b89d6
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Sep 24 13:05:48 2024 +0200
misc: Link tst-mkstemp-fuse-parallel with $(shared-thread-library)
The barrier functions require this on Hurd.
diff --git a/misc/Makefile b/misc/Makefile
index a684fb1076fc2354..6aa74d332b40ca94 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -369,3 +369,4 @@ $(objpfx)tst-select: $(librt)
$(objpfx)tst-select-time64: $(librt)
$(objpfx)tst-pselect: $(librt)
$(objpfx)tst-pselect-time64: $(librt)
+$(objpfx)tst-mkstemp-fuse-parallel: $(shared-thread-library)

View File

@ -0,0 +1,39 @@
commit 6f999af332c91035350390ef8af96388b8f4fd2c
Author: Arjun Shankar <arjun@redhat.com>
Date: Mon Aug 18 15:33:13 2025 +0200
support: Handle FUSE_GETXATTR during FUSE FS mount
When testing with some kernel versions, support FUSE infrastructure
encounters a FUSE_GETXATTR request, leading to FUSE tests hanging until
timed out. Therefore, pass FUSE_GETXATTR requests from
support_fuse_handle_mountpoint to support_fuse_handle_directory, and
adjust support_fuse_handle_directory to return ENOSYS so that tests can
proceed.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/support/support_fuse.c b/support/support_fuse.c
index f6c063b549e2c26c..5af2f7d8ab93a5ea 100644
--- a/support/support_fuse.c
+++ b/support/support_fuse.c
@@ -212,6 +212,9 @@ support_fuse_handle_directory (struct support_fuse *f)
support_fuse_reply_prepared (f);
}
return true;
+ case FUSE_GETXATTR:
+ support_fuse_reply_error (f, ENOSYS);
+ return true;
default:
return false;
}
@@ -222,7 +225,8 @@ support_fuse_handle_mountpoint (struct support_fuse *f)
{
TEST_VERIFY (f->inh != NULL);
/* 1 is the root node. */
- if (f->inh->opcode == FUSE_GETATTR && f->inh->nodeid == 1)
+ if ((f->inh->opcode == FUSE_GETATTR || f->inh->opcode == FUSE_GETXATTR)
+ && f->inh->nodeid == 1)
return support_fuse_handle_directory (f);
return false;
}

41
glibc-RHEL-108823-2.patch Normal file
View File

@ -0,0 +1,41 @@
commit 34e52acd55d69964d14fb3188c5538442b8b32be
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Aug 22 16:14:17 2024 +0200
support: Report errno constants in TEST_COMPARE failures
If the expression is errno, decode it as an errno constant
using strerrorname_np.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
diff --git a/support/support_test_compare_failure.c b/support/support_test_compare_failure.c
index ae73d200cda81ea9..dba79e413feffec5 100644
--- a/support/support_test_compare_failure.c
+++ b/support/support_test_compare_failure.c
@@ -17,7 +17,9 @@
<https://www.gnu.org/licenses/>. */
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
+#include <string.h>
#include <support/check.h>
static void
@@ -31,7 +33,14 @@ report (const char *which, const char *expr, long long value, int positive,
printf ("%lld", value);
unsigned long long mask
= (~0ULL) >> (8 * (sizeof (unsigned long long) - size));
- printf (" (0x%llx); from: %s\n", (unsigned long long) value & mask, expr);
+ const char *errno_constant = NULL;
+ if (strcmp (expr, "errno") == 0
+ && positive && (unsigned long long int) value <= INT_MAX)
+ errno_constant = strerrorname_np (value);
+ printf (" (0x%llx", (unsigned long long) value & mask);
+ if (errno_constant != NULL)
+ printf (", %s", errno_constant);
+ printf ("); from: %s\n", expr);
}
void

88
glibc-RHEL-108823-3.patch Normal file
View File

@ -0,0 +1,88 @@
commit 424d97be50488beb6196c0ff0bc3dfeb87b4281c
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Aug 30 20:37:18 2024 +0200
io: Add error tests for fchmod
On Linux most descriptors that do not correspond to file system
entities (such as anonymous pipes and sockets) have file permissions
that can be changed. While it is possible to create a custom file
system that returns (say) EINVAL for an fchmod attempt, testing this
does not appear to be useful.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/io/Makefile b/io/Makefile
index 54d950d51f31758b..8ecd2842e20fef97 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -188,6 +188,7 @@ tests := \
tst-closefrom \
tst-copy_file_range \
tst-faccessat \
+ tst-fchmod-errors \
tst-fchmodat \
tst-fchownat \
tst-fcntl \
diff --git a/io/tst-fchmod-errors.c b/io/tst-fchmod-errors.c
new file mode 100644
index 0000000000000000..ee15300fc3edf6f0
--- /dev/null
+++ b/io/tst-fchmod-errors.c
@@ -0,0 +1,56 @@
+/* Test various fchmod error cases.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <support/check.h>
+#include <support/xunistd.h>
+
+static int
+do_test (void)
+{
+ {
+ /* Permissions on /dev/null (the opened descriptor) cannot be changed. */
+ int fd = xopen ("/dev/null", O_RDWR, 0);
+ errno = 0;
+ TEST_COMPARE (fchmod (fd, 0), -1);
+ TEST_COMPARE (errno, EPERM);
+ xclose (fd);
+
+ /* Now testing an invalid file descriptor. */
+ errno = 0;
+ TEST_COMPARE (fchmod (fd, 0600), -1);
+ TEST_COMPARE (errno, EBADF);
+ }
+
+ errno = 0;
+ TEST_COMPARE (fchmod (-1, 0600), -1);
+ TEST_COMPARE (errno, EBADF);
+
+ errno = 0;
+ TEST_COMPARE (fchmod (AT_FDCWD, 0600), -1);
+ TEST_COMPARE (errno, EBADF);
+
+ /* Linux supports fchmod on pretty much all file descriptors, so
+ there is no check for failure on specific types of descriptors
+ here. */
+
+ return 0;
+}
+
+#include <support/test-driver.c>

44
glibc-RHEL-108823-4.patch Normal file
View File

@ -0,0 +1,44 @@
commit 3844cdc33093dbe1e33ddb831eada9bdb4a482b9
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Aug 30 22:07:12 2024 +0200
io: Fix destructive nature of tst-fchmod-errors
We must not change the permissions of /dev/null if running
as root.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/io/tst-fchmod-errors.c b/io/tst-fchmod-errors.c
index ee15300fc3edf6f0..bf2a4c568e33aeaa 100644
--- a/io/tst-fchmod-errors.c
+++ b/io/tst-fchmod-errors.c
@@ -18,8 +18,10 @@
#include <errno.h>
#include <fcntl.h>
+#include <stdio.h>
#include <support/check.h>
#include <support/xunistd.h>
+#include <unistd.h>
static int
do_test (void)
@@ -27,9 +29,14 @@ do_test (void)
{
/* Permissions on /dev/null (the opened descriptor) cannot be changed. */
int fd = xopen ("/dev/null", O_RDWR, 0);
- errno = 0;
- TEST_COMPARE (fchmod (fd, 0), -1);
- TEST_COMPARE (errno, EPERM);
+ if (getuid () == 0)
+ puts ("info: /dev/null fchmod test skipped because of root privileges");
+ else
+ {
+ errno = 0;
+ TEST_COMPARE (fchmod (fd, 0), -1);
+ TEST_COMPARE (errno, EPERM);
+ }
xclose (fd);
/* Now testing an invalid file descriptor. */

1646
glibc-RHEL-108823-5.patch Normal file

File diff suppressed because it is too large Load Diff

414
glibc-RHEL-108823-6.patch Normal file
View File

@ -0,0 +1,414 @@
commit 3b1d32177635023e37bec7fbfd77c3cfb2659eb1
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Aug 30 21:52:10 2024 +0200
support: Add <support/xdirent.h>
Use static functions for readdir/readdir_r, so that
-D_FILE_OFFSET_BITS=64 does not improperly redirect calls to the wrong
implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/support/Makefile b/support/Makefile
index 23ce2ccec89743bb..2cc0654e86a5e0de 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -73,6 +73,8 @@ libsupport-routines = \
support_quote_blob \
support_quote_blob_wide \
support_quote_string \
+ support_readdir_check \
+ support_readdir_r_check \
support_record_failure \
support_run_diff \
support_select_modifies_timeout \
@@ -115,6 +117,7 @@ libsupport-routines = \
xclock_settime_time64 \
xclone \
xclose \
+ xclosedir \
xconnect \
xcopy_file_range \
xdlfcn \
@@ -122,6 +125,7 @@ libsupport-routines = \
xdup2 \
xfchmod \
xfclose \
+ xfdopendir \
xfgets \
xfopen \
xfork \
@@ -143,6 +147,7 @@ libsupport-routines = \
xmunmap \
xnewlocale \
xopen \
+ xopendir \
xpipe \
xpoll \
xposix_memalign \
@@ -328,6 +333,7 @@ tests = \
tst-test_compare_string \
tst-test_compare_string_wide \
tst-timespec \
+ tst-xdirent \
tst-xreadlink \
tst-xsigstack \
# tests
diff --git a/support/support_readdir_check.c b/support/support_readdir_check.c
new file mode 100644
index 0000000000000000..5687004276f87d93
--- /dev/null
+++ b/support/support_readdir_check.c
@@ -0,0 +1,30 @@
+/* Error-checking helper for xreaddir, xreaddir64.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+void *
+support_readdir_check (const char *name, void *result, int saved_errno)
+{
+ if (result == NULL && errno != 0)
+ FAIL_EXIT1 ("%s: %m", name);
+ errno = saved_errno;
+ return result;
+}
diff --git a/support/support_readdir_r_check.c b/support/support_readdir_r_check.c
new file mode 100644
index 0000000000000000..6bbb0d0b32fb949e
--- /dev/null
+++ b/support/support_readdir_r_check.c
@@ -0,0 +1,35 @@
+/* Error-checking helper for xreaddir_r, xreaddir64_r.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+int
+support_readdir_r_check (const char *name, int result, void *buf, void *ptr)
+{
+ if (result != 0)
+ {
+ errno = result;
+ FAIL_EXIT1 ("%s: %m", name);
+ }
+ if (buf != ptr)
+ FAIL_EXIT1 ("%s: buffer pointer and returned pointer differ: %p != %p",
+ name, buf, ptr);
+ return result;
+}
diff --git a/support/tst-xdirent.c b/support/tst-xdirent.c
new file mode 100644
index 0000000000000000..642483165a36765c
--- /dev/null
+++ b/support/tst-xdirent.c
@@ -0,0 +1,76 @@
+/* Compile test for error-checking wrappers for <dirent.h>
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <libc-diag.h>
+#include <support/check.h>
+#include <unistd.h>
+
+static int
+do_test (void)
+{
+ {
+ DIR *d = xopendir (".");
+ struct dirent *e = xreaddir (d);
+ /* Assume that the "." special entry always comes first. */
+ TEST_COMPARE_STRING (e->d_name, ".");
+ while (xreaddir (d) != NULL)
+ ;
+ xclosedir (d);
+ }
+
+ {
+ DIR *d = xopendir (".");
+ struct dirent64 *e = xreaddir64 (d);
+ TEST_COMPARE_STRING (e->d_name, ".");
+ while (xreaddir64 (d) != NULL)
+ ;
+ xclosedir (d);
+ }
+
+ /* The functions readdir_r, readdir64_r were deprecated in glibc 2.24. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
+ {
+ DIR *d = xopendir (".");
+ struct dirent buf = { 0, };
+ TEST_VERIFY (xreaddir_r (d, &buf));
+ TEST_COMPARE_STRING (buf.d_name, ".");
+ while (xreaddir_r (d, &buf))
+ ;
+ xclosedir (d);
+ }
+
+ {
+ DIR *d = xopendir (".");
+ struct dirent64 buf = { 0, };
+ TEST_VERIFY (xreaddir64_r (d, &buf));
+ TEST_COMPARE_STRING (buf.d_name, ".");
+ while (xreaddir64_r (d, &buf))
+ ;
+ xclosedir (d);
+ }
+
+ DIAG_POP_NEEDS_COMMENT;
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/support/xclosedir.c b/support/xclosedir.c
new file mode 100644
index 0000000000000000..b490df5598e76226
--- /dev/null
+++ b/support/xclosedir.c
@@ -0,0 +1,28 @@
+/* Error-checking wrapper for closedir.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+void
+xclosedir (DIR *dir)
+{
+ if (closedir (dir) != 0)
+ FAIL_EXIT1 ("closedir: %m");
+}
diff --git a/support/xdirent.h b/support/xdirent.h
new file mode 100644
index 0000000000000000..8465d70ec1ea97d8
--- /dev/null
+++ b/support/xdirent.h
@@ -0,0 +1,86 @@
+/* Error-checking wrappers for <dirent.h>
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef SUPPORT_XDIRENT_H
+#define SUPPORT_XDIRENT_H
+
+#include <dirent.h>
+#include <errno.h>
+#include <libc-diag.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+__BEGIN_DECLS
+
+DIR *xopendir (const char *path);
+DIR *xfdopendir (int fd);
+void xclosedir (DIR *);
+
+void *support_readdir_check (const char *, void *, int);
+
+static __attribute__ ((unused)) struct dirent *
+xreaddir (DIR *stream)
+{
+ int saved_errno = errno;
+ errno = 0;
+ struct dirent *result = readdir (stream);
+ return support_readdir_check ("readdir", result, saved_errno);
+}
+
+static __attribute__ ((unused)) struct dirent64 *
+xreaddir64 (DIR *stream)
+{
+ int saved_errno = errno;
+ errno = 0;
+ struct dirent64 *result = readdir64 (stream);
+ return support_readdir_check ("readdir64", result, saved_errno);
+}
+
+/* The functions readdir_r, readdir64_r were deprecated in glibc 2.24. */
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
+int support_readdir_r_check (const char *, int, void *, void *);
+
+static __attribute__ ((unused)) bool
+xreaddir_r (DIR *stream, struct dirent *buf)
+{
+ struct dirent *ptr;
+ int ret = readdir_r (stream, buf, &ptr);
+ if (ret == 0 && ptr == NULL)
+ return false;
+ support_readdir_r_check ("readdir_r", ret, buf, ptr);
+ return true;
+}
+
+static __attribute__ ((unused)) bool
+xreaddir64_r (DIR *stream, struct dirent64 *buf)
+{
+ struct dirent64 *ptr;
+ int ret = readdir64_r (stream, buf, &ptr);
+ if (ret == 0 && ptr == NULL)
+ return false;
+ support_readdir_r_check ("readdir64_r", ret, buf, ptr);
+ return true;
+}
+
+DIAG_POP_NEEDS_COMMENT;
+
+__END_DECLS
+
+#endif /* SUPPORT_XDIRENT_H */
diff --git a/support/xfdopendir.c b/support/xfdopendir.c
new file mode 100644
index 0000000000000000..d881d28c738a26a8
--- /dev/null
+++ b/support/xfdopendir.c
@@ -0,0 +1,30 @@
+/* Error-checking wrapper for fdopendir.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+DIR *
+xfdopendir (int fd)
+{
+ DIR *result = fdopendir (fd);
+ if (result == NULL)
+ FAIL_EXIT1 ("fdopendir (%d): %m", fd);
+ return result;
+}
diff --git a/support/xopendir.c b/support/xopendir.c
new file mode 100644
index 0000000000000000..e4aee07fee074d5e
--- /dev/null
+++ b/support/xopendir.c
@@ -0,0 +1,30 @@
+/* Error-checking wrapper for opendir.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+DIR *
+xopendir (const char *path)
+{
+ DIR *result = opendir (path);
+ if (result == NULL)
+ FAIL_EXIT1 ("opendir (\"%s\"): %m", path);
+ return result;
+}

1320
glibc-RHEL-108823-7.patch Normal file

File diff suppressed because it is too large Load Diff

141
glibc-RHEL-108823-8.patch Normal file
View File

@ -0,0 +1,141 @@
commit f4ae345810942db891bddf9b482c72b3a120c3b2
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Aug 29 11:06:08 2024 +0200
io: Add tst-lstat-nofollow, tst-lstat-nofollow-time64
They verify that lstat, lstat64 do not follow symbolic links.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/io/Makefile b/io/Makefile
index 8ecd2842e20fef97..ed9d4c3eed5941a3 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -208,6 +208,7 @@ tests := \
tst-lchmod \
tst-linkat \
tst-lockf \
+ tst-lstat-nofollow \
tst-lutimes \
tst-mkdirat \
tst-mkfifoat \
@@ -236,6 +237,7 @@ tests-time64 := \
tst-futimes-time64\
tst-futimesat-time64 \
tst-lchmod-time64 \
+ tst-lstat-nofollow-time64 \
tst-lutimes-time64 \
tst-stat-time64 \
tst-utime-time64 \
diff --git a/io/tst-lstat-nofollow-time64.c b/io/tst-lstat-nofollow-time64.c
new file mode 100644
index 0000000000000000..45feb3f13085ae44
--- /dev/null
+++ b/io/tst-lstat-nofollow-time64.c
@@ -0,0 +1 @@
+#include "tst-lstat-nofollow.c"
diff --git a/io/tst-lstat-nofollow.c b/io/tst-lstat-nofollow.c
new file mode 100644
index 0000000000000000..5bbb557c72938a8a
--- /dev/null
+++ b/io/tst-lstat-nofollow.c
@@ -0,0 +1,98 @@
+/* Test that lstat does not follow symbolic links.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <string.h>
+#include <support/check.h>
+#include <support/fuse.h>
+#include <support/support.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+static void
+fuse_thread (struct support_fuse *f, void *closure)
+{
+ struct fuse_in_header *inh;
+ while ((inh = support_fuse_next (f)) != NULL)
+ {
+ if (support_fuse_handle_mountpoint (f)
+ || (inh->nodeid == 1 && support_fuse_handle_directory (f)))
+ continue;
+ switch (inh->opcode)
+ {
+ case FUSE_LOOKUP:
+ {
+ TEST_COMPARE (inh->nodeid, 1);
+ TEST_COMPARE_STRING (support_fuse_cast (LOOKUP, inh), "symlink");
+ struct fuse_entry_out *out = support_fuse_prepare_entry (f, 2);
+ out->attr.mode = S_IFLNK | 0777;
+ out->attr.size = strlen ("target");
+ support_fuse_reply_prepared (f);
+ }
+ break;
+ case FUSE_GETATTR:
+ {
+ TEST_COMPARE (inh->nodeid, 2);
+ struct fuse_attr_out *out = support_fuse_prepare_attr (f);
+ out->attr.mode = S_IFLNK | 0777;
+ out->attr.size = strlen ("target");
+ support_fuse_reply_prepared (f);
+ }
+ break;
+ case FUSE_READLINK:
+ /* The lstat operation must not attempt to look at the
+ symbolic link target. */
+ FAIL ("attempt to obtain target of symblic link for node %llu",
+ (unsigned long long int) inh->nodeid);
+ break;
+ default:
+ FAIL ("unexpected event %s", support_fuse_opcode (inh->opcode));
+ }
+ }
+}
+
+static int
+do_test (void)
+{
+ support_fuse_init ();
+ struct support_fuse *f = support_fuse_mount (fuse_thread, NULL);
+ char *symlink_path = xasprintf ("%s/symlink", support_fuse_mountpoint (f));
+
+ {
+ struct stat st = { 0, };
+ TEST_COMPARE (lstat (symlink_path, &st), 0);
+ TEST_COMPARE (st.st_uid, getuid ());
+ TEST_COMPARE (st.st_gid, getgid ());
+ TEST_COMPARE (st.st_size, 6);
+ TEST_COMPARE (st.st_mode, S_IFLNK | 0777);
+ }
+
+ {
+ struct stat64 st = { 0, };
+ TEST_COMPARE (lstat64 (symlink_path, &st), 0);
+ TEST_COMPARE (st.st_uid, getuid ());
+ TEST_COMPARE (st.st_gid, getgid ());
+ TEST_COMPARE (st.st_size, 6);
+ TEST_COMPARE (st.st_mode, S_IFLNK | 0777);
+ }
+
+ free (symlink_path);
+ support_fuse_unmount (f);
+ return 0;
+}
+
+#include <support/test-driver.c>

143
glibc-RHEL-108823-9.patch Normal file
View File

@ -0,0 +1,143 @@
commit 43669fcf7315f494bbbc2c040cedeb0fa8416a5f
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Aug 22 11:02:51 2024 +0200
io: Add FUSE-based test for fchmod
Test all mode arguments, and that extra bits are ignored
as required by POSIX.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/io/Makefile b/io/Makefile
index ed9d4c3eed5941a3..085c7db66a406793 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -189,6 +189,7 @@ tests := \
tst-copy_file_range \
tst-faccessat \
tst-fchmod-errors \
+ tst-fchmod-fuse \
tst-fchmodat \
tst-fchownat \
tst-fcntl \
diff --git a/io/tst-fchmod-fuse.c b/io/tst-fchmod-fuse.c
new file mode 100644
index 0000000000000000..fbd3309963491105
--- /dev/null
+++ b/io/tst-fchmod-fuse.c
@@ -0,0 +1,114 @@
+/* FUSE-based test for fchmod.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/fuse.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/xunistd.h>
+
+/* Set from do_test to indicate the expected incoming mode change request. */
+static _Atomic int expected_mode;
+
+static void
+fuse_thread (struct support_fuse *f, void *closure)
+{
+ struct fuse_in_header *inh;
+ while ((inh = support_fuse_next (f)) != NULL)
+ {
+ if (support_fuse_handle_mountpoint (f)
+ || (inh->nodeid == 1 && support_fuse_handle_directory (f)))
+ continue;
+ switch (inh->opcode)
+ {
+ case FUSE_LOOKUP:
+ {
+ char *name = support_fuse_cast (LOOKUP, inh);
+ TEST_COMPARE_STRING (name, "file");
+ struct fuse_entry_out *out
+ = support_fuse_prepare_entry (f, 2);
+ out->attr.mode = S_IFREG | 0600;
+ support_fuse_reply_prepared (f);
+ }
+ break;
+ case FUSE_OPEN:
+ {
+ TEST_COMPARE (inh->nodeid, 2);
+ struct fuse_open_in *p = support_fuse_cast (OPEN, inh);
+ TEST_COMPARE (p->flags & O_ACCMODE, O_RDWR);
+ struct fuse_open_out out = { 0, };
+ support_fuse_reply (f, &out, sizeof (out));
+ }
+ break;
+ case FUSE_SETATTR:
+ {
+ TEST_COMPARE (inh->nodeid, 2);
+ struct fuse_setattr_in *p = support_fuse_cast (SETATTR, inh);
+ TEST_COMPARE (p->valid , FATTR_MODE);
+ TEST_COMPARE (p->mode, S_IFREG | expected_mode);
+ struct fuse_attr_out *out = support_fuse_prepare_attr (f);
+ out->attr.mode = S_IFREG | p->mode;
+ support_fuse_reply_prepared (f);
+ }
+ break;
+ case FUSE_FLUSH:
+ support_fuse_reply_empty (f);
+ break;
+ default:
+ support_fuse_reply_error (f, EIO);
+ }
+ }
+}
+
+/* Test all mode values with the specified extra bits. */
+static void
+test_with_bits (int fd, unsigned int extra_bits)
+{
+ for (int do_mode = 0; do_mode <= 07777; ++do_mode)
+ {
+ expected_mode = do_mode;
+ TEST_COMPARE (fchmod (fd, extra_bits | do_mode), 0);
+ }
+}
+
+static int
+do_test (void)
+{
+ support_fuse_init ();
+
+ struct support_fuse *f = support_fuse_mount (fuse_thread, NULL);
+ char *path = xasprintf ("%s/file", support_fuse_mountpoint (f));
+ int fd = xopen (path, O_RDWR, 0600);
+ free (path);
+
+ test_with_bits (fd, 0);
+ /* POSIX requires that the extra bits are ignored. */
+ test_with_bits (fd, S_IFREG);
+ test_with_bits (fd, S_IFDIR);
+ test_with_bits (fd, ~07777);
+
+ xclose (fd);
+ support_fuse_unmount (f);
+
+ return 0;
+}
+
+#include <support/test-driver.c>

41
glibc-RHEL-108974-1.patch Normal file
View File

@ -0,0 +1,41 @@
commit 400bdb5c85af5a52b3f5653357c9fca87f036bd3
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue May 28 10:07:47 2024 -0700
Improve doc for time_t range (BZ 31808)
diff --git a/manual/time.texi b/manual/time.texi
index 7d9efc7c6f5b8a43..2e029975b952ac29 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -123,7 +123,7 @@ The number of clock ticks per second is system-specific.
@code{time_t} is the simplest data type used to represent simple
calendar time.
-In ISO C, @code{time_t} can be either an integer or a floating-point
+In ISO C, @code{time_t} can be either an integer or a real floating
type, and the meaning of @code{time_t} values is not specified. The
only things a strictly conforming program can do with @code{time_t}
values are: pass them to @code{difftime} to get the elapsed time
@@ -134,11 +134,21 @@ and pass them to the functions that convert them to broken-down time
On POSIX-conformant systems, @code{time_t} is an integer type and its
values represent the number of seconds elapsed since the @dfn{epoch},
which is 00:00:00 on January 1, 1970, Coordinated Universal Time.
+The count of seconds ignores leap seconds.
@Theglibc{} additionally guarantees that @code{time_t} is a signed
type, and that all of its functions operate correctly on negative
@code{time_t} values, which are interpreted as times before the epoch.
+Functions like @code{localtime} assume the Gregorian calendar even
+though this is historically inaccurate for timestamps before the
+calendar was introduced or after the calendar will become obsolete.
@cindex epoch
+@Theglibc{} also supports leap seconds as an option, in which case
+@code{time_t} counts leap seconds instead of ignoring them.
+Currently the @code{time_t} type is 64 bits wide on all platforms
+supported by @theglibc{}, except that it is 32 bits wide on a few
+older platforms unless you define @code{_TIME_BITS} to 64.
+@xref{Feature Test Macros}.
@end deftp
@deftp {Data Type} {struct timespec}

View File

@ -0,0 +1,70 @@
commit 7fe1fde499507126f7de10ebf12fecaf77ae6602
Author: Joseph Myers <josmyers@redhat.com>
Date: Mon Oct 28 22:22:26 2024 +0000
Document further requirement on mixing streams / file descriptors
The gilbc manual has some documentation in llio.texi of requirements
for moving between I/O on FILE * streams and file descriptors on the
same open file description.
The documentation of what must be done on a FILE * stream to move from
it to either a file descriptor or another FILE * for the same open
file description seems to match POSIX. However, there is an
additional requirement in POSIX on the *second* of the two handles
being moved between, which is not mentioned in the glibc manual: "If
any previous active handle has been used by a function that explicitly
changed the file offset, except as required above for the first
handle, the application shall perform an lseek() or fseek() (as
appropriate to the type of handle) to an appropriate location.".
Document this requirement on seeking in the glibc manual, limited to
the case that seems relevant to glibc (the new channel is a previously
active stream, on which the seeking previously occurred). Note that
I'm not sure what the "except as required above for the first handle"
is meant to be about, so I haven't documented anything for it. As far
as I can tell, nothing specified for moving from the first handle
actually list calling a seek function as one of the steps to be done.
(Current POSIX doesn't seem to have any relevant rationale for this
section. The rationale in the 1996 edition says "In requiring the
seek to an appropriate location for the new handle, the application is
required to know what it is doing if it is passing streams with seeks
involved. If the required seek is not done, the results are undefined
(and in fact the program probably will not work on many common
implementations)." - which also doesn't help in understanding the
purpose of "except as required above for the first handle".)
Tested with "make info" and "make pdf".
diff --git a/manual/llio.texi b/manual/llio.texi
index 850d09205a604589..7121a513a6d6d41b 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -1097,6 +1097,27 @@ streams persist in other processes, their file positions become
undefined as a result. To prevent this, you must clean up the streams
before destroying them.
+In addition to cleaning up a stream before doing I/O using another
+linked channel, additional precautions are needed to ensure a
+well-defined file position indicator in some cases. If both the
+following conditions hold, you must set the file position indicator on
+the new channel (a stream) using a function such as @code{fseek}.
+
+@itemize @bullet
+@item
+The new linked channel is a stream that was previously active.
+
+@item
+The file position indicator was previously set on that channel (while
+it was previously active) with a function such as @code{fseek}.
+@end itemize
+
+POSIX requires such precautions in more cases: if either the old or
+the new linked channel is a stream (whether or not previously active)
+and the file position indicator was previously set on any channel
+linked to those channels with a function such as @code{fseek} or
+@code{lseek}.
+
@node Independent Channels
@subsection Independent Channels
@cindex independent channels

146
glibc-RHEL-108974-11.patch Normal file
View File

@ -0,0 +1,146 @@
commit b7d4de086ce7fcc531cdd67a61dc27b5b3eff482
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Aug 5 16:01:12 2024 +0200
manual: Describe struct link_map, support link maps with dlinfo
This does not describe how to use RTLD_DI_ORIGIN and l_name
to reconstruct a full path for the an object. The reason
is that I think we should not recommend further use of
RTLD_DI_ORIGIN due to its buffer overflow potential (bug 24298).
This should be covered by another dlinfo extension. It would
also obsolete the need for the dladdr approach to obtain
the file name for the main executable.
Obtaining the lowest address from load segments in program
headers is quite clumsy and should be provided directly
via dlinfo.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/manual/dynlink.texi b/manual/dynlink.texi
index d71f7a30d6f46808..ead5455e30c10a61 100644
--- a/manual/dynlink.texi
+++ b/manual/dynlink.texi
@@ -351,16 +351,119 @@ support the XGETBV instruction.
@node Dynamic Linker Introspection
@section Dynamic Linker Introspection
-@Theglibc{} provides various functions for querying information from the
+@Theglibc{} provides various facilities for querying information from the
dynamic linker.
+@deftp {Data Type} {struct link_map}
+
+@cindex link map
+A @dfn{link map} is associated with the main executable and each shared
+object. Some fields of the link map are accessible to applications and
+exposed through the @code{struct link_map}. Applications must not modify
+the link map directly.
+
+Pointers to link maps can be obtained from the @code{_r_debug} variable,
+from the @code{RTLD_DI_LINKMAP} request for @code{dlinfo}, and from the
+@code{_dl_find_object} function. See below for details.
+
+@table @code
+@item l_addr
+@cindex load address
+This field contains the @dfn{load address} of the object. This is the
+offset that needs to be applied to unrelocated addresses in the object
+image (as stored on disk) to form an address that can be used at run
+time for accessing data or running code. For position-dependent
+executables, the load address is typically zero, and no adjustment is
+required. For position-independent objects, the @code{l_addr} field
+usually contains the address of the object's ELF header in the process
+image. However, this correspondence is not guaranteed because the ELF
+header might not be mapped at all, and the ELF file as stored on disk
+might use zero as the lowest virtual address. Due to the second
+variable, values of the @code{l_addr} field do not necessarily uniquely
+identify a shared object.
+
+On Linux, to obtain the lowest loaded address of the main program, use
+@code{getauxval} to obtain the @code{AT_PHDR} and @code{AT_PHNUM} values
+for the current process. Alternatively, call
+@samp{dlinfo (_r_debug.r_map, &@var{phdr})}
+to obtain the number of program headers, and the address of the program
+header array will be stored in @var{phdr}
+(of type @code{const ElfW(Phdr) *}, as explained below).
+These values allow processing the array of program headers and the
+address information in the @code{PT_LOAD} entries among them.
+This works even when the program was started with an explicit loader
+invocation.
+
+@item l_name
+For a shared object, this field contains the file name that the
+@theglibc{} dynamic loader used when opening the object. This can be
+a relative path (relative to the current directory at process start,
+or if the object was loaded later, via @code{dlopen} or
+@code{dlmopen}). Symbolic links are not necessarily resolved.
+
+For the main executable, @code{l_name} is @samp{""} (the empty string).
+(The main executable is not loaded by @theglibc{}, so its file name is
+not available.) On Linux, the main executable is available as
+@file{/proc/self/exe} (unless an explicit loader invocation was used to
+start the program). The file name @file{/proc/self/exe} continues to
+resolve to the same file even if it is moved within or deleted from the
+file system. Its current location can be read using @code{readlink}.
+@xref{Symbolic Links}. (Although @file{/proc/self/exe} is not actually
+a symbol link, it is only presented as one.) Note that @file{/proc} may
+not be mounted, in which case @file{/proc/self/exe} is not available.
+
+If an explicit loader invocation is used (such as @samp{ld.so
+/usr/bin/emacs}), the @file{/proc/self/exe} approach does not work
+because the file name refers to the dynamic linker @code{ld.so}, and not
+the @code{/usr/bin/emacs} program. An approximation to the executable
+path is still available in the @code{@var{info}.dli_fname} member after
+calling @samp{dladdr (_r_debug.r_map->l_ld, &@var{info})}. Note that
+this could be a relative path, and it is supplied by the process that
+created the current process, not the kernel, so it could be inaccurate.
+
+@item l_ld
+This is a pointer to the ELF dynamic segment, an array of tag/value
+pairs that provide various pieces of information that the dynamic
+linking process uses. On most architectures, addresses in the dynamic
+segment are relocated at run time, but on some architectures and in some
+run-time configurations, it is necessary to add the @code{l_addr} field
+value to obtain a proper address.
+
+@item l_prev
+@itemx l_next
+These fields are used to maintain a double-linked linked list of all
+link maps within one @code{dlmopen} namespace. Note that there is
+currently no thread-safe way to iterate over this list. The
+callback-based @code{dl_iterate_phdr} interface can be used instead.
+@end table
+@end deftp
+
+@strong{Portability note:} It is not possible to create a @code{struct
+link_map} object and pass a pointer to a function that expects a
+@code{struct link_map *} argument. Only link map pointers initially
+supplied by @theglibc{} are permitted as arguments. In current versions
+of @theglibc{}, handles returned by @code{dlopen} and @code{dlmopen} are
+pointers to link maps. However, this is not a portable assumption, and
+may even change in future versions of @theglibc{}. To obtain the link
+map associated with a handle, see @code{dlinfo} and
+@code{RTLD_DI_LINKMAP} below. If a function accepts both
+@code{dlopen}/@code{dlmopen} handles and @code{struct link_map} pointers
+in its @code{void *} argument, that is documented explicitly.
+
+@subsection Querying information for loaded objects
+
+The @code{dlinfo} function provides access to internal information
+associated with @code{dlopen}/@code{dlmopen} handles and link maps.
+
@deftypefun {int} dlinfo (void *@var{handle}, int @var{request}, void *@var{arg})
@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
@standards{GNU, dlfcn.h}
This function returns information about @var{handle} in the memory
location @var{arg}, based on @var{request}. The @var{handle} argument
must be a pointer returned by @code{dlopen} or @code{dlmopen}; it must
-not have been closed by @code{dlclose}.
+not have been closed by @code{dlclose}. Alternatively, @var{handle}
+can be a @code{struct link_map *} value for a link map of an object
+that has not been closed.
On success, @code{dlinfo} returns 0 for most request types; exceptions
are noted below. If there is an error, the function returns @math{-1},

View File

@ -0,0 +1,83 @@
commit 87cd94bba4091d22e24116298ade33b712ada235
Author: DJ Delorie <dj@redhat.com>
Date: Tue Dec 10 17:07:21 2024 -0500
manual: Document more sigaction flags
Adds documentation for three-argument handler
Adds remainder of the SA_* flags
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/signal.texi b/manual/signal.texi
index 5c2ba7dae6072926..2012980efe5e2ccc 100644
--- a/manual/signal.texi
+++ b/manual/signal.texi
@@ -1141,6 +1141,15 @@ This is used in the same way as the @var{action} argument to the
@code{signal} function. The value can be @code{SIG_DFL},
@code{SIG_IGN}, or a function pointer. @xref{Basic Signal Handling}.
+@item void (*sa_sigaction) (int @var{signum}, siginfo_t *@var{info}, void *@var{ucontext})
+This is an alternate to @code{sa_handler} that is used when the
+@code{sa_flags} includes the @code{flag SA_SIGINFO}. Note that this
+and @code{sa_handler} overlap; only ever set one at a time.
+
+The contents of the @var{info} and @var{ucontext} structures are
+kernel and architecture dependent. Please see
+@manpageurl{sigaction,2} for details.
+
@item sigset_t sa_mask
This specifies a set of signals to be blocked while the handler runs.
Blocking is explained in @ref{Blocking for Handler}. Note that the
@@ -1324,6 +1333,24 @@ delivered for both terminated children and stopped children.
Setting this flag for a signal other than @code{SIGCHLD} has no effect.
@end deftypevr
+@deftypevr Macro int SA_NOCLDWAIT
+This flag is meaningful only for the @code{SIGCHLD} signal. When the
+flag is set, the terminated child will not wait for the parent to reap
+it, or become a zombie if not reaped. The child will instead be
+reaped by the kernel immediately on termination, similar to setting
+SIGCHLD to SIG_IGN.
+
+Setting this flag for a signal other than @code{SIGCHLD} has no effect.
+@end deftypevr
+
+@deftypevr Macro int SA_NODEFER
+Normally a signal is added to the signal mask while running its own
+handler; this negates that, so that the same signal can be received
+while it's handler is running. Note that if the signal is included in
+@code{sa_mask}, it is masked regardless of this flag. Only useful when
+assigning a function as a signal handler.
+@end deftypevr
+
@deftypevr Macro int SA_ONSTACK
@standards{BSD, signal.h}
If this flag is set for a particular signal number, the system uses the
@@ -1332,6 +1359,12 @@ If a signal with this flag arrives and you have not set a signal stack,
the normal user stack is used instead, as if the flag had not been set.
@end deftypevr
+@deftypevr Macro int SA_RESETHAND
+Resets the handler for a signal to SIG_DFL, at the moment specified
+handler function begins. I.e. the handler is called once, then the
+action resets.
+@end deftypevr
+
@deftypevr Macro int SA_RESTART
@standards{BSD, signal.h}
This flag controls what happens when a signal is delivered during
@@ -1347,6 +1380,12 @@ clear, returning from a handler makes the function fail.
@xref{Interrupted Primitives}.
@end deftypevr
+@deftypevr Macro int SA_SIGINFO
+Indicates that the @code{sa_sigaction} three-argument form of the
+handler should be used in setting up a handler instead of the
+one-argument @code{sa_handler} form.
+@end deftypevr
+
@node Initial Signal Actions
@subsection Initial Signal Actions
@cindex initial signal actions

220
glibc-RHEL-108974-13.patch Normal file
View File

@ -0,0 +1,220 @@
commit a3a5634d9b0e193502d16488205452598dc4aa74
Author: Arjun Shankar <arjun@redhat.com>
Date: Tue Jan 14 02:52:09 2025 +0100
manual: Consolidate POSIX Semaphores docs in Threads chapter
This commit moves the `sem_*' family of functions from the IPC chapter,
replacing them with a reference to their new location in the Threads
chapter. `sem_clockwait' is also moved out of the Non-POSIX Extensions
subsection since it is now included in the standard since Issue 8:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_clockwait.html
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/manual/ipc.texi b/manual/ipc.texi
index 32c5ac066fb94579..f9c763835961ec32 100644
--- a/manual/ipc.texi
+++ b/manual/ipc.texi
@@ -46,71 +46,6 @@ by @theglibc{}.
@end deftypefun
@subsection POSIX Semaphores
-
-@deftypefun int sem_init (sem_t *@var{sem}, int @var{pshared}, unsigned int @var{value})
-@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
-@c Does not atomically update sem_t therefore AC-unsafe
-@c because it can leave sem_t partially initialized.
-@end deftypefun
-
-@deftypefun int sem_destroy (sem_t *@var{sem})
-@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-@c Function does nothing and is therefore always safe.
-@end deftypefun
-
-@deftypefun {sem_t *} sem_open (const char *@var{name}, int @var{oflag}, ...)
-@safety{@prelim{}@mtsafe{}@asunsafe{@asuinit{}}@acunsafe{@acuinit{}}}
-@c pthread_once asuinit
-@c
-@c We are AC-Unsafe because we use pthread_once to initialize
-@c a global variable that holds the location of the mounted
-@c shmfs on Linux.
-@end deftypefun
-
-@deftypefun int sem_close (sem_t *@var{sem})
-@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
-@c lll_lock asulock aculock
-@c twalk mtsrace{:root}
-@c
-@c We are AS-unsafe because we take a non-recursive lock.
-@c We are AC-unsafe because several internal data structures
-@c are not updated atomically.
-@end deftypefun
-
-@deftypefun int sem_unlink (const char *@var{name})
-@safety{@prelim{}@mtsafe{}@asunsafe{@asuinit{}}@acunsafe{@acucorrupt{}}}
-@c pthread_once asuinit acucorrupt aculock
-@c mempcpy acucorrupt
-@end deftypefun
-
-@deftypefun int sem_wait (sem_t *@var{sem})
-@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
-@c atomic_fetch_add_relaxed (nwaiters) acucorrupt
-@c
-@c Given the use atomic operations this function seems
-@c to be AS-safe. It is AC-unsafe because there is still
-@c a window between atomic_fetch_add_relaxed and the pthread_push
-@c of the handler that undoes that operation. A cancellation
-@c at that point would fail to remove the process from the
-@c waiters count.
-@end deftypefun
-
-@deftypefun int sem_timedwait (sem_t *@var{sem}, const struct timespec *@var{abstime})
-@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
-@c Same safety issues as sem_wait.
-@end deftypefun
-
-@deftypefun int sem_trywait (sem_t *@var{sem})
-@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-@c All atomic operations are safe in all contexts.
-@end deftypefun
-
-@deftypefun int sem_post (sem_t *@var{sem})
-@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-@c Same safety as sem_trywait.
-@end deftypefun
-
-@deftypefun int sem_getvalue (sem_t *@var{sem}, int *@var{sval})
-@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-@c Atomic write of a value is safe in all contexts.
-@end deftypefun
+@Theglibc{} provides POSIX semaphores as well. These functions' names begin
+with @code{sem_} and they are declared in @file{semaphore.h}. @xref{POSIX
+Semaphores}.
diff --git a/manual/threads.texi b/manual/threads.texi
index 9ea137cb9663b89c..806ab866c5231015 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -554,6 +554,8 @@ This section describes the @glibcadj{} POSIX Threads implementation.
@menu
* Thread-specific Data:: Support for creating and
managing thread-specific data
+* POSIX Semaphores:: Support for process and thread
+ synchronization using semaphores
* Non-POSIX Extensions:: Additional functions to extend
POSIX Thread functionality
@end menu
@@ -615,6 +617,86 @@ Associate the thread-specific @var{value} with @var{key} in the calling thread.
@end deftypefun
+@node POSIX Semaphores
+@subsection POSIX Semaphores
+
+@deftypefun int sem_init (sem_t *@var{sem}, int @var{pshared}, unsigned int @var{value})
+@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
+@c Does not atomically update sem_t therefore AC-unsafe
+@c because it can leave sem_t partially initialized.
+@end deftypefun
+
+@deftypefun int sem_destroy (sem_t *@var{sem})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c Function does nothing and is therefore always safe.
+@end deftypefun
+
+@deftypefun {sem_t *} sem_open (const char *@var{name}, int @var{oflag}, ...)
+@safety{@prelim{}@mtsafe{}@asunsafe{@asuinit{}}@acunsafe{@acuinit{}}}
+@c pthread_once asuinit
+@c
+@c We are AC-Unsafe because we use pthread_once to initialize
+@c a global variable that holds the location of the mounted
+@c shmfs on Linux.
+@end deftypefun
+
+@deftypefun int sem_close (sem_t *@var{sem})
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
+@c lll_lock asulock aculock
+@c twalk mtsrace{:root}
+@c
+@c We are AS-unsafe because we take a non-recursive lock.
+@c We are AC-unsafe because several internal data structures
+@c are not updated atomically.
+@end deftypefun
+
+@deftypefun int sem_unlink (const char *@var{name})
+@safety{@prelim{}@mtsafe{}@asunsafe{@asuinit{}}@acunsafe{@acucorrupt{}}}
+@c pthread_once asuinit acucorrupt aculock
+@c mempcpy acucorrupt
+@end deftypefun
+
+@deftypefun int sem_wait (sem_t *@var{sem})
+@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
+@c atomic_fetch_add_relaxed (nwaiters) acucorrupt
+@c
+@c Given the use atomic operations this function seems
+@c to be AS-safe. It is AC-unsafe because there is still
+@c a window between atomic_fetch_add_relaxed and the pthread_push
+@c of the handler that undoes that operation. A cancellation
+@c at that point would fail to remove the process from the
+@c waiters count.
+@end deftypefun
+
+@deftypefun int sem_timedwait (sem_t *@var{sem}, const struct timespec *@var{abstime})
+@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
+@c Same safety issues as sem_wait.
+@end deftypefun
+
+@deftypefun int sem_clockwait (sem_t *@var{sem}, clockid_t @var{clockid}, const struct timespec *@var{abstime})
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
+Behaves like @code{sem_timedwait} except the time @var{abstime} is measured
+against the clock specified by @var{clockid} rather than
+@code{CLOCK_REALTIME}. Currently, @var{clockid} must be either
+@code{CLOCK_MONOTONIC} or @code{CLOCK_REALTIME}.
+@end deftypefun
+
+@deftypefun int sem_trywait (sem_t *@var{sem})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c All atomic operations are safe in all contexts.
+@end deftypefun
+
+@deftypefun int sem_post (sem_t *@var{sem})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c Same safety as sem_trywait.
+@end deftypefun
+
+@deftypefun int sem_getvalue (sem_t *@var{sem}, int *@var{sval})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c Atomic write of a value is safe in all contexts.
+@end deftypefun
+
+
@node Non-POSIX Extensions
@subsection Non-POSIX Extensions
@@ -752,16 +834,6 @@ freed.
@Theglibc{} provides several waiting functions that expect an explicit
@code{clockid_t} argument.
-@comment semaphore.h
-@comment POSIX-proposed
-@deftypefun int sem_clockwait (sem_t *@var{sem}, clockid_t @var{clockid}, const struct timespec *@var{abstime})
-@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
-Behaves like @code{sem_timedwait} except the time @var{abstime} is measured
-against the clock specified by @var{clockid} rather than
-@code{CLOCK_REALTIME}. Currently, @var{clockid} must be either
-@code{CLOCK_MONOTONIC} or @code{CLOCK_REALTIME}.
-@end deftypefun
-
@comment pthread.h
@comment POSIX-proposed
@deftypefun int pthread_cond_clockwait (pthread_cond_t *@var{cond}, pthread_mutex_t *@var{mutex}, clockid_t @var{clockid}, const struct timespec *@var{abstime})
@@ -835,6 +907,9 @@ Currently, @var{clockid} must be either @code{CLOCK_MONOTONIC} or
@code{CLOCK_REALTIME}.
@end deftypefun
+The @code{sem_clockwait} function also works using a @code{clockid_t}
+argument. @xref{POSIX Semaphores}.
+
@node Single-Threaded
@subsubsection Detecting Single-Threaded Execution

111
glibc-RHEL-108974-14.patch Normal file
View File

@ -0,0 +1,111 @@
commit 47c4f4045caaaad1e6165cb638e45d633d6ca97f
Author: Arjun Shankar <arjun@redhat.com>
Date: Tue Jan 14 02:52:10 2025 +0100
manual: Add links to POSIX Semaphores man-pages documentation
The POSIX Semaphores functions are currently undocumented in our info
pages. This commit adds links to the man-pages documentation for all
the `sem_*' functions (except `sem_clockwait') so that they refer to
some useful documentation instead of just being stubs. `sem_clockwait'
isn't documented by man-pages but thankfully already has a small useful
blurb in our own docs.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/manual/threads.texi b/manual/threads.texi
index 806ab866c5231015..7b9c79636c9cc79c 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -621,18 +621,24 @@ Associate the thread-specific @var{value} with @var{key} in the calling thread.
@subsection POSIX Semaphores
@deftypefun int sem_init (sem_t *@var{sem}, int @var{pshared}, unsigned int @var{value})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
+@manpagefunctionstub{sem_init,3}
@c Does not atomically update sem_t therefore AC-unsafe
@c because it can leave sem_t partially initialized.
@end deftypefun
@deftypefun int sem_destroy (sem_t *@var{sem})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@manpagefunctionstub{sem_destroy,3}
@c Function does nothing and is therefore always safe.
@end deftypefun
@deftypefun {sem_t *} sem_open (const char *@var{name}, int @var{oflag}, ...)
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@asunsafe{@asuinit{}}@acunsafe{@acuinit{}}}
+@manpagefunctionstub{sem_open,3}
@c pthread_once asuinit
@c
@c We are AC-Unsafe because we use pthread_once to initialize
@@ -641,7 +647,9 @@ Associate the thread-specific @var{value} with @var{key} in the calling thread.
@end deftypefun
@deftypefun int sem_close (sem_t *@var{sem})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
+@manpagefunctionstub{sem_close,3}
@c lll_lock asulock aculock
@c twalk mtsrace{:root}
@c
@@ -651,13 +659,17 @@ Associate the thread-specific @var{value} with @var{key} in the calling thread.
@end deftypefun
@deftypefun int sem_unlink (const char *@var{name})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@asunsafe{@asuinit{}}@acunsafe{@acucorrupt{}}}
+@manpagefunctionstub{sem_unlink,3}
@c pthread_once asuinit acucorrupt aculock
@c mempcpy acucorrupt
@end deftypefun
@deftypefun int sem_wait (sem_t *@var{sem})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
+@manpagefunctionstub{sem_wait,3}
@c atomic_fetch_add_relaxed (nwaiters) acucorrupt
@c
@c Given the use atomic operations this function seems
@@ -669,11 +681,14 @@ Associate the thread-specific @var{value} with @var{key} in the calling thread.
@end deftypefun
@deftypefun int sem_timedwait (sem_t *@var{sem}, const struct timespec *@var{abstime})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
+@manpagefunctionstub{sem_timedwait,3}
@c Same safety issues as sem_wait.
@end deftypefun
@deftypefun int sem_clockwait (sem_t *@var{sem}, clockid_t @var{clockid}, const struct timespec *@var{abstime})
+@standards{POSIX.1-2024, semaphore.h}
@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
Behaves like @code{sem_timedwait} except the time @var{abstime} is measured
against the clock specified by @var{clockid} rather than
@@ -682,17 +697,23 @@ against the clock specified by @var{clockid} rather than
@end deftypefun
@deftypefun int sem_trywait (sem_t *@var{sem})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@manpagefunctionstub{sem_trywait,3}
@c All atomic operations are safe in all contexts.
@end deftypefun
@deftypefun int sem_post (sem_t *@var{sem})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@manpagefunctionstub{sem_post,3}
@c Same safety as sem_trywait.
@end deftypefun
@deftypefun int sem_getvalue (sem_t *@var{sem}, int *@var{sval})
+@standards{POSIX.1-2008, semaphore.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@manpagefunctionstub{sem_getvalue,3}
@c Atomic write of a value is safe in all contexts.
@end deftypefun

View File

@ -0,0 +1,31 @@
commit 1b29cb7b781ecf3f6dc4647c32861119bacbd5ef
Author: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
Date: Tue Jan 28 15:31:01 2025 -0300
manual: Safety annotations for timespec_get and timespec_getres
Add preliminary annotations that are consistent with clock_gettime and
clock_getres.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/time.texi b/manual/time.texi
index 6ccb07fcfc10449b..6abae3f43640e8ec 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -595,6 +595,7 @@ Systems may support more than just this @w{ISO C} clock.
@deftypefun int timespec_get (struct timespec *@var{ts}, int @var{base})
@standards{ISO, time.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Store into @code{*@var{ts}} the current time according to the @w{ISO
C} time @var{base}.
@@ -603,6 +604,7 @@ The return value is @var{base} on success and @code{0} on failure.
@deftypefun int timespec_getres (struct timespec *@var{res}, int @var{base})
@standards{ISO, time.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
If @var{ts} is non-null, store into @code{*@var{ts}} the resolution of
the time provided by @code{timespec_get} function for the @w{ISO C}
time @var{base}.

View File

@ -0,0 +1,94 @@
commit 37a0933e1bf97346b45463bde0c4631be8abaa07
Author: DJ Delorie <dj@redhat.com>
Date: Tue Dec 10 16:57:21 2024 -0500
manual: make @manpageurl more specific to each output
Tweak the @manpageurl macro to customize the output for
each of html, info, and pdf output. HTML and PDF (at
least, these days) support clicking on the link title,
whereas info does not. Add text to the intro section
explaining which man pages are normative and which
aren't.
diff --git a/manual/intro.texi b/manual/intro.texi
index 879c1b38d9b73a46..d95648468db6f224 100644
--- a/manual/intro.texi
+++ b/manual/intro.texi
@@ -966,13 +966,25 @@ functionality is available on commercial systems.
@Theglibc{} includes by reference the Linux man-pages
@value{man_pages_version} documentation to document the listed
-syscalls for the Linux kernel. For reference purposes only the latest
+syscalls for the Linux kernel. For reference purposes only, the latest
@uref{https://www.kernel.org/doc/man-pages/,Linux man-pages Project}
documentation can be accessed from the
@uref{https://www.kernel.org,Linux kernel} website. Where the syscall
has more specific documentation in this manual that more specific
documentation is considered authoritative.
+Throughout this manual, when we refer to a man page, for example:
+@quotation
+@manpageurl{sendmsg,2}
+@end quotation
+@noindent
+we are referring primarily to the specific version noted above (the
+``normative'' version), typically accessed by running (for example)
+@code{man 2 sendmsg} on a system with that version installed. For
+convenience, we will also link to the online latest copy of the man
+pages, but keep in mind that version will almost always be newer than,
+and thus different than, the normative version noted above.
+
Additional details on the Linux system call interface can be found in
@xref{System Calls}.
diff --git a/manual/macros.texi b/manual/macros.texi
index f48dd4ec2282634f..2003ce2678054ae4 100644
--- a/manual/macros.texi
+++ b/manual/macros.texi
@@ -282,14 +282,22 @@ cwd\comments\
@macro standardsx {element, standard, header}
@end macro
+@ifhtml
@macro manpageurl {func, sec}
-@url{https://man7.org/linux/man-pages/man\sec\/\func\.\sec\.html}
+@url{https://man7.org/linux/man-pages/man\sec\/\func\.\sec\.html,,\func\(\sec\)}
+@xref{Linux Kernel}
@end macro
+@end ifhtml
+@ifnothtml
+@macro manpageurl {func, sec}
+\func\(\sec\) (Latest, online: @url{https://man7.org/linux/man-pages/man\sec\/\func\.\sec\.html})
+@xref{Linux Kernel}
+@end macro
+@end ifnothtml
@macro manpagefunctionstub {func,sec}
This documentation is a stub. For additional information on this
function, consult the manual page @manpageurl{\func\,\sec\}.
-@xref{Linux Kernel}.
@end macro
@end ifclear
diff --git a/manual/resource.texi b/manual/resource.texi
index 6729ada79402f0ad..23952a6b8b9f4f58 100644
--- a/manual/resource.texi
+++ b/manual/resource.texi
@@ -966,7 +966,6 @@ scheduling policies.
For additional information about scheduling policies, consult consult
the manual pages @manpageurl{sched,7} and @manpageurl{sched_setattr,2}.
-@xref{Linux Kernel}.
@strong{Note:} Calling the @code{sched_setattr} function is incompatible
with support for @code{PTHREAD_PRIO_PROTECT} mutexes.
@@ -1000,7 +999,7 @@ Scheduling flags associated with the scheduling policy.
In addition to the generic fields, policy-specific fields are available.
For additional information, consult the manual page
-@manpageurl{sched_setattr,2}. @xref{Linux Kernel}.
+@manpageurl{sched_setattr,2}.
@end deftp
@deftypefun int sched_setattr (pid_t @var{tid}, struct sched_attr *@var{attr}, unsigned int flags)

View File

@ -0,0 +1,86 @@
commit bb6496b96444dfd55d7105396780f6eba14b1cd9
Author: DJ Delorie <dj@redhat.com>
Date: Fri Jan 17 17:34:02 2025 -0500
manual: Update signal descriptions
Based on auditing all the signals and source trees for Hurd and
Linux...
SIGSYS - This is not used for a bad system call (ENOSYS is used
for that). This is used by SECCOMP and some cases where an invalid
sub-function was requested.
SIGSTKFLT - Note it used to be a coprocessor stack fault but is now
obsolete and available for general user use.
SIGLOST - Hurd only now; note that its original purpose as an NFS
lock lost signal is obsolete.
SIGPWR - Note this is for power lost *and* power restored, and is
more a user-mode signal than a kernel-generated signal.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/signal.texi b/manual/signal.texi
index 2012980efe5e2ccc..842b4e49a275bd3b 100644
--- a/manual/signal.texi
+++ b/manual/signal.texi
@@ -427,9 +427,18 @@ failure to properly emulate them.
@deftypevr Macro int SIGSYS
@standards{Unix, signal.h}
-Bad system call; that is to say, the instruction to trap to the
-operating system was executed, but the code number for the system call
-to perform was invalid.
+System call event. This signal may be generated by a valid system
+call which requested an invalid sub-function, and also by the SECCOMP
+filter when it filters or traps a system call.
+
+If the system call itself is invalid or unsupported by the kernel, the
+call will not raise this signal, but will return @code{ENOSYS}.
+@end deftypevr
+
+@deftypevr Macro int SIGSTKFLT
+Coprocessor stack fault. Obsolete, no longer generated. This signal
+may be used by applications in much the way @code{SIGUSR1} and
+@code{SIGUSR2} are.
@end deftypevr
@node Termination Signals
@@ -752,12 +761,11 @@ that isn't connected. @xref{Sending Data}.
@deftypevr Macro int SIGLOST
@standards{GNU, signal.h}
@cindex lost resource signal
-Resource lost. This signal is generated when you have an advisory lock
-on an NFS file, and the NFS server reboots and forgets about your lock.
-
-On @gnuhurdsystems{}, @code{SIGLOST} is generated when any server program
-dies unexpectedly. It is usually fine to ignore the signal; whatever
-call was made to the server that died just returns an error.
+Resource lost. On @gnuhurdsystems{}, @code{SIGLOST} is generated when
+any server program dies unexpectedly. It is usually fine to ignore
+the signal; whatever call was made to the server that died just
+returns an error. This signal's original purpose of signalling a lost
+NFS lock is obsolete.
@end deftypevr
@deftypevr Macro int SIGXCPU
@@ -817,6 +825,17 @@ to print some status information about the system and what the process
is doing. Otherwise the default is to do nothing.
@end deftypevr
+@deftypevr Macro int SIGPWR
+@cindex power event signal
+Power lost or restored. On s390x Linux systems, this signal is
+generated when a machine check warning is issued, and is sent to the
+process designated to receive ctrl-alt-del notifications. Otherwise,
+it is up to userspace applications to generate this signal and manage
+notifications as to the type of power event that happened.
+
+The default action is to terminate the process.
+@end deftypevr
+
@node Signal Messages
@subsection Signal Messages
@cindex signal messages

View File

@ -0,0 +1,60 @@
commit 226476e32251b5688eead482a9338c04ce84d715
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Thu Jan 30 10:05:17 2025 -0500
manual: Explain sched_yield semantics with different schedulers
The manual entry for sched_yield mentions that the function call could
be a nop if there are no other tasks with the same absolute priority.
Expand the explanation to include example schedulers on Linux so that
it's clear that sched_yield may not always result in a different task
being scheduled.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Joseph Myers <josmyers@redhat.com>
diff --git a/manual/resource.texi b/manual/resource.texi
index 23952a6b8b9f4f58..685ddd6defc57818 100644
--- a/manual/resource.texi
+++ b/manual/resource.texi
@@ -929,18 +929,31 @@ function, so there are no specific @code{errno} values.
@c Direct syscall on Linux; alias to swtch on HURD.
This function voluntarily gives up the task's claim on the CPU.
-
-Technically, @code{sched_yield} causes the calling task to be made
-immediately ready to run (as opposed to running, which is what it was
-before). This means that if it has absolute priority higher than 0, it
-gets pushed onto the tail of the queue of tasks that share its
+Depending on the scheduling policy in effect and the tasks ready to run
+on the system, another task may be scheduled to run instead.
+
+A call to @code{sched_yield} does not guarantee that a different task
+from the calling task is scheduled as a result; it depends on the
+scheduling policy used on the target system. It is possible that the
+call may not result in any visible effect, i.e., the same task gets
+scheduled again.
+
+For example on Linux systems, when a simple priority-based FIFO
+scheduling policy (@code{SCHED_FIFO}) is in effect, the calling task is
+made immediately ready to run (as opposed to running, which is what it
+was before). This means that if it has absolute priority higher than 0,
+it gets pushed onto the tail of the queue of tasks that share its
absolute priority and are ready to run, and it will run again when its
turn next arrives. If its absolute priority is 0, it is more
complicated, but still has the effect of yielding the CPU to other
-tasks.
-
-If there are no other tasks that share the calling task's absolute
-priority, this function doesn't have any effect.
+tasks. If there are no other tasks that share the calling task's
+absolute priority, it will be scheduled again as if @code{sched_yield}
+was never called.
+
+Another example could be a time slice based preemptive round-robin
+policy, such as the @code{SCHED_RR} policy on Linux. It is possible
+with this policy that the calling task is scheduled again because it
+still has time left in its slice.
To the extent that the containing program is oblivious to what other
processes in the system are doing and how fast it executes, this

View File

@ -0,0 +1,65 @@
commit f451a02a8c3c0bc6b41dac5e9e6ad49dd1c9529c
Author: Joseph Myers <josmyers@redhat.com>
Date: Mon May 12 14:56:07 2025 +0000
Document all CLOCK_* values
The manual documents CLOCK_REALTIME and CLOCK_MONOTONIC but not other
CLOCK_* values. Add documentation of the POSIX clocks
CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID, along with a
reference to the Linux man pages for the semantics of the
Linux-specific clocks supported (as with some other functionality
coming direct from the Linux kernel where the man pages can be
considered the main documentation).
Note: CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE and
CLOCK_MONOTONIC_COARSE are also defined in the toplevel bits/time.h,
as used for Hurd. Nevertheless, I see no sign that the Hurd code in
glibc actually has any support for those clocks, so I think it is
correct to document them as Linux-specific (and to refer only to the
Linux man pages for their semantics).
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/manual/time.texi b/manual/time.texi
index 6abae3f43640e8ec..4dde875dde4d8075 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -528,7 +528,36 @@ Therefore, @code{CLOCK_MONOTONIC} cannot be used to measure
absolute time, only elapsed time.
@end deftypevr
-Systems may support more than just these two POSIX clocks.
+The following clocks are defined by POSIX, but may not be supported by
+all POSIX systems:
+
+@deftypevr Macro clockid_t CLOCK_PROCESS_CPUTIME_ID
+@standards{POSIX.1, time.h}
+This POSIX clock measures the amount of CPU time used by the calling
+process.
+@end deftypevr
+
+@deftypevr Macro clockid_t CLOCK_THREAD_CPUTIME_ID
+@standards{POSIX.1, time.h}
+This POSIX clock measures the amount of CPU time used by the calling
+thread.
+@end deftypevr
+
+The following clocks are Linux extensions:
+
+@deftypevr Macro clockid_t CLOCK_MONOTONIC_RAW
+@deftypevrx Macro clockid_t CLOCK_REALTIME_COARSE
+@deftypevrx Macro clockid_t CLOCK_MONOTONIC_COARSE
+@deftypevrx Macro clockid_t CLOCK_BOOTTIME
+@deftypevrx Macro clockid_t CLOCK_REALTIME_ALARM
+@deftypevrx Macro clockid_t CLOCK_BOOTTIME_ALARM
+@deftypevrx Macro clockid_t CLOCK_TAI
+@standards{Linux, time.h}
+For details of these clocks, see the manual page
+@manpageurl{clock_gettime,2}.
+@end deftypevr
+
+Systems may support additional clocks beyond those listed here.
@deftypefun int clock_gettime (clockid_t @var{clock}, struct timespec *@var{ts})
@standards{POSIX.1, time.h}

1893
glibc-RHEL-108974-2.patch Normal file

File diff suppressed because it is too large Load Diff

144
glibc-RHEL-108974-20.patch Normal file
View File

@ -0,0 +1,144 @@
commit 6c9bb270d6a624f82a38443545e3d99f5b1e07e1
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri May 16 16:47:02 2025 +0200
manual: Clarifications for listing directories
Support for seeking is limited. Using the d_off and d_reclen members
of struct dirent is discouraged, especially with readdir. Concurrent
modification of directories during iteration may result in duplicate
or missing etnries.
diff --git a/manual/filesys.texi b/manual/filesys.texi
index aabb68385b6b9732..450d175e614d8834 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -409,18 +409,41 @@ entries. It contains the following fields:
This is the null-terminated file name component. This is the only
field you can count on in all POSIX systems.
+While this field is defined with a specified length, functions such as
+@code{readdir} may return a pointer to a @code{struct dirent} where the
+@code{d_name} extends beyond the end of the struct.
+
@item ino_t d_fileno
This is the file serial number. For BSD compatibility, you can also
refer to this member as @code{d_ino}. On @gnulinuxhurdsystems{} and most POSIX
systems, for most files this the same as the @code{st_ino} member that
@code{stat} will return for the file. @xref{File Attributes}.
+@item off_t d_off
+This value contains the offset of the next directory entry (after this
+entry) in the directory stream. The value may not be compatible with
+@code{lseek} or @code{seekdir}, especially if the width of @code{d_off}
+is less than 64 bits. Directory entries are not ordered by offset, and
+the @code{d_off} and @code{d_reclen} values are unrelated. Seeking on
+directory streams is not recommended. The symbol
+@code{_DIRENT_HAVE_D_OFF} is defined if the @code{d_ino} member is
+available.
+
@item unsigned char d_namlen
This is the length of the file name, not including the terminating
null character. Its type is @code{unsigned char} because that is the
integer type of the appropriate size. This member is a BSD extension.
The symbol @code{_DIRENT_HAVE_D_NAMLEN} is defined if this member is
-available.
+available. (It is not available on Linux.)
+
+@item unsigned short int d_reclen
+This is the length of the entire directory record. When iterating
+through a buffer filled by @code{getdents64} (@pxref{Low-level Directory
+Access}), this value needs to be added to the offset of the current
+directory entry to obtain the offset of the next entry. When using
+@code{readdir} and related functions, the value of @code{d_reclen} is
+undefined and should not be accessed. The symbol
+@code{_DIRENT_HAVE_D_RECLEN} is defined if this member is available.
@item unsigned char d_type
This is the type of the file, possibly unknown. The following constants
@@ -457,7 +480,7 @@ This member is a BSD extension. The symbol @code{_DIRENT_HAVE_D_TYPE}
is defined if this member is available. On systems where it is used, it
corresponds to the file type bits in the @code{st_mode} member of
@code{struct stat}. If the value cannot be determined the member
-value is DT_UNKNOWN. These two macros convert between @code{d_type}
+value is @code{DT_UNKNOWN}. These two macros convert between @code{d_type}
values and @code{st_mode} values:
@deftypefun int IFTODT (mode_t @var{mode})
@@ -632,6 +655,20 @@ and can be rewritten by a subsequent call.
return entries for @file{.} and @file{..}, even though these are always
valid file names in any directory. @xref{File Name Resolution}.
+If a directory is modified between a call to @code{readdir} and after
+the directory stream was created or @code{rewinddir} was last called on
+it, it is unspecified according to POSIX whether newly created or
+removed entries appear among the entries returned by repeated
+@code{readdir} calls before the end of the directory is reached.
+However, due to practical implementation constraints, it is possible
+that entries (including unrelated, unmodified entries) appear multiple
+times or do not appear at all if the directory is modified while listing
+it. If the application intends to create files in the directory, it may
+be necessary to complete the iteration first and create a copy of the
+information obtained before creating any new files. (See below for
+instructions regarding copying of @code{d_name}.) The iteration can be
+restarted using @code{rewinddir}. @xref{Random Access Directory}.
+
If there are no more entries in the directory or an error is detected,
@code{readdir} returns a null pointer. The following @code{errno} error
conditions are defined for this function:
@@ -812,6 +849,10 @@ directory since it was opened with @code{opendir}. (Entries for these
files might or might not be returned by @code{readdir} if they were
added or removed since you last called @code{opendir} or
@code{rewinddir}.)
+
+For example, it is recommended to call @code{rewinddir} followed by
+@code{readdir} to check if a directory is empty after listing it with
+@code{readdir} and deleting all encountered files from it.
@end deftypefun
@deftypefun {long int} telldir (DIR *@var{dirstream})
@@ -823,6 +864,13 @@ added or removed since you last called @code{opendir} or
The @code{telldir} function returns the file position of the directory
stream @var{dirstream}. You can use this value with @code{seekdir} to
restore the directory stream to that position.
+
+Using the the @code{telldir} function is not recommended.
+
+The value returned by @code{telldir} may not be compatible with the
+@code{d_off} field in @code{struct dirent}, and cannot be used with the
+@code{lseek} function. The returned value may not unambiguously
+identify the position in the directory stream.
@end deftypefun
@deftypefun void seekdir (DIR *@var{dirstream}, long int @var{pos})
@@ -836,6 +884,9 @@ stream @var{dirstream} to @var{pos}. The value @var{pos} must be the
result of a previous call to @code{telldir} on this particular stream;
closing and reopening the directory can invalidate values returned by
@code{telldir}.
+
+Using the the @code{seekdir} function is not recommended. To seek to
+the beginning of the directory stream, use @code{rewinddir}.
@end deftypefun
@@ -1007,9 +1058,20 @@ Note that some file systems support file names longer than
@code{NAME_MAX} bytes (e.g., because they support up to 255 Unicode
characters), so a buffer size of at least 1024 is recommended.
+If the directory has been modified since the first call to
+@code{getdents64} on the directory (opening the descriptor or seeking to
+offset zero), it is possible that the buffer contains entries that have
+been encountered before. Likewise, it is possible that files that are
+still present are not reported before the end of the directory is
+encountered (and @code{getdents64} returns zero).
+
This function is specific to Linux.
@end deftypefun
+Systems that support @code{getdents64} support seeking on directory
+streams. @xref{File Position Primitive}. However, the only offset that
+works reliably is offset zero, indicating that reading the directory
+should start from the beginning.
@node Working with Directory Trees
@section Working with Directory Trees

View File

@ -0,0 +1,67 @@
commit 43afae31e0d7579deef13536c4c3704afaa017da
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu May 29 22:11:38 2025 +0100
manual: Document error codes missing for 'socket'
Add missing EAFNOSUPPORT, ESOCKTNOSUPPORT, EPROTOTYPE, EINVAL, EPERM,
and ENOMEM error codes, and adjust existing descriptions accordingly.
On Linux either ENOBUFS or ENOMEM is returned in the case of a memory
allocation failure, depending on the namespace requested, e.g. AF_INET
returns ENOMEM while AF_INET6 returns ENOBUFS, so document these codes
as alternatives.
Similarly EPERM is returned rather than EACCES on Linux, so document
these codes as alternatives as well. We might want to convert EPERM to
EACCES for POSIX compliance, but it is beyond the scope of this change,
and software has to expect either anyway, owing to the long-established
practice.
Finally ESOCKTNOSUPPORT is returned rather than EPROTONOSUPPORT for an
unsupported style except for the AF_QIPCRTR namespace where EPROTOTYPE
is used, so document these codes as alternatives too.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/socket.texi b/manual/socket.texi
index 8708cbb07ca02b5c..ed24cd5bd41ce8c0 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -2205,9 +2205,19 @@ socket, or @code{-1} in case of error. The following @code{errno} error
conditions are defined for this function:
@table @code
+@item EAFNOSUPPORT
+The @var{namespace} requested is not supported.
+
+@item ESOCKTNOSUPPORT
+@itemx EPROTONOSUPPORT
+@itemx EPROTOTYPE
+The @var{style} is not supported by the @var{namespace} specified.
+
@item EPROTONOSUPPORT
-The @var{protocol} or @var{style} is not supported by the
-@var{namespace} specified.
+The @var{protocol} is not supported by the @var{namespace} specified.
+
+@item EINVAL
+The @var{style} or @var{protocol} requested is not valid.
@item EMFILE
The process already has too many file descriptors open.
@@ -2216,11 +2226,13 @@ The process already has too many file descriptors open.
The system already has too many file descriptors open.
@item EACCES
+@itemx EPERM
The process does not have the privilege to create a socket of the specified
@var{style} or @var{protocol}.
@item ENOBUFS
-The system ran out of internal buffer space.
+@itemx ENOMEM
+Insufficient memory was available.
@end table
The file descriptor returned by the @code{socket} function supports both

View File

@ -0,0 +1,36 @@
commit 79b5febd762d6735ba8e878086a50ea04993e340
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu May 29 22:11:38 2025 +0100
manual: Document error codes missing for 'inet_ntop'
Add documentation for EAFNOSUPPORT and ENOSPC error codes returned, and
the return value on failure.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/socket.texi b/manual/socket.texi
index ed24cd5bd41ce8c0..2f0e7509e92974d1 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -1211,7 +1211,19 @@ network (binary) to presentation (textual) form. @var{af} should be
either @code{AF_INET} or @code{AF_INET6}, as appropriate. @var{cp} is a
pointer to the address to be converted. @var{buf} should be a pointer
to a buffer to hold the result, and @var{len} is the length of this
-buffer. The return value from the function will be this buffer address.
+buffer.
+
+The return value is @var{buf} on success. On failure, the function's
+return value is a null pointer and @code{errno} is set accordingly.
+The following @code{errno} values are specific to this function:
+
+@table @code
+@item EAFNOSUPPORT
+The address family requested is neither @code{AF_INET} nor @code{AF_INET6}.
+
+@item ENOSPC
+Insufficient space available for the result in the buffer provided.
+@end table
@end deftypefun
@node Host Names

View File

@ -0,0 +1,23 @@
commit 9a743032cd59c59167bf615d8ab4acc96b2bf47e
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Fri May 30 15:01:51 2025 +0100
manual: Fix invalid 'illegal' usage with 'nanosleep'
The GNU Coding Standards demand that 'illegal' only be used to refer to
activities prohibited by law. Replace it with 'invalid' accordingly in
the description of the EINVAL error condition for 'nanosleep'.
diff --git a/manual/time.texi b/manual/time.texi
index 4dde875dde4d8075..e754d3a7e7f5c52d 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -3212,7 +3212,7 @@ elapsed time.
@item EINVAL
The nanosecond value in the @var{requested_time} parameter contains an
-illegal value. Either the value is negative or greater than or equal to
+invalid value. Either the value is negative or greater than or equal to
1000 million.
@end table

121
glibc-RHEL-108974-24.patch Normal file
View File

@ -0,0 +1,121 @@
commit 1a3d8f2201d4d613401ce5be9a283f4f28c43093
Author: Arjun Shankar <arjun@redhat.com>
Date: Fri May 30 02:09:50 2025 +0200
manual: Document clock_nanosleep
Make minor clarifications in the documentation for 'nanosleep' and add
an entry for 'clock_nanosleep' as a generalized variant of the former
function that allows clock selection.
Reviewed-by: Maciej W. Rozycki <macro@redhat.com>
diff --git a/manual/time.texi b/manual/time.texi
index e754d3a7e7f5c52d..60e4d4b6fab1482b 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -3179,12 +3179,12 @@ On @gnusystems{}, it is safe to use @code{sleep} and @code{SIGALRM} in
the same program, because @code{sleep} does not work by means of
@code{SIGALRM}.
-@deftypefun int nanosleep (const struct timespec *@var{requested_time}, struct timespec *@var{remaining})
+@deftypefun int nanosleep (const struct timespec *@var{requested_time}, struct timespec *@var{remaining_time})
@standards{POSIX.1, time.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c On Linux, it's a syscall. On Mach, it calls gettimeofday and uses
@c ports.
-If resolution to seconds is not enough the @code{nanosleep} function can
+If resolution to seconds is not enough, the @code{nanosleep} function can
be used. As the name suggests the sleep interval can be specified in
nanoseconds. The actual elapsed time of the sleep interval might be
longer since the system rounds the elapsed time you request up to the
@@ -3193,21 +3193,22 @@ next integer multiple of the actual resolution the system can deliver.
@code{*@var{requested_time}} is the elapsed time of the interval you
want to sleep.
-The function returns as @code{*@var{remaining}} the elapsed time left
-in the interval for which you requested to sleep. If the interval
-completed without getting interrupted by a signal, this is zero.
+If @var{remaining_time} is not the null pointer, the function returns as
+@code{*@var{remaining_time}} the elapsed time left in the interval for which
+you requested to sleep. If the interval completed without getting
+interrupted by a signal, this is zero.
@code{struct timespec} is described in @ref{Time Types}.
-If the function returns because the interval is over the return value is
-zero. If the function returns @math{-1} the global variable @code{errno}
+If the function returns because the interval is over, the return value is
+zero. If the function returns @math{-1}, the global variable @code{errno}
is set to the following values:
@table @code
@item EINTR
The call was interrupted because a signal was delivered to the thread.
-If the @var{remaining} parameter is not the null pointer the structure
-pointed to by @var{remaining} is updated to contain the remaining
+If the @var{remaining_time} parameter is not the null pointer, the structure
+pointed to by @var{remaining_time} is updated to contain the remaining
elapsed time.
@item EINVAL
@@ -3219,10 +3220,58 @@ invalid value. Either the value is negative or greater than or equal to
This function is a cancellation point in multi-threaded programs. This
is a problem if the thread allocates some resources (like memory, file
descriptors, semaphores or whatever) at the time @code{nanosleep} is
-called. If the thread gets canceled these resources stay allocated
-until the program ends. To avoid this calls to @code{nanosleep} should
+called. If the thread gets canceled, these resources stay allocated
+until the program ends. To avoid this, calls to @code{nanosleep} should
be protected using cancellation handlers.
@c ref pthread_cleanup_push / pthread_cleanup_pop
The @code{nanosleep} function is declared in @file{time.h}.
@end deftypefun
+
+@deftypefun int clock_nanosleep (clockid_t @var{clock}, int @var{flags}, const struct timespec *@var{requested_time}, struct timespec *@var{remaining_time})
+@standards{POSIX.1-2001, time.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function is a generalized variant of @code{nanosleep}, providing the
+caller with a way to specify the clock to be used to measure elapsed time
+and express the sleep interval in absolute or relative terms. The call:
+
+@smallexample
+nanosleep (@var{requested_time}, @var{remaining_time})
+@end smallexample
+
+is equivalent to:
+
+@smallexample
+clock_nanosleep (CLOCK_REALTIME, 0, @var{requested_time}, @var{remaining_time})
+@end smallexample
+
+The @var{clock} argument specifies the clock to use.
+@xref{Getting the Time}, for the @code{clockid_t} type and possible values
+of @var{clock}. Not all clocks listed are supported for use with
+@code{clock_nanosleep}. For details, see the manual page
+@manpageurl{clock_nanosleep,2}.
+
+The @var{flags} argument is either @code{0} or @code{TIMER_ABSTIME}. If
+@var{flags} is @code{0}, then @code{clock_nanosleep} interprets
+@var{requested_time} as an interval relative to the current time specified
+by @var{clock}. If it is @code{TIMER_ABSTIME} instead, @var{requested_time}
+specifies an absolute time measured by @var{clock}; if at the time of the
+call the value requested is less than or equal to the clock specified, then
+the function returns right away. When @var{flags} is @code{TIMER_ABSTIME},
+@var{remaining_time} is not updated.
+
+The return values and error conditions for @code{clock_nanosleep} are the
+same as for @code{nanosleep}, with the following conditions additionally
+defined:
+
+@table @code
+@item EINVAL
+The @var{clock} argument is not a valid clock.
+
+@item EOPNOTSUPP
+The @var{clock} argument is not supported by the kernel for
+@code{clock_nanosleep}.
+@end table
+
+The @code{clock_nanosleep} function is declared in @file{time.h}.
+@end deftypefun

View File

@ -0,0 +1,74 @@
commit 591283a68965fe61a7186c9c81f7812e71b282b4
Author: Arjun Shankar <arjun@redhat.com>
Date: Mon Jun 2 10:41:02 2025 +0200
manual: Correct return value description of 'clock_nanosleep'
Commit 1a3d8f2201d4d613401ce5be9a283f4f28c43093 incorrectly described
'clock_nanosleep' as having the same return values as 'nanosleep'. Fix
this, clarifying that 'clock_nanosleep' returns a positive error number
upon failure instead of setting 'errno'. Also clarify that 'nanosleep'
returns '-1' upon error.
Fixes: 1a3d8f2201d4d613401ce5be9a283f4f28c43093
Reported-by: Mark Harris <mark.hsj@gmail.com>
Reviewed-by: Mark Harris <mark.hsj@gmail.com>
diff --git a/manual/time.texi b/manual/time.texi
index 60e4d4b6fab1482b..a7c276e1e4f074a6 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -3200,9 +3200,9 @@ interrupted by a signal, this is zero.
@code{struct timespec} is described in @ref{Time Types}.
-If the function returns because the interval is over, the return value is
-zero. If the function returns @math{-1}, the global variable @code{errno}
-is set to the following values:
+If the function returns because the interval is over, it returns zero.
+Otherwise it returns @math{-1} and sets the global variable @code{errno} to
+one of the following values:
@table @code
@item EINTR
@@ -3231,19 +3231,14 @@ The @code{nanosleep} function is declared in @file{time.h}.
@deftypefun int clock_nanosleep (clockid_t @var{clock}, int @var{flags}, const struct timespec *@var{requested_time}, struct timespec *@var{remaining_time})
@standards{POSIX.1-2001, time.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-This function is a generalized variant of @code{nanosleep}, providing the
-caller with a way to specify the clock to be used to measure elapsed time
-and express the sleep interval in absolute or relative terms. The call:
-
-@smallexample
-nanosleep (@var{requested_time}, @var{remaining_time})
-@end smallexample
-
-is equivalent to:
-
-@smallexample
-clock_nanosleep (CLOCK_REALTIME, 0, @var{requested_time}, @var{remaining_time})
-@end smallexample
+This function is similar to @code{nanosleep} while additionally providing
+the caller with a way to specify the clock to be used to measure elapsed
+time and express the sleep interval in absolute or relative terms. It
+returns zero when returning because the interval is over, and a positive
+error number corresponding to the error encountered otherwise. This is
+different from @code{nanosleep}, which returns @math{-1} upon failure and
+sets the global variable @code{errno} according to the error encountered
+instead.
The @var{clock} argument specifies the clock to use.
@xref{Getting the Time}, for the @code{clockid_t} type and possible values
@@ -3260,9 +3255,9 @@ call the value requested is less than or equal to the clock specified, then
the function returns right away. When @var{flags} is @code{TIMER_ABSTIME},
@var{remaining_time} is not updated.
-The return values and error conditions for @code{clock_nanosleep} are the
-same as for @code{nanosleep}, with the following conditions additionally
-defined:
+The @code{clock_nanosleep} function returns error codes as positive return
+values. The error conditions for @code{clock_nanosleep} are the same as for
+@code{nanosleep}, with the following conditions additionally defined:
@table @code
@item EINVAL

View File

@ -0,0 +1,47 @@
commit 46acdf46cc1948187d6540cdf4abee5053cd8bcc
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Wed Jun 4 16:27:20 2025 +0100
manual: Document error codes missing for 'if_indextoname'
Add documentation for ENXIO error code returned and refer to 'socket'
for further possible codes from the underlying function call.
While changing the text clarify the description by mentioning 'ifname'
and replace @code tags with @var ones where referring to a function
parameter.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/socket.texi b/manual/socket.texi
index 2f0e7509e92974d1..a6fb6b1b7e2b0473 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -505,11 +505,22 @@ name. If no interface exists with the name given, it returns 0.
@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
@c It opens a socket with opensock to use ioctl on the fd to get the
@c name from the index.
-This function maps an interface index to its corresponding name. The
-returned name is placed in the buffer pointed to by @code{ifname}, which
-must be at least @code{IFNAMSIZ} bytes in length. If the index was
-invalid, the function's return value is a null pointer, otherwise it is
-@code{ifname}.
+This function maps an interface index @var{ifindex} to its corresponding
+name. The returned name is placed in the buffer pointed to by @var{ifname},
+which must be at least @code{IFNAMSIZ} bytes in length.
+
+The return value is @var{ifname} on success. On failure, the function's
+return value is a null pointer and @code{errno} is set accordingly. The
+following @code{errno} values are specific to this function:
+
+@table @code
+@item ENXIO
+There is no interface at the index requested.
+@end table
+
+Additionally, since @code{if_indextoname} invokes @code{socket}
+internally, @code{errno} may also be set to a value listed for the
+@code{socket} function (@pxref{Creating a Socket}).
@end deftypefun
@deftp {Data Type} {struct if_nameindex}

View File

@ -0,0 +1,39 @@
commit 5a9020eeb27eee88e7839ff5e9cea94892ec90ff
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Wed Jun 4 16:27:20 2025 +0100
manual: Document error codes missing for 'if_nametoindex'
Add documentation for ENODEV error code returned and refer to 'socket'
for further possible codes from the underlying function call.
While changing the text clarify the description by mentioning 'ifname'.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/socket.texi b/manual/socket.texi
index a6fb6b1b7e2b0473..e8285b9200bbfc6d 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -497,7 +497,20 @@ interface name, including its terminating zero byte.
@c takes a lock, which makes all callers AS- and AC-Unsafe.
@c opensock @asulock @aculock @acsfd
This function yields the interface index corresponding to a particular
-name. If no interface exists with the name given, it returns 0.
+name specified with @var{ifname}.
+
+The return value is the interface index on success. On failure, the
+function's return value is zero and @code{errno} is set accordingly.
+The following @code{errno} values are specific to this function:
+
+@table @code
+@item ENODEV
+There is no interface by the name requested.
+@end table
+
+Additionally, since @code{if_nametoindex} invokes @code{socket}
+internally, @code{errno} may also be set to a value listed for the
+@code{socket} function (@pxref{Creating a Socket}).
@end deftypefun
@deftypefun {char *} if_indextoname (unsigned int @var{ifindex}, char *@var{ifname})

View File

@ -0,0 +1,33 @@
commit 140b20e9716b51659a5223b182dcf07ac62b3f77
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Wed Jun 4 16:27:20 2025 +0100
manual: Document error codes missing for 'inet_pton'
Add documentation for EAFNOSUPPORT error code returned, and the possible
return values on non-success.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/socket.texi b/manual/socket.texi
index e8285b9200bbfc6d..d804c7a48b91b403 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -1216,6 +1216,17 @@ either @code{AF_INET} or @code{AF_INET6}, as appropriate for the type of
address being converted. @var{cp} is a pointer to the input string, and
@var{buf} is a pointer to a buffer for the result. It is the caller's
responsibility to make sure the buffer is large enough.
+
+The return value is @code{1} on success and @code{0} if @var{cp} does not
+point to a valid address string for the address family @var{af} requested.
+On failure, the function's return value is @code{-1} and @code{errno} is
+set accordingly. The following @code{errno} values are specific to this
+function:
+
+@table @code
+@item EAFNOSUPPORT
+The address family requested is neither @code{AF_INET} nor @code{AF_INET6}.
+@end table
@end deftypefun
@deftypefun {const char *} inet_ntop (int @var{af}, const void *@var{cp}, char *@var{buf}, socklen_t @var{len})

View File

@ -0,0 +1,67 @@
commit 3b21166c4d34ee032093bcf599ffac42ad8a4371
Author: Arjun Shankar <arjun@redhat.com>
Date: Wed Jun 4 13:08:53 2025 +0200
manual: Expand Descriptor-Relative Access section
Improve the clarity of the paragraphs describing common flags and add a
list of common error conditions for descriptor-relative functions.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/filesys.texi b/manual/filesys.texi
index 450d175e614d8834..28d38f23fc58c51f 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -310,12 +310,17 @@ This is a GNU extension.
The flags argument in @code{@dots{}at} functions can be a combination of
the following flags, defined in @file{fcntl.h}. Not all such functions
support all flags, and some (such as @code{openat}) do not accept a
-flags argument at all.
-
-In the flag descriptions below, the @dfn{effective final path component}
-refers to the final component (basename) of the full path constructed
-from the descriptor and file name arguments, using file name lookup, as
-described above.
+flags argument at all. Although the flags specific to each function have
+distinct values from each other, some flags (relevant to different
+functions) might share the same value and therefore are not guaranteed to
+have unique values.
+
+A non-exhaustive list of common flags and their descriptions follows. Flags
+specific to a function are described alongside the function itself. In
+these flag descriptions, the @dfn{effective final path component} refers to
+the final component (basename) of the full path constructed from the
+descriptor and file name arguments, using file name lookup, as described
+above.
@vtable @code
@item AT_EMPTY_PATH
@@ -353,6 +358,28 @@ a non-final component of the file name are still followed.
argument to the @code{getauxval} function (with @code{AT_@dots{}}
constants defined in @file{elf.h}). @xref{Auxiliary Vector}.
+@cindex common errors in descriptor-relative functions
+@cindex common errors in @code{@dots{}at} functions
+
+The @code{@dots{}at} functions have some common error conditions due to the
+nature of descriptor-relative access. A list of common errors and their
+descriptions follows. Errors specific to a function are described alongside
+the function itself.
+
+@table @code
+@item EBADF
+The file name argument is a relative path but the descriptor argument
+is neither @code{AT_FDCWD} nor a valid file descriptor.
+
+@item EINVAL
+If the function accepts a @var{flags} argument, the flag combination passed
+is not valid for the function.
+
+@item ENOTDIR
+The file name argument is a relative file name but the descriptor
+argument is associated with a file that is not a directory.
+@end table
+
@node Accessing Directories
@section Accessing Directories
@cindex accessing directories

206
glibc-RHEL-108974-3.patch Normal file
View File

@ -0,0 +1,206 @@
commit dce754b1553b86fc6352636f1fa490a85b7cf0ff
Author: DJ Delorie <dj@redhat.com>
Date: Fri May 10 14:52:09 2024 -0400
Update mmap() flags and errors lists
Extend the list of MAP_* macros to include all macros available
to the average program (gcc -E -dM | grep MAP_*)
Extend the list of errno codes.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/llio.texi b/manual/llio.texi
index a8ed72c5db6ecba9..be55dca1b7c9ebcd 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -1574,10 +1574,15 @@ permitted. They include @code{PROT_READ}, @code{PROT_WRITE}, and
of address space for future use. The @code{mprotect} function can be
used to change the protection flags. @xref{Memory Protection}.
-@var{flags} contains flags that control the nature of the map.
-One of @code{MAP_SHARED} or @code{MAP_PRIVATE} must be specified.
+The @var{flags} parameter contains flags that control the nature of
+the map. One of @code{MAP_SHARED}, @code{MAP_SHARED_VALIDATE}, or
+@code{MAP_PRIVATE} must be specified. Additional flags may be bitwise
+OR'd to further define the mapping.
-They include:
+Note that, aside from @code{MAP_PRIVATE} and @code{MAP_SHARED}, not
+all flags are supported on all versions of all operating systems.
+Consult the kernel-specific documentation for details. The flags
+include:
@vtable @code
@item MAP_PRIVATE
@@ -1599,9 +1604,19 @@ Note that actual writing may take place at any time. You need to use
@code{msync}, described below, if it is important that other processes
using conventional I/O get a consistent view of the file.
+@item MAP_SHARED_VALIDATE
+Similar to @code{MAP_SHARED} except that additional flags will be
+validated by the kernel, and the call will fail if an unrecognized
+flag is provided. With @code{MAP_SHARED} using a flag on a kernel
+that doesn't support it causes the flag to be ignored.
+@code{MAP_SHARED_VALIDATE} should be used when the behavior of all
+flags is required.
+
@item MAP_FIXED
This forces the system to use the exact mapping address specified in
-@var{address} and fail if it can't.
+@var{address} and fail if it can't. Note that if the new mapping
+would overlap an existing mapping, the overlapping portion of the
+existing map is unmapped.
@c One of these is official - the other is obviously an obsolete synonym
@c Which is which?
@@ -1642,10 +1657,73 @@ The @code{MAP_HUGETLB} flag is specific to Linux.
@c There is a mechanism to select different hugepage sizes; see
@c include/uapi/asm-generic/hugetlb_encode.h in the kernel sources.
-@c Linux has some other MAP_ options, which I have not discussed here.
-@c MAP_DENYWRITE, MAP_EXECUTABLE and MAP_GROWSDOWN don't seem applicable to
-@c user programs (and I don't understand the last two). MAP_LOCKED does
-@c not appear to be implemented.
+@item MAP_32BIT
+Require addresses that can be accessed with a signed 32 bit pointer,
+i.e., within the first 2 GiB. Ignored if MAP_FIXED is specified.
+
+@item MAP_DENYWRITE
+@itemx MAP_EXECUTABLE
+@itemx MAP_FILE
+
+Provided for compatibility. Ignored by the Linux kernel.
+
+@item MAP_FIXED_NOREPLACE
+Similar to @code{MAP_FIXED} except the call will fail with
+@code{EEXIST} if the new mapping would overwrite an existing mapping.
+To test for support for this flag, specify MAP_FIXED_NOREPLACE without
+MAP_FIXED, and (if the call was successful) check the actual address
+returned. If it does not match the address passed, then this flag is
+not supported.
+
+@item MAP_GROWSDOWN
+This flag is used to make stacks, and is typically only needed inside
+the program loader to set up the main stack for the running process.
+The mapping is created according to the other flags, except an
+additional page just prior to the mapping is marked as a ``guard
+page''. If a write is attempted inside this guard page, that page is
+mapped, the mapping is extended, and a new guard page is created.
+Thus, the mapping continues to grow towards lower addresses until it
+encounters some other mapping.
+
+Note that accessing memory beyond the guard page will not trigger this
+feature. In gcc, use @code{-fstack-clash-protection} to ensure the
+guard page is always touched.
+
+@item MAP_LOCKED
+A hint that requests that mapped pages are locked in memory (i.e. not
+paged out). Note that this is a request and not a requirement; use
+@code{mlock} if locking is required.
+
+@item MAP_POPULATE
+@itemx MAP_NONBLOCK
+@code{MAP_POPULATE} is a hint that requests that the kernel read-ahead
+a file-backed mapping, causing pages to be mapped before they're
+needed. @code{MAP_NONBLOCK} is a hint that requests that the kernel
+@emph{not} attempt such except for pages are already in memory. Note
+that neither of these hints affects future paging activity, use
+@code{mlock} if such needs to be controlled.
+
+@item MAP_NORESERVE
+Asks the kernel to not reserve physical backing (i.e. space in a swap
+device) for a mapping. This would be useful for, for example, a very
+large but sparsely used mapping which need not be limited in total
+length by available RAM, but with very few mapped pages. Note that
+writes to such a mapping may cause a @code{SIGSEGV} if the system is
+unable to map a page due to lack of resources.
+
+On Linux, this flag's behavior may be overwridden by
+@file{/proc/sys/vm/overcommit_memory} as documented in the proc(5) man
+page.
+
+@item MAP_STACK
+Ensures that the resulting mapping is suitable for use as a program
+stack. For example, the use of huge pages might be precluded.
+
+@item MAP_SYNC
+This is a special flag for DAX devices, which tells the kernel to
+write dirty metadata out whenever dirty data is written out. Unlike
+most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE}
+is also given.
@item MAP_DROPPABLE
Request the page to be never written out to swap, it will be zeroed
@@ -1665,6 +1743,24 @@ Possible errors include:
@table @code
+@item EACCES
+
+@var{filedes} was not open for the type of access specified in @var{protect}.
+
+@item EAGAIN
+
+The system has temporarily run out of resources.
+
+@item EBADF
+
+The @var{fd} passed is invalid, and a valid file descriptor is
+required (i.e. MAP_ANONYMOUS was not specified).
+
+@item EEXIST
+
+@code{MAP_FIXED_NOREPLACE} was specified and an existing mapping was
+found overlapping the requested address range.
+
@item EINVAL
Either @var{address} was unusable (because it is not a multiple of the
@@ -1673,23 +1769,37 @@ applicable page size), or inconsistent @var{flags} were given.
If @code{MAP_HUGETLB} was specified, the file or system does not support
large page sizes.
-@item EACCES
+@item ENODEV
-@var{filedes} was not open for the type of access specified in @var{protect}.
+This file is of a type that doesn't support mapping, the process has
+exceeded its data space limit, or the map request would exceed the
+process's virtual address space.
@item ENOMEM
-Either there is not enough memory for the operation, or the process is
-out of address space.
-
-@item ENODEV
-
-This file is of a type that doesn't support mapping.
+There is not enough memory for the operation, the process is out of
+address space, or there are too many mappings. On Linux, the maximum
+number of mappings can be controlled via
+@file{/proc/sys/vm/max_map_count} or, if your OS supports it, via
+the @code{vm.max_map_count} @code{sysctl} setting.
@item ENOEXEC
The file is on a filesystem that doesn't support mapping.
+@item EPERM
+
+@code{PROT_EXEC} was requested but the file is on a filesystem that
+was mounted with execution denied, a file seal prevented the mapping,
+or the caller set MAP_HUDETLB but does not have the required
+priviledges.
+
+@item EOVERFLOW
+
+Either the offset into the file plus the length of the mapping causes
+internal page counts to overflow, or the offset requested exceeds the
+length of the file.
+
@c On Linux, EAGAIN will appear if the file has a conflicting mandatory lock.
@c However mandatory locks are not discussed in this manual.
@c

View File

@ -0,0 +1,50 @@
commit 941157dbcdf1c410960bde991206bfb6d9bb292f
Author: Arjun Shankar <arjun@redhat.com>
Date: Wed Jun 4 13:08:54 2025 +0200
manual: Document faccessat
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/filesys.texi b/manual/filesys.texi
index 28d38f23fc58c51f..17c15b54037e719d 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -3069,6 +3069,29 @@ Flag meaning test for execute/search permission.
Flag meaning test for existence of the file.
@end deftypevr
+@deftypefun int faccessat (int @var{filedes}, const char *@var{filename}, int @var{how}, int @var{flags})
+@standards{POSIX.1-2008, unistd.h}
+@comment Unaudited and therefore marked AC-Unsafe and AS-Unsafe by default
+@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
+This function is a descriptor-relative version of the @code{access}
+function above. @xref{Descriptor-Relative Access}. The @var{flags}
+argument can contain a combination of the flags @code{AT_EACCESS} described
+below, @code{AT_EMPTY_PATH}, and @code{AT_SYMLINK_NOFOLLOW}.
+
+@vtable @code
+@item AT_EACCESS
+This flag when passed to the @code{faccessat} function causes it to perform
+access checks using effective user and group IDs instead of real IDs, which
+is the default and matches the @code{access} function.
+@end vtable
+
+Compared to @code{access}, some additional error conditions can occur.
+@xref{Descriptor-Relative Access}.
+
+This function may not work correctly on older kernels missing the
+@code{faccessat2} system call.
+@end deftypefun
+
@node File Times
@subsection File Times
@@ -3849,7 +3872,6 @@ creation always works like @code{open} with @code{O_EXCL}.
The @code{mkdtemp} function comes from OpenBSD.
@c FIXME these are undocumented:
-@c faccessat
@c fchmodat
@c fchownat
@c futimesat

View File

@ -0,0 +1,38 @@
commit 49766eb1a5b93d093bd0fada55ca7a42dfdb10d6
Author: Arjun Shankar <arjun@redhat.com>
Date: Wed Jun 4 13:08:55 2025 +0200
manual: Document mkdirat
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/filesys.texi b/manual/filesys.texi
index 17c15b54037e719d..d8f362f3beda9b28 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -1964,6 +1964,17 @@ To use this function, your program should include the header file
@pindex sys/stat.h
@end deftypefun
+@deftypefun int mkdirat (int @var{filedes}, const char *@var{filename}, mode_t @var{mode})
+@standards{POSIX.1-2008, sys/stat.h}
+@comment Unaudited and therefore marked AC-Unsafe and AS-Unsafe by default
+@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
+This function is a descriptor-relative version of the @code{mkdir}
+function above. @xref{Descriptor-Relative Access}.
+
+Compared to @code{mkdir}, some additional error conditions can occur.
+@xref{Descriptor-Relative Access}.
+@end deftypefun
+
@node File Attributes
@section File Attributes
@@ -3877,7 +3888,6 @@ The @code{mkdtemp} function comes from OpenBSD.
@c futimesat
@c fstatat (there's a commented-out safety assessment for this one)
@c statx
-@c mkdirat
@c mkfifoat
@c name_to_handle_at
@c openat

View File

@ -0,0 +1,38 @@
commit 60f86c9cd062882cbeb04b2944c3dfb7457ee5c5
Author: Arjun Shankar <arjun@redhat.com>
Date: Wed Jun 4 13:08:56 2025 +0200
manual: Document renameat
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/filesys.texi b/manual/filesys.texi
index d8f362f3beda9b28..8a173c562fa71f83 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -1910,6 +1910,17 @@ file systems.
@end table
@end deftypefun
+@deftypefun int renameat (int @var{oldfiledes}, const char *@var{oldname}, int @var{newfiledes}, const char *@var{newname})
+@standards{POSIX.1-2008, stdio.h}
+@comment Unaudited and therefore marked AC-Unsafe and AS-Unsafe by default
+@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
+This function is a descriptor-relative version of the @code{rename}
+function above. @xref{Descriptor-Relative Access}.
+
+Compared to @code{rename}, some additional error conditions can occur.
+@xref{Descriptor-Relative Access}.
+@end deftypefun
+
@node Creating Directories
@section Creating Directories
@cindex creating a directory
@@ -3893,7 +3904,6 @@ The @code{mkdtemp} function comes from OpenBSD.
@c openat
@c open_by_handle_at
@c readlinkat
-@c renameat
@c renameat2
@c scandirat
@c symlinkat

View File

@ -0,0 +1,51 @@
commit 75b725717ff23d0ae38fc7f4a0361cb1bdffbe2e
Author: Arjun Shankar <arjun@redhat.com>
Date: Wed Jun 4 13:08:57 2025 +0200
manual: Document unlinkat
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/filesys.texi b/manual/filesys.texi
index 8a173c562fa71f83..396d68c32925c501 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -1779,6 +1779,31 @@ file system and can't be modified.
@end table
@end deftypefun
+@deftypefun int unlinkat (int @var{filedes}, const char *@var{filename}, int @var{flags})
+@standards{POSIX.1-2008, unistd.h}
+@comment Unaudited and therefore marked AC-Unsafe and AS-Unsafe by default
+@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
+This function is a descriptor-relative version of the @code{unlink}
+function above. @xref{Descriptor-Relative Access}. The @var{flags}
+argument may either be @code{0} or contain the flag @code{AT_REMOVEDIR}:
+
+@table @code
+@item AT_REMOVEDIR
+This flag causes @code{unlinkat} to perform an @code{rmdir} operation on
+@code{filename} instead of performing the equivalent of @code{unlink}.
+@end table
+
+Compared to @code{unlink}, some additional error conditions can occur due to
+descriptor-relative access. @xref{Descriptor-Relative Access}. In
+addition to this, the following other errors can also occur:
+
+@table @code
+@item EISDIR
+The effective final path derived from @var{filename} and @var{filedes} is a
+directory but @code{AT_REMOVEDIR} was not passed in @code{flags}.
+@end table
+@end deftypefun
+
@deftypefun int rmdir (const char *@var{filename})
@standards{POSIX.1, unistd.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@@ -3907,6 +3932,5 @@ The @code{mkdtemp} function comes from OpenBSD.
@c renameat2
@c scandirat
@c symlinkat
-@c unlinkat
@c utimensat
@c mknodat

View File

@ -0,0 +1,97 @@
commit 25f1d945766a3a757d9b54eb48fe7c3c48c0f791
Author: Arjun Shankar <arjun@redhat.com>
Date: Wed Jun 4 13:08:58 2025 +0200
manual: Document futimens and utimensat
Document futimens and utimensat. Also document the EINVAL error
condition for futimes. It is inherited by futimens and utimensat as
well.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
diff --git a/manual/filesys.texi b/manual/filesys.texi
index 396d68c32925c501..f21f21804251e480 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -3307,6 +3307,10 @@ permission for the file, or be a privileged user.
@item EBADF
The @var{filedes} argument is not a valid file descriptor.
+@item EINVAL
+At least one of the fields in the @code{tvp} array passed has an invalid
+value.
+
@item EPERM
If the @var{times} argument is not a null pointer, you must either be
the owner of the file or be a privileged user.
@@ -3316,6 +3320,64 @@ The file lives on a read-only file system.
@end table
@end deftypefun
+@deftypefun int futimens (int @var{filedes}, const struct timespec @var{tsp}@t{[2]})
+@standards{POSIX.1-2008, sys/stat.h}
+@comment Unaudited and therefore marked AC-Unsafe and AS-Unsafe by default
+@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
+This function is like @code{futimes}, except that it sets the file access
+and modification timestamps with nanosecond precision. The argument
+@code{tsp} is used similarly to @code{futimes}' @code{tvp}, but has a
+@code{const struct timespec} type that can express calendar time with
+nanosecond precision. @xref{Time Types}.
+@end deftypefun
+
+@deftypefun int utimensat (int @var{filedes}, const char *@var{filename}, const struct timespec @var{tsp}@t{[2]}, int @var{flags})
+@standards{POSIX.1-2008, sys/stat.h}
+@comment Unaudited and therefore marked AC-Unsafe and AS-Unsafe by default
+@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
+This function is a descriptor-relative version of the @code{futimens}
+function above. @xref{Descriptor-Relative Access}. The @var{flags}
+argument can contain a combination of the flags @code{AT_EMPTY_PATH}, and
+@code{AT_SYMLINK_NOFOLLOW}. The call:
+
+@smallexample
+futimens (@var{filedes}, @var{tsp})
+@end smallexample
+
+is equivalent to:
+
+@smallexample
+utimensat (@var{filedes}, @code{NULL}, @var{tsp}, 0)
+@end smallexample
+
+Compared to @code{futimens}, some additional error conditions can occur due
+to descriptor-relative access. @xref{Descriptor-Relative Access}. In
+addition to this, the following other errors can also occur:
+
+@table @code
+@item EINVAL
+The @var{filename} argument is NULL, @var{filedes} is not @code{AT_FDCWD},
+and @var{flags} is not @code{0}.
+
+@item ELOOP
+There are too many levels of indirection. This can be the result of
+circular symbolic links to directories.
+
+@item ENAMETOOLONG
+The resulting path is too long. This error only occurs on systems which
+have a limit on the file name length.
+
+@item ENOENT
+The @var{filename} argument is an empty string and @var{flags} does not
+contain @code{AT_EMPTY_PATH}, or @var{filename} does not refer to an
+existing file.
+
+@item ESRCH
+Search permission was denied for one of the prefix components of the the
+@var{filename} argument.
+@end table
+@end deftypefun
+
@node File Size
@subsection File Size
@@ -3932,5 +3994,4 @@ The @code{mkdtemp} function comes from OpenBSD.
@c renameat2
@c scandirat
@c symlinkat
-@c utimensat
@c mknodat

44
glibc-RHEL-108974-4.patch Normal file
View File

@ -0,0 +1,44 @@
commit 0e16db440cc73d2cdd94e439c0efa1ec43d92b2a
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Aug 13 15:52:34 2024 +0200
manual: Document generic printf error codes
Describe EOVERFLOW, ENOMEN, EILSEQ.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/manual/stdio.texi b/manual/stdio.texi
index 393ed9c665792609..19b4a53299410ca6 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -2354,6 +2354,29 @@ the easiest way to make sure you have all the right prototypes is to
just include @file{stdio.h}.
@pindex stdio.h
+The @code{printf} family shares the error codes listed below.
+Individual functions may report additional @code{errno} values if they
+fail.
+
+@table @code
+@item EOVERFLOW
+The number of written bytes would have exceeded @code{INT_MAX}, and thus
+could not be represented in the return type @code{int}.
+
+@item ENOMEM
+The function could not allocate memory during processing. Long argument
+lists and certain floating point conversions may require memory
+allocation, as does initialization of an output stream upon first use.
+
+@item EILSEQ
+POSIX specifies this error code should be used if a wide character is
+encountered that does not have a matching valid character. @Theglibc{}
+always performs transliteration, using a replacement character if
+necessary, so this error condition cannot occur on output. However,
+@theglibc{} uses @code{EILSEQ} to indicate that an input character
+sequence (wide or multi-byte) could not be converted successfully.
+@end table
+
@deftypefun int printf (const char *@var{template}, @dots{})
@standards{ISO, stdio.h}
@safety{@prelim{}@mtsafe{@mtslocale{}}@asunsafe{@asucorrupt{} @ascuheap{}}@acunsafe{@acsmem{} @aculock{} @acucorrupt{}}}

53
glibc-RHEL-108974-5.patch Normal file
View File

@ -0,0 +1,53 @@
commit 2be0572f3a41d5d5a8bb3b2b04244b7c01ac0f58
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Aug 13 15:52:34 2024 +0200
manual: Document dprintf and vdprintf
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/manual/stdio.texi b/manual/stdio.texi
index 19b4a53299410ca6..3f837fa99c3c6574 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -2523,6 +2523,26 @@ store the result in which case @code{-1} is returned. This was
changed in order to comply with the @w{ISO C99} standard.
@end deftypefun
+@deftypefun dprintf (int @var{fd}, @var{template}, ...)
+@standards{POSIX, stdio.h}
+@safety{@mtsafe{@mtslocale{}}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}}
+This function formats its arguments according to @var{template} and
+writes the result to the file descriptor @var{fd}, using the
+@code{write} function. It returns the number of bytes written, or a
+negative value if there was an error. In the error case, @code{errno}
+is set appropriately. The possible @code{errno} values depend on the
+type of the file descriptor @var{fd}, in addition to the general
+@code{printf} error codes.
+
+The number of calls to @code{write} is unspecified, and some @code{write}
+calls may have happened even if @code{dprintf} returns with an error.
+
+@strong{Portability Note:} POSIX does not require that this function is
+async-signal-safe, and @theglibc{} implementation is not. However, some
+other systems offer this function as an async-signal-safe alternative to
+@code{fprintf}. @xref{POSIX Safety Concepts}.
+@end deftypefun
+
@node Dynamic Output
@subsection Dynamically Allocating Formatted Output
@@ -2736,6 +2756,13 @@ The @code{obstack_vprintf} function is the equivalent of
as for @code{vprintf}.
@end deftypefun
+@deftypefun int vdprintf (int @var{fd}, const char *@var{template}, va_list @var{ap})
+@standards{POSIX, stdio.h}
+@safety{@mtsafe{@mtslocale{}}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}}
+The @code{vdprintf} is the equivalent of @code{dprintf}, but processes
+an argument list.
+@end deftypefun
+
Here's an example showing how you might use @code{vfprintf}. This is a
function that prints error messages to the stream @code{stderr}, along
with a prefix indicating the name of the program

321
glibc-RHEL-108974-6.patch Normal file
View File

@ -0,0 +1,321 @@
commit 3de73f974fab55430177c811c9c9ba3f251d5747
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Aug 7 14:57:41 2024 +0200
manual: Add Descriptor-Relative Access section
Reference this new section from the O_PATH documentation.
And document the functions openat, openat64, fstatat, fstatat64.
(The safety assessment for fstatat was already obsolete because
current glibc assumes kernel support for the underlying system
call.)
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/manual/filesys.texi b/manual/filesys.texi
index 47d929744eea75dd..aabb68385b6b9732 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -15,6 +15,7 @@ access permissions and modification times.
@menu
* Working Directory:: This is used to resolve relative
file names.
+* Descriptor-Relative Access:: Ways to control file name lookup.
* Accessing Directories:: Finding out what files a directory
contains.
* Working with Directory Trees:: Apply actions to all files or a selectable
@@ -206,6 +207,151 @@ An I/O error occurred.
@end table
@end deftypefun
+@node Descriptor-Relative Access
+@section Descriptor-Relative Access
+@cindex file name resolution based on descriptors
+@cindex descriptor-based file name resolution
+@cindex @code{@dots{}at} functions
+
+Many functions that accept file names have @code{@dots{}at} variants
+which accept a file descriptor and a file name argument instead of just
+a file name argument. For example, @code{fstatat} is the
+descriptor-based variant of the @code{fstat} function. Most such
+functions also accept an additional flags argument which changes the
+behavior of the file name lookup based on the passed @code{AT_@dots{}}
+flags.
+
+There are several reasons to use descriptor-relative access:
+
+@itemize @bullet
+@item
+The working directory is a process-wide resource, so individual threads
+cannot change it without affecting other threads in the process.
+Explicitly specifying the directory against which relative paths are
+resolved can be a thread-safe alternative to changing the working
+directory.
+
+@item
+If a program wishes to access a directory tree which is being modified
+concurrently, perhaps even by a different user on the system, the
+program must avoid looking up file names with multiple components, in
+order to detect symbolic links, using the @code{O_NOFOLLOW} flag
+(@pxref{Open-time Flags}) or the @code{AT_SYMLINK_FOLLOW} flag
+(described below). Without directory-relative access, it is necessary
+to use the @code{fchdir} function to change the working directory
+(@pxref{Working Directory}), which is not thread-safe.
+
+@item
+Listing directory contents using the @code{readdir} or @code{readdir64}
+functions (@pxref{Reading/Closing Directory}) does not provide full file
+name paths. Using @code{@dots{}at} functions, it is possible to use the
+file names directly, without having to construct such full paths.
+
+@item
+Additional flags available with some of the @code{@dots{}at} functions
+provide access to functionality which is not available otherwise.
+@end itemize
+
+The file descriptor used by these @code{@dots{}at} functions has the
+following uses:
+
+@itemize @bullet
+@item
+It can be a file descriptor referring to a directory. Such a descriptor
+can be created explicitly using the @code{open} function and the
+@code{O_RDONLY} file access mode, with or without the @code{O_DIRECTORY}
+flag. @xref{Opening and Closing Files}. Or it can be created
+implicitly by @code{opendir} and retrieved using the @code{dirfd}
+function. @xref{Opening a Directory}.
+
+If a directory descriptor is used with one of the @code{@dots{}at}
+functions, a relative file name argument is resolved relative to
+directory referred to by the file descriptor, just as if that directory
+were the current working directory. Absolute file name arguments
+(starting with @samp{/}) are resolved against the file system root, and
+the descriptor argument is effectively ignored.
+
+This means that file name lookup is not constrained to the directory of
+the descriptor. For example, it is possible to access a file
+@file{example} in the descriptor's parent directory using a file name
+argument @code{"../example"}, or in the root directory using
+@code{"/example"}.
+
+If the file descriptor refers to a directory, the empty string @code{""}
+is not a valid file name argument. It is possible to use @code{"."} to
+refer to the directory itself. Also see @code{AT_EMPTY_PATH} below.
+
+@item
+@vindex @code{AT_FDCWD}
+The special value @code{AT_FDCWD}. This means that the current working
+directory is used for the lookup if the file name is a relative. For
+@code{@dots{}at} functions with an @code{AT_@dots{}} flags argument,
+this provides a shortcut to use those flags with regular (not
+descriptor-based) file name lookups.
+
+If @code{AT_FDCWD} is used, the empty string @code{""} is not a valid
+file name argument.
+
+@item
+An arbitrary file descriptor, along with an empty string @code{""} as
+the file name argument, and the @code{AT_EMPTY_PATH} flag. In this
+case, the operation uses the file descriptor directly, without further
+file name resolution. On Linux, this allows operations on descriptors
+opened with the @code{O_PATH} flag. For regular descriptors (opened
+without @code{O_PATH}), the same functionality is also available through
+the plain descriptor-based functions (for example, @code{fstat} instead
+of @code{fstatat}).
+
+This is a GNU extension.
+@end itemize
+
+@cindex file name resolution flags
+@cindex @code{AT_*} file name resolution flags
+The flags argument in @code{@dots{}at} functions can be a combination of
+the following flags, defined in @file{fcntl.h}. Not all such functions
+support all flags, and some (such as @code{openat}) do not accept a
+flags argument at all.
+
+In the flag descriptions below, the @dfn{effective final path component}
+refers to the final component (basename) of the full path constructed
+from the descriptor and file name arguments, using file name lookup, as
+described above.
+
+@vtable @code
+@item AT_EMPTY_PATH
+This flag is used with an empty file name @code{""} and a descriptor
+which does not necessarily refer to a directory. It is most useful with
+@code{O_PATH} descriptors, as described above. This flag is a GNU
+extension.
+
+@item AT_NO_AUTOMOUNT
+If the effective final path component refers to a potential file system
+mount point controlled by an auto-mounting service, the operation does
+not trigger auto-mounting and refers to the unmounted mount point
+instead. @xref{Mount-Unmount-Remount}. If a file system has already
+been mounted at the effective final path component, the operation
+applies to the file or directory in the mounted file system, not the
+underlying file system that was mounted over. This flag is a GNU
+extension.
+
+@item AT_SYMLINK_FOLLOW
+If the effective final path component is a symbolic link, the
+operation follows the symbolic link and operates on its target. (For
+most functions, this is the default behavior.)
+
+@item AT_SYMLINK_NOFOLLOW
+If the effective final path component is a symbolic link, the
+operation operates on the symbolic link, without following it. The
+difference in behavior enabled by this flag is similar to the difference
+between the @code{lstat} and @code{stat} functions, or the behavior
+activated by the @code{O_NOFOLLOW} argument to the @code{open} function.
+Even with the @code{AT_SYMLINK_NOFOLLOW} flag present, symbolic links in
+a non-final component of the file name are still followed.
+@end vtable
+
+@strong{Note:} There is no relationship between these flags and the type
+argument to the @code{getauxval} function (with @code{AT_@dots{}}
+constants defined in @file{elf.h}). @xref{Auxiliary Vector}.
@node Accessing Directories
@section Accessing Directories
@@ -1250,10 +1396,11 @@ A hardware error occurred while trying to read or write the to filesystem.
The @code{linkat} function is analogous to the @code{link} function,
except that it identifies its source and target using a combination of a
-file descriptor (referring to a directory) and a pathname. If a
-pathnames is not absolute, it is resolved relative to the corresponding
-file descriptor. The special file descriptor @code{AT_FDCWD} denotes
-the current directory.
+file descriptor (referring to a directory) and a file name.
+@xref{Descriptor-Relative Access}. For @code{linkat}, if a file name is
+not absolute, it is resolved relative to the corresponding file
+descriptor. As usual, the special value @code{AT_FDCWD} denotes the
+current directory.
The @var{flags} argument is a combination of the following flags:
@@ -2091,9 +2238,44 @@ function is available under the name @code{fstat} and so transparently
replaces the interface for small files on 32-bit machines.
@end deftypefun
-@c fstatat will call alloca and snprintf if the syscall is not
-@c available.
-@c @safety{@mtsafe{}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}}
+@deftypefun int fstatat (int @var{filedes}, const char *@var{filename}, struct stat *@var{buf}, int @var{flags})
+@standards{POSIX.1, sys/stat.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function is a descriptor-relative version of the @code{fstat}
+function above. @xref{Descriptor-Relative Access}. The @var{flags}
+argument can contain a combination of the flags @code{AT_EMPTY_PATH},
+@code{AT_NO_AUTOMOUNT}, @code{AT_SYMLINK_NOFOLLOW}.
+
+Compared to @code{fstat}, the following additional error conditions can
+occur:
+
+@table @code
+@item EBADF
+The @var{filedes} argument is not a valid file descriptor.
+
+@item EINVAL
+The @var{flags} argument is not valid for this function.
+
+@item ENOTDIR
+The descriptor @var{filedes} is not associated with a directory, and
+@var{filename} is a relative file name.
+@end table
+
+When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this
+function is in fact @code{fstatat64} since the LFS interface transparently
+replaces the normal implementation.
+@end deftypefun
+
+@deftypefun int fstatat64 (int @var{filedes}, const char *@var{filename}, struct stat64 *@var{buf}, int @var{flags})
+@standards{GNU, sys/stat.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function is the large-file variant of @code{fstatat}, similar to
+how @code{fstat64} is the variant of @code{fstat}.
+
+When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this
+function is available under the name @code{fstatat} and so transparently
+replaces the interface for small files on 32-bit machines.
+@end deftypefun
@deftypefun int lstat (const char *@var{filename}, struct stat *@var{buf})
@standards{BSD, sys/stat.h}
diff --git a/manual/llio.texi b/manual/llio.texi
index be55dca1b7c9ebcd..05ab44c6e7a5d4fd 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -181,6 +181,43 @@ new, extended API using 64 bit file sizes and offsets transparently
replaces the old API.
@end deftypefun
+@deftypefun int openat (int @var{filedes}, const char *@var{filename}, int @var{flags}[, mode_t @var{mode}])
+@standards{POSIX.1, fcntl.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{@acsfd{}}}
+This function is the descriptor-relative variant of the @code{open}
+function. @xref{Descriptor-Relative Access}.
+
+Note that the @var{flags} argument of @code{openat} does not accept
+@code{AT_@dots{}} flags, only the flags described for the @code{open}
+function above.
+
+The @code{openat} function can fail for additional reasons:
+
+@table @code
+@item EBADF
+The @var{filedes} argument is not a valid file descriptor.
+
+@item ENOTDIR
+The descriptor @var{filedes} is not associated with a directory, and
+@var{filename} is a relative file name.
+@end table
+
+When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this
+function is in fact @code{openat64} since the LFS interface transparently
+replaces the normal implementation.
+@end deftypefun
+
+@deftypefun int openat64 (int @var{filedes}, const char *@var{filename}, int @var{flags}[, mode_t @var{mode}])
+@standards{GNU, fcntl.h}
+The large-file variant of the @code{openat}, similar to how
+@code{open64} is the large-file variant of @code{open}.
+
+When the sources are translated with @code{_FILE_OFFSET_BITS == 64} this
+function is actually available under the name @code{openat}. I.e., the
+new, extended API using 64 bit file sizes and offsets transparently
+replaces the old API.
+@end deftypefun
+
@deftypefn {Obsolete function} int creat (const char *@var{filename}, mode_t @var{mode})
@standards{POSIX.1, fcntl.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{@acsfd{}}}
@@ -3816,7 +3853,9 @@ contains it is still needed), and permissions are checked when the
descriptor is used later on.
For example, such descriptors can be used with the @code{fexecve}
-function (@pxref{Executing a File}).
+function (@pxref{Executing a File}). Other applications involve the
+@samp{*at} function variants, along with the @code{AT_EMPTY_PATH} flag.
+@xref{Descriptor-Relative Access}.
This access mode is specific to Linux. On @gnuhurdsystems{}, it is
possible to use @code{O_EXEC} explicitly, or specify no access modes
diff --git a/manual/startup.texi b/manual/startup.texi
index c421563d16979c64..c1a3683d584cb914 100644
--- a/manual/startup.texi
+++ b/manual/startup.texi
@@ -664,8 +664,12 @@ basis there may be information that is not available any other way.
This function is used to inquire about the entries in the auxiliary
vector. The @var{type} argument should be one of the @samp{AT_} symbols
defined in @file{elf.h}. If a matching entry is found, the value is
-returned; if the entry is not found, zero is returned and @code{errno} is
-set to @code{ENOENT}.
+returned; if the entry is not found, zero is returned and @code{errno}
+is set to @code{ENOENT}.
+
+@strong{Note:} There is no relationship between the @samp{AT_} contants
+defined in @file{elf.h} and the file name lookup flags in
+@file{fcntl.h}. @xref{Descriptor-Relative Access}.
@end deftypefun
For some platforms, the key @code{AT_HWCAP} is the easiest way to inquire

31
glibc-RHEL-108974-7.patch Normal file
View File

@ -0,0 +1,31 @@
commit 6efd6cd46bf2257e674be4933a034542d80944eb
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 6 14:07:00 2024 +0200
manual: Safety annotations for clock_gettime, clock_getres
The annotations are preliminary, for consistency with existing
annotations on gettimeofday etc.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/manual/time.texi b/manual/time.texi
index ab5063be81cf0af9..d292e269ebb2f975 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -532,6 +532,7 @@ Systems may support more than just these two POSIX clocks.
@deftypefun int clock_gettime (clockid_t @var{clock}, struct timespec *@var{ts})
@standards{POSIX.1, time.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Get the current time according to the clock identified by @var{clock},
storing it as seconds and nanoseconds in @code{*@var{ts}}.
@xref{Time Types}, for a description of @code{struct timespec}.
@@ -553,6 +554,7 @@ clock:
@deftypefun int clock_getres (clockid_t @var{clock}, struct timespec *@var{res})
@standards{POSIX.1, time.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
Get the actual resolution of the clock identified by @var{clock},
storing it in @code{*@var{ts}}.

387
glibc-RHEL-108974-8.patch Normal file
View File

@ -0,0 +1,387 @@
commit 83a1cc3bc3d28c97d1af6c0957b11fe39fd786d8
Author: Carlos O'Donell <carlos@redhat.com>
Date: Wed Oct 9 18:32:26 2024 -0400
manual: Fix and test @deftypef* function formatting
The manual contained several instances of incorrect formatting
that were correct texinfo but produced incorrectly rendered manuals
or incorrect behaviour from the tooling.
The most important was incorrect quoting of function returns
by failing to use {} to quote the return. The impact of this
mistake means that 'info libc func' does not jump to the function
in question but instead to the introductory page under the assumption
that func doesn't exist. The function returns are now correctly
quoted.
The second issue was the use of a category specifier with
@deftypefun which doesn't accept a category specifier. If a category
specifier is required then @deftypefn needs to be used. This is
corrected by changing the command to @deftypefn for such functions
that used {Deprecated function} as a category.
The last issue is a missing space between the function name and the
arguments which results in odd function names like "epoll_wait(int"
instead of "epoll_wait". This also impacts the use of 'info libc'
and is corrected.
We additionally remove ';' from the end of function arguments and
add an 'int' return type for dprintf.
Lastly we add a new test check-deftype.sh which verifies the expected
formatting of @deftypefun, @deftypefunx, @deftypefn, and
@deftypefnx. The new test is also run as the summary file is
generated to ensure we don't generate incorrect results.
The existing check-safety.sh is also run directly as a test to increase
coverage since the existing tests only ran on manual install.
The new tests now run as part of the standard "make check" that
pre-commit CI runs and developers should run.
No regressions on x86_64.
HTML and PDF rendering reviewed and looks correct for all changes.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
diff --git a/manual/Makefile b/manual/Makefile
index a6c05db540d6c1da..6a4cfbeb765265f3 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -69,6 +69,11 @@ chapters.% top-menu.%: libc-texinfo.sh $(texis-path) Makefile
'$(chapters)' \
'$(appendices) $(licenses)'
+# Verify validity of texinfo sources against project rules.
+tests-special += \
+ $(objpfx)check-deftype.out \
+ $(objpfx)check-safety.out \
+ # tests-special
$(objpfx)libc.dvi $(objpfx)libc.pdf $(objpfx)libc.info: \
$(addprefix $(objpfx),$(libc-texi-generated))
@@ -83,10 +88,19 @@ $(objpfx)summary.texi: $(objpfx)stamp-summary ;
$(objpfx)stamp-summary: summary.pl $(filter-out $(objpfx)summary.texi, \
$(texis-path))
$(SHELL) ./check-safety.sh $(filter-out $(objpfx)%, $(texis-path))
+ $(SHELL) ./check-deftype.sh $(filter-out $(objpfx)%, $(texis-path))
LC_ALL=C $(PERL) $^ > $(objpfx)summary-tmp
$(move-if-change) $(objpfx)summary-tmp $(objpfx)summary.texi
touch $@
+$(objpfx)check-safety.out: check-safety.sh
+ $(SHELL) $< > $@ ; \
+ $(evaluate-test)
+
+$(objpfx)check-deftype.out: check-deftype.sh
+ $(SHELL) $< > $@ ; \
+ $(evaluate-test)
+
# Generate a file which can be added to the `dir' content to provide direct
# access to the documentation of the function, variables, and other
# definitions.
@@ -152,10 +166,19 @@ $(objpfx)%.pdf: %.texinfo
# Distribution.
-minimal-dist = summary.pl texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
- libm-err.texi stamp-libm-err check-safety.sh \
- $(filter-out summary.texi, $(nonexamples)) \
- $(patsubst %.c.texi,examples/%.c, $(examples))
+minimal-dist = \
+ $(filter-out summary.texi, $(nonexamples)) \
+ $(patsubst %.c.texi,examples/%.c, $(examples)) \
+ check-deftype.sh \
+ check-safety.sh \
+ libc-texinfo.sh \
+ libc.texinfo \
+ libm-err.texi \
+ stamp-libm-err \
+ summary.pl \
+ texis.awk \
+ tsort.awk \
+ # minimal-dist
indices = cp fn pg tp vr ky
generated-dirs += libc
diff --git a/manual/check-deftype.sh b/manual/check-deftype.sh
new file mode 100644
index 0000000000000000..395c99af6afe1fdd
--- /dev/null
+++ b/manual/check-deftype.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# Copyright 2024 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <https://www.gnu.org/licenses/>.
+
+# Check that the @deftypefun command is called with the expected
+# arguments and includes checking for common mistakes including
+# failure to include a space after the function name, or incorrect
+# quoting.
+
+success=:
+
+# If no arguments are given, take all *.texi files in the current directory.
+test $# != 0 || set *.texi
+
+# We search for all @deftypefun and @deftypefunx command uses.
+# Then we remove all of those that match our expectations.
+# A @deftypefun or @deftypefunx command takes 3 arguments:
+# - return type
+# - name
+# - arguments
+# This is different from @deftypefn which includes an additional
+# category which is implicit here.
+grep -n -r '^@deftypefun' "$@" |
+grep -v '^.*@deftypefunx\?'\
+' \({\?[a-zA-Z0-9_ *]*}\?\) \([a-zA-Z0-9_]*\) (.*)$' &&
+success=false
+
+# We search for all @deftypefn and @deftypefnx command uses.
+# We have 4 arguments in the command including the category.
+grep -n -r '^@deftypefn' "$@" |
+grep -v '^.*@deftypefnx\?'\
+' {\?[a-zA-Z ]*}\? \({\?[a-zA-Z0-9@{}_ *]*}\?\) \([a-zA-Z0-9_]*\) (.*)$' &&
+success=false
+
+$success
diff --git a/manual/ipc.texi b/manual/ipc.texi
index 6a6e5ad410c14387..32c5ac066fb94579 100644
--- a/manual/ipc.texi
+++ b/manual/ipc.texi
@@ -20,7 +20,7 @@ by @theglibc{}.
@c Need descriptions for all of these functions.
@subsection System V Semaphores
-@deftypefun int semctl (int @var{semid}, int @var{semnum}, int @var{cmd});
+@deftypefun int semctl (int @var{semid}, int @var{semnum}, int @var{cmd})
@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{/linux}}}
@c syscall(ipc) ok
@c
@@ -30,35 +30,35 @@ by @theglibc{}.
@c semid_ds.
@end deftypefun
-@deftypefun int semget (key_t @var{key}, int @var{nsems}, int @var{semflg});
+@deftypefun int semget (key_t @var{key}, int @var{nsems}, int @var{semflg})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c syscall(ipc) ok
@end deftypefun
-@deftypefun int semop (int @var{semid}, struct sembuf *@var{sops}, size_t @var{nsops});
+@deftypefun int semop (int @var{semid}, struct sembuf *@var{sops}, size_t @var{nsops})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c syscall(ipc) ok
@end deftypefun
-@deftypefun int semtimedop (int @var{semid}, struct sembuf *@var{sops}, size_t @var{nsops}, const struct timespec *@var{timeout});
+@deftypefun int semtimedop (int @var{semid}, struct sembuf *@var{sops}, size_t @var{nsops}, const struct timespec *@var{timeout})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c syscall(ipc) ok
@end deftypefun
@subsection POSIX Semaphores
-@deftypefun int sem_init (sem_t *@var{sem}, int @var{pshared}, unsigned int @var{value});
+@deftypefun int sem_init (sem_t *@var{sem}, int @var{pshared}, unsigned int @var{value})
@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
@c Does not atomically update sem_t therefore AC-unsafe
@c because it can leave sem_t partially initialized.
@end deftypefun
-@deftypefun int sem_destroy (sem_t *@var{sem});
+@deftypefun int sem_destroy (sem_t *@var{sem})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c Function does nothing and is therefore always safe.
@end deftypefun
-@deftypefun sem_t *sem_open (const char *@var{name}, int @var{oflag}, ...);
+@deftypefun {sem_t *} sem_open (const char *@var{name}, int @var{oflag}, ...)
@safety{@prelim{}@mtsafe{}@asunsafe{@asuinit{}}@acunsafe{@acuinit{}}}
@c pthread_once asuinit
@c
@@ -67,7 +67,7 @@ by @theglibc{}.
@c shmfs on Linux.
@end deftypefun
-@deftypefun int sem_close (sem_t *@var{sem});
+@deftypefun int sem_close (sem_t *@var{sem})
@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
@c lll_lock asulock aculock
@c twalk mtsrace{:root}
@@ -77,13 +77,13 @@ by @theglibc{}.
@c are not updated atomically.
@end deftypefun
-@deftypefun int sem_unlink (const char *@var{name});
+@deftypefun int sem_unlink (const char *@var{name})
@safety{@prelim{}@mtsafe{}@asunsafe{@asuinit{}}@acunsafe{@acucorrupt{}}}
@c pthread_once asuinit acucorrupt aculock
@c mempcpy acucorrupt
@end deftypefun
-@deftypefun int sem_wait (sem_t *@var{sem});
+@deftypefun int sem_wait (sem_t *@var{sem})
@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
@c atomic_fetch_add_relaxed (nwaiters) acucorrupt
@c
@@ -95,22 +95,22 @@ by @theglibc{}.
@c waiters count.
@end deftypefun
-@deftypefun int sem_timedwait (sem_t *@var{sem}, const struct timespec *@var{abstime});
+@deftypefun int sem_timedwait (sem_t *@var{sem}, const struct timespec *@var{abstime})
@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{}}}
@c Same safety issues as sem_wait.
@end deftypefun
-@deftypefun int sem_trywait (sem_t *@var{sem});
+@deftypefun int sem_trywait (sem_t *@var{sem})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c All atomic operations are safe in all contexts.
@end deftypefun
-@deftypefun int sem_post (sem_t *@var{sem});
+@deftypefun int sem_post (sem_t *@var{sem})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c Same safety as sem_trywait.
@end deftypefun
-@deftypefun int sem_getvalue (sem_t *@var{sem}, int *@var{sval});
+@deftypefun int sem_getvalue (sem_t *@var{sem}, int *@var{sval})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c Atomic write of a value is safe in all contexts.
@end deftypefun
diff --git a/manual/llio.texi b/manual/llio.texi
index 05ab44c6e7a5d4fd..850d09205a604589 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -4840,12 +4840,12 @@ of an IOCTL, see @ref{Out-of-Band Data}.
@manpagefunctionstub{poll,2}
@end deftypefun
-@deftypefun int epoll_create(int @var{size})
+@deftypefun int epoll_create (int @var{size})
@manpagefunctionstub{epoll_create,2}
@end deftypefun
-@deftypefun int epoll_wait(int @var{epfd}, struct epoll_event *@var{events}, int @var{maxevents}, int @var{timeout})
+@deftypefun int epoll_wait (int @var{epfd}, struct epoll_event *@var{events}, int @var{maxevents}, int @var{timeout})
@manpagefunctionstub{epoll_wait,2}
@end deftypefun
diff --git a/manual/memory.texi b/manual/memory.texi
index 3710d7ec667519cc..58683ee93dace783 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -2935,7 +2935,7 @@ exceed the process' data storage limit.
@end deftypefun
-@deftypefun void *sbrk (ptrdiff_t @var{delta})
+@deftypefun {void *} sbrk (ptrdiff_t @var{delta})
@standards{BSD, unistd.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
diff --git a/manual/stdio.texi b/manual/stdio.texi
index 3f837fa99c3c6574..aa137e9888b5b59d 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -2523,7 +2523,7 @@ store the result in which case @code{-1} is returned. This was
changed in order to comply with the @w{ISO C99} standard.
@end deftypefun
-@deftypefun dprintf (int @var{fd}, @var{template}, ...)
+@deftypefun int dprintf (int @var{fd}, @var{template}, ...)
@standards{POSIX, stdio.h}
@safety{@mtsafe{@mtslocale{}}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}}
This function formats its arguments according to @var{template} and
diff --git a/manual/threads.texi b/manual/threads.texi
index 25e99c9606dcad77..9ea137cb9663b89c 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -592,7 +592,7 @@ destructor for the thread-specific data is not called during destruction, nor
is it called during thread exit.
@end deftypefun
-@deftypefun void *pthread_getspecific (pthread_key_t @var{key})
+@deftypefun {void *} pthread_getspecific (pthread_key_t @var{key})
@standards{POSIX, pthread.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c pthread_getspecific ok
diff --git a/manual/time.texi b/manual/time.texi
index d292e269ebb2f975..6ccb07fcfc10449b 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -1829,7 +1829,7 @@ can be placed in the buffer @var{s} the return value is zero, with the
same problems indicated in the @code{strftime} documentation.
@end deftypefun
-@deftypefun {Deprecated function} {char *} asctime (const struct tm *@var{brokentime})
+@deftypefn {Deprecated function} {char *} asctime (const struct tm *@var{brokentime})
@standards{ISO, time.h}
@safety{@prelim{}@mtunsafe{@mtasurace{:asctime} @mtslocale{}}@asunsafe{}@acsafe{}}
@c asctime @mtasurace:asctime @mtslocale
@@ -1863,9 +1863,9 @@ string.)
@strong{Portability note:}
This obsolescent function is deprecated in C23.
Programs should instead use @code{strftime} or even @code{sprintf}.
-@end deftypefun
+@end deftypefn
-@deftypefun {Deprecated function} {char *} asctime_r (const struct tm *@var{brokentime}, char *@var{buffer})
+@deftypefn {Deprecated function} {char *} asctime_r (const struct tm *@var{brokentime}, char *@var{buffer})
@standards{???, time.h}
@safety{@prelim{}@mtsafe{@mtslocale{}}@assafe{}@acsafe{}}
@c asctime_r @mtslocale
@@ -1884,9 +1884,9 @@ it returns @code{NULL}.
@strong{Portability Note:}
POSIX.1-2024 removed this obsolescent function.
Programs should instead use @code{strftime} or even @code{sprintf}.
-@end deftypefun
+@end deftypefn
-@deftypefun {Deprecated function} {char *} ctime (const time_t *@var{time})
+@deftypefn {Deprecated function} {char *} ctime (const time_t *@var{time})
@standards{ISO, time.h}
@safety{@prelim{}@mtunsafe{@mtasurace{:tmbuf} @mtasurace{:asctime} @mtsenv{} @mtslocale{}}@asunsafe{@ascuheap{} @asulock{}}@acunsafe{@aculock{} @acsmem{} @acsfd{}}}
@c ctime @mtasurace:tmbuf @mtasurace:asctime @mtsenv @mtslocale @ascuheap @asulock @aculock @acsmem @acsfd
@@ -1909,9 +1909,9 @@ Calling @code{ctime} also sets the time zone state as if
@strong{Portability note:}
This obsolescent function is deprecated in C23.
Programs should instead use @code{strftime} or even @code{sprintf}.
-@end deftypefun
+@end deftypefn
-@deftypefun {Deprecated function} {char *} ctime_r (const time_t *@var{time}, char *@var{buffer})
+@deftypefn {Deprecated function} {char *} ctime_r (const time_t *@var{time}, char *@var{buffer})
@standards{???, time.h}
@safety{@prelim{}@mtsafe{@mtsenv{} @mtslocale{}}@asunsafe{@ascuheap{} @asulock{}}@acunsafe{@aculock{} @acsmem{} @acsfd{}}}
@c ctime_r @mtsenv @mtslocale @ascuheap @asulock @aculock @acsmem @acsfd
@@ -1935,7 +1935,7 @@ it returns @code{NULL}.
@strong{Portability Note:}
POSIX.1-2024 removed this obsolescent function.
Programs should instead use @code{strftime} or even @code{sprintf}.
-@end deftypefun
+@end deftypefn
@node Parsing Date and Time
@subsection Convert textual time and date information back

58
glibc-RHEL-108974-9.patch Normal file
View File

@ -0,0 +1,58 @@
commit dcad78507433a9a64b8b548b19e110933f8d939a
Author: DJ Delorie <dj@redhat.com>
Date: Thu Oct 10 17:16:35 2024 -0400
manual: Document stdio.h functions that may be macros
Glibc has two gnu-extension functions that are implemented as
macros but not documented as such: fread_unlocked and
fwrite_unlocked. Document them as such.
Additionally, putc_unlocked and getc_unlocked are documented in
POSIX as possibly being macros. Update the manual to add a warning
about those also, depite glibc not implementing them as macros.
diff --git a/manual/stdio.texi b/manual/stdio.texi
index aa137e9888b5b59d..1708d33b10a63b89 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -921,6 +921,9 @@ Therefore, @var{stream} should never be an expression with side-effects.
@safety{@prelim{}@mtsafe{@mtsrace{:stream}}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
The @code{putc_unlocked} function is equivalent to the @code{putc}
function except that it does not implicitly lock the stream.
+Like @code{putc}, it may be implemented as a macro and may evaluate
+the @var{stream} argument more than once. Therefore, @var{stream}
+should not be an expression with side-effects.
@end deftypefun
@deftypefun wint_t putwc_unlocked (wchar_t @var{wc}, FILE *@var{stream})
@@ -1124,6 +1127,9 @@ Therefore, @var{stream} should never be an expression with side-effects.
@safety{@prelim{}@mtsafe{@mtsrace{:stream}}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}}
The @code{getc_unlocked} function is equivalent to the @code{getc}
function except that it does not implicitly lock the stream.
+Like @code{getc}, it may be implemented as a macro and may evaluate
+the @var{stream} argument more than once. Therefore, @var{stream}
+should not be an expression with side-effects.
@end deftypefun
@deftypefun wint_t getwc_unlocked (FILE *@var{stream})
@@ -1563,6 +1569,9 @@ The @code{fread_unlocked} function is equivalent to the @code{fread}
function except that it does not implicitly lock the stream.
This function is a GNU extension.
+This function may be implemented as a macro and may evaluate
+@var{stream} more than once. Therefore, @var{stream} should not be an
+expression with side-effects.
@end deftypefun
@deftypefun size_t fwrite (const void *@var{data}, size_t @var{size}, size_t @var{count}, FILE *@var{stream})
@@ -1581,6 +1590,9 @@ The @code{fwrite_unlocked} function is equivalent to the @code{fwrite}
function except that it does not implicitly lock the stream.
This function is a GNU extension.
+This function may be implemented as a macro and may evaluate
+@var{stream} more than once. Therefore, @var{stream} should not be an
+expression with side-effects.
@end deftypefun
@node Formatted Output

View File

@ -18,10 +18,10 @@ Date: Thu Sep 4 20:30:41 2025 +0200
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index 06d8c27473c22a0e..cd243adb49ca4e1e 100644
index c97b3ac13af248c0..1f2455a4d0dce4e5 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -209,6 +209,7 @@ LDFLAGS-tst-plt-rewrite2 = -Wl,-z,now
@@ -206,6 +206,7 @@ LDFLAGS-tst-plt-rewrite2 = -Wl,-z,now
LDFLAGS-tst-plt-rewritemod2.so = -Wl,-z,now,-z,undefs
tst-plt-rewrite2-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=2
$(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
@ -29,7 +29,7 @@ index 06d8c27473c22a0e..cd243adb49ca4e1e 100644
tests-special += $(objpfx)check-dt-x86-64-plt.out
@@ -218,7 +219,6 @@ $(objpfx)check-dt-x86-64-plt.out: $(common-objpfx)libc.so
@@ -215,7 +216,6 @@ $(objpfx)check-dt-x86-64-plt.out: $(common-objpfx)libc.so
| grep GLIBC_ABI_DT_X86_64_PLT > $@; \
$(evaluate-test)
generated += check-dt-x86-64-plt.out

Some files were not shown because too many files have changed in this diff Show More