diff options
author | Michael Jeanson <mjeanson@efficios.com> | 2024-02-22 18:16:13 -0500 |
---|---|---|
committer | Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | 2024-02-23 15:15:22 -0500 |
commit | 9de60bd2c5cd1a82ba1d29634b6d708c99fff1b9 (patch) | |
tree | 79c0ac953ae5c3efa95edc055da8ffeaff7660a1 | |
parent | ebd2757381d9a641c39bbaad73ecd7e1ef000797 (diff) | |
download | librseq-9de60bd2c5cd1a82ba1d29634b6d708c99fff1b9.tar.gz |
fix: always set the rseq offset and flags
Even when the rseq syscall is unavailable, set the __rseq_offset to the
correct value as application or library code might try to check the
registration status by reading the cpu_id.
Change-Id: I8f579af236e17a45dfb71c3310bc41a9c17652fd
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-rw-r--r-- | src/rseq.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -223,6 +223,12 @@ void rseq_init(void) /* librseq owns the registration */ rseq_ownership = 1; + /* Calculate the offset of the rseq area from the thread pointer. */ + rseq_offset = (uintptr_t)&__rseq_abi - (uintptr_t)rseq_thread_pointer(); + + /* rseq flags are deprecated, always set to 0. */ + rseq_flags = 0; + /* * Check if the rseq syscall is available, if not set the size and * feature_size to 0. @@ -233,12 +239,6 @@ void rseq_init(void) goto unlock; } - /* Calculate the offset of the rseq area from the thread pointer. */ - rseq_offset = (uintptr_t)&__rseq_abi - (uintptr_t)rseq_thread_pointer(); - - /* rseq flags are deprecated, always set to 0. */ - rseq_flags = 0; - /* * If the feature size matches the original ABI (20), set the size to * match the original ABI allocation (32), otherwise use the allocated |