]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rseq: Introduce struct rseq_data
authorThomas Gleixner <tglx@linutronix.de>
Mon, 27 Oct 2025 08:44:33 +0000 (09:44 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 4 Nov 2025 07:30:50 +0000 (08:30 +0100)
commitfaba9d250eaec7afa248bba71531a08ccc497aab
tree2c178787b061b036b397b6a02379499964595288
parent566d8015f7eef11d82cd63dc4e1f620fcfc2a394
rseq: Introduce struct rseq_data

In preparation for a major rewrite of this code, provide a data structure
for rseq management.

Put all the rseq related data into it (except for the debug part), which
allows to simplify fork/execve by using memset() and memcpy() instead of
adding new fields to initialize over and over.

Create a storage struct for event management as well and put the
sched_switch event and a indicator for RSEQ on a task into it as a
start. That uses a union, which allows to mask and clear the whole lot
efficiently.

The indicators are explicitly not a bit field. Bit fields generate abysmal
code.

The boolean members are defined as u8 as that actually guarantees that it
fits. There seem to be strange architecture ABIs which need more than 8
bits for a boolean.

The has_rseq member is redundant vs. task::rseq, but it turns out that
boolean operations and quick checks on the union generate better code than
fiddling with separate entities and data types.

This struct will be extended over time to carry more information.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/20251027084306.527086690@linutronix.de
include/linux/rseq.h
include/linux/rseq_types.h [new file with mode: 0644]
include/linux/sched.h
kernel/ptrace.c
kernel/rseq.c