Skip to contentSkip to conversation

tracing/kprobes: fix probe parsing

PATCH In review Heiko Carstens 2 participants 3 messages Feb 10, 2010 – Feb 14, 2010 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing/kprobes: fix probe parsing

From: Heiko Carstens <[email protected]>

Trying to add a probe like

echo p:myprobe 0x10000 > /sys/kernel/debug/tracing/kprobe_events

will fail since the wrong pointer is passed to strict_strtoul when trying to convert the address to an unsigned long.

---
 kernel/trace/trace_kprobe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_kprobe.c +1 -1
@@ -689,7 +689,7 @@ static int create_trace_probe(int argc, 
 			return -EINVAL;
 		}
 		/* an address specified */
-		ret = strict_strtoul(&argv[0][2], 0, (unsigned long *)&addr);
+		ret = strict_strtoul(&argv[1][0], 0, (unsigned long *)&addr);
 		if (ret) {
 			pr_info("Failed to parse address.\n");
 			return ret;
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Heiko Carstens

From: Heiko Carstens <[email protected]>

Trying to add a probe like

echo p:myprobe 0x10000 > /sys/kernel/debug/tracing/kprobe_events

will fail since the wrong pointer is passed to strict_strtoul when trying to convert the address to an unsigned long.

Right, it's a bug! Thank you!

Quoted 2 lines
Quoted 15 lines
---
 kernel/trace/trace_kprobe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_kprobe.c +1 -1
@@ -689,7 +689,7 @@ static int create_trace_probe(int argc, 
 			return -EINVAL;
 		}
 		/* an address specified */
-		ret = strict_strtoul(&argv[0][2], 0, (unsigned long *)&addr);
+		ret = strict_strtoul(&argv[1][0], 0, (unsigned long *)&addr);
 		if (ret) {
 			pr_info("Failed to parse address.\n");
 			return ret;
Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
#2 lore raw

[tip:tracing/urgent] tracing/kprobes: Fix probe parsing

In reply to Heiko Carstens
Commit-ID:  a9bb18f36c8056f0712fb28c52c0f85d98438dfb
Gitweb:     http://git.kernel.org/tip/a9bb18f36c8056f0712fb28c52c0f85d98438dfb
Author:     Heiko Carstens <[email protected]>
AuthorDate: Wed, 10 Feb 2010 17:23:47 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 14 Feb 2010 09:43:58 +0100

tracing/kprobes: Fix probe parsing

Trying to add a probe like:

echo p:myprobe 0x10000 > /sys/kernel/debug/tracing/kprobe_events

will fail since the wrong pointer is passed to strict_strtoul when trying to convert the address to an unsigned long.

LKML-Reference: <[email protected]>

---
 kernel/trace/trace_kprobe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/trace_kprobe.c +1 -1
index 6ea90c0..50b1b82 100644
@@ -689,7 +689,7 @@ static int create_trace_probe(int argc, char **argv)
 			return -EINVAL;
 		}
 		/* an address specified */
-		ret = strict_strtoul(&argv[0][2], 0, (unsigned long *)&addr);
+		ret = strict_strtoul(&argv[1][0], 0, (unsigned long *)&addr);
 		if (ret) {
 			pr_info("Failed to parse address.\n");
 			return ret;