diff options
author | bibo,mao <bibo.mao@intel.com> | 2006-10-02 05:17:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:16 -0400 |
commit | 99219a3fbc2dcf2eaa954f7b2ac27299fd7894cd (patch) | |
tree | 895abde156c9fbeea9c5a87cfaaa411d4ad175c6 /arch/i386/kernel/kprobes.c | |
parent | f2aa85a0ccd90110e76c6375535adc3ae358f971 (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/i386/kernel/kprobes.c')
-rw-r--r-- | arch/i386/kernel/kprobes.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 7a97544f15a0..d98e44b16fe2 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -396,11 +396,12 @@ no_kprobe: | |||
396 | fastcall void *__kprobes trampoline_handler(struct pt_regs *regs) | 396 | fastcall void *__kprobes trampoline_handler(struct pt_regs *regs) |
397 | { | 397 | { |
398 | struct kretprobe_instance *ri = NULL; | 398 | struct kretprobe_instance *ri = NULL; |
399 | struct hlist_head *head; | 399 | struct hlist_head *head, empty_rp; |
400 | struct hlist_node *node, *tmp; | 400 | struct hlist_node *node, *tmp; |
401 | unsigned long flags, orig_ret_address = 0; | 401 | unsigned long flags, orig_ret_address = 0; |
402 | unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; | 402 | unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; |
403 | 403 | ||
404 | INIT_HLIST_HEAD(&empty_rp); | ||
404 | spin_lock_irqsave(&kretprobe_lock, flags); | 405 | spin_lock_irqsave(&kretprobe_lock, flags); |
405 | head = kretprobe_inst_table_head(current); | 406 | head = kretprobe_inst_table_head(current); |
406 | 407 | ||
@@ -429,7 +430,7 @@ fastcall void *__kprobes trampoline_handler(struct pt_regs *regs) | |||
429 | } | 430 | } |
430 | 431 | ||
431 | orig_ret_address = (unsigned long)ri->ret_addr; | 432 | orig_ret_address = (unsigned long)ri->ret_addr; |
432 | recycle_rp_inst(ri); | 433 | recycle_rp_inst(ri, &empty_rp); |
433 | 434 | ||
434 | if (orig_ret_address != trampoline_address) | 435 | if (orig_ret_address != trampoline_address) |
435 | /* | 436 | /* |
@@ -444,6 +445,10 @@ fastcall void *__kprobes trampoline_handler(struct pt_regs *regs) | |||
444 | 445 | ||
445 | spin_unlock_irqrestore(&kretprobe_lock, flags); | 446 | spin_unlock_irqrestore(&kretprobe_lock, flags); |
446 | 447 | ||
448 | hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { | ||
449 | hlist_del(&ri->hlist); | ||
450 | kfree(ri); | ||
451 | } | ||
447 | return (void*)orig_ret_address; | 452 | return (void*)orig_ret_address; |
448 | } | 453 | } |
449 | 454 | ||