Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rseq: Simplify registration

There is no point to read the critical section element in the newly
registered user space RSEQ struct first in order to clear it.

Just clear it and be done with it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/20251027084306.274661227@linutronix.de

authored by

Thomas Gleixner and committed by
Ingo Molnar
067b3b41 41b43a6b

+3 -7
+3 -7
kernel/rseq.c
··· 492 492 /* 493 493 * sys_rseq - setup restartable sequences for caller thread. 494 494 */ 495 - SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, 496 - int, flags, u32, sig) 495 + SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, int, flags, u32, sig) 497 496 { 498 497 int ret; 499 - u64 rseq_cs; 500 498 501 499 if (flags & RSEQ_FLAG_UNREGISTER) { 502 500 if (flags & ~RSEQ_FLAG_UNREGISTER) ··· 555 557 * avoid a potential segfault on return to user-space. The proper thing 556 558 * to do would have been to fail the registration but this would break 557 559 * older libcs that reuse the rseq area for new threads without 558 - * clearing the fields. 560 + * clearing the fields. Don't bother reading it, just reset it. 559 561 */ 560 - if (rseq_get_rseq_cs_ptr_val(rseq, &rseq_cs)) 561 - return -EFAULT; 562 - if (rseq_cs && clear_rseq_cs(rseq)) 562 + if (put_user(0UL, &rseq->rseq_cs)) 563 563 return -EFAULT; 564 564 565 565 #ifdef CONFIG_DEBUG_RSEQ