提交 adad0f33 编写于 作者: K Keshavamurthy Anil S 提交者: Linus Torvalds

[PATCH] kprobes: fix race in aggregate kprobe registration

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: NAnil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Acked-by: NAnanth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b88cb424
......@@ -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);
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册