Re: 2.6.10 kprobes/jprobes panic

From: Badari Pulavarty
Date: Wed Feb 09 2005 - 19:04:24 EST


On Tue, 2005-02-08 at 21:07, Prasanna S Panchamukhi wrote:
> Hi Badri,
>
> > Hi,
> >
> > I ran into this while playing with jprobes in 2.6.10.
> >
> > I tried to install jprobe handler on a invalid address,
>
> User should prevent inserting jprobes on an invalid address.

Well, I was hoping register handler would do some basic
error checking to prevent user from panicking. For example,
I ran into it untentionally (I moved my code from ia32 to
x86-64, forgot to update the addresses).

>
> > I get OOPS. I was hoping for a error check and a graceful
> > exit rather than kernel Oops.
> >
>
> Error check and graceful exit can be done in the jprobe handler
> module. In the jprobe network packet logging patch, error check
> was taken care by using kallsyms_lookup_name() as shown below.
>
> nt->jp.kp.addr = (kprobe_opcode_t *)
> kallsyms_lookup_name(nt->funcname);
> if (nt->jp.kp.addr) {
> printk("plant jprobe at %s (%p), handler addr %p\n",
> nt->funcname, nt->jp.kp.addr, nt->jp.entry);
> register_jprobe(&nt->jp);
> } else {
> printk("couldn't find %s to plant jprobe\n",
> nt->funcname);
> }.
>

I tried to do this earlier in my module, but I get

# insmod myprobe.ko
insmod: error inserting 'myprobe.ko': -1 Unknown symbol in module
myprobe: Unknown symbol kallsyms_lookup_name

How did you use it ? it looks like kallsyms_lookup_name()
is not exported. Thats the reason why I was hardcoding addresses.

# grep KALL .config
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_EXTRA_PASS=y


Thanks,
Badari



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/