diff options
author | Abhishek Sagar <sagar.abhishek@gmail.com> | 2008-06-14 02:29:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-14 02:32:29 -0400 |
commit | a4500b84c51645bbc86be3ca84f2252b7ada060f (patch) | |
tree | 4f11488be2c6a7f89762ce800c77d888d540fb1a /kernel/trace | |
parent | 20764ff1efb440640353053ec83263e69e1259e0 (diff) |
ftrace: fix "notrace" filtering priority
This is a fix to give notrace filter rules priority over "set_ftrace_filter"
rules.
This fix ensures that functions which are set to be filtered and are
concurrently marked as "notrace" don't get recorded. As of now, if
a record is marked as FTRACE_FL_FILTER and is enabled, then the notrace
flag is not checked. Tested on x86-32.
Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ftrace.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 0118979e211f..b532e4a68c74 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -355,20 +355,26 @@ __ftrace_replace_code(struct dyn_ftrace *rec, | |||
355 | * If this record is set not to trace then | 355 | * If this record is set not to trace then |
356 | * do nothing. | 356 | * do nothing. |
357 | * | 357 | * |
358 | * If this record is set not to trace and | ||
359 | * it is enabled then disable it. | ||
360 | * | ||
358 | * If this record is not set to be filtered and | 361 | * If this record is not set to be filtered and |
359 | * it is enabled, disable it. | 362 | * it is enabled, disable it. |
360 | */ | 363 | */ |
361 | fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_ENABLED); | 364 | |
365 | fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_NOTRACE | | ||
366 | FTRACE_FL_ENABLED); | ||
362 | 367 | ||
363 | if ((fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED)) || | 368 | if ((fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED)) || |
364 | (fl == 0) || (rec->flags & FTRACE_FL_NOTRACE)) | 369 | (fl == (FTRACE_FL_FILTER | FTRACE_FL_NOTRACE)) || |
370 | !fl || (fl == FTRACE_FL_NOTRACE)) | ||
365 | return 0; | 371 | return 0; |
366 | 372 | ||
367 | /* | 373 | /* |
368 | * If it is enabled disable it, | 374 | * If it is enabled disable it, |
369 | * otherwise enable it! | 375 | * otherwise enable it! |
370 | */ | 376 | */ |
371 | if (fl == FTRACE_FL_ENABLED) { | 377 | if (fl & FTRACE_FL_ENABLED) { |
372 | /* swap new and old */ | 378 | /* swap new and old */ |
373 | new = old; | 379 | new = old; |
374 | old = ftrace_call_replace(ip, FTRACE_ADDR); | 380 | old = ftrace_call_replace(ip, FTRACE_ADDR); |