aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorbibo,mao <bibo.mao@intel.com>2006-10-02 05:17:35 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:16 -0400
commit99219a3fbc2dcf2eaa954f7b2ac27299fd7894cd (patch)
tree895abde156c9fbeea9c5a87cfaaa411d4ad175c6 /arch/powerpc
parentf2aa85a0ccd90110e76c6375535adc3ae358f971 (diff)
[PATCH] kretprobe spinlock deadlock patch
kprobe_flush_task() possibly calls kfree function during holding kretprobe_lock spinlock, if kfree function is probed by kretprobe that will incur spinlock deadlock. This patch moves kfree function out scope of kretprobe_lock. Signed-off-by: bibo, mao <bibo.mao@intel.com> Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/kprobes.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 46d2fd0e5789..7b8d12b9026c 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -260,11 +260,12 @@ void kretprobe_trampoline_holder(void)
260int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 260int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
261{ 261{
262 struct kretprobe_instance *ri = NULL; 262 struct kretprobe_instance *ri = NULL;
263 struct hlist_head *head; 263 struct hlist_head *head, empty_rp;
264 struct hlist_node *node, *tmp; 264 struct hlist_node *node, *tmp;
265 unsigned long flags, orig_ret_address = 0; 265 unsigned long flags, orig_ret_address = 0;
266 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; 266 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
267 267
268 INIT_HLIST_HEAD(&empty_rp);
268 spin_lock_irqsave(&kretprobe_lock, flags); 269 spin_lock_irqsave(&kretprobe_lock, flags);
269 head = kretprobe_inst_table_head(current); 270 head = kretprobe_inst_table_head(current);
270 271
@@ -290,7 +291,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
290 ri->rp->handler(ri, regs); 291 ri->rp->handler(ri, regs);
291 292
292 orig_ret_address = (unsigned long)ri->ret_addr; 293 orig_ret_address = (unsigned long)ri->ret_addr;
293 recycle_rp_inst(ri); 294 recycle_rp_inst(ri, &empty_rp);
294 295
295 if (orig_ret_address != trampoline_address) 296 if (orig_ret_address != trampoline_address)
296 /* 297 /*
@@ -308,6 +309,10 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
308 spin_unlock_irqrestore(&kretprobe_lock, flags); 309 spin_unlock_irqrestore(&kretprobe_lock, flags);
309 preempt_enable_no_resched(); 310 preempt_enable_no_resched();
310 311
312 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
313 hlist_del(&ri->hlist);
314 kfree(ri);
315 }
311 /* 316 /*
312 * By returning a non-zero value, we are telling 317 * By returning a non-zero value, we are telling
313 * kprobe_handler() that we don't want the post_handler 318 * kprobe_handler() that we don't want the post_handler