Skip to content

Commit

Permalink
uretprobes/powerpc: Hijack return address
Browse files Browse the repository at this point in the history
Hijack the return address and replace it with a trampoline address.
PowerPC implementation.

Signed-off-by: Anton Arapov <anton@redhat.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
  • Loading branch information
Anton Arapov authored and Oleg Nesterov committed Apr 13, 2013
1 parent 791eca1 commit f15706b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/uprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
#endif /* _ASM_UPROBES_H */
13 changes: 13 additions & 0 deletions arch/powerpc/kernel/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,16 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)

return false;
}

unsigned long
arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs)
{
unsigned long orig_ret_vaddr;

orig_ret_vaddr = regs->link;

/* Replace the return addr with trampoline addr */
regs->link = trampoline_vaddr;

return orig_ret_vaddr;
}

0 comments on commit f15706b

Please sign in to comment.