Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1642740

[PATCH] kprobes: Document how optimized kprobes are removed from module unload

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject [PATCH] kprobes: Document how optimized kprobes are removed from module unload
Date Tue, 16 May 2017 21:00:01 +0200
Message-ID <tHPRn-M2-7@gated-at.bofh.it> (permalink)
X-Original-To Masami Hiramatsu <mhiramat@kernel.org>
Dmarc-Filter OpenDMARC Filter v1.3.2 mail.kernel.org 991FD23984
Authentication-Results mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org
Authentication-Results mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org
X-Mailer Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu)
MIME-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 34
Organization linux.* mail to news gateway
X-Original-Cc LKML <linux-kernel@vger.kernel.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>
X-Original-Date Tue, 16 May 2017 14:58:35 -0400
X-Original-Message-ID <20170516145835.3827d3aa@gandalf.local.home>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1642740

Show key headers only | View raw


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.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 7367e0e..ac386f6 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);
 			}

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] kprobes: Document how optimized kprobes are removed from  module unload Steven Rostedt <rostedt@goodmis.org> - 2017-05-16 21:00 +0200
  Re: [PATCH] kprobes: Document how optimized kprobes are removed  from module unload Masami Hiramatsu <mhiramat@kernel.org> - 2017-05-17 03:50 +0200
    Re: [PATCH] kprobes: Document how optimized kprobes are removed  from module unload Steven Rostedt <rostedt@goodmis.org> - 2017-05-17 04:50 +0200
      Re: [PATCH] kprobes: Document how optimized kprobes are removed  from module unload Masami Hiramatsu <mhiramat@kernel.org> - 2017-05-17 06:10 +0200

csiph-web