Make sure filters for string fields don't use integer values and vice
versa. Getting it wrong can crash the system or produce bogus
results.
Signed-off-by: Tom Zanussi <[email protected]>
---
kernel/trace/trace_events_filter.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 9fca8bb..026be41 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -237,9 +237,14 @@ int filter_add_pred(struct ftrace_event_call *call, struct filter_pred *pred)
pred->offset = field->offset;
if (is_string_field(field->type)) {
+ if (!pred->str_val)
+ return -EINVAL;
pred->fn = filter_pred_string;
pred->str_len = field->size;
return __filter_add_pred(call, pred);
+ } else {
+ if (pred->str_val)
+ return -EINVAL;
}
switch (field->size) {
--
1.5.6.3
Commit-ID: 9f58a159d022c8f2533a27708aa267adf4f0e3ce
Gitweb: http://git.kernel.org/tip/9f58a159d022c8f2533a27708aa267adf4f0e3ce
Author: Tom Zanussi <[email protected]>
AuthorDate: Tue, 24 Mar 2009 02:14:42 -0500
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 24 Mar 2009 08:26:52 +0100
tracing/filters: disallow integer values for string filters and vice versa
Impact: fix filter use boundary condition / crash
Make sure filters for string fields don't use integer values and vice
versa. Getting it wrong can crash the system or produce bogus
results.
Signed-off-by: Tom Zanussi <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: =?ISO-8859-1?Q?Fr=E9d=E9ric?= Weisbecker <[email protected]>
LKML-Reference: <1237878882.8339.61.camel@charm-linux>
Signed-off-by: Ingo Molnar <[email protected]>
---
kernel/trace/trace_events_filter.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 9fca8bb..026be41 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -237,9 +237,14 @@ int filter_add_pred(struct ftrace_event_call *call, struct filter_pred *pred)
pred->offset = field->offset;
if (is_string_field(field->type)) {
+ if (!pred->str_val)
+ return -EINVAL;
pred->fn = filter_pred_string;
pred->str_len = field->size;
return __filter_add_pred(call, pred);
+ } else {
+ if (pred->str_val)
+ return -EINVAL;
}
switch (field->size) {
Commit-ID: 9a8118baaeb0eaa148913bed77bf9c6335f6ca63
Gitweb: http://git.kernel.org/tip/9a8118baaeb0eaa148913bed77bf9c6335f6ca63
Author: Tom Zanussi <[email protected]>
AuthorDate: Thu, 26 Mar 2009 01:24:34 -0500
Committer: Ingo Molnar <[email protected]>
CommitDate: Thu, 26 Mar 2009 09:13:14 +0100
tracing: filter fix for TRACE_EVENT_FORMAT events
Impact: fix crash (hang) when using TRACE_EVENT_FORMAT filter files
filters are only hooked up to the tracepoint events defined using
TRACE_EVENT but not the tracers that use TRACE_EVENT_FORMAT, such
as ftrace.
Do not display the filter files at all for TRACE_EVENT_FORMAT events
for the time being.
Cc: Steven Rostedt <[email protected]>
Cc: =?ISO-8859-1?Q?Fr=E9d=E9ric?= Weisbecker <[email protected]>
LKML-Reference: <1237878882.8339.61.camel@charm-linux>
Signed-off-by: Ingo Molnar <[email protected]>
---
kernel/trace/trace_events.c | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index d132997..64ec4d2 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -680,7 +680,6 @@ static struct dentry *
event_subsystem_dir(const char *name, struct dentry *d_events)
{
struct event_subsystem *system;
- struct dentry *entry;
/* First see if we did not already create this dir */
list_for_each_entry(system, &event_subsystems, list) {
@@ -709,12 +708,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
system->preds = NULL;
- entry = debugfs_create_file("filter", 0644, system->entry, system,
- &ftrace_subsystem_filter_fops);
- if (!entry)
- pr_warning("Could not create debugfs "
- "'%s/filter' entry\n", name);
-
return system->entry;
}
@@ -770,14 +763,13 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
" events/%s\n", call->name);
return ret;
}
+ entry = debugfs_create_file("filter", 0644, call->dir, call,
+ &ftrace_event_filter_fops);
+ if (!entry)
+ pr_warning("Could not create debugfs "
+ "'%s/filter' entry\n", call->name);
}
- entry = debugfs_create_file("filter", 0644, call->dir, call,
- &ftrace_event_filter_fops);
- if (!entry)
- pr_warning("Could not create debugfs "
- "'%s/filter' entry\n", call->name);
-
/* A trace may not want to export its format */
if (!call->show_format)
return 0;