public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Don't oops when unregistering unknown kprobes
@ 2005-04-26 16:22 Frederik Deweerdt
  2005-04-26 16:27 ` Prasanna S Panchamukhi
  2005-04-26 19:48 ` Chris Wedgwood
  0 siblings, 2 replies; 7+ messages in thread
From: Frederik Deweerdt @ 2005-04-26 16:22 UTC (permalink / raw)
  To: prasanna; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

Hi Prasanna,

Here's a patch that handles gracefully attempts to unregister
unregistered kprobes (ie. a warning message instead of an oops).
Patch is against 2.6.12-rc3

Signed-off-by: Frederik Deweerdt <frederik.deweerdt@laposte.net>

Regards,
Frederik

-- 
o----------------------------------------------o
| http://open-news.net : l'info alternative    |
| Tech - Sciences - Politique - International  |
o----------------------------------------------o

[-- Attachment #2: dont.oops.on.unregister.unknown.kprobe.patch --]
[-- Type: text/plain, Size: 508 bytes --]

--- linux-2.6.12-rc3/kernel/kprobes.c	2005-04-26 16:35:22.000000000 +0200
+++ linux-2.6.12-rc3-devel/kernel/kprobes.c	2005-04-26 16:44:57.000000000 +0200
@@ -107,6 +107,13 @@ rm_kprobe:
 void unregister_kprobe(struct kprobe *p)
 {
 	unsigned long flags;
+
+	if (!get_kprobe(p)) {
+		printk(KERN_WARNING "Warning: Attempt to unregister "
+					"unknown kprobe (addr:0x%lx)\n",
+					(unsigned long) p);
+		return;
+	}
 	arch_remove_kprobe(p);
 	spin_lock_irqsave(&kprobe_lock, flags);
 	*p->addr = p->opcode;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-04-27  5:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-26 16:22 [PATCH] Don't oops when unregistering unknown kprobes Frederik Deweerdt
2005-04-26 16:27 ` Prasanna S Panchamukhi
2005-04-26 21:42   ` Frederik Deweerdt
2005-04-26 22:09     ` Jesper Juhl
2005-04-26 22:31       ` Frederik Deweerdt
2005-04-26 19:48 ` Chris Wedgwood
2005-04-27  5:08   ` Prasanna S Panchamukhi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox