Re: [RFC PATCH 1/5] rseq: uapi: add rseq operation definitions
From: Florian Weimer
Date: Mon Aug 31 2026 - 05:29:29 EST
> Introduce userspace ABI for rseq operations: a per-thread list of
> operations the kernel applies on return to user space.
>
> The main motivation for this work is to encourage TCMalloc to migrate to
> RSEQ v2 [0] and use the glibc RSEQ region.
>
> Indeed, TCMalloc relies on the behavior of RSEQ v1, that reset the
> cpu_id bits in the RSEQ shared region, to invalidate a per-cpu pointer
> cached in a TLS. This hack requires TCMalloc users to use a glibc
> tunable to disable RSEQ registration for threads so that TCMalloc can
> register its own region, overlapping the TLS cache.
The commit message does not quite say how this addresses tcmalloc needs.
I assume the idea is to reset some other data structure and not the rseq
fields. Is my assumption correct?
Would it be possible to use actual CPU instructions running in userspace
for this? I assume not because it's not possible to restore the
register contents.
My concern is that this would turn into another bytecode interpreter
over time, basically reimplementing BPF.
Thanks,
Florian