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: Use static branch for syscall exit debug when GENERIC_IRQ_ENTRY=y

Make the syscall exit debug mechanism available via the static branch on
architectures which utilize the generic entry code.

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/20251027084307.333440475@linutronix.de

authored by

Thomas Gleixner and committed by
Ingo Molnar
eaa9088d c1cbad8f

+18 -3
+1 -1
include/linux/entry-common.h
··· 146 146 local_irq_enable(); 147 147 } 148 148 149 - rseq_syscall(regs); 149 + rseq_debug_syscall_return(regs); 150 150 151 151 /* 152 152 * Do one-time syscall specific work. If these work items are
+9
include/linux/rseq_entry.h
··· 296 296 ev->events = 0; 297 297 } 298 298 299 + void __rseq_debug_syscall_return(struct pt_regs *regs); 300 + 301 + static inline void rseq_debug_syscall_return(struct pt_regs *regs) 302 + { 303 + if (static_branch_unlikely(&rseq_debug_enabled)) 304 + __rseq_debug_syscall_return(regs); 305 + } 306 + 299 307 #else /* CONFIG_RSEQ */ 300 308 static inline void rseq_note_user_irq_entry(void) { } 301 309 static inline void rseq_exit_to_user_mode(void) { } 310 + static inline void rseq_debug_syscall_return(struct pt_regs *regs) { } 302 311 #endif /* !CONFIG_RSEQ */ 303 312 304 313 #endif /* _LINUX_RSEQ_ENTRY_H */
+8 -2
kernel/rseq.c
··· 473 473 force_sigsegv(sig); 474 474 } 475 475 476 - #ifdef CONFIG_DEBUG_RSEQ 477 476 /* 478 477 * Terminate the process if a syscall is issued within a restartable 479 478 * sequence. 480 479 */ 481 - void rseq_syscall(struct pt_regs *regs) 480 + void __rseq_debug_syscall_return(struct pt_regs *regs) 482 481 { 483 482 struct task_struct *t = current; 484 483 u64 csaddr; ··· 494 495 return; 495 496 fail: 496 497 force_sig(SIGSEGV); 498 + } 499 + 500 + #ifdef CONFIG_DEBUG_RSEQ 501 + /* Kept around to keep GENERIC_ENTRY=n architectures supported. */ 502 + void rseq_syscall(struct pt_regs *regs) 503 + { 504 + __rseq_debug_syscall_return(regs); 497 505 } 498 506 #endif 499 507