[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251205100823.28aa8ffd@gandalf.local.home>
Date: Fri, 5 Dec 2025 10:08:23 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: "qingwei.hu" <qingwei.hu@...edance.com>
Cc: naveen@...nel.org, davem@...emloft.net, mhiramat@...nel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH] kprobes: Call check_ftrace_location() on
CONFIG_KPROBES_ON_FTRACE
On Fri, 5 Dec 2025 17:29:33 +0800
"qingwei.hu" <qingwei.hu@...edance.com> wrote:
> From: Qingwei Hu <qingwei.hu@...edance.com>
>
> There is a possible configuration dependency:
>
> KPROBES_ON_FTRACE [=n]
> ^----- KPROBES [=y]
> |--- HAVE_KPROBES_ON_FTRACE [=n]
> |--- DYNAMIC_FTRACE_WITH_REGS [=n]
> ^----- FTRACE [=y]
> |--- DYNAMIC_FTRACE [=y]
> |--- HAVE_DYNAMIC_FTRACE_WITH_REGS [=n]
>
> With DYNAMIC_FTRACE=y, ftrace_location() is meaningful and may
> return the same address as the probe target.
>
> However, when KPROBES_ON_FTRACE=n, the current implementation
> returns -EINVAL after calling check_ftrace_location(), causing
> the validation to fail.
This is a feature not a bug.
The reason is if you put a kprobe on a ftrace location, it can cause ftrace
to trigger a bug, as kprobes will modify the location and ftrace will see
something it doesn't expect and think the system is corrupted. We don't want
that either.
If you say "KPROBES_ON_FTRACE=n" and place a kprobe on a location that is
controlled by ftrace, it had better fail!
NAK
-- Steve
Powered by blists - more mailing lists