]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] kprobes: fix race in aggregate kprobe registration
authorKeshavamurthy Anil S <anil.s.keshavamurthy@intel.com>
Mon, 12 Dec 2005 08:37:12 +0000 (00:37 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 12 Dec 2005 16:57:43 +0000 (08:57 -0800)
When registering multiple kprobes at the same address, we leave a small
window where the kprobe hlist will not contain a reference to the
registered kprobe, leading to potentially, a system crash if the breakpoint
is hit on another processor.

Patch below now automically relpace the old kprobe with the new
kprobe from the hash list.

Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/kprobes.c

index fde5a16a2913c2675d28c46e37f88b7cc28a82aa..e4f0fc62bd3ecb428b1aef5377557f3e44314d51 100644 (file)
@@ -399,10 +399,7 @@ static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p)
        INIT_LIST_HEAD(&ap->list);
        list_add_rcu(&p->list, &ap->list);
 
-       INIT_HLIST_NODE(&ap->hlist);
-       hlist_del_rcu(&p->hlist);
-       hlist_add_head_rcu(&ap->hlist,
-               &kprobe_table[hash_ptr(ap->addr, KPROBE_HASH_BITS)]);
+       hlist_replace_rcu(&p->hlist, &ap->hlist);
 }
 
 /*