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: Provide tracepoint wrappers for inline code

Provide tracepoint wrappers for the upcoming RSEQ exit to user space inline
fast path, so that the header can be safely included by code which defines
actual trace points.

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

authored by

Thomas Gleixner and committed by
Ingo Molnar
dab34475 2fc0e4b4

+46 -1
+28
include/linux/rseq_entry.h
··· 5 5 #ifdef CONFIG_RSEQ 6 6 #include <linux/rseq.h> 7 7 8 + #include <linux/tracepoint-defs.h> 9 + 10 + #ifdef CONFIG_TRACEPOINTS 11 + DECLARE_TRACEPOINT(rseq_update); 12 + DECLARE_TRACEPOINT(rseq_ip_fixup); 13 + void __rseq_trace_update(struct task_struct *t); 14 + void __rseq_trace_ip_fixup(unsigned long ip, unsigned long start_ip, 15 + unsigned long offset, unsigned long abort_ip); 16 + 17 + static inline void rseq_trace_update(struct task_struct *t, struct rseq_ids *ids) 18 + { 19 + if (tracepoint_enabled(rseq_update) && ids) 20 + __rseq_trace_update(t); 21 + } 22 + 23 + static inline void rseq_trace_ip_fixup(unsigned long ip, unsigned long start_ip, 24 + unsigned long offset, unsigned long abort_ip) 25 + { 26 + if (tracepoint_enabled(rseq_ip_fixup)) 27 + __rseq_trace_ip_fixup(ip, start_ip, offset, abort_ip); 28 + } 29 + 30 + #else /* CONFIG_TRACEPOINT */ 31 + static inline void rseq_trace_update(struct task_struct *t, struct rseq_ids *ids) { } 32 + static inline void rseq_trace_ip_fixup(unsigned long ip, unsigned long start_ip, 33 + unsigned long offset, unsigned long abort_ip) { } 34 + #endif /* !CONFIG_TRACEPOINT */ 35 + 8 36 static __always_inline void rseq_note_user_irq_entry(void) 9 37 { 10 38 if (IS_ENABLED(CONFIG_GENERIC_IRQ_ENTRY))
+18 -1
kernel/rseq.c
··· 70 70 #include <linux/sched.h> 71 71 #include <linux/uaccess.h> 72 72 #include <linux/syscalls.h> 73 - #include <linux/rseq.h> 73 + #include <linux/rseq_entry.h> 74 74 #include <linux/types.h> 75 75 #include <linux/ratelimit.h> 76 76 #include <asm/ptrace.h> ··· 90 90 #define RSEQ_CS_NO_RESTART_FLAGS (RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT | \ 91 91 RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL | \ 92 92 RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE) 93 + 94 + #ifdef CONFIG_TRACEPOINTS 95 + /* 96 + * Out of line, so the actual update functions can be in a header to be 97 + * inlined into the exit to user code. 98 + */ 99 + void __rseq_trace_update(struct task_struct *t) 100 + { 101 + trace_rseq_update(t); 102 + } 103 + 104 + void __rseq_trace_ip_fixup(unsigned long ip, unsigned long start_ip, 105 + unsigned long offset, unsigned long abort_ip) 106 + { 107 + trace_rseq_ip_fixup(ip, start_ip, offset, abort_ip); 108 + } 109 + #endif /* CONFIG_TRACEPOINTS */ 93 110 94 111 #ifdef CONFIG_DEBUG_RSEQ 95 112 static struct rseq *rseq_kernel_fields(struct task_struct *t)