From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Alexei Starovoitov <ast@kernel.org>, Yonghong Song <yhs@fb.com>,
"Paul E . McKenney" <paulmck@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>,
bpf@vger.kernel.org, Joel Fernandes <joel@joelfernandes.org>,
linux-trace-kernel@vger.kernel.org,
Michael Jeanson <mjeanson@efficios.com>
Subject: Re: [PATCH resend 6/8] tracing/ftrace: Add might_fault check to syscall probes
Date: Mon, 28 Oct 2024 15:02:26 -0400 [thread overview]
Message-ID: <f6caee5c-9d4d-449c-b697-a0a27993bd33@efficios.com> (raw)
In-Reply-To: <87cyjk2kgg.ffs@tglx>
On 2024-10-28 13:42, Thomas Gleixner wrote:
> On Mon, Sep 30 2024 at 15:23, Mathieu Desnoyers wrote:
>> diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
>> index a3d8ac00793e..0430890cbb42 100644
>> --- a/kernel/trace/trace_syscalls.c
>> +++ b/kernel/trace/trace_syscalls.c
>> @@ -303,6 +303,7 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
>> * Syscall probe called with preemption enabled, but the ring
>> * buffer and per-cpu data require preemption to be disabled.
>> */
>> + might_fault();
>> guard(preempt_notrace)();
>
> I find it odd that the might_fault() check is in all the implementations
> and not in the tracepoint itself:
>
> if (syscall) {
> might_fault();
> rcu_read_unlock_trace();
> } else ...
>
> That's where I would have expected it to be.
You raise a good point: we should also add a might_fault() check in
__DO_TRACE() in the syscall case, so we can catch incorrect use of the
syscall tracepoint even if no probes are registered to it.
I've added the might_fault() in each tracer syscall probe to make sure
a tracer don't end up registering a faultable probe on a tracepoint
protected with preempt_disable by mistake. It validates that the tracers
are using the tracepoint registration as expected.
I'll prepare separate a patch adding this and will add it to this
series.
Thanks,
Mathieu
>
> Thanks,
>
> tglx
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2024-10-28 19:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 19:23 [PATCH resend 0/8] tracing: Allow system call tracepoints to handle page faults Mathieu Desnoyers
2024-09-30 19:23 ` [PATCH resend 1/8] tracing: Declare system call tracepoints with TRACE_EVENT_SYSCALL Mathieu Desnoyers
2024-10-03 9:51 ` kernel test robot
2024-10-03 9:51 ` kernel test robot
2024-09-30 19:23 ` [PATCH resend 2/8] tracing/ftrace: guard syscall probe with preempt_notrace Mathieu Desnoyers
2024-09-30 19:23 ` [PATCH resend 3/8] tracing/perf: " Mathieu Desnoyers
2024-09-30 19:23 ` [PATCH resend 4/8] tracing/bpf: " Mathieu Desnoyers
2024-09-30 19:23 ` [PATCH resend 5/8] tracing: Allow system call tracepoints to handle page faults Mathieu Desnoyers
2024-09-30 19:23 ` [PATCH resend 6/8] tracing/ftrace: Add might_fault check to syscall probes Mathieu Desnoyers
2024-10-28 17:42 ` Thomas Gleixner
2024-10-28 19:02 ` Mathieu Desnoyers [this message]
2024-09-30 19:23 ` [PATCH resend 7/8] tracing/perf: " Mathieu Desnoyers
2024-09-30 19:23 ` [PATCH resend 8/8] tracing/bpf: " Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6caee5c-9d4d-449c-b697-a0a27993bd33@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=mjeanson@efficios.com \
--cc=namhyung@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox