Re: [patch 02/10] rseq: Protect rseq_reset() against interrupts

From: Dmitry Vyukov

Date: Wed Apr 29 2026 - 04:23:00 EST


On Wed, 29 Apr 2026 at 01:33, Thomas Gleixner <tglx@xxxxxxxxxx> wrote:
>
> rseq_reset() uses memset() to clear the tasks rseq data. That's racy
> against membarrier() and preemption.
>
> Guard it with irqsave to cure this.
>
> Fixes: faba9d250eae ("rseq: Introduce struct rseq_data")
> Reported-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> ---
> include/linux/rseq.h | 1 +
> 1 file changed, 1 insertion(+)
>
> --- a/include/linux/rseq.h
> +++ b/include/linux/rseq.h
> @@ -119,6 +119,7 @@ static inline void rseq_virt_userspace_e
>
> static inline void rseq_reset(struct task_struct *t)
> {
> + guard(irqsave)();

This may deserve a comment for future readers, but otherwise:

Reviewed-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>

> memset(&t->rseq, 0, sizeof(t->rseq));
> t->rseq.ids.cpu_id = RSEQ_CPU_ID_UNINITIALIZED;
> }
>