commit 6c33b018438ee799c29486f21d43d8100bdbd597 Author: Florian Weimer 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 Reviewed-by: Carlos O'Donell 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 +#include #include #include #include @@ -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