Re: [PATCH v2] rseq: update kernel fields in lockstep with CONFIG_DEBUG_RSEQ
From: Michael Jeanson
Date: Tue Feb 25 2025 - 15:05:23 EST
On 2025-02-25 14:56, Ingo Molnar wrote:
>
> * Michael Jeanson <mjeanson@xxxxxxxxxxxx> wrote:
>
>> With CONFIG_DEBUG_RSEQ=y, an in-kernel copy of the read-only fields is
>> kept synchronized with the user-space fields. Ensure the updates are
>> done in lockstep in case we error out on a write to user-space.
>>
>> Fixes: 7d5265ffcd8b ("rseq: Validate read-only fields under DEBUG_RSEQ config")
>> Signed-off-by: Michael Jeanson <mjeanson@xxxxxxxxxxxx>
>> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
>> ---
>> kernel/rseq.c | 85 +++++++++++++++++++++++++++------------------------
>> 1 file changed, 45 insertions(+), 40 deletions(-)
>>
>> diff --git a/kernel/rseq.c b/kernel/rseq.c
>> index 2cb16091ec0a..88aa780f8cf4 100644
>> --- a/kernel/rseq.c
>> +++ b/kernel/rseq.c
>> @@ -26,6 +26,11 @@
>> RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL | \
>> RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE)
>>
>> +static struct rseq __user *rseq_user_fields(struct task_struct *t)
>> +{
>> + return (struct rseq __user *) t->rseq;
>
> Why is this wrapper needed?
>
> task_struct::rseq is already of that exact type AFAICS:
>
> struct rseq __user *rseq;
It's not needed, I can remove it and resend.
Thanks,
Michael