[RFC -mm][PATCH 5/6] prepare kprobes code for x86 unification

Srinivasa Ds srinivasa@in.ibm.com
Thu Dec 13 08:18:00 GMT 2007


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;
+
 
                for (i = 0; kretprobe_blacklist[i].name != NULL; i++) {
                        if (kretprobe_blacklist[i].addr == addr)



More information about the Systemtap mailing list