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

Thomas Gleixner
2026-04-28T23:33:47Z

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)();
memset(&t->rseq, 0, sizeof(t->rseq));
t->rseq.ids.cpu_id = RSEQ_CPU_ID_UNINITIALIZED;
}