lkml.org 
[lkml]   [2013]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectkprobe pre_handler change return IP
Date
I use kprobe to probe a function suppose: 
int is_winter(int num) { ... }
int replace_is_winter(int num) { ...}
I want to replace is_winter() with replace_is_winter(), so when we call is_winter, replace_is_winter will be called.

so:
int my_pre_handler(struct kprobe *p, struct pt_regs *regs)
{
regs->ip = (unsigned long)&replace_is_winter;
return 1;
}

and echo 0 > /proc/sys/debug/kprobes-optimization so that jump instruction will not be used.

I got a exception in fault_handler, and trap number is 14.

fault_handler: p->addr = 0xffffffffa08e201a, ip = ffffffff8021c59d, trap #14n

Anyone here can help me ?
\
 
 \ /
  Last update: 2013-10-17 15:21    [W:1.314 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site