diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-02-02 16:49:11 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-02-04 03:36:19 -0500 |
commit | 2cfa19780d61740f65790c5bae363b759d7c96fa (patch) | |
tree | cc7a8277a9f04c1bd613efe03c7d6d16cd18dc96 /kernel/trace | |
parent | 615d0ebbc782b67296e3226c293f520f93f93515 (diff) |
ftrace/alternatives: Introducing *_text_reserved functions
Introducing *_text_reserved functions for checking the text
address range is partially reserved or not. This patch provides
checking routines for x86 smp alternatives and dynamic ftrace.
Since both functions modify fixed pieces of kernel text, they
should reserve and protect those from other dynamic text
modifier, like kprobes.
This will also be extended when introducing other subsystems
which modify fixed pieces of kernel text. Dynamic text modifiers
should avoid those.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: przemyslaw@pawelczyk.it
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
Cc: Jason Baron <jbaron@redhat.com>
LKML-Reference: <20100202214911.4694.16587.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ftrace.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 1e6640f80454..3d90661a5f40 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1025,6 +1025,21 @@ static void ftrace_bug(int failed, unsigned long ip) | |||
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | 1027 | ||
1028 | /* Return 1 if the address range is reserved for ftrace */ | ||
1029 | int ftrace_text_reserved(void *start, void *end) | ||
1030 | { | ||
1031 | struct dyn_ftrace *rec; | ||
1032 | struct ftrace_page *pg; | ||
1033 | |||
1034 | do_for_each_ftrace_rec(pg, rec) { | ||
1035 | if (rec->ip <= (unsigned long)end && | ||
1036 | rec->ip + MCOUNT_INSN_SIZE > (unsigned long)start) | ||
1037 | return 1; | ||
1038 | } while_for_each_ftrace_rec(); | ||
1039 | return 0; | ||
1040 | } | ||
1041 | |||
1042 | |||
1028 | static int | 1043 | static int |
1029 | __ftrace_replace_code(struct dyn_ftrace *rec, int enable) | 1044 | __ftrace_replace_code(struct dyn_ftrace *rec, int enable) |
1030 | { | 1045 | { |