diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kprobes.c | 10 | ||||
-rw-r--r-- | kernel/sched.c | 9 |
2 files changed, 13 insertions, 6 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 1fb9f753ef60..1156eb0977d0 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -323,10 +323,10 @@ struct hlist_head __kprobes *kretprobe_inst_table_head(struct task_struct *tsk) | |||
323 | } | 323 | } |
324 | 324 | ||
325 | /* | 325 | /* |
326 | * This function is called from exit_thread or flush_thread when task tk's | 326 | * This function is called from finish_task_switch when task tk becomes dead, |
327 | * stack is being recycled so that we can recycle any function-return probe | 327 | * so that we can recycle any function-return probe instances associated |
328 | * instances associated with this task. These left over instances represent | 328 | * with this task. These left over instances represent probed functions |
329 | * probed functions that have been called but will never return. | 329 | * that have been called but will never return. |
330 | */ | 330 | */ |
331 | void __kprobes kprobe_flush_task(struct task_struct *tk) | 331 | void __kprobes kprobe_flush_task(struct task_struct *tk) |
332 | { | 332 | { |
@@ -336,7 +336,7 @@ void __kprobes kprobe_flush_task(struct task_struct *tk) | |||
336 | unsigned long flags = 0; | 336 | unsigned long flags = 0; |
337 | 337 | ||
338 | spin_lock_irqsave(&kretprobe_lock, flags); | 338 | spin_lock_irqsave(&kretprobe_lock, flags); |
339 | head = kretprobe_inst_table_head(current); | 339 | head = kretprobe_inst_table_head(tk); |
340 | hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { | 340 | hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { |
341 | if (ri->task == tk) | 341 | if (ri->task == tk) |
342 | recycle_rp_inst(ri); | 342 | recycle_rp_inst(ri); |
diff --git a/kernel/sched.c b/kernel/sched.c index 7ffaabd64f89..78acdefeccca 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/syscalls.h> | 49 | #include <linux/syscalls.h> |
50 | #include <linux/times.h> | 50 | #include <linux/times.h> |
51 | #include <linux/acct.h> | 51 | #include <linux/acct.h> |
52 | #include <linux/kprobes.h> | ||
52 | #include <asm/tlb.h> | 53 | #include <asm/tlb.h> |
53 | 54 | ||
54 | #include <asm/unistd.h> | 55 | #include <asm/unistd.h> |
@@ -1546,8 +1547,14 @@ static inline void finish_task_switch(runqueue_t *rq, task_t *prev) | |||
1546 | finish_lock_switch(rq, prev); | 1547 | finish_lock_switch(rq, prev); |
1547 | if (mm) | 1548 | if (mm) |
1548 | mmdrop(mm); | 1549 | mmdrop(mm); |
1549 | if (unlikely(prev_task_flags & PF_DEAD)) | 1550 | if (unlikely(prev_task_flags & PF_DEAD)) { |
1551 | /* | ||
1552 | * Remove function-return probe instances associated with this | ||
1553 | * task and put them back on the free list. | ||
1554 | */ | ||
1555 | kprobe_flush_task(prev); | ||
1550 | put_task_struct(prev); | 1556 | put_task_struct(prev); |
1557 | } | ||
1551 | } | 1558 | } |
1552 | 1559 | ||
1553 | /** | 1560 | /** |