linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Ingo Molnar <mingo@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	peterz@infradead.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Andrea Righi <righi.andrea@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH -tip v3 09/10] kprobes: Prohibit probing on lockdep functions
Date: Wed, 13 Feb 2019 01:15:05 +0900	[thread overview]
Message-ID: <154998810578.31052.1680977921449292812.stgit@devbox> (raw)
In-Reply-To: <154998785011.31052.1475728497912659748.stgit@devbox>

Some lockdep functions can be involved in breakpoint handling
and probing on those functions can cause a breakpoint recursion.
Prohibit probing on those functions by blacklist.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 kernel/locking/lockdep.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 7f7db23fc002..c1653a1b57b7 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -50,6 +50,7 @@
 #include <linux/random.h>
 #include <linux/jhash.h>
 #include <linux/nmi.h>
+#include <linux/kprobes.h>
 
 #include <asm/sections.h>
 
@@ -2796,6 +2797,7 @@ void lockdep_hardirqs_on(unsigned long ip)
 	__trace_hardirqs_on_caller(ip);
 	current->lockdep_recursion = 0;
 }
+NOKPROBE_SYMBOL(lockdep_hardirqs_on);
 
 /*
  * Hardirqs were disabled:
@@ -2825,6 +2827,7 @@ void lockdep_hardirqs_off(unsigned long ip)
 	} else
 		debug_atomic_inc(redundant_hardirqs_off);
 }
+NOKPROBE_SYMBOL(lockdep_hardirqs_off);
 
 /*
  * Softirqs will be enabled:
@@ -3638,7 +3641,8 @@ __lock_release(struct lockdep_map *lock, int nested, unsigned long ip)
 	return 0;
 }
 
-static int __lock_is_held(const struct lockdep_map *lock, int read)
+static nokprobe_inline
+int __lock_is_held(const struct lockdep_map *lock, int read)
 {
 	struct task_struct *curr = current;
 	int i;
@@ -3871,6 +3875,7 @@ int lock_is_held_type(const struct lockdep_map *lock, int read)
 	return ret;
 }
 EXPORT_SYMBOL_GPL(lock_is_held_type);
+NOKPROBE_SYMBOL(lock_is_held_type);
 
 struct pin_cookie lock_pin_lock(struct lockdep_map *lock)
 {


  parent reply	other threads:[~2019-02-12 16:15 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:perf/core] " tip-bot for Masami Hiramatsu
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 ` Masami Hiramatsu [this message]
2019-02-13  9:03   ` [tip:perf/core] kprobes: Prohibit probing on lockdep functions 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=154998810578.31052.1680977921449292812.stgit@devbox \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=righi.andrea@gmail.com \
    --cc=rostedt@goodmis.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).