This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC -mm][PATCH 5/6] prepare kprobes code for x86 unification
On Thu, Dec 13, 2007 at 01:47:50PM +0530, Srinivasa Ds wrote:
> Ananth N Mavinakayanahalli wrote:
> >On Wed, Dec 12, 2007 at 08:21:01PM -0500, Masami Hiramatsu wrote:
> >>Masami Hiramatsu wrote:
> >>>Finally, I reproduced it by executing a command below:
> >>>% stap -e 'probe kernel.function("migration_init"){}'
> >>>
>
> >
> >That does seem like the right thing to do. This also needs to live in
> >common code.
> >
> >Srini,
> >Want to take a stab at it?
>
>
> How about this Ananth ???
>
>
> Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>
>
>
>
>
> --- kernel/kprobes.c.orig 2007-12-13 13:43:45.000000000 +0530
> +++ kernel/kprobes.c 2007-12-13 13:48:32.000000000 +0530
> @@ -48,6 +48,7 @@
> #include <asm/cacheflush.h>
> #include <asm/errno.h>
> #include <asm/uaccess.h>
> +#include <asm/sections.h>
>
> #define KPROBE_HASH_BITS 6
> #define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS)
> @@ -722,6 +723,11 @@ int __kprobes register_kretprobe(struct
> if (addr == NULL)
> kprobe_lookup_name(rp->kp.symbol_name, addr);
> addr += rp->kp.offset;
> +
> + if (addr >= (unsigned long)_sinittext &&
> + addr <= (unsigned long)_einittext)
> + return -EINVAL;
> +
We wouldn't want to permit registration of kprobes also, do we? Looks
like you've changed it only for kretprobes.
Have you tested the patch?
Ananth
>
> for (i = 0; kretprobe_blacklist[i].name != NULL; i++) {
> if (kretprobe_blacklist[i].addr == addr)