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: Allow registering RSEQ with slice extension

Since glibc cares about the number of syscalls required to initialize a new
thread, allow initializing rseq with slice extension on. This avoids having to
do another prctl().

Requested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260121143207.814193010@infradead.org

+12 -3
+2 -1
include/uapi/linux/rseq.h
··· 19 19 }; 20 20 21 21 enum rseq_flags { 22 - RSEQ_FLAG_UNREGISTER = (1 << 0), 22 + RSEQ_FLAG_UNREGISTER = (1 << 0), 23 + RSEQ_FLAG_SLICE_EXT_DEFAULT_ON = (1 << 1), 23 24 }; 24 25 25 26 enum rseq_cs_flags_bit {
+10 -2
kernel/rseq.c
··· 424 424 return 0; 425 425 } 426 426 427 - if (unlikely(flags)) 427 + if (unlikely(flags & ~(RSEQ_FLAG_SLICE_EXT_DEFAULT_ON))) 428 428 return -EINVAL; 429 429 430 430 if (current->rseq.usrptr) { ··· 459 459 if (!access_ok(rseq, rseq_len)) 460 460 return -EFAULT; 461 461 462 - if (IS_ENABLED(CONFIG_RSEQ_SLICE_EXTENSION)) 462 + if (IS_ENABLED(CONFIG_RSEQ_SLICE_EXTENSION)) { 463 463 rseqfl |= RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE; 464 + if (rseq_slice_extension_enabled() && 465 + (flags & RSEQ_FLAG_SLICE_EXT_DEFAULT_ON)) 466 + rseqfl |= RSEQ_CS_FLAG_SLICE_EXT_ENABLED; 467 + } 464 468 465 469 scoped_user_write_access(rseq, efault) { 466 470 /* ··· 491 487 current->rseq.usrptr = rseq; 492 488 current->rseq.len = rseq_len; 493 489 current->rseq.sig = sig; 490 + 491 + #ifdef CONFIG_RSEQ_SLICE_EXTENSION 492 + current->rseq.slice.state.enabled = !!(rseqfl & RSEQ_CS_FLAG_SLICE_EXT_ENABLED); 493 + #endif 494 494 495 495 /* 496 496 * If rseq was previously inactive, and has just been