Skip to content

RFC rseq: add support for RSEQ operations

[email protected] lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5rseq: uapi: add rseq operation definitionsinclude/uapi/linux/prctl.h include/uapi/linux/rseq.h+108 -86 replies
2/5rseq: add per-task rseq operation stateinclude/linux/rseq.h include/linux/rseq_types.h+18 -11 reply
3/5rseq: apply operations on exit to user spaceinclude/linux/rseq_entry.h+152 -51 reply
4/5rseq: register and unregister operations via prctlkernel/rseq.c kernel/sys.c+212 -131 reply
5/5selftests/rseq: add coverage for rseq operationstools/testing/selftests/rseq/.gitignore tools/testing/selftests/rseq/Makefile tools/testing/selftests/rseq/rseq-abi.h +2 more+223 -290 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/5] rseq: add support for RSEQ operations

From: Olivier Dion <[email protected]>

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/[email protected]>.

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(-)
Signature · 1 line
2.54.0