Import glibc-2.34-37.fc35 from f35

* Wed Jun  8 2022 Florian Weimer <fweimer@redhat.com> - 2.34-37
- Enable rseq by default and add GLIBC_2.35 rseq symbols (#2085529)

* Wed Jun  8 2022 Florian Weimer <fweimer@redhat.com> - 2.34-36
- Sync with upstream branch release/2.34/master,
  commit 4c92a1041257c0155c6aa7a182fe5f78e477b0e6:
- powerpc: Fix VSX register number on __strncpy_power9 [BZ #29197]
- socket: Fix mistyped define statement in socket/sys/socket.h (BZ #29225)
- iconv: Use 64 bit stat for gconv_parseconfdir (BZ# 29213)
- catgets: Use 64 bit stat for __open_catalog (BZ# 29211)
- inet: Use 64 bit stat for ruserpass (BZ# 29210)
- socket: Use 64 bit stat for isfdtype (BZ# 29209)
- posix: Use 64 bit stat for fpathconf (_PC_ASYNC_IO) (BZ# 29208)
- posix: Use 64 bit stat for posix_fallocate fallback (BZ# 29207)
- misc: Use 64 bit stat for getusershell (BZ# 29204)
- misc: Use 64 bit stat for daemon (BZ# 29203)

Resolves: #2085529
Resolves: #2091549
Related: #2091541
This commit is contained in:
Florian Weimer 2022-06-08 17:01:17 +02:00
parent 601650f878
commit 5f265ff1c6
15 changed files with 1271 additions and 1 deletions

605
glibc-rh2085529-1.patch Normal file
View File

@ -0,0 +1,605 @@
commit c901c3e764d7c7079f006b4e21e877d5036eb4f5
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Dec 9 09:49:32 2021 +0100
nptl: Add public rseq symbols and <sys/rseq.h>
The relationship between the thread pointer and the rseq area
is made explicit. The constant offset can be used by JIT compilers
to optimize rseq access (e.g., for really fast sched_getcpu).
Extensibility is provided through __rseq_size and __rseq_flags.
(In the future, the kernel could request a different rseq size
via the auxiliary vector.)
Co-Authored-By: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
diff --git a/manual/threads.texi b/manual/threads.texi
index 7f166bfa87e88c36..4869f69d2ceed255 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -629,6 +629,8 @@ the standard.
* Waiting with Explicit Clocks:: Functions for waiting with an
explicit clock specification.
* Single-Threaded:: Detecting single-threaded execution.
+* Restartable Sequences:: Linux-specific restartable sequences
+ integration.
@end menu
@node Default Thread Attributes
@@ -958,6 +960,85 @@ application-created thread because future versions of @theglibc{} may
create background threads after the first thread has been created, and
the application has no way of knowning that these threads are present.
+@node Restartable Sequences
+@subsubsection Restartable Sequences
+
+This section describes restartable sequences integration for
+@theglibc{}. This functionality is only available on Linux.
+
+@deftp {Data Type} {struct rseq}
+@standards{Linux, sys/rseq.h}
+The type of the restartable sequences area. Future versions
+of Linux may add additional fields to the end of this structure.
+
+
+Users need to obtain the address of the restartable sequences area using
+the thread pointer and the @code{__rseq_offset} variable, described
+below.
+
+One use of the restartable sequences area is to read the current CPU
+number from its @code{cpu_id} field, as an inline version of
+@code{sched_getcpu}. @Theglibc{} sets the @code{cpu_id} field to
+@code{RSEQ_CPU_ID_REGISTRATION_FAILED} if registration failed or was
+explicitly disabled.
+
+Furthermore, users can store the address of a @code{struct rseq_cs}
+object into the @code{rseq_cs} field of @code{struct rseq}, thus
+informing the kernel that the thread enters a restartable sequence
+critical section. This pointer and the code areas it itself points to
+must not be left pointing to memory areas which are freed or re-used.
+Several approaches can guarantee this. If the application or library
+can guarantee that the memory used to hold the @code{struct rseq_cs} and
+the code areas it refers to are never freed or re-used, no special
+action must be taken. Else, before that memory is re-used of freed, the
+application is responsible for setting the @code{rseq_cs} field to
+@code{NULL} in each thread's restartable sequence area to guarantee that
+it does not leak dangling references. Because the application does not
+typically have knowledge of libraries' use of restartable sequences, it
+is recommended that libraries using restartable sequences which may end
+up freeing or re-using their memory set the @code{rseq_cs} field to
+@code{NULL} before returning from library functions which use
+restartable sequences.
+
+The manual for the @code{rseq} system call can be found
+at @uref{https://git.kernel.org/pub/scm/libs/librseq/librseq.git/tree/doc/man/rseq.2}.
+@end deftp
+
+@deftypevar {int} __rseq_offset
+@standards{Linux, sys/rseq.h}
+This variable contains the offset between the thread pointer (as defined
+by @code{__builtin_thread_pointer} or the thread pointer register for
+the architecture) and the restartable sequences area. This value is the
+same for all threads in the process. If the restartable sequences area
+is located at a lower address than the location to which the thread
+pointer points, the value is negative.
+@end deftypevar
+
+@deftypevar {unsigned int} __rseq_size
+@standards{Linux, sys/rseq.h}
+This variable is either zero (if restartable sequence registration
+failed or has been disabled) or the size of the restartable sequence
+registration. This can be different from the size of @code{struct rseq}
+if the kernel has extended the size of the registration. If
+registration is successful, @code{__rseq_size} is at least 32 (the
+initial size of @code{struct rseq}).
+@end deftypevar
+
+@deftypevar {unsigned int} __rseq_flags
+@standards{Linux, sys/rseq.h}
+The flags used during restartable sequence registration with the kernel.
+Currently zero.
+@end deftypevar
+
+@deftypevr Macro int RSEQ_SIG
+@standards{Linux, sys/rseq.h}
+Each supported architecture provides a @code{RSEQ_SIG} macro in
+@file{sys/rseq.h} which contains a signature. That signature is
+expected to be present in the code before each restartable sequences
+abort handler. Failure to provide the expected signature may terminate
+the process with a segmentation fault.
+@end deftypevr
+
@c FIXME these are undocumented:
@c pthread_atfork
@c pthread_attr_destroy
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c
index 23aa4cfc0b784dfc..0f5280a75d546d2f 100644
--- a/sysdeps/nptl/dl-tls_init_tp.c
+++ b/sysdeps/nptl/dl-tls_init_tp.c
@@ -22,6 +22,7 @@
#include <pthreadP.h>
#include <tls.h>
#include <rseq-internal.h>
+#include <thread_pointer.h>
#define TUNABLE_NAMESPACE pthread
#include <dl-tunables.h>
@@ -43,6 +44,10 @@ rtld_mutex_dummy (pthread_mutex_t *lock)
}
#endif
+const unsigned int __rseq_flags;
+const unsigned int __rseq_size attribute_relro;
+const int __rseq_offset attribute_relro;
+
void
__tls_pre_init_tp (void)
{
@@ -100,7 +105,23 @@ __tls_init_tp (void)
#if HAVE_TUNABLES
do_rseq = TUNABLE_GET (rseq, int, NULL);
#endif
- rseq_register_current_thread (pd, do_rseq);
+ if (rseq_register_current_thread (pd, do_rseq))
+ {
+ /* We need a writable view of the variables. They are in
+ .data.relro and are not yet write-protected. */
+ extern unsigned int size __asm__ ("__rseq_size");
+ size = sizeof (pd->rseq_area);
+ }
+
+#ifdef RSEQ_SIG
+ /* This should be a compile-time constant, but the current
+ infrastructure makes it difficult to determine its value. Not
+ all targets support __thread_pointer, so set __rseq_offset only
+ if thre rseq registration may have happened because RSEQ_SIG is
+ defined. */
+ extern int offset __asm__ ("__rseq_offset");
+ offset = (char *) &pd->rseq_area - (char *) __thread_pointer ();
+#endif
}
/* Set initial thread's stack block from 0 up to __libc_stack_end.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 5c772f69d1b1f1f1..9b7e214219943531 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -110,7 +110,8 @@ sysdep_headers += sys/mount.h sys/acct.h \
bits/types/struct_semid64_ds_helper.h \
bits/types/struct_shmid64_ds.h \
bits/types/struct_shmid64_ds_helper.h \
- bits/pthread_stack_min.h bits/pthread_stack_min-dynamic.h
+ bits/pthread_stack_min.h bits/pthread_stack_min-dynamic.h \
+ sys/rseq.h bits/rseq.h
tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 26452f3f17b5421d..3f8809a1581f27d0 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -316,6 +316,11 @@ librt {
}
ld {
+ GLIBC_2.35 {
+ __rseq_flags;
+ __rseq_offset;
+ __rseq_size;
+ }
GLIBC_PRIVATE {
__nptl_change_stack_perm;
}
diff --git a/sysdeps/unix/sysv/linux/aarch64/ld.abilist b/sysdeps/unix/sysv/linux/aarch64/ld.abilist
index b7196a80e2df8efc..bf4d4f9b6f2ddf97 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/ld.abilist
@@ -4,3 +4,6 @@ GLIBC_2.17 __tls_get_addr F
GLIBC_2.17 _dl_mcount F
GLIBC_2.17 _r_debug D 0x28
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/alpha/ld.abilist b/sysdeps/unix/sysv/linux/alpha/ld.abilist
index 13f7fc74af62941d..a23325a566419b41 100644
--- a/sysdeps/unix/sysv/linux/alpha/ld.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/ld.abilist
@@ -3,4 +3,7 @@ GLIBC_2.1 __libc_stack_end D 0x8
GLIBC_2.1 _dl_mcount F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x8
diff --git a/sysdeps/unix/sysv/linux/arc/ld.abilist b/sysdeps/unix/sysv/linux/arc/ld.abilist
index 7284383a6bea8e64..55f0c2ab9c6f7d91 100644
--- a/sysdeps/unix/sysv/linux/arc/ld.abilist
+++ b/sysdeps/unix/sysv/linux/arc/ld.abilist
@@ -4,3 +4,6 @@ GLIBC_2.32 __tls_get_addr F
GLIBC_2.32 _dl_mcount F
GLIBC_2.32 _r_debug D 0x14
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/arm/be/ld.abilist b/sysdeps/unix/sysv/linux/arm/be/ld.abilist
index 7987bbae1112aa3d..f1da2c636ddb359d 100644
--- a/sysdeps/unix/sysv/linux/arm/be/ld.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/ld.abilist
@@ -1,4 +1,7 @@
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __libc_stack_end D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
GLIBC_2.4 __tls_get_addr F
diff --git a/sysdeps/unix/sysv/linux/arm/le/ld.abilist b/sysdeps/unix/sysv/linux/arm/le/ld.abilist
index 7987bbae1112aa3d..f1da2c636ddb359d 100644
--- a/sysdeps/unix/sysv/linux/arm/le/ld.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/ld.abilist
@@ -1,4 +1,7 @@
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __libc_stack_end D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
GLIBC_2.4 __tls_get_addr F
diff --git a/sysdeps/unix/sysv/linux/csky/ld.abilist b/sysdeps/unix/sysv/linux/csky/ld.abilist
index 4939b20631dc6c54..7f482276ed8df1d5 100644
--- a/sysdeps/unix/sysv/linux/csky/ld.abilist
+++ b/sysdeps/unix/sysv/linux/csky/ld.abilist
@@ -4,3 +4,6 @@ GLIBC_2.29 __tls_get_addr F
GLIBC_2.29 _dl_mcount F
GLIBC_2.29 _r_debug D 0x14
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/hppa/ld.abilist b/sysdeps/unix/sysv/linux/hppa/ld.abilist
index 7cc9ebd792c2aadc..7f5527fb301b913c 100644
--- a/sysdeps/unix/sysv/linux/hppa/ld.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/ld.abilist
@@ -3,4 +3,7 @@ GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x14
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
diff --git a/sysdeps/unix/sysv/linux/i386/ld.abilist b/sysdeps/unix/sysv/linux/i386/ld.abilist
index e8d187b14d722a64..9c4a45d8dc525e52 100644
--- a/sysdeps/unix/sysv/linux/i386/ld.abilist
+++ b/sysdeps/unix/sysv/linux/i386/ld.abilist
@@ -4,3 +4,6 @@ GLIBC_2.1 _dl_mcount F
GLIBC_2.3 ___tls_get_addr F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/ia64/ld.abilist b/sysdeps/unix/sysv/linux/ia64/ld.abilist
index be5122650ae2b327..8ccb5be911e0e9a2 100644
--- a/sysdeps/unix/sysv/linux/ia64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/ld.abilist
@@ -3,3 +3,6 @@ GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x28
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist
index 7987bbae1112aa3d..f1da2c636ddb359d 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist
@@ -1,4 +1,7 @@
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __libc_stack_end D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
GLIBC_2.4 __tls_get_addr F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist
index 4f2854edf7746958..dadbf852d0522e77 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist
@@ -3,4 +3,7 @@ GLIBC_2.1 __libc_stack_end D 0x4
GLIBC_2.1 _dl_mcount F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
diff --git a/sysdeps/unix/sysv/linux/microblaze/ld.abilist b/sysdeps/unix/sysv/linux/microblaze/ld.abilist
index 9f0fdeca38890a34..89a0b7e4fd5a95fa 100644
--- a/sysdeps/unix/sysv/linux/microblaze/ld.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/ld.abilist
@@ -4,3 +4,6 @@ GLIBC_2.18 __tls_get_addr F
GLIBC_2.18 _dl_mcount F
GLIBC_2.18 _r_debug D 0x14
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/ld.abilist b/sysdeps/unix/sysv/linux/mips/mips32/ld.abilist
index f750067d5c34bf42..e304d1bb464b28f4 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/ld.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/ld.abilist
@@ -3,4 +3,7 @@ GLIBC_2.2 __libc_stack_end D 0x4
GLIBC_2.2 _dl_mcount F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist
index f750067d5c34bf42..e304d1bb464b28f4 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist
@@ -3,4 +3,7 @@ GLIBC_2.2 __libc_stack_end D 0x4
GLIBC_2.2 _dl_mcount F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
index 2fba6a9b6ec92e47..37a47ebc0a0d16c8 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
@@ -3,4 +3,7 @@ GLIBC_2.2 __libc_stack_end D 0x8
GLIBC_2.2 _dl_mcount F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x8
diff --git a/sysdeps/unix/sysv/linux/nios2/ld.abilist b/sysdeps/unix/sysv/linux/nios2/ld.abilist
index 57dfad5a53b739e8..811ae9da2fa85399 100644
--- a/sysdeps/unix/sysv/linux/nios2/ld.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/ld.abilist
@@ -4,3 +4,6 @@ GLIBC_2.21 __tls_get_addr F
GLIBC_2.21 _dl_mcount F
GLIBC_2.21 _r_debug D 0x14
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist
index e89660739262c6ab..5a68aeb9eed33844 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist
@@ -5,3 +5,6 @@ GLIBC_2.22 __tls_get_addr_opt F
GLIBC_2.23 __parse_hwcap_and_convert_at_platform F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist
index ce0bc639597c4bd9..da24dc7fb52ad2d4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist
@@ -5,3 +5,6 @@ GLIBC_2.3 __tls_get_addr F
GLIBC_2.3 _dl_mcount F
GLIBC_2.3 _r_debug D 0x28
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist
index 65b22674d2462e96..b9ae89ae8d90ed9e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist
@@ -5,3 +5,6 @@ GLIBC_2.17 _r_debug D 0x28
GLIBC_2.22 __tls_get_addr_opt F
GLIBC_2.23 __parse_hwcap_and_convert_at_platform F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist
index 5ad4c81d12d7a612..068368878eb2406e 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist
@@ -4,3 +4,6 @@ GLIBC_2.33 __tls_get_addr F
GLIBC_2.33 _dl_mcount F
GLIBC_2.33 _r_debug D 0x14
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
index 479efdea9bb654bb..48431c91a9fd16b0 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
@@ -4,3 +4,6 @@ GLIBC_2.27 __tls_get_addr F
GLIBC_2.27 _dl_mcount F
GLIBC_2.27 _r_debug D 0x28
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h
index 6a3441f2cc49e7c4..9e8f99fd51a063b1 100644
--- a/sysdeps/unix/sysv/linux/rseq-internal.h
+++ b/sysdeps/unix/sysv/linux/rseq-internal.h
@@ -41,7 +41,7 @@ rseq_register_current_thread (struct pthread *self, bool do_rseq)
return false;
}
#else /* RSEQ_SIG */
-static inline void
+static inline bool
rseq_register_current_thread (struct pthread *self, bool do_rseq)
{
THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist
index d5ecb636bb792bdf..c15288394a232a8c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist
@@ -3,3 +3,6 @@ GLIBC_2.1 __libc_stack_end D 0x4
GLIBC_2.1 _dl_mcount F
GLIBC_2.3 __tls_get_offset F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
index 62a5e1d99a2e6f42..117d1430a4c6272e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
@@ -3,3 +3,6 @@ GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x28
GLIBC_2.3 __tls_get_offset F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/sh/be/ld.abilist b/sysdeps/unix/sysv/linux/sh/be/ld.abilist
index 7cc9ebd792c2aadc..7f5527fb301b913c 100644
--- a/sysdeps/unix/sysv/linux/sh/be/ld.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/ld.abilist
@@ -3,4 +3,7 @@ GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x14
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
diff --git a/sysdeps/unix/sysv/linux/sh/le/ld.abilist b/sysdeps/unix/sysv/linux/sh/le/ld.abilist
index 7cc9ebd792c2aadc..7f5527fb301b913c 100644
--- a/sysdeps/unix/sysv/linux/sh/le/ld.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/ld.abilist
@@ -3,4 +3,7 @@ GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x14
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist
index 2e6054349871e7d5..3aac73f3df646cb6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist
@@ -3,3 +3,6 @@ GLIBC_2.1 __libc_stack_end D 0x4
GLIBC_2.1 _dl_mcount F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
index be5122650ae2b327..8ccb5be911e0e9a2 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
@@ -3,3 +3,6 @@ GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x28
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/sys/rseq.h b/sysdeps/unix/sysv/linux/sys/rseq.h
index c8edff50d40e29b6..1215b5d086b8852b 100644
--- a/sysdeps/unix/sysv/linux/sys/rseq.h
+++ b/sysdeps/unix/sysv/linux/sys/rseq.h
@@ -171,4 +171,14 @@ struct rseq
#endif /* __GLIBC_HAVE_KERNEL_RSEQ */
+/* Offset from the thread pointer to the rseq area. */
+extern const int __rseq_offset;
+
+/* Size of the registered rseq area. 0 if the registration was
+ unsuccessful. */
+extern const unsigned int __rseq_size;
+
+/* Flags used during rseq registration. */
+extern const unsigned int __rseq_flags;
+
#endif /* sys/rseq.h */
diff --git a/sysdeps/unix/sysv/linux/tst-rseq-disable.c b/sysdeps/unix/sysv/linux/tst-rseq-disable.c
index 000e351872fc2f76..6d73f77e9621da42 100644
--- a/sysdeps/unix/sysv/linux/tst-rseq-disable.c
+++ b/sysdeps/unix/sysv/linux/tst-rseq-disable.c
@@ -21,6 +21,7 @@
#include <support/namespace.h>
#include <support/xthread.h>
#include <sysdep.h>
+#include <thread_pointer.h>
#include <unistd.h>
#ifdef RSEQ_SIG
@@ -30,6 +31,11 @@ static void
check_rseq_disabled (void)
{
struct pthread *pd = THREAD_SELF;
+
+ TEST_COMPARE (__rseq_flags, 0);
+ TEST_VERIFY ((char *) __thread_pointer () + __rseq_offset
+ == (char *) &pd->rseq_area);
+ TEST_COMPARE (__rseq_size, 0);
TEST_COMPARE ((int) pd->rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
int ret = syscall (__NR_rseq, &pd->rseq_area, sizeof (pd->rseq_area),
diff --git a/sysdeps/unix/sysv/linux/tst-rseq.c b/sysdeps/unix/sysv/linux/tst-rseq.c
index 926376b6a5446ece..572c11166f8b6533 100644
--- a/sysdeps/unix/sysv/linux/tst-rseq.c
+++ b/sysdeps/unix/sysv/linux/tst-rseq.c
@@ -29,12 +29,20 @@
# include <stdlib.h>
# include <string.h>
# include <syscall.h>
+# include <thread_pointer.h>
+# include <tls.h>
# include "tst-rseq.h"
static void
do_rseq_main_test (void)
{
+ struct pthread *pd = THREAD_SELF;
+
TEST_VERIFY_EXIT (rseq_thread_registered ());
+ TEST_COMPARE (__rseq_flags, 0);
+ TEST_VERIFY ((char *) __thread_pointer () + __rseq_offset
+ == (char *) &pd->rseq_area);
+ TEST_COMPARE (__rseq_size, sizeof (pd->rseq_area));
}
static void
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist b/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
index afddaec57c11f837..ae622bdf9710bdbd 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
@@ -3,3 +3,6 @@ GLIBC_2.2.5 _dl_mcount F
GLIBC_2.2.5 _r_debug D 0x28
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist
index defc488d137c61c3..e17496d124b0c7b7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist
@@ -3,3 +3,6 @@ GLIBC_2.16 __tls_get_addr F
GLIBC_2.16 _dl_mcount F
GLIBC_2.16 _r_debug D 0x14
GLIBC_2.34 __rtld_version_placeholder F
+GLIBC_2.35 __rseq_flags D 0x4
+GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_size D 0x4

180
glibc-rh2085529-2.patch Normal file
View File

@ -0,0 +1,180 @@
commit 6c33b018438ee799c29486f21d43d8100bdbd597
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Feb 2 22:37:20 2022 +0100
Linux: Use ptrdiff_t for __rseq_offset
This matches the data size initial-exec relocations use on most
targets.
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/manual/threads.texi b/manual/threads.texi
index 4869f69d2ceed255..48fd562923800b34 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -1004,7 +1004,7 @@ The manual for the @code{rseq} system call can be found
at @uref{https://git.kernel.org/pub/scm/libs/librseq/librseq.git/tree/doc/man/rseq.2}.
@end deftp
-@deftypevar {int} __rseq_offset
+@deftypevar {ptrdiff_t} __rseq_offset
@standards{Linux, sys/rseq.h}
This variable contains the offset between the thread pointer (as defined
by @code{__builtin_thread_pointer} or the thread pointer register for
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c
index 0f5280a75d546d2f..d5f2587f1348441c 100644
--- a/sysdeps/nptl/dl-tls_init_tp.c
+++ b/sysdeps/nptl/dl-tls_init_tp.c
@@ -46,7 +46,7 @@ rtld_mutex_dummy (pthread_mutex_t *lock)
const unsigned int __rseq_flags;
const unsigned int __rseq_size attribute_relro;
-const int __rseq_offset attribute_relro;
+const ptrdiff_t __rseq_offset attribute_relro;
void
__tls_pre_init_tp (void)
@@ -119,7 +119,7 @@ __tls_init_tp (void)
all targets support __thread_pointer, so set __rseq_offset only
if thre rseq registration may have happened because RSEQ_SIG is
defined. */
- extern int offset __asm__ ("__rseq_offset");
+ extern ptrdiff_t offset __asm__ ("__rseq_offset");
offset = (char *) &pd->rseq_area - (char *) __thread_pointer ();
#endif
}
diff --git a/sysdeps/unix/sysv/linux/aarch64/ld.abilist b/sysdeps/unix/sysv/linux/aarch64/ld.abilist
index bf4d4f9b6f2ddf97..5151c0781de01bf1 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/ld.abilist
@@ -5,5 +5,5 @@ GLIBC_2.17 _dl_mcount F
GLIBC_2.17 _r_debug D 0x28
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/alpha/ld.abilist b/sysdeps/unix/sysv/linux/alpha/ld.abilist
index a23325a566419b41..3e296c547314f6c2 100644
--- a/sysdeps/unix/sysv/linux/alpha/ld.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/ld.abilist
@@ -4,6 +4,6 @@ GLIBC_2.1 _dl_mcount F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x8
diff --git a/sysdeps/unix/sysv/linux/ia64/ld.abilist b/sysdeps/unix/sysv/linux/ia64/ld.abilist
index 8ccb5be911e0e9a2..5471b24d59a7527a 100644
--- a/sysdeps/unix/sysv/linux/ia64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/ld.abilist
@@ -4,5 +4,5 @@ GLIBC_2.2 _r_debug D 0x28
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
index 37a47ebc0a0d16c8..f26e594a139f0058 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
@@ -4,6 +4,6 @@ GLIBC_2.2 _dl_mcount F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
GLIBC_2.4 __stack_chk_guard D 0x8
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist
index da24dc7fb52ad2d4..21f472e674299ab7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist
@@ -6,5 +6,5 @@ GLIBC_2.3 _dl_mcount F
GLIBC_2.3 _r_debug D 0x28
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist
index b9ae89ae8d90ed9e..9c9c40450d651880 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist
@@ -6,5 +6,5 @@ GLIBC_2.22 __tls_get_addr_opt F
GLIBC_2.23 __parse_hwcap_and_convert_at_platform F
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
index 48431c91a9fd16b0..a7758a0e52fc8cc8 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
@@ -5,5 +5,5 @@ GLIBC_2.27 _dl_mcount F
GLIBC_2.27 _r_debug D 0x28
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
index 117d1430a4c6272e..78d071600b1f3431 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
@@ -4,5 +4,5 @@ GLIBC_2.2 _r_debug D 0x28
GLIBC_2.3 __tls_get_offset F
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
index 8ccb5be911e0e9a2..5471b24d59a7527a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
@@ -4,5 +4,5 @@ GLIBC_2.2 _r_debug D 0x28
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4
diff --git a/sysdeps/unix/sysv/linux/sys/rseq.h b/sysdeps/unix/sysv/linux/sys/rseq.h
index 1215b5d086b8852b..791ed83176b61fe4 100644
--- a/sysdeps/unix/sysv/linux/sys/rseq.h
+++ b/sysdeps/unix/sysv/linux/sys/rseq.h
@@ -21,6 +21,7 @@
/* Architecture-specific rseq signature. */
#include <bits/rseq.h>
+#include <stddef.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <bits/endian.h>
@@ -172,7 +173,7 @@ struct rseq
#endif /* __GLIBC_HAVE_KERNEL_RSEQ */
/* Offset from the thread pointer to the rseq area. */
-extern const int __rseq_offset;
+extern const ptrdiff_t __rseq_offset;
/* Size of the registered rseq area. 0 if the registration was
unsuccessful. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist b/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
index ae622bdf9710bdbd..5a8bd322cdc95d5b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
@@ -4,5 +4,5 @@ GLIBC_2.2.5 _r_debug D 0x28
GLIBC_2.3 __tls_get_addr F
GLIBC_2.34 __rtld_version_placeholder F
GLIBC_2.35 __rseq_flags D 0x4
-GLIBC_2.35 __rseq_offset D 0x4
+GLIBC_2.35 __rseq_offset D 0x8
GLIBC_2.35 __rseq_size D 0x4

59
glibc-rh2085529-3.patch Normal file
View File

@ -0,0 +1,59 @@
commit 4b527650e0d559a5f693275c598667e06cd6455c
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Jun 2 16:29:55 2022 +0200
Linux: Adjust struct rseq definition to current kernel version
This definition is only used as a fallback with old kernel headers.
The change follows kernel commit bfdf4e6208051ed7165b2e92035b4bf11
("rseq: Remove broken uapi field layout on 32-bit little endian").
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/sysdeps/unix/sysv/linux/sys/rseq.h b/sysdeps/unix/sysv/linux/sys/rseq.h
index 791ed83176b61fe4..56550329db962cc8 100644
--- a/sysdeps/unix/sysv/linux/sys/rseq.h
+++ b/sysdeps/unix/sysv/linux/sys/rseq.h
@@ -24,7 +24,6 @@
#include <stddef.h>
#include <stdint.h>
#include <sys/cdefs.h>
-#include <bits/endian.h>
#ifdef __has_include
# if __has_include ("linux/rseq.h")
@@ -129,28 +128,13 @@ struct rseq
targeted by the rseq_cs. Also needs to be set to NULL by user-space
before reclaiming memory that contains the targeted struct rseq_cs.
- Read and set by the kernel. Set by user-space with single-copy
- atomicity semantics. This field should only be updated by the
- thread which registered this data structure. Aligned on 64-bit. */
- union
- {
- uint64_t ptr64;
-# ifdef __LP64__
- uint64_t ptr;
-# else /* __LP64__ */
- struct
- {
-#if __BYTE_ORDER == __BIG_ENDIAN
- uint32_t padding; /* Initialized to zero. */
- uint32_t ptr32;
-# else /* LITTLE */
- uint32_t ptr32;
- uint32_t padding; /* Initialized to zero. */
-# endif /* ENDIAN */
- } ptr;
-# endif /* __LP64__ */
- } rseq_cs;
+ Read and set by the kernel. Set by user-space with single-copy
+ atomicity semantics. This field should only be updated by the
+ thread which registered this data structure. Aligned on 64-bit.
+ 32-bit architectures should update the low order bits of the
+ rseq_cs field, leaving the high order bits initialized to 0. */
+ uint64_t rseq_cs;
/* Restartable sequences flags field.
This field should only be updated by the thread which

38
glibc-rh2085529-4.patch Normal file
View File

@ -0,0 +1,38 @@
Revert glibc-rh2024347-13.patch. Enable rseq by default.
diff --git a/manual/tunables.texi b/manual/tunables.texi
index f559c44dcec4624b..28ff502990c2a10f 100644
--- a/manual/tunables.texi
+++ b/manual/tunables.texi
@@ -425,13 +425,11 @@ The value is measured in bytes. The default is @samp{41943040}
@end deftp
@deftp Tunable glibc.pthread.rseq
-The @code{glibc.pthread.rseq} tunable can be set to @samp{1}, to enable
-restartable sequences support. @Theglibc{} uses this to optimize the
-@code{sched_getcpu} function.
-
-The default is @samp{0}, which means that applications can perform
-restartable sequences registration, but @code{sched_getcpu} is not
-accelerated.
+The @code{glibc.pthread.rseq} tunable can be set to @samp{0}, to disable
+restartable sequences support in @theglibc{}. This enables applications
+to perform direct restartable sequence registration with the kernel.
+The default is @samp{1}, which means that @theglibc{} performs
+registration on behalf of the application.
Restartable sequences are a Linux-specific extension.
@end deftp
diff --git a/sysdeps/nptl/dl-tunables.list b/sysdeps/nptl/dl-tunables.list
index df2a39ce01858d3b..d24f4be0d08ba407 100644
--- a/sysdeps/nptl/dl-tunables.list
+++ b/sysdeps/nptl/dl-tunables.list
@@ -31,7 +31,7 @@ glibc {
type: INT_32
minval: 0
maxval: 1
- default: 0
+ default: 1
}
}
}

View File

@ -0,0 +1,30 @@
commit b349fe072275bfc5763110a49fe6ef1b44d60289
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue May 31 11:46:59 2022 -0300
misc: Use 64 bit stat for daemon (BZ# 29203)
This is a missing spot initially from 52a5fe70a2c77935.
Checked on i686-linux-gnu.
(cherry picked from commit 3fbc33010c76721d34f676d8efb45bcc54e0d575)
diff --git a/misc/daemon.c b/misc/daemon.c
index 0e688f4d7482e335..3c73ac2ab8709812 100644
--- a/misc/daemon.c
+++ b/misc/daemon.c
@@ -61,11 +61,10 @@ daemon (int nochdir, int noclose)
(void)__chdir("/");
if (!noclose) {
- struct stat64 st;
+ struct __stat64_t64 st;
if ((fd = __open_nocancel(_PATH_DEVNULL, O_RDWR, 0)) != -1
- && (__builtin_expect (__fstat64 (fd, &st), 0)
- == 0)) {
+ && __glibc_likely (__fstat64_time64 (fd, &st) == 0)) {
if (__builtin_expect (S_ISCHR (st.st_mode), 1) != 0
#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
&& (st.st_rdev

View File

@ -0,0 +1,34 @@
commit aa8a87f51d7a1fb86ff75d3e3870316b6bc70dfe
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue May 31 11:51:46 2022 -0300
misc: Use 64 bit stat for getusershell (BZ# 29204)
This is a missing spot initially from 52a5fe70a2c77935.
Checked on i686-linux-gnu.
(cherry picked from commit ec995fb2152f160f02bf695ff83c45df4a6cd868)
diff --git a/misc/getusershell.c b/misc/getusershell.c
index 11f5aa83f888a114..4221095dca743dfa 100644
--- a/misc/getusershell.c
+++ b/misc/getusershell.c
@@ -97,7 +97,7 @@ initshells (void)
{
char **sp, *cp;
FILE *fp;
- struct stat64 statb;
+ struct __stat64_t64 statb;
size_t flen;
free(shells);
@@ -106,7 +106,7 @@ initshells (void)
strings = NULL;
if ((fp = fopen(_PATH_SHELLS, "rce")) == NULL)
goto init_okshells_noclose;
- if (__fstat64(fileno(fp), &statb) == -1) {
+ if (__fstat64_time64(fileno(fp), &statb) == -1) {
init_okshells:
(void)fclose(fp);
init_okshells_noclose:

View File

@ -0,0 +1,56 @@
commit 9db6a597ef950737d3cd7af0d4211291197b82dd
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue May 31 12:17:20 2022 -0300
posix: Use 64 bit stat for posix_fallocate fallback (BZ# 29207)
This is a missing spot initially from 52a5fe70a2c77935.
Checked on i686-linux-gnu.
(cherry picked from commit 574ba60fc8a7fb35e6216e2fdecc521acab7ffd2)
diff --git a/sysdeps/posix/posix_fallocate.c b/sysdeps/posix/posix_fallocate.c
index 0bb379c94d7cf779..4381033d6e16c2e3 100644
--- a/sysdeps/posix/posix_fallocate.c
+++ b/sysdeps/posix/posix_fallocate.c
@@ -30,7 +30,7 @@
int
posix_fallocate (int fd, __off_t offset, __off_t len)
{
- struct stat64 st;
+ struct __stat64_t64 st;
if (offset < 0 || len < 0)
return EINVAL;
@@ -48,7 +48,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
}
/* We have to make sure that this is really a regular file. */
- if (__fstat64 (fd, &st) != 0)
+ if (__fstat64_time64 (fd, &st) != 0)
return EBADF;
if (S_ISFIFO (st.st_mode))
return ESPIPE;
diff --git a/sysdeps/posix/posix_fallocate64.c b/sysdeps/posix/posix_fallocate64.c
index c1e233b49c8d7f37..d45b0c17489fbbbb 100644
--- a/sysdeps/posix/posix_fallocate64.c
+++ b/sysdeps/posix/posix_fallocate64.c
@@ -30,7 +30,7 @@
int
__posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
{
- struct stat64 st;
+ struct __stat64_t64 st;
if (offset < 0 || len < 0)
return EINVAL;
@@ -48,7 +48,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
}
/* We have to make sure that this is really a regular file. */
- if (__fstat64 (fd, &st) != 0)
+ if (__fstat64_time64 (fd, &st) != 0)
return EBADF;
if (S_ISFIFO (st.st_mode))
return ESPIPE;

View File

@ -0,0 +1,28 @@
commit f9c3e57ac25511db78f3d51a38f6a715be220479
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue May 31 12:22:13 2022 -0300
posix: Use 64 bit stat for fpathconf (_PC_ASYNC_IO) (BZ# 29208)
This is a missing spot initially from 52a5fe70a2c77935.
Checked on i686-linux-gnu.
(cherry picked from commit 6e7137f28c9d743d66b5a1cb8fa0d1717b96f853)
diff --git a/sysdeps/posix/fpathconf.c b/sysdeps/posix/fpathconf.c
index ec0e780466756e00..e673f2016136679e 100644
--- a/sysdeps/posix/fpathconf.c
+++ b/sysdeps/posix/fpathconf.c
@@ -131,9 +131,9 @@ __fpathconf (int fd, int name)
#ifdef _POSIX_ASYNC_IO
{
/* AIO is only allowed on regular files and block devices. */
- struct stat64 st;
+ struct __stat64_t64 st;
- if (__fstat64 (fd, &st) < 0
+ if (__fstat64_time64 (fd, &st) < 0
|| (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
return -1;
else

View File

@ -0,0 +1,31 @@
commit 61fd3e0e7495f597b41e90d3e045b8c3b182a23d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue May 31 12:28:20 2022 -0300
socket: Use 64 bit stat for isfdtype (BZ# 29209)
This is a missing spot initially from 52a5fe70a2c77935.
Checked on i686-linux-gnu.
(cherry picked from commit 87f1ec12e79a3895b33801fa816884f0d24ae7ef)
diff --git a/sysdeps/posix/isfdtype.c b/sysdeps/posix/isfdtype.c
index 06b5386c4379063d..f18bcfef224ebac6 100644
--- a/sysdeps/posix/isfdtype.c
+++ b/sysdeps/posix/isfdtype.c
@@ -24,12 +24,12 @@
int
isfdtype (int fildes, int fdtype)
{
- struct stat64 st;
+ struct __stat64_t64 st;
int result;
{
int save_error = errno;
- result = __fstat64 (fildes, &st);
+ result = __fstat64_time64 (fildes, &st);
__set_errno (save_error);
}

View File

@ -0,0 +1,34 @@
commit 34422108f4e0b8fc0d950b8c00b87193a7884ee5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue May 31 12:34:48 2022 -0300
inet: Use 64 bit stat for ruserpass (BZ# 29210)
This is a missing spot initially from 52a5fe70a2c77935.
Checked on i686-linux-gnu.
(cherry picked from commit 3cd4785ea02cc3878bf21996cf9b61b3a306447e)
diff --git a/inet/ruserpass.c b/inet/ruserpass.c
index d61a72877d20b7e5..75e2a065524aa1d5 100644
--- a/inet/ruserpass.c
+++ b/inet/ruserpass.c
@@ -95,7 +95,7 @@ ruserpass (const char *host, const char **aname, const char **apass)
char *hdir, *buf, *tmp;
char myname[1024], *mydomain;
int t, usedefault = 0;
- struct stat64 stb;
+ struct __stat64_t64 stb;
hdir = __libc_secure_getenv("HOME");
if (hdir == NULL) {
@@ -174,7 +174,7 @@ next:
break;
case PASSWD:
if (strcmp(*aname, "anonymous") &&
- __fstat64(fileno(cfile), &stb) >= 0 &&
+ __fstat64_time64(fileno(cfile), &stb) >= 0 &&
(stb.st_mode & 077) != 0) {
warnx(_("Error: .netrc file is readable by others."));
warnx(_("Remove 'password' line or make file unreadable by others."));

View File

@ -0,0 +1,34 @@
commit 52431199b5cef8f56c71c66f5859b097804aebe8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue May 31 12:38:55 2022 -0300
catgets: Use 64 bit stat for __open_catalog (BZ# 29211)
This is a missing spot initially from 52a5fe70a2c77935.
Checked on i686-linux-gnu.
(cherry picked from commit c86631de6fa2fb5fa293810c66e53898537a4ddc)
diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c
index 7f67cc056445b5e2..75703b2cadd1764c 100644
--- a/catgets/open_catalog.c
+++ b/catgets/open_catalog.c
@@ -40,7 +40,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
__nl_catd catalog)
{
int fd = -1;
- struct stat64 st;
+ struct __stat64_t64 st;
int swapping;
size_t cnt;
size_t max_offset;
@@ -194,7 +194,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
return -1;
}
- if (__builtin_expect (__fstat64 (fd, &st), 0) < 0)
+ if (__glibc_unlikely (__fstat64_time64 (fd, &st) < 0))
goto close_unlock_return;
if (__builtin_expect (!S_ISREG (st.st_mode), 0)

View File

@ -0,0 +1,47 @@
commit b3f935940ebcdf553b64e74fdf65dfd4858821ad
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue May 31 12:51:43 2022 -0300
iconv: Use 64 bit stat for gconv_parseconfdir (BZ# 29213)
The issue is only when used within libc.so (iconvconfig already builds
with _TIME_SIZE=64).
This is a missing spot initially from 52a5fe70a2c77935.
Checked on i686-linux-gnu.
(cherry picked from commit c789e6e40974e2b67bd33a17f29b20dce6ae8822)
diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
index a586268abc103abd..79398a980cde84e3 100644
--- a/iconv/gconv_parseconfdir.h
+++ b/iconv/gconv_parseconfdir.h
@@ -32,8 +32,11 @@
# define readdir __readdir
# define closedir __closedir
# define mempcpy __mempcpy
-# define lstat64 __lstat64
+# define struct_stat struct __stat64_t64
+# define lstat __lstat64_time64
# define feof_unlocked __feof_unlocked
+#else
+# define struct_stat struct stat
#endif
/* Name of the file containing the module information in the directories
@@ -158,12 +161,12 @@ gconv_parseconfdir (const char *prefix, const char *dir, size_t dir_len)
&& strcmp (ent->d_name + len - strlen (suffix), suffix) == 0)
{
char *conf;
- struct stat64 st;
+ struct_stat st;
if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0)
continue;
if (ent->d_type != DT_UNKNOWN
- || (lstat64 (conf, &st) != -1 && S_ISREG (st.st_mode)))
+ || (lstat (conf, &st) != -1 && S_ISREG (st.st_mode)))
found |= read_conf_file (conf, dir, dir_len);
free (conf);

View File

@ -0,0 +1,21 @@
commit 9947f2df19a6c5b5706ed3b002199dbb9fef17b1
Author: Dmitriy Fedchenko <xfedch@gmail.com>
Date: Mon Jun 6 12:46:14 2022 -0300
socket: Fix mistyped define statement in socket/sys/socket.h (BZ #29225)
(cherry picked from commit 999835533bc60fbd0b0b65d2412a6742e5a54b9d)
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index bd14e7e3a5008ec5..5765dc1f0dedd380 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -181,7 +181,7 @@ extern ssize_t __REDIRECT (sendmsg, (int __fd, const struct msghdr *__message,
# else
extern ssize_t __sendmsg64 (int __fd, const struct msghdr *__message,
int __flags);
-# defien sendmsg __sendmsg64
+# define sendmsg __sendmsg64
# endif
#endif

View File

@ -0,0 +1,42 @@
commit 4c92a1041257c0155c6aa7a182fe5f78e477b0e6
Author: Matheus Castanho <msc@linux.ibm.com>
Date: Tue Jun 7 10:27:26 2022 -0300
powerpc: Fix VSX register number on __strncpy_power9 [BZ #29197]
__strncpy_power9 initializes VR 18 with zeroes to be used throughout the
code, including when zero-padding the destination string. However, the
v18 reference was mistakenly being used for stxv and stxvl, which take a
VSX vector as operand. The code ended up using the uninitialized VSR 18
register by mistake.
Both occurrences have been changed to use the proper VSX number for VR 18
(i.e. VSR 50).
Tested on powerpc, powerpc64 and powerpc64le.
Signed-off-by: Kewen Lin <linkw@gcc.gnu.org>
(cherry picked from commit 0218463dd8265ed937622f88ac68c7d984fe0cfc)
diff --git a/sysdeps/powerpc/powerpc64/le/power9/strncpy.S b/sysdeps/powerpc/powerpc64/le/power9/strncpy.S
index 291941c1e5c0eb4b..5421525acee3ebfe 100644
--- a/sysdeps/powerpc/powerpc64/le/power9/strncpy.S
+++ b/sysdeps/powerpc/powerpc64/le/power9/strncpy.S
@@ -352,7 +352,7 @@ L(zero_padding_loop):
cmpldi cr6,r5,16 /* Check if length was reached. */
ble cr6,L(zero_padding_end)
- stxv v18,0(r11)
+ stxv 32+v18,0(r11)
addi r11,r11,16
addi r5,r5,-16
@@ -360,7 +360,7 @@ L(zero_padding_loop):
L(zero_padding_end):
sldi r10,r5,56 /* stxvl wants size in top 8 bits */
- stxvl v18,r11,r10 /* Partial store */
+ stxvl 32+v18,r11,r10 /* Partial store */
blr
.align 4

View File

@ -148,7 +148,7 @@ end \
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 35%{?dist}
Release: 37%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -529,6 +529,20 @@ Patch321: glibc-upstream-2.34-255.patch
Patch322: glibc-upstream-2.34-256.patch
Patch323: glibc-upstream-2.34-257.patch
Patch324: glibc-upstream-2.34-258.patch
Patch325: glibc-upstream-2.34-259.patch
Patch326: glibc-upstream-2.34-260.patch
Patch327: glibc-upstream-2.34-261.patch
Patch328: glibc-upstream-2.34-262.patch
Patch329: glibc-upstream-2.34-263.patch
Patch330: glibc-upstream-2.34-264.patch
Patch331: glibc-upstream-2.34-265.patch
Patch332: glibc-upstream-2.34-266.patch
Patch333: glibc-upstream-2.34-267.patch
Patch334: glibc-upstream-2.34-268.patch
Patch335: glibc-rh2085529-1.patch
Patch336: glibc-rh2085529-2.patch
Patch337: glibc-rh2085529-3.patch
Patch338: glibc-rh2085529-4.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2585,6 +2599,23 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Wed Jun 8 2022 Florian Weimer <fweimer@redhat.com> - 2.34-37
- Enable rseq by default and add GLIBC_2.35 rseq symbols (#2085529)
* Wed Jun 8 2022 Florian Weimer <fweimer@redhat.com> - 2.34-36
- Sync with upstream branch release/2.34/master,
commit 4c92a1041257c0155c6aa7a182fe5f78e477b0e6:
- powerpc: Fix VSX register number on __strncpy_power9 [BZ #29197]
- socket: Fix mistyped define statement in socket/sys/socket.h (BZ #29225)
- iconv: Use 64 bit stat for gconv_parseconfdir (BZ# 29213)
- catgets: Use 64 bit stat for __open_catalog (BZ# 29211)
- inet: Use 64 bit stat for ruserpass (BZ# 29210)
- socket: Use 64 bit stat for isfdtype (BZ# 29209)
- posix: Use 64 bit stat for fpathconf (_PC_ASYNC_IO) (BZ# 29208)
- posix: Use 64 bit stat for posix_fallocate fallback (BZ# 29207)
- misc: Use 64 bit stat for getusershell (BZ# 29204)
- misc: Use 64 bit stat for daemon (BZ# 29203)
* Tue May 31 2022 Arjun Shankar <arjun@redhat.com> - 2.34-35
- Sync with upstream branch release/2.34/master,
commit ff450cdbdee0b8cb6b9d653d6d2fa892de29be31: