if (iRet)
EPRINTF ("uninstall_kernel_probe(do_page_fault) result=%d!", iRet);
- iRet = uninstall_kernel_probe (cp_addr, US_PROC_CP_INSTLD,
- 0, &cp_probe);
- if (iRet)
- EPRINTF ("uninstall_kernel_probe(copy_process) result=%d!", iRet);
-
- iRet = uninstall_kernel_probe (mr_addr, US_PROC_MR_INSTLD,
- 0, &mr_probe);
- if (iRet)
- EPRINTF ("uninstall_kernel_probe(mm_release) result=%d!", iRet);
-
- iRet = uninstall_kernel_probe (exit_addr, US_PROC_EXIT_INSTLD,
- 0, &exit_probe);
- if (iRet)
- EPRINTF ("uninstall_kernel_probe(do_exit) result=%d!", iRet);
-
- iRet = uninstall_kernel_probe (unmap_addr, US_PROC_UNMAP_INSTLD,
- 0, &unmap_probe);
- if (iRet)
- EPRINTF ("uninstall_kernel_probe(do_munmap) result=%d!", iRet);
-
if (is_libonly()) {
struct sspt_proc *proc;
}
else
{
- if (us_proc_info.tgid == 0)
- return 0;
+ if (us_proc_info.tgid != 0) {
rcu_read_lock ();
- for_each_process (task)
- {
- if (task->tgid == us_proc_info.tgid)
+ for_each_process (task)
{
- found = 1;
- get_task_struct (task);
- break;
- }
- }
- rcu_read_unlock ();
- if (found)
- {
- int i, ret;
- // uninstall IPs
- ret = uninstall_us_proc_probes(task, us_proc_info.pp, US_UNREGS_PROBE);
- if (ret != 0) {
- EPRINTF ("failed to uninstall IPs %d!", ret);
+ if (task->tgid == us_proc_info.tgid)
+ {
+ found = 1;
+ get_task_struct (task);
+ break;
+ }
}
+ rcu_read_unlock ();
+ if (found)
+ {
+ int i, ret;
+ // uninstall IPs
+ ret = uninstall_us_proc_probes(task,
+ us_proc_info.pp,
+ US_UNREGS_PROBE);
+ if (ret != 0) {
+ EPRINTF ("failed to uninstall IPs %d!",
+ ret);
+ }
- put_task_struct (task);
+ put_task_struct (task);
- printk("### 1 ### dbi_unregister_all_uprobes:\n");
- dbi_unregister_all_uprobes(task, 1);
- us_proc_info.tgid = 0;
- for(i = 0; i < us_proc_info.libs_count; i++)
- us_proc_info.p_libs[i].loaded = 0;
+ printk("###1### dbi_unregister_all_uprobes:\n");
+ dbi_unregister_all_uprobes(task, 1);
+ us_proc_info.tgid = 0;
+ for(i = 0; i < us_proc_info.libs_count; i++)
+ us_proc_info.p_libs[i].loaded = 0;
+ }
}
}
+ iRet = uninstall_kernel_probe (cp_addr, US_PROC_CP_INSTLD,
+ 0, &cp_probe);
+ if (iRet)
+ EPRINTF ("uninstall_kernel_probe(copy_process) result=%d!", iRet);
+
+ iRet = uninstall_kernel_probe (mr_addr, US_PROC_MR_INSTLD,
+ 0, &mr_probe);
+ if (iRet)
+ EPRINTF ("uninstall_kernel_probe(mm_release) result=%d!", iRet);
+
+ iRet = uninstall_kernel_probe (exit_addr, US_PROC_EXIT_INSTLD,
+ 0, &exit_probe);
+ if (iRet)
+ EPRINTF ("uninstall_kernel_probe(do_exit) result=%d!", iRet);
+
+ iRet = uninstall_kernel_probe (unmap_addr, US_PROC_UNMAP_INSTLD,
+ 0, &unmap_probe);
+ if (iRet)
+ EPRINTF ("uninstall_kernel_probe(do_munmap) result=%d!", iRet);
+
return iRet;
}
static int install_kernel_probe (unsigned long addr, int uflag, int kflag, kernel_probe_t ** pprobe)
DPRINTF("User space instr");
+ // enable 'do_exit' probe to detect for remove task_struct
+ ret = install_kernel_probe (exit_addr, US_PROC_EXIT_INSTLD, 0, &exit_probe);
+ if (ret != 0)
+ {
+ EPRINTF ("install_kernel_probe(do_exit) result=%d!", ret);
+ return ret;
+ }
+
+ // enable 'mm_release' probe to detect when for remove user space probes
+ ret = install_kernel_probe (mr_addr, US_PROC_MR_INSTLD, 0, &mr_probe);
+ if (ret != 0)
+ {
+ EPRINTF ("install_kernel_probe(mm_release) result=%d!", ret);
+ return ret;
+ }
+
+ // enable 'do_munmap' probe to detect when for remove user space probes
+ ret = install_kernel_probe (unmap_addr, US_PROC_UNMAP_INSTLD, 0, &unmap_probe);
+ if (ret != 0)
+ {
+ EPRINTF ("install_kernel_probe(do_munmap) result=%d!", ret);
+ return ret;
+ }
+
+ /* enable 'copy_process' */
+ ret = install_kernel_probe (cp_addr, US_PROC_CP_INSTLD, 0, &cp_probe);
+ if (ret != 0)
+ {
+ EPRINTF ("instpall_kernel_probe(copy_process) result=%d!", ret);
+ return ret;
+ }
+
+ // enable 'do_page_fault' probe to detect when they will be loaded
+ ret = install_kernel_probe (pf_addr, US_PROC_PF_INSTLD, 0, &pf_probe);
+ if (ret != 0)
+ {
+ EPRINTF ("install_kernel_probe(do_page_fault) result=%d!", ret);
+ return ret;
+ }
+
#ifdef SLP_APP
launchpad_daemon_dentry = dentry_by_path("/usr/bin/launchpad_preloading_preinitializing_daemon");
if (launchpad_daemon_dentry == NULL) {
}
}
- // enable 'do_page_fault' probe to detect when they will be loaded
- ret = install_kernel_probe (pf_addr, US_PROC_PF_INSTLD, 0, &pf_probe);
- if (ret != 0)
- {
- EPRINTF ("install_kernel_probe(do_page_fault) result=%d!", ret);
- return ret;
- }
- // enable 'do_exit' probe to detect for remove task_struct
- ret = install_kernel_probe (exit_addr, US_PROC_EXIT_INSTLD, 0, &exit_probe);
- if (ret != 0)
- {
- EPRINTF ("install_kernel_probe(do_exit) result=%d!", ret);
- return ret;
- }
- /* enable 'copy_process' */
- ret = install_kernel_probe (cp_addr, US_PROC_CP_INSTLD, 0, &cp_probe);
- if (ret != 0)
- {
- EPRINTF ("instpall_kernel_probe(copy_process) result=%d!", ret);
- return ret;
- }
-
- // enable 'mm_release' probe to detect when for remove user space probes
- ret = install_kernel_probe (mr_addr, US_PROC_MR_INSTLD, 0, &mr_probe);
- if (ret != 0)
- {
- EPRINTF ("install_kernel_probe(mm_release) result=%d!", ret);
- return ret;
- }
-
- // enable 'do_munmap' probe to detect when for remove user space probes
- ret = install_kernel_probe (unmap_addr, US_PROC_UNMAP_INSTLD, 0, &unmap_probe);
- if (ret != 0)
- {
- EPRINTF ("install_kernel_probe(do_munmap) result=%d!", ret);
- return ret;
- }
return 0;
}
retval = read_proc_vm_atomic(task, (unsigned long)stack, buf, sizeof(buf));
if (retval != sizeof(buf)) {
- printk("---> %s (%d/%d): failed to read stack from %08lx",
+ printk("---> %s (%d/%d): failed to read stack from %08lx\n",
task->comm, task->tgid, task->pid, (unsigned long)stack);
retval = -EFAULT;
goto out;
}
if (found) {
- printk("---> %s (%d/%d): trampoline found at %08lx (%08lx /%+d) - %p\n",
- task->comm, task->tgid, task->pid,
- (unsigned long)found, (unsigned long)sp,
- found - sp, ri->rp->kp.addr);
+ /* printk("---> %s (%d/%d): trampoline found at %08lx (%08lx /%+d) - %p\n", */
+ /* task->comm, task->tgid, task->pid, */
+ /* (unsigned long)found, (unsigned long)sp, */
+ /* found - sp, ri->rp->kp.addr); */
retval = write_proc_vm_atomic(task, (unsigned long)found, &ri->ret_addr,
sizeof(ri->ret_addr));
if (retval != sizeof(ri->ret_addr)) {
struct pt_regs *uregs = task_pt_regs(ri->task);
unsigned long ra = dbi_get_ret_addr(uregs);
if (ra == (unsigned long)tramp) {
- printk("---> %s (%d/%d): trampoline found at lr = %08lx - %p\n",
- task->comm, task->tgid, task->pid, ra, ri->rp->kp.addr);
- dbi_set_ret_addr(uregs, (unsigned long)tramp);
+ /* printk("---> %s (%d/%d): trampoline found at lr = %08lx - %p\n", */
+ /* task->comm, task->tgid, task->pid, ra, ri->rp->kp.addr); */
+ dbi_set_ret_addr(uregs, (unsigned long)ri->ret_addr);
retval = 0;
} else {
printk("---> %s (%d/%d): trampoline NOT found at sp = %08lx, lr = %08lx - %p\n",
struct kretprobe_instance *ri;
struct kretprobe *rp2 = NULL;
+ unregister_uprobe(&rp->kp, task, atomic);
spin_lock_irqsave (&kretprobe_lock, flags);
while ((ri = get_used_rp_inst(rp)) != NULL) {
if (dbi_disarm_urp_inst(ri, NULL) != 0)
- /*panic*/printk("%s (%d/%d): cannot disarm urp instance (%08lx)\n",
+ printk("%s (%d/%d): cannot disarm urp instance (%08lx)\n",
ri->task->comm, ri->task->tgid, ri->task->pid,
(unsigned long)rp->kp.addr);
recycle_rp_inst(ri);
spin_unlock_irqrestore(&kretprobe_lock, flags);
free_rp_inst(rp);
- unregister_uprobe(&rp->kp, task, atomic);
}
void dbi_unregister_all_uprobes(struct task_struct *task, int atomic)
head = &kprobe_table[i];
swap_hlist_for_each_entry_safe(p, node, tnode, head, hlist) {
if (p->tgid == task->tgid) {
- printk("dbi_unregister_all_uprobes: delete uprobe at %p[%lx] for %s/%d\n",
- p->addr, (unsigned long)p->opcode, task->comm, task->pid);
+ /* printk("dbi_unregister_all_uprobes: delete uprobe at %p[%lx] for %s/%d\n", */
+ /* p->addr, (unsigned long)p->opcode, task->comm, task->pid); */
unregister_uprobe(p, task, atomic);
}
}