summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@kernel.org>2026-04-28 11:14:41 +0300
committerPeter Zijlstra <peterz@infradead.org>2026-05-01 22:32:20 +0300
commite9766e6f7d330dce7530918d8c6e3ec96d6c6e24 (patch)
tree63950a6c65d7fdc0e67e06e3e2b7ed8fc3859e54 /include/linux
parent2cb68e45120dfc66404c7547d95b8ac6ff0b25ce (diff)
downloadlinux-e9766e6f7d330dce7530918d8c6e3ec96d6c6e24.tar.xz
rseq: Protect rseq_reset() against interrupts
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> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224427.353887714%40kernel.org Cc: stable@vger.kernel.org
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/rseq.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/rseq.h b/include/linux/rseq.h
index b9d62fc2140d..f446909551df 100644
--- a/include/linux/rseq.h
+++ b/include/linux/rseq.h
@@ -119,6 +119,8 @@ static inline void rseq_virt_userspace_exit(void)
static inline void rseq_reset(struct task_struct *t)
{
+ /* Protect against preemption and membarrier IPI */
+ guard(irqsave)();
memset(&t->rseq, 0, sizeof(t->rseq));
t->rseq.ids.cpu_id = RSEQ_CPU_ID_UNINITIALIZED;
}