******************************************************************************
*/
+/* FIXME: sync with stop */
+static unsigned long mr_cb(void *data)
+{
+ struct task_struct *task = *(struct task_struct **)data;
+
+ if (task->tgid != task->pid) {
+ /* if the thread is killed we need to discard pending
+ * uretprobe instances which have not triggered yet */
+ swap_discard_pending_uretprobes(task);
+ } else {
+ call_mm_release(task);
+ }
+
+ return 0;
+}
+
/* Detects when target process removes IPs. */
static int mr_pre_handler(struct kprobe *p, struct pt_regs *regs)
{
+ int ret = 0;
struct task_struct *task = (struct task_struct *)swap_get_karg(regs, 0);
if (is_kthread(task))
goto out;
- if (task->tgid != task->pid) {
- /* if the thread is killed we need to discard pending
- * uretprobe instances which have not triggered yet */
- swap_discard_pending_uretprobes(task);
- goto out;
+ ret = set_kjump_cb(regs, mr_cb, (void *)&task, sizeof(task));
+ if (ret < 0) {
+ printk("##### ERROR: mr_pre_handler, ret=%d\n", ret);
+ ret = 0;
}
-
- call_mm_release(task);
out:
- return 0;
+ return ret;
}
static struct kprobe mr_kprobe = {