From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: [for-next][PATCH 8/8] kprobes: Document how optimized kprobes are removed from module unload
Date: Thu, 18 May 2017 20:43:21 -0400 [thread overview]
Message-ID: <20170519004413.421034231@goodmis.org> (raw)
In-Reply-To: 20170519004313.407366856@goodmis.org
[-- Attachment #1: 0008-kprobes-Document-how-optimized-kprobes-are-removed-f.patch --]
[-- Type: text/plain, Size: 1652 bytes --]
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Thomas discovered a bug where the kprobe trace tests had a race
condition where the kprobe_optimizer called from a delayed work queue
that does the optimizing and "unoptimizing" of a kprobe, can try to
modify the text after it has been freed by the init code.
The kprobe trace selftest is a special case, and Thomas and myself
investigated to see if there's a chance that this could also be a bug
with module unloading, as the code is not obvious to how it handles
this. After adding lots of printks, I figured it out. Thomas suggested
that this should be commented so that others will not have to go
through this exercise again.
Link: http://lkml.kernel.org/r/20170516145835.3827d3aa@gandalf.local.home
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
kernel/kprobes.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 199243bba554..2d2d3a568e4e 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2183,6 +2183,12 @@ static int kprobes_module_callback(struct notifier_block *nb,
* The vaddr this probe is installed will soon
* be vfreed buy not synced to disk. Hence,
* disarming the breakpoint isn't needed.
+ *
+ * Note, this will also move any optimized probes
+ * that are pending to be removed from their
+ * corresponding lists to the freeing_list and
+ * will not be touched by the delayed
+ * kprobe_optimizer work handler.
*/
kill_kprobe(p);
}
--
2.10.2
prev parent reply other threads:[~2017-05-19 0:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 0:43 [for-next][PATCH 0/8] tracing/ftrace: Updates for 4.12-rc1 Steven Rostedt
2017-05-19 0:43 ` [for-next][PATCH 1/8] tracing: Move postpone selftests to core from early_initcall Steven Rostedt
2017-05-19 0:43 ` [for-next][PATCH 2/8] tracing/kprobes: Enforce kprobes teardown after testing Steven Rostedt
2017-05-19 0:43 ` [for-next][PATCH 3/8] ftrace: Simplify glob handling in unregister_ftrace_function_probe_func() Steven Rostedt
2017-05-19 0:43 ` [for-next][PATCH 4/8] ftrace/instances: Clear function triggers when removing instances Steven Rostedt
2017-05-19 0:43 ` [for-next][PATCH 5/8] ftrace: Remove #ifdef from code and add clear_ftrace_function_probes() stub Steven Rostedt
2017-05-19 0:43 ` [for-next][PATCH 6/8] selftests/ftrace: Fix bashisms Steven Rostedt
2017-05-19 0:43 ` [for-next][PATCH 7/8] selftests/ftrace: Add test to remove instance with active event triggers Steven Rostedt
2017-05-19 0:43 ` Steven Rostedt [this message]
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=20170519004413.421034231@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.