return ret;
}
-static void arm_uprobe(struct uprobe *p)
+static int arm_uprobe(struct uprobe *p)
{
kprobe_opcode_t insn = BREAKPOINT_INSTRUCTION;
int ret = write_proc_vm_atomic(p->task, (unsigned long)p->kp.addr,
&insn, sizeof(insn));
if (!ret) {
- panic("arm_uprobe: failed to write memory "
- "tgid=%u addr=%p!\n", p->task->tgid, p->kp.addr);
+ printk("arm_uprobe: failed to write memory "
+ "tgid=%u addr=%p!\n", p->task->tgid, p->kp.addr);
+
+ return -EACCES;
}
+
+ return 0;
}
/**
int ret = write_proc_vm_atomic(task, (unsigned long)p->addr,
&p->opcode, sizeof(p->opcode));
if (!ret) {
- panic("disarm_uprobe: failed to write memory "
- "tgid=%u, addr=%p!\n", task->tgid, p->addr);
+ printk("disarm_uprobe: failed to write memory "
+ "tgid=%u, addr=%p!\n", task->tgid, p->addr);
}
}
EXPORT_SYMBOL_GPL(disarm_uprobe);
INIT_HLIST_NODE(&p->hlist);
hlist_add_head_rcu(&p->hlist,
&uprobe_table[hash_ptr(p->addr, UPROBE_HASH_BITS)]);
- arm_uprobe(up);
+
+ ret = arm_uprobe(up);
+ if (ret)
+ remove_uprobe(up);
out:
DBPRINTF("out ret = 0x%x\n", ret);