This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
Re: register_kprobe undefined symbol on 2.6.11 of X86_64
Ananth,
Not i386, I am working on the arch as x86_64 SMP, this is the reason why
I have to try 2.6.11 not 2.6.9.
Yes, the KPROBES is enabled in the .config.
And, I even find the register_kprobe in the Module.symvers file.
I attached the .c file I just wrote FYI in this attachment.
Thanks,
Neo
On Wed, 2005-07-06 at 16:08 -0400, Ananth N Mavinakayanahalli wrote:
> Neo Jia wrote:
> > All,
> >
> > I am using the Kprobes on 2.6.11 from your website. After successfully
> > build the kernel and installed, I cannot insert my kernel space probes.
> > It seems that the "register_kprobe" is undefined. But I really find such
> > symbol in the vmlinux.
>
> Which arch? I suppose its i386. In that case, you don't need any extra
> "patches" for kprobes since 2.6.11 ships with the required changes.
>
> > Can anyone help me step out this problem?
>
> Are you sure CONFIG_KPROBES=y in your .config?
>
> Ananth
--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/kprobes.h> /* Needed for Kprobes */
/* pre_handler: this is called just before the probed instruction is executed. */
int handler_pre(struct kprobe *p, struct pt_regs * regs)
{
printk("pre_handler: p->addr=0x%p, eflags=0x%lx\n", p->addr, regs->eflags);
return 0;
}
/* post_handler: this is called after the probed instruction is executed
* provided no exception is generated).
*/
void handler_post(struct kprobe *p, struct pt_regs *regs, unsigned long flags)
{
printk("post_handler: p->addr=0x%p, eflags=0x%lx\n", p->addr, regs->eflags);
}
/* fault_handler: this is called if an exeception is generated for
* any instruction within the fault-handler, or when Kprobes
* single-steps the probed instruction.
*/
int handler_fault(struct kprobe *p, struct pt_regs *regs, int trapnr)
{
printk("fault_handler:p->addr=0x%p, eflags=0x%lx\n", p->addr, regs->eflags);
return 0;
}
int init_module(void)
{
struct kprobe kp;
/* specify pre_handler address */
kp.pre_handler = handler_pre;
/* specify post_handler address */
kp.post_handler = handler_post;
/* specify fault_hanlder address */
kp.fault_handler = handler_fault;
/* specify the address/offset where you want to insert probe. */
kp.addr = (kprobe_opcode_t *) 0xffffffff801377c0;
/* All set to register with Kprobes */
register_kprobe(&kp);
return 0;
}