pid_t tgid = find_proc_by_task(task, us_proc_info.m_f_dentry);
if (tgid) {
us_proc_info.tgid = gl_nNotifyTgid = tgid;
+ procs = sspt_procs_get_by_task_or_new(task);
- us_proc_info.pp->sm = create_sm_us(task);
/* install probes in already mapped memory */
- install_proc_probes(task, us_proc_info.pp);
+ install_proc_probes(task, procs);
}
}
if (us_proc_info.tgid == task->tgid) {
- procs = us_proc_info.pp;
+ procs = sspt_procs_get_by_task_or_new(task);
}
}
static void rm_uprobes_child(struct task_struct *task)
{
- if (is_libonly()) {
- struct sspt_procs *procs = sspt_procs_get_by_task(current);
- if(procs) {
- recover_child(task, procs);
- }
- } else {
- if(us_proc_info.tgid == current->tgid) {
- recover_child(task, us_proc_info.pp);
- }
+ struct sspt_procs *procs = sspt_procs_get_by_task(current);
+ if(procs) {
+ recover_child(task, procs);
}
}
procs = sspt_procs_get_by_task(task);
} else {
if (task->tgid == us_proc_info.tgid) {
- procs = us_proc_info.pp;
+ procs = sspt_procs_get_by_task(task);
us_proc_info.tgid = 0;
}
}
goto out;
}
- if (is_libonly()) {
- procs = sspt_procs_get_by_task(task);
- } else {
- if (task->tgid == us_proc_info.tgid) {
- procs = us_proc_info.pp;
- }
- }
-
+ procs = sspt_procs_get_by_task(task);
if (procs) {
if (remove_unmap_probes(task, procs, start, len)) {
printk("ERROR do_munmap: start=%lx, len=%x\n", start, len);
return;
}
- if (strcmp(us_proc_info.path,"*") == 0) {
- // app
- sspt_procs_free(us_proc_info.pp);
- us_proc_info.pp = NULL;
- } else {
- // libonly
- struct sspt_procs *procs, *n;
- list_for_each_entry_safe(procs, n, &proc_probes_list, list) {
- list_del(&procs->list);
- sspt_procs_free(procs);
- }
+ struct sspt_procs *procs, *n;
+ list_for_each_entry_safe(procs, n, &proc_probes_list, list) {
+ list_del(&procs->list);
+ sspt_procs_free(procs);
}
}
{
int iRet = 0, found = 0;
struct task_struct *task = NULL;
+ struct sspt_procs *procs;
if (!is_us_instrumentation()) {
return 0;
if (iRet)
EPRINTF ("uninstall_kernel_probe(do_munmap) result=%d!", iRet);
- if (is_libonly()) {
- struct sspt_procs *procs;
- for_each_process(task) {
- procs = sspt_procs_get_by_task(task);
- if (procs) {
- int ret = uninstall_us_proc_probes(task, procs, US_UNREGS_PROBE);
- if (ret) {
- EPRINTF ("failed to uninstall IPs (%d)!", ret);
- }
-
- dbi_unregister_all_uprobes(task);
- }
- }
- }
- else
- {
- if (us_proc_info.tgid == 0)
- return 0;
- rcu_read_lock ();
- for_each_process (task)
- {
- 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);
+ for_each_process(task) {
+ procs = sspt_procs_get_by_task(task);
+ if (procs) {
+ int ret = uninstall_us_proc_probes(task, procs, US_UNREGS_PROBE);
+ if (ret) {
+ EPRINTF ("failed to uninstall IPs (%d)!", ret);
}
- put_task_struct (task);
-
- printk("### 1 ### dbi_unregister_all_uprobes:\n");
dbi_unregister_all_uprobes(task);
- us_proc_info.tgid = 0;
- for(i = 0; i < us_proc_info.libs_count; i++)
- us_proc_info.p_libs[i].loaded = 0;
}
}
}
else
{
- ret = find_task_by_path (us_proc_info.path, &task, NULL);
- if ( task )
- {
- DPRINTF("task found. installing probes");
+ ret = find_task_by_path(us_proc_info.path, &task, NULL);
+ if (task) {
+ struct sspt_procs *procs;
+
+ procs = sspt_procs_get_by_task_or_new(task);
+
us_proc_info.tgid = task->pid;
- us_proc_info.pp->sm = create_sm_us(task);
- install_proc_probes(task, us_proc_info.pp);
- put_task_struct (task);
+ install_proc_probes(task, procs);
+ put_task_struct(task);
}
}