[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250729193005.348d7df8206d3e9ac438fd57@kernel.org>
Date: Tue, 29 Jul 2025 19:30:05 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Masami Hiramatsu (Google) <mhiramat@...nel.org>, Steven Rostedt
<rostedt@...dmis.org>, Masami Hiramatsu <mhiramat@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [GIT PULL] probes: Fixes for v6.16
Hi Linus,
Probes fixes for v6.16:
- Fix a potential infinite recursion in fprobe by using preempt_*_notrace().
Please pull the latest probes-fixes-v6.16 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
probes-fixes-v6.16
Tag SHA1: 1d7c77d4dfae320b756b5d0bcd04ecce5a38fbeb
Head SHA1: a3e892ab0fc287389176eabdcd74234508f6e52d
Masami Hiramatsu (Google) (1):
tracing: fprobe: Fix infinite recursion using preempt_*_notrace()
----
kernel/trace/fprobe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---------------------------
commit a3e892ab0fc287389176eabdcd74234508f6e52d
Author: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Date: Tue Jul 29 08:47:03 2025 +0900
tracing: fprobe: Fix infinite recursion using preempt_*_notrace()
Since preempt_count_add/del() are tracable functions, it is not allowed
to use preempt_disable/enable() in ftrace handlers. Without this fix,
probing on `preempt_count_add%return` will cause an infinite recursion
of fprobes.
To fix this problem, use preempt_disable/enable_notrace() in
fprobe_return().
Link: https://lore.kernel.org/all/175374642359.1471729.1054175011228386560.stgit@mhiramat.tok.corp.google.com/
Fixes: 4346ba160409 ("fprobe: Rewrite fprobe on function-graph tracer")
Cc: stable@...r.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index ba7ff14f5339..f9b3aa9afb17 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -352,7 +352,7 @@ static void fprobe_return(struct ftrace_graph_ret *trace,
size_words = SIZE_IN_LONG(size);
ret_ip = ftrace_regs_get_instruction_pointer(fregs);
- preempt_disable();
+ preempt_disable_notrace();
curr = 0;
while (size_words > curr) {
@@ -368,7 +368,7 @@ static void fprobe_return(struct ftrace_graph_ret *trace,
}
curr += size;
}
- preempt_enable();
+ preempt_enable_notrace();
}
NOKPROBE_SYMBOL(fprobe_return);
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists