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

Dmitry Vyukov
2026-04-29T08:22:50Z

On Wed, 29 Apr 2026 at 01:33, Thomas Gleixner <tglx@kernel.org> 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@google.com>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: stable@vger.kernel.org
> ---
> 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@google.com>

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