* [PATCH] kprobes: Update examples to target _do_fork
@ 2015-08-12 16:57 Steve Capper
2015-08-12 21:47 ` 平松雅巳 / HIRAMATU,MASAMI
0 siblings, 1 reply; 2+ messages in thread
From: Steve Capper @ 2015-08-12 16:57 UTC (permalink / raw)
To: linux-kernel
Cc: masami.hiramatsu.pt, will.deacon, sandeepa.s.prabhu, dave.long,
catalin.marinas, linux, wcohen, tixy, ananth,
anil.s.keshavamurthy, davem, broonie, Steve Capper
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] kprobes: Update examples to target _do_fork
2015-08-12 16:57 [PATCH] kprobes: Update examples to target _do_fork Steve Capper
@ 2015-08-12 21:47 ` 平松雅巳 / HIRAMATU,MASAMI
0 siblings, 0 replies; 2+ messages in thread
From: 平松雅巳 / HIRAMATU,MASAMI @ 2015-08-12 21:47 UTC (permalink / raw)
To: 'Steve Capper', linux-kernel
Cc: will.deacon, sandeepa.s.prabhu, dave.long, catalin.marinas,
linux, wcohen, tixy, ananth, anil.s.keshavamurthy, davem,
broonie
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3133 bytes --]
> From: Steve Capper [mailto:steve.capper@linaro.org]
>
> 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.
Oops, right! I've found it on ftrace-test, but missed on kprobes examples :(
>
> Signed-off-by: Steve Capper <steve.capper@linaro.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Thank you!
> ---
> 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
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-12 21:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-12 16:57 [PATCH] kprobes: Update examples to target _do_fork Steve Capper
2015-08-12 21:47 ` 平松雅巳 / HIRAMATU,MASAMI
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