[RFC PATCH 0/5] rseq: add support for RSEQ operations
From: odion
Date: Fri Aug 28 2026 - 11:43:00 EST
From: Olivier Dion <odion@xxxxxxxxxxxx>
Hi,
This series introduces RSEQ operations: a per-thread list of operations the
kernel applies, on behalf of a ask, when returning to user space.
The main motivation is to help TCMalloc migrate from RSEQ v1 to RSEQ v2 and use
the RSEQ area registered by glibc. TCMalloc currently relies on RSEQ v1
resetting the cpu_id field to invalidate a per-CPU pointer cached in TLS. This
requires applications to disable glibc's implicit RSEQ registration and prevents
sharing the glibc RSEQ area.
RSEQ operations provide an opt-in replacement for that invalidation
mechanism. User space registers operation nodes with prctl; the kernel keeps the
nodes in a per-thread circular list and applies them on return to user
space. Only tasks with registered operations incur the additional RSEQ exit-path
work.
The first patch adds the UAPI. The next three patches add the task state,
operation execution, and prctl registration support. The final patch adds
selftests covering normal operation and malformed-list and invalid-memory cases.
See also <https://lore.kernel.org/lkml/20260428221058.149538293@xxxxxxxxxx>.
Thanks,
old
Olivier Dion (5):
rseq: uapi: add rseq operation definitions
rseq: add per-task rseq operation state
rseq: apply operations on exit to user space
rseq: register and unregister operations via prctl
selftests/rseq: add coverage for rseq operations
include/linux/rseq.h | 10 +-
include/linux/rseq_entry.h | 157 ++++++++++++++++-
include/linux/rseq_types.h | 9 +
include/uapi/linux/prctl.h | 12 ++
include/uapi/linux/rseq.h | 104 ++++++++++-
kernel/rseq.c | 220 ++++++++++++++++++++++--
kernel/sys.c | 5 +
tools/testing/selftests/rseq/.gitignore | 4 +-
tools/testing/selftests/rseq/Makefile | 4 +-
tools/testing/selftests/rseq/rseq-abi.h | 146 +++++++++++++---
tools/testing/selftests/rseq/rseq.c | 23 ++-
tools/testing/selftests/rseq/rseq.h | 75 ++++++++
12 files changed, 713 insertions(+), 56 deletions(-)
--
2.54.0