Catch incorrect use of syscall tracepoints even if no probes are registered by adding a might_fault() check in trace_##name() emitted by __DECLARE_TRACE_SYSCALL.
Suggested-by: Thomas Gleixner <t...@linutronix.de> Tested-by: Jordan Rife <jr...@google.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Michael Jeanson <mjean...@efficios.com> Cc: Steven Rostedt <rost...@goodmis.org> Cc: Masami Hiramatsu <mhira...@kernel.org> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Alexei Starovoitov <a...@kernel.org> Cc: Yonghong Song <y...@fb.com> Cc: Paul E. McKenney <paul...@kernel.org> Cc: Ingo Molnar <mi...@redhat.com> Cc: Arnaldo Carvalho de Melo <a...@kernel.org> Cc: Mark Rutland <mark.rutl...@arm.com> Cc: Alexander Shishkin <alexander.shish...@linux.intel.com> Cc: Namhyung Kim <namhy...@kernel.org> Cc: Andrii Nakryiko <andrii.nakry...@gmail.com> Cc: b...@vger.kernel.org Cc: Joel Fernandes <j...@joelfernandes.org> Cc: Jordan Rife <jr...@google.com> Cc: linux-trace-kernel@vger.kernel.org --- Changes since v4: - Move might_fault() to trace_##name() emitted by __DECLARE_TRACE_SYSCALL so it is validated even when the tracepoint is disabled. --- include/linux/tracepoint.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 906f3091d23d..425123e921ac 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -301,6 +301,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) __DECLARE_TRACE_COMMON(name, PARAMS(proto), PARAMS(args), cond, PARAMS(data_proto)) \ static inline void trace_##name(proto) \ { \ + might_fault(); \ if (static_branch_unlikely(&__tracepoint_##name.key)) \ __DO_TRACE(name, \ TP_ARGS(args), \ -- 2.39.5