]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rseq: Provide and use rseq_set_ids()
authorThomas Gleixner <tglx@linutronix.de>
Mon, 27 Oct 2025 08:45:08 +0000 (09:45 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 4 Nov 2025 07:33:33 +0000 (08:33 +0100)
commit0f085b41880e3140efa6941ff2b8fd43bac4d659
tree441ac375157092ba3b346b5f661acbddda7185dd
parenteaa9088d568c84afd72fa32dbe01833aef861d0d
rseq: Provide and use rseq_set_ids()

Provide a new and straight forward implementation to set the IDs (CPU ID,
Node ID and MM CID), which can be later inlined into the fast path.

It does all operations in one scoped_user_rw_access() section and retrieves
also the critical section member (rseq::cs_rseq) from user space to avoid
another user..begin/end() pair. This is in preparation for optimizing the
fast path to avoid extra work when not required.

On rseq registration set the CPU ID fields to RSEQ_CPU_ID_UNINITIALIZED and
node and MM CID to zero. That's the same as the kernel internal reset
values. That makes the debug validation in the exit code work correctly on
the first exit to user space.

Use it to replace the whole related zoo in rseq.c

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/20251027084307.393972266@linutronix.de
fs/binfmt_elf.c
include/linux/rseq.h
include/linux/rseq_entry.h
include/linux/sched.h
kernel/rseq.c