mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
kprobes: kretprobe user entry-handler
Provide support to add an optional user defined callback to be run at function entry of a kretprobe'd function. Also modify the kprobe smoke tests to include an entry-handler during the kretprobe sanity test. Signed-off-by: Abhishek Sagar <[email protected]> Cc: Prasanna S Panchamukhi <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Anil S Keshavamurthy <[email protected]> Acked-by: Jim Keniston <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5beec4aa2a
commit
f47cd9b553
4 changed files with 94 additions and 15 deletions
|
|
@ -699,6 +699,12 @@ static int __kprobes pre_handler_kretprobe(struct kprobe *p,
|
|||
struct kretprobe_instance, uflist);
|
||||
ri->rp = rp;
|
||||
ri->task = current;
|
||||
|
||||
if (rp->entry_handler && rp->entry_handler(ri, regs)) {
|
||||
spin_unlock_irqrestore(&kretprobe_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
arch_prepare_kretprobe(ri, regs);
|
||||
|
||||
/* XXX(hch): why is there no hlist_move_head? */
|
||||
|
|
@ -745,7 +751,8 @@ int __kprobes register_kretprobe(struct kretprobe *rp)
|
|||
INIT_HLIST_HEAD(&rp->used_instances);
|
||||
INIT_HLIST_HEAD(&rp->free_instances);
|
||||
for (i = 0; i < rp->maxactive; i++) {
|
||||
inst = kmalloc(sizeof(struct kretprobe_instance), GFP_KERNEL);
|
||||
inst = kmalloc(sizeof(struct kretprobe_instance) +
|
||||
rp->data_size, GFP_KERNEL);
|
||||
if (inst == NULL) {
|
||||
free_rp_inst(rp);
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Reference in a new issue