diff options
author | Rusty Lynch <rusty.lynch@intel.com> | 2005-06-27 18:17:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-27 18:23:53 -0400 |
commit | 97f7943d70ff0e1e92ea627c44cfacfdae65dbc4 (patch) | |
tree | e2a042a3bb5014ee98551bd5d42dc3b21a42e1ec /arch/ppc64/kernel/process.c | |
parent | 9508dbfe39112813612085c00d55bacd398eddc6 (diff) |
[PATCH] Return probe redesign: ppc64 specific implementation
The following is a patch provided by Ananth Mavinakayanahalli that implements
the new PPC64 specific parts of the new function return probe design.
NOTE: Since getting Ananth's patch, I changed trampoline_probe_handler()
to consume each of the outstanding return probem instances (feedback
on my original RFC after Ananth cut a patch), and also added the
arch_init() function (adding arch specific initialization.) I have
cross compiled but have not testing this on a PPC64 machine.
Changes include:
* Addition of kretprobe_trampoline to act as a dummy function for instrumented
functions to return to, and for the return probe infrastructure to place
a kprobe on on, gaining control so that the return probe handler
can be called, and so that the instruction pointer can be moved back
to the original return address.
* Addition of arch_init(), allowing a kprobe to be registered on
kretprobe_trampoline
* Addition of trampoline_probe_handler() which is used as the pre_handler
for the kprobe inserted on kretprobe_implementation. This is the function
that handles the details for calling the return probe handler function
and returning control back at the original return address
* Addition of arch_prepare_kretprobe() which is setup as the pre_handler
for a kprobe registered at the beginning of the target function by
kernel/kprobes.c so that a return probe instance can be setup when
a caller enters the target function. (A return probe instance contains
all the needed information for trampoline_probe_handler to do it's job.)
* Hooks added to the exit path of a task so that we can cleanup any left-over
return probe instances (i.e. if a task dies while inside a targeted function
then the return probe instance was reserved at the beginning of the function
but the function never returns so we need to mark the instance as unused.)
Signed-off-by: Rusty Lynch <rusty.lynch@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc64/kernel/process.c')
-rw-r--r-- | arch/ppc64/kernel/process.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c index aba89554d89d..f7cae05e40fb 100644 --- a/arch/ppc64/kernel/process.c +++ b/arch/ppc64/kernel/process.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/kallsyms.h> | 36 | #include <linux/kallsyms.h> |
37 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
38 | #include <linux/utsname.h> | 38 | #include <linux/utsname.h> |
39 | #include <linux/kprobes.h> | ||
39 | 40 | ||
40 | #include <asm/pgtable.h> | 41 | #include <asm/pgtable.h> |
41 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
@@ -307,6 +308,8 @@ void show_regs(struct pt_regs * regs) | |||
307 | 308 | ||
308 | void exit_thread(void) | 309 | void exit_thread(void) |
309 | { | 310 | { |
311 | kprobe_flush_task(current); | ||
312 | |||
310 | #ifndef CONFIG_SMP | 313 | #ifndef CONFIG_SMP |
311 | if (last_task_used_math == current) | 314 | if (last_task_used_math == current) |
312 | last_task_used_math = NULL; | 315 | last_task_used_math = NULL; |
@@ -321,6 +324,7 @@ void flush_thread(void) | |||
321 | { | 324 | { |
322 | struct thread_info *t = current_thread_info(); | 325 | struct thread_info *t = current_thread_info(); |
323 | 326 | ||
327 | kprobe_flush_task(current); | ||
324 | if (t->flags & _TIF_ABI_PENDING) | 328 | if (t->flags & _TIF_ABI_PENDING) |
325 | t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); | 329 | t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); |
326 | 330 | ||