diff mbox series

[v8,4/8] nptl: Add features to internal 'struct rseq_area'

Message ID 20240206162801.882585-5-mjeanson@efficios.com
State New
Headers show
Series Extend rseq support | expand

Commit Message

Michael Jeanson Feb. 6, 2024, 4:27 p.m. UTC
The 'struct rseq_area' is used to define the offset of the various
features available in the rseq ABI. Add fields that follow cpu_id
(rseq_cs, flags, node_id, mm_cid) in preparation for their use.

Access to features following the original rseq ABI 20 bytes (after
'flags') starting with 'node_id' must be gated by an rseq feature size
test.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 sysdeps/unix/sysv/linux/rseq-internal.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

DJ Delorie Feb. 17, 2024, 2:04 a.m. UTC | #1
Michael Jeanson <mjeanson@efficios.com> writes:
> Access to features following the original rseq ABI 20 bytes (after
> 'flags') starting with 'node_id' must be gated by an rseq feature size
> test.

Are there any kernels that still provide auxvals that result in a 8 byte
rseq area?  I.e. perhaps an older kernel that doesn't support the
feature area at all?

> diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h
> index b6c9deea6b..a63e4afbdb 100644
> --- a/sysdeps/unix/sysv/linux/rseq-internal.h
> +++ b/sysdeps/unix/sysv/linux/rseq-internal.h
> @@ -28,13 +28,17 @@
>  #include <ldsodefs.h>
>  
>  /* rseq area registered with the kernel.  Use a custom definition
> -   here to isolate from kernel struct rseq changes.  The
> -   implementation of sched_getcpu needs acccess to the cpu_id field;
> -   the other fields are unused and not included here.  */
> +   here to isolate from kernel struct rseq changes.  Access to fields
> +   beyond the 20 bytes of the original ABI (after 'flags') must be gated
> +   by a check of the feature size.  */

If the answer to the first question is "yes" then this should be changed
to say "8 bytes" etc.

>  struct rseq_area
>  {
>    uint32_t cpu_id_start;
>    uint32_t cpu_id;
> +  uint64_t rseq_cs;
> +  uint32_t flags;
> +  uint32_t node_id;
> +  uint32_t mm_cid;
>  };

Ok.
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h
index b6c9deea6b..a63e4afbdb 100644
--- a/sysdeps/unix/sysv/linux/rseq-internal.h
+++ b/sysdeps/unix/sysv/linux/rseq-internal.h
@@ -28,13 +28,17 @@ 
 #include <ldsodefs.h>
 
 /* rseq area registered with the kernel.  Use a custom definition
-   here to isolate from kernel struct rseq changes.  The
-   implementation of sched_getcpu needs acccess to the cpu_id field;
-   the other fields are unused and not included here.  */
+   here to isolate from kernel struct rseq changes.  Access to fields
+   beyond the 20 bytes of the original ABI (after 'flags') must be gated
+   by a check of the feature size.  */
 struct rseq_area
 {
   uint32_t cpu_id_start;
   uint32_t cpu_id;
+  uint64_t rseq_cs;
+  uint32_t flags;
+  uint32_t node_id;
+  uint32_t mm_cid;
 };
 
 static inline struct rseq_area *