linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: alexander.shishkin@linux.intel.com, peterz@infradead.org,
	hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org,
	jolsa@redhat.com, torvalds@linux-foundation.org, acme@redhat.com,
	righi.andrea@gmail.com, rostedt@goodmis.org, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org
Subject: [tip:perf/core] kprobes: Prohibit probing on hardirq tracers
Date: Wed, 13 Feb 2019 01:02:00 -0800	[thread overview]
Message-ID: <tip-eeeb080bae906a57b6513d37efe3c38f2cb87a1c@git.kernel.org> (raw)
In-Reply-To: <154998802073.31052.17255044712514564153.stgit@devbox>

Commit-ID:  eeeb080bae906a57b6513d37efe3c38f2cb87a1c
Gitweb:     https://git.kernel.org/tip/eeeb080bae906a57b6513d37efe3c38f2cb87a1c
Author:     Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate: Wed, 13 Feb 2019 01:13:40 +0900
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Feb 2019 08:16:40 +0100

kprobes: Prohibit probing on hardirq tracers

Since kprobes breakpoint handling involves hardirq tracer,
probing these functions cause breakpoint recursion problem.

Prohibit probing on those functions.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrea Righi <righi.andrea@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/154998802073.31052.17255044712514564153.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/trace/trace_irqsoff.c    | 9 +++++++--
 kernel/trace/trace_preemptirq.c | 5 +++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index d3294721f119..d42a473b8240 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -14,6 +14,7 @@
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/ftrace.h>
+#include <linux/kprobes.h>
 
 #include "trace.h"
 
@@ -365,7 +366,7 @@ out:
 	__trace_function(tr, CALLER_ADDR0, parent_ip, flags, pc);
 }
 
-static inline void
+static nokprobe_inline void
 start_critical_timing(unsigned long ip, unsigned long parent_ip, int pc)
 {
 	int cpu;
@@ -401,7 +402,7 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip, int pc)
 	atomic_dec(&data->disabled);
 }
 
-static inline void
+static nokprobe_inline void
 stop_critical_timing(unsigned long ip, unsigned long parent_ip, int pc)
 {
 	int cpu;
@@ -443,6 +444,7 @@ void start_critical_timings(void)
 		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1, pc);
 }
 EXPORT_SYMBOL_GPL(start_critical_timings);
+NOKPROBE_SYMBOL(start_critical_timings);
 
 void stop_critical_timings(void)
 {
@@ -452,6 +454,7 @@ void stop_critical_timings(void)
 		stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1, pc);
 }
 EXPORT_SYMBOL_GPL(stop_critical_timings);
+NOKPROBE_SYMBOL(stop_critical_timings);
 
 #ifdef CONFIG_FUNCTION_TRACER
 static bool function_enabled;
@@ -611,6 +614,7 @@ void tracer_hardirqs_on(unsigned long a0, unsigned long a1)
 	if (!preempt_trace(pc) && irq_trace())
 		stop_critical_timing(a0, a1, pc);
 }
+NOKPROBE_SYMBOL(tracer_hardirqs_on);
 
 void tracer_hardirqs_off(unsigned long a0, unsigned long a1)
 {
@@ -619,6 +623,7 @@ void tracer_hardirqs_off(unsigned long a0, unsigned long a1)
 	if (!preempt_trace(pc) && irq_trace())
 		start_critical_timing(a0, a1, pc);
 }
+NOKPROBE_SYMBOL(tracer_hardirqs_off);
 
 static int irqsoff_tracer_init(struct trace_array *tr)
 {
diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c
index 71f553cceb3c..4d8e99fdbbbe 100644
--- a/kernel/trace/trace_preemptirq.c
+++ b/kernel/trace/trace_preemptirq.c
@@ -9,6 +9,7 @@
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/ftrace.h>
+#include <linux/kprobes.h>
 #include "trace.h"
 
 #define CREATE_TRACE_POINTS
@@ -30,6 +31,7 @@ void trace_hardirqs_on(void)
 	lockdep_hardirqs_on(CALLER_ADDR0);
 }
 EXPORT_SYMBOL(trace_hardirqs_on);
+NOKPROBE_SYMBOL(trace_hardirqs_on);
 
 void trace_hardirqs_off(void)
 {
@@ -43,6 +45,7 @@ void trace_hardirqs_off(void)
 	lockdep_hardirqs_off(CALLER_ADDR0);
 }
 EXPORT_SYMBOL(trace_hardirqs_off);
+NOKPROBE_SYMBOL(trace_hardirqs_off);
 
 __visible void trace_hardirqs_on_caller(unsigned long caller_addr)
 {
@@ -56,6 +59,7 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr)
 	lockdep_hardirqs_on(CALLER_ADDR0);
 }
 EXPORT_SYMBOL(trace_hardirqs_on_caller);
+NOKPROBE_SYMBOL(trace_hardirqs_on_caller);
 
 __visible void trace_hardirqs_off_caller(unsigned long caller_addr)
 {
@@ -69,6 +73,7 @@ __visible void trace_hardirqs_off_caller(unsigned long caller_addr)
 	lockdep_hardirqs_off(CALLER_ADDR0);
 }
 EXPORT_SYMBOL(trace_hardirqs_off_caller);
+NOKPROBE_SYMBOL(trace_hardirqs_off_caller);
 #endif /* CONFIG_TRACE_IRQFLAGS */
 
 #ifdef CONFIG_TRACE_PREEMPT_TOGGLE

  reply	other threads:[~2019-02-13  9:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 16:10 [PATCH -tip v3 00/10] kprobes: Fix and improve blacklist symbols Masami Hiramatsu
2019-02-12 16:11 ` [PATCH -tip v3 01/10] x86/kprobes: Prohibit probing on optprobe template code Masami Hiramatsu
2019-02-13  8:58   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2019-02-12 16:11 ` [PATCH -tip v3 02/10] x86/kprobes: Move trampoline code into RODATA Masami Hiramatsu
2019-02-13  8:59   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2019-02-12 16:12 ` [PATCH -tip v3 03/10] x86/kprobes: Prohibit probing on functions before kprobe_int3_handler() Masami Hiramatsu
2019-02-13  9:00   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2019-02-12 16:12 ` [PATCH -tip v3 04/10] x86/kprobes: Prohibit probing on IRQ handlers directly Masami Hiramatsu
2019-02-13  9:00   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2019-03-25 21:23   ` [PATCH -tip v3 04/10] " Steven Rostedt
2019-03-26 14:50     ` Masami Hiramatsu
2019-03-26 15:17       ` Andrea Righi
2019-02-12 16:13 ` [PATCH -tip v3 05/10] kprobes: Search non-suffixed symbol in blacklist Masami Hiramatsu
2019-02-13  7:13   ` Ingo Molnar
2019-02-13  7:17     ` Ingo Molnar
2019-02-13 13:43       ` Steven Rostedt
2019-02-13 23:44       ` Masami Hiramatsu
2019-02-13  9:01   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2019-02-12 16:13 ` [PATCH -tip v3 06/10] kprobes: Prohibit probing on hardirq tracers Masami Hiramatsu
2019-02-13  9:02   ` tip-bot for Masami Hiramatsu [this message]
2019-02-12 16:14 ` [PATCH -tip v3 07/10] kprobes: Prohibit probing on preempt_check debug functions Masami Hiramatsu
2019-02-13  9:02   ` [tip:perf/core] kprobes: Prohibit probing on preemption checking " tip-bot for Masami Hiramatsu
2019-02-12 16:14 ` [PATCH -tip v3 08/10] kprobes: Prohibit probing on RCU debug routine Masami Hiramatsu
2019-02-13  9:03   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2019-02-12 16:15 ` [PATCH -tip v3 09/10] kprobes: Prohibit probing on lockdep functions Masami Hiramatsu
2019-02-13  9:03   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2019-02-12 16:15 ` [PATCH -tip v3 10/10] kprobes: Prohibit probing on bsearch() Masami Hiramatsu
2019-02-13  9:04   ` [tip:perf/core] " tip-bot for Andrea Righi

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=tip-eeeb080bae906a57b6513d37efe3c38f2cb87a1c@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=righi.andrea@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).