Re: [PATCH] Don't oops when unregistering unknown kprobes

From: Frederik Deweerdt
Date: Tue Apr 26 2005 - 17:29:57 EST

Le 27/04/05 00:09 +0200, Jesper Juhl écrivit:
> On Tue, 26 Apr 2005, Frederik Deweerdt wrote:
> Seems to me this will end up calling spin_lock_irqsave() twice, but only
> spin_unlock_irqrestore once in the non-failing case... hmm..

Indeed, I made an obvious mistake there, sorry.

> Also, as Chris Wedgwood asked, why not simply return -EINVAL; instead of
> the printk()? Does the user really care that we tried to unregister a
> nonexisting kprobe? and if you really think someone would like to know
> then I'd personally say that KERN_DEBUG should be sufficient.

I wanted to make the patch minimal, but it does make sense.

> I'd suggest something like this :
> [ ... ]

You should also change the prototype in include/kernel/kprobes.h:

--- linux-2.6.12-rc3/include/linux/kprobes.h 2005-03-02 08:37:50.000000000 +0100
+++ linux-2.6.12-rc3-devel/include/linux/kprobes.h 2005-04-27 00:23:09.000000000 +0200
@@ -103,7 +103,7 @@ extern void show_registers(struct pt_reg
struct kprobe *get_kprobe(void *addr);

int register_kprobe(struct kprobe *p);
-void unregister_kprobe(struct kprobe *p);
+int unregister_kprobe(struct kprobe *p);
int setjmp_pre_handler(struct kprobe *, struct pt_regs *);
int longjmp_break_handler(struct kprobe *, struct pt_regs *);
int register_jprobe(struct jprobe *p);

PS: I've fixed my mailing habits, sorry for inconvenience :)

| : l'info alternative |
| Tech - Sciences - Politique - International |
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at