Re: [patch V3 05/12] rseq: Add prctl() to enable time slice extensions

From: Thomas Gleixner

Date: Fri Oct 31 2025 - 17:05:50 EST


On Fri, Oct 31 2025 at 15:43, Mathieu Desnoyers wrote:
> On 2025-10-29 09:22, Thomas Gleixner wrote:
>> + case PR_RSEQ_SLICE_EXTENSION_SET: {
>> + u32 rflags, valid = RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE;
>> + bool enable = !!(arg3 & PR_RSEQ_SLICE_EXT_ENABLE);
>> +
>> + if (arg3 & ~PR_RSEQ_SLICE_EXT_ENABLE)
>> + return -EINVAL;
>> + if (!rseq_slice_extension_enabled())
>> + return -ENOTSUPP;
>> + if (!current->rseq.usrptr)
>> + return -ENXIO;
>> +
>
> So what happens if we have an (unlikely) scenario of:
>
> - thread startup
> - thread registration to rseq
> - prctl PR_RSEQ_SLICE_EXTENSION_SET
> - rseq unregistration
> - rseq registration
> --> What's the status of slice extension here ?

On unregister it's cleared and you have to re-register it when you
register a new rseq. It's part of the rseq state so obviously it's all
set back to zero.