Skip to contentSkip to conversation

fprobes: Add a comment why fprobe_kprobe_handler exits if kprobe is running

PATCH In review Masami Hiramatsu (Google) 2 participants 2 messages Jul 7, 2023 Tracing

lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

PATCH 1/1 fprobes: Add a comment why fprobe_kprobe_handler exits if kprobe is running

From: Masami Hiramatsu (Google) <[email protected]>

Add a comment the reason why fprobe_kprobe_handler() exits if any other kprobe is running.

---
 kernel/trace/fprobe.c |    6 ++++++
 1 file changed, 6 insertions(+)
kernel/trace/fprobe.c +6 -0
index 75517667b54f..133b31f44945 100644
@@ -100,6 +100,12 @@ static void fprobe_kprobe_handler(unsigned long ip, unsigned long parent_ip,
 		return;
 	}
 
+	/*
+	 * This user handler is shared with other kprobes and is not expected to be
+	 * called recursively. So if any other kprobe handler is running, this will
+	 * exit as kprobe does. See the section 'Share the callbacks with kprobes'
+	 * in Documentation/trace/fprobe.rst for more information.
+	 */
 	if (unlikely(kprobe_running())) {
 		fp->nmissed++;
 		return;
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Sat, 8 Jul 2023 01:38:03 +0900 "Masami Hiramatsu (Google)"…

From: Masami Hiramatsu (Google) <[email protected]>

Add a comment the reason why fprobe_kprobe_handler() exits if any other kprobe is running.

-- Steve

Quoted 21 lines
---
 kernel/trace/fprobe.c |    6 ++++++
 1 file changed, 6 insertions(+)
kernel/trace/fprobe.c +6 -0
index 75517667b54f..133b31f44945 100644
@@ -100,6 +100,12 @@ static void fprobe_kprobe_handler(unsigned long ip, unsigned long parent_ip,
 		return;
 	}
 
+	/*
+	 * This user handler is shared with other kprobes and is not expected to be
+	 * called recursively. So if any other kprobe handler is running, this will
+	 * exit as kprobe does. See the section 'Share the callbacks with kprobes'
+	 * in Documentation/trace/fprobe.rst for more information.
+	 */
 	if (unlikely(kprobe_running())) {
 		fp->nmissed++;
 		return;