mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [GIT PULL] probes: Fixes for v6.16
Date: Tue, 29 Jul 2025 19:30:05 +0900	[thread overview]
Message-ID: <20250729193005.348d7df8206d3e9ac438fd57@kernel.org> (raw)

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@kernel.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@vger.kernel.org
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.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@kernel.org>

             reply	other threads:[~2025-07-29 10:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 10:30 Masami Hiramatsu [this message]
2025-07-31  0:35 ` pr-tracker-bot
  -- strict thread matches above, loose matches on Subject: below --
2025-07-16  6:22 [GIT PULL] probes: fixes " Masami Hiramatsu
2025-07-17  0:12 ` pr-tracker-bot

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=20250729193005.348d7df8206d3e9ac438fd57@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®