[PATCH v2] Linux: Adjust struct rseq definition to current kernel version
Carlos O'Donell
carlos@redhat.com
Thu Jun 2 14:28:35 GMT 2022
On 6/2/22 10:26, Florian Weimer wrote:
> 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").
LGTM.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> ---
> v2: Drop #include <bits/endian.h>. Use uint64_t instead of __u64.
>
> sysdeps/unix/sysv/linux/sys/rseq.h | 28 ++++++----------------------
> 1 file changed, 6 insertions(+), 22 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/sys/rseq.h b/sysdeps/unix/sysv/linux/sys/rseq.h
> index 8533782cf4..899d534df8 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>
OK. Drop endian.h since it's not needed any longer.
>
> #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;
OK. Upstream drops the entire union and leaves only the first element.
> -# 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. */
OK. This matches upstream text.
> + uint64_t rseq_cs;
OK. This matches the first element of the union (as upstream did).
> /* Restartable sequences flags field.
>
> This field should only be updated by the thread which
>
--
Cheers,
Carlos.
More information about the Libc-alpha
mailing list