mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steve Capper <steve.capper@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: masami.hiramatsu.pt@hitachi.com, will.deacon@arm.com,
	sandeepa.s.prabhu@gmail.com, dave.long@linaro.org,
	catalin.marinas@arm.com, linux@arm.linux.org.uk,
	wcohen@redhat.com, tixy@linaro.org, ananth@in.ibm.com,
	anil.s.keshavamurthy@intel.com, davem@davemloft.net,
	broonie@kernel.org, Steve Capper <steve.capper@linaro.org>
Subject: [PATCH] kprobes: Update examples to target _do_fork
Date: Wed, 12 Aug 2015 17:57:35 +0100	[thread overview]
Message-ID: <1439398655-9357-1-git-send-email-steve.capper@linaro.org> (raw)

In commit 3033f14ab78c ("clone: support passing tls argument via C
rather than pt_regs magic"), the kernel calls _do_fork in places where
it previously called do_fork.

Unfortunately, the kprobe examples target do_fork; thus no events
appear to fire when one runs the example modules.

This commit updates the kprobe example code s.t. _do_fork is targeted
instead, and the examples work as expected.

Signed-off-by: Steve Capper <steve.capper@linaro.org>
---
 samples/kprobes/jprobe_example.c    | 8 ++++----
 samples/kprobes/kprobe_example.c    | 2 +-
 samples/kprobes/kretprobe_example.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/samples/kprobes/jprobe_example.c b/samples/kprobes/jprobe_example.c
index 9119ac6..11dd54b 100644
--- a/samples/kprobes/jprobe_example.c
+++ b/samples/kprobes/jprobe_example.c
@@ -23,9 +23,9 @@
  */
 
 /* Proxy routine having the same arguments as actual do_fork() routine */
-static long jdo_fork(unsigned long clone_flags, unsigned long stack_start,
+static long j_do_fork(unsigned long clone_flags, unsigned long stack_start,
 	      unsigned long stack_size, int __user *parent_tidptr,
-	      int __user *child_tidptr)
+	      int __user *child_tidptr, unsigned long tls)
 {
 	pr_info("jprobe: clone_flags = 0x%lx, stack_start = 0x%lx "
 		"stack_size = 0x%lx\n", clone_flags, stack_start, stack_size);
@@ -36,9 +36,9 @@ static long jdo_fork(unsigned long clone_flags, unsigned long stack_start,
 }
 
 static struct jprobe my_jprobe = {
-	.entry			= jdo_fork,
+	.entry			= j_do_fork,
 	.kp = {
-		.symbol_name	= "do_fork",
+		.symbol_name	= "_do_fork",
 	},
 };
 
diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c
index 51d459c..597e101 100644
--- a/samples/kprobes/kprobe_example.c
+++ b/samples/kprobes/kprobe_example.c
@@ -16,7 +16,7 @@
 
 /* For each probe you need to allocate a kprobe structure */
 static struct kprobe kp = {
-	.symbol_name	= "do_fork",
+	.symbol_name	= "_do_fork",
 };
 
 /* kprobe pre_handler: called just before the probed instruction is executed */
diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c
index 1041b67..a270535 100644
--- a/samples/kprobes/kretprobe_example.c
+++ b/samples/kprobes/kretprobe_example.c
@@ -25,7 +25,7 @@
 #include <linux/limits.h>
 #include <linux/sched.h>
 
-static char func_name[NAME_MAX] = "do_fork";
+static char func_name[NAME_MAX] = "_do_fork";
 module_param_string(func, func_name, NAME_MAX, S_IRUGO);
 MODULE_PARM_DESC(func, "Function to kretprobe; this module will report the"
 			" function's execution time");
-- 
2.1.0


             reply	other threads:[~2015-08-12 16:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 16:57 Steve Capper [this message]
2015-08-12 21:47 ` 平松雅巳 / HIRAMATU,MASAMI

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=1439398655-9357-1-git-send-email-steve.capper@linaro.org \
    --to=steve.capper@linaro.org \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dave.long@linaro.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=sandeepa.s.prabhu@gmail.com \
    --cc=tixy@linaro.org \
    --cc=wcohen@redhat.com \
    --cc=will.deacon@arm.com \
    /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

Powered by JetHome