Skip to contentSkip to conversation

tracing/kprobes: Fix field creation's bad error handling

GIT PULL Frederic Weisbecker 3 participants 4 messages Dec 8, 2009 – Dec 9, 2009 Tracing

lore
Share & tools
lore
#0 lore raw

Ingo,

Please pull the tracing/fixes branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/fixes

Thanks,
Frederic
---

Frederic Weisbecker (1):
tracing/kprobes: Fix field creation's bad error handling

 kernel/trace/trace_kprobe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

---

Quoted 1 line

From 12e22dfaaee46f70762beb1982a7b86a68317b11 Mon Sep 17 00:00:00 2001

From: Frederic Weisbecker <[email protected]>
Date: Tue, 8 Dec 2009 10:00:04 +0100
Subject: [PATCH] tracing/kprobes: Fix field creation's bad error handling
Cc: Lai Jiangshan <[email protected]>, Steven Rostedt <[email protected]>, Masami Hiramatsu <[email protected]>, Li Zefan <[email protected]>

When we define the common event fields in kprobe, we invert the error handling and return immediately in case of success. Then we omit to define specific kprobes fields (ip and nargs), and specific kretprobes fields (func, ret_ip, nargs). And we only define them when we fail to create common fields.

The most visible consequence is that we can't create filter for k(ret)probes specific fields.

This patch re-invert the success/error handling to fix it.

---
 kernel/trace/trace_kprobe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_kprobe.c +2 -2
index aff5f80..ca04523 100644
@@ -1114,7 +1114,7 @@ static int kprobe_event_define_fields(struct ftrace_event_call *event_call)
 	struct trace_probe *tp = (struct trace_probe *)event_call->data;
 
 	ret = trace_define_common_fields(event_call);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	DEFINE_FIELD(unsigned long, ip, FIELD_STRING_IP, 0);
@@ -1132,7 +1132,7 @@ static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
 	struct trace_probe *tp = (struct trace_probe *)event_call->data;
 
 	ret = trace_define_common_fields(event_call);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	DEFINE_FIELD(unsigned long, func, FIELD_STRING_FUNC, 0);
Signature · 1 line
1.6.2.3
#1 lore raw
Quoted 34 lines · Frederic Weisbecker

Ingo,

Please pull the tracing/fixes branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/fixes

Thanks,
Frederic
---

Frederic Weisbecker (1):
tracing/kprobes: Fix field creation's bad error handling

 kernel/trace/trace_kprobe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

---
From 12e22dfaaee46f70762beb1982a7b86a68317b11 Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <[email protected]>
Date: Tue, 8 Dec 2009 10:00:04 +0100
Subject: [PATCH] tracing/kprobes: Fix field creation's bad error handling
Cc: Lai Jiangshan <[email protected]>, Steven Rostedt <[email protected]>, Masami Hiramatsu <[email protected]>, Li Zefan <[email protected]>

When we define the common event fields in kprobe, we invert the error handling and return immediately in case of success. Then we omit to define specific kprobes fields (ip and nargs), and specific kretprobes fields (func, ret_ip, nargs). And we only define them when we fail to create common fields.

The most visible consequence is that we can't create filter for k(ret)probes specific fields.

Quoted 7 lines

This patch re-invert the success/error handling to fix it.

Thanks for fix that.

Ingo, I think this should go to tip:urgent.

Thank you,

Quoted 26 lines
---
 kernel/trace/trace_kprobe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_kprobe.c +2 -2
index aff5f80..ca04523 100644
@@ -1114,7 +1114,7 @@ static int kprobe_event_define_fields(struct ftrace_event_call *event_call)
 	struct trace_probe *tp = (struct trace_probe *)event_call->data;
 
 	ret = trace_define_common_fields(event_call);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	DEFINE_FIELD(unsigned long, ip, FIELD_STRING_IP, 0);
@@ -1132,7 +1132,7 @@ static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
 	struct trace_probe *tp = (struct trace_probe *)event_call->data;
 
 	ret = trace_define_common_fields(event_call);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	DEFINE_FIELD(unsigned long, func, FIELD_STRING_FUNC, 0);
Signature · 7 lines
Masami Hiramatsu

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

e-mail: [email protected]
#2 lore raw
Quoted 43 lines · Masami Hiramatsu
Quoted 34 lines · Frederic Weisbecker

Ingo,

Please pull the tracing/fixes branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/fixes

Thanks,
Frederic
---

Frederic Weisbecker (1):
tracing/kprobes: Fix field creation's bad error handling

 kernel/trace/trace_kprobe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

---
From 12e22dfaaee46f70762beb1982a7b86a68317b11 Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <[email protected]>
Date: Tue, 8 Dec 2009 10:00:04 +0100
Subject: [PATCH] tracing/kprobes: Fix field creation's bad error handling
Cc: Lai Jiangshan <[email protected]>, Steven Rostedt <[email protected]>, Masami Hiramatsu <[email protected]>, Li Zefan <[email protected]>

When we define the common event fields in kprobe, we invert the error handling and return immediately in case of success. Then we omit to define specific kprobes fields (ip and nargs), and specific kretprobes fields (func, ret_ip, nargs). And we only define them when we fail to create common fields.

The most visible consequence is that we can't create filter for k(ret)probes specific fields.

Quoted 7 lines

This patch re-invert the success/error handling to fix it.

Quoted 6 lines

Thanks for fix that.

Ingo, I think this should go to tip:urgent.

Will apply, thanks guys!

Ingo

#3 lore raw
In reply to Frederic Weisbecker
Commit-ID:  822a6961112f0c9101d3359d8524604c3309ee6c
Gitweb:     http://git.kernel.org/tip/822a6961112f0c9101d3359d8524604c3309ee6c
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Tue, 8 Dec 2009 10:00:04 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 9 Dec 2009 10:32:21 +0100

tracing/kprobes: Fix field creation's bad error handling

When we define the common event fields in kprobe, we invert the error handling and return immediately in case of success. Then we omit to define specific kprobes fields (ip and nargs), and specific kretprobes fields (func, ret_ip, nargs). And we only define them when we fail to create common fields.

The most visible consequence is that we can't create filter for k(ret)probes specific fields.

This patch re-invert the success/error handling to fix it.

LKML-Reference: <[email protected]>

---
 kernel/trace/trace_kprobe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_kprobe.c +2 -2
index bf05fb4..b52d397 100644
@@ -1133,7 +1133,7 @@ static int kprobe_event_define_fields(struct ftrace_event_call *event_call)
 	struct trace_probe *tp = (struct trace_probe *)event_call->data;
 
 	ret = trace_define_common_fields(event_call);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	DEFINE_FIELD(unsigned long, ip, FIELD_STRING_IP, 0);
@@ -1151,7 +1151,7 @@ static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
 	struct trace_probe *tp = (struct trace_probe *)event_call->data;
 
 	ret = trace_define_common_fields(event_call);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	DEFINE_FIELD(unsigned long, func, FIELD_STRING_FUNC, 0);