cross_compiler = $(subst gcc,,$(CC))
inlude_opt = -I$(realpath $(top_srcdir)/src/modules/ksyms) \
+ -I$(realpath $(top_srcdir)/src/modules/driver) \
-I$(realpath $(top_srcdir)/src/common) \
-I$(realpath $(top_srcdir)/src/profile) \
-I$(realpath $(top_srcdir)/src/modules/kprobe) \
}
if (is_libonly()) {
- procs = get_proc_probes_by_task_or_new(task);
+ procs = sspt_procs_get_by_task_or_new(task);
} else {
// find task
if (us_proc_info.tgid == 0) {
static void rm_uprobes_child(struct task_struct *task)
{
if (is_libonly()) {
- struct sspt_procs *procs = get_proc_probes_by_task(current);
+ struct sspt_procs *procs = sspt_procs_get_by_task(current);
if(procs) {
recover_child(task, procs);
}
}
if (is_libonly()) {
- procs = get_proc_probes_by_task(task);
+ procs = sspt_procs_get_by_task(task);
} else {
if (task->tgid == us_proc_info.tgid) {
- procs = get_proc_probes_by_task(task);
+ procs = us_proc_info.pp;
us_proc_info.tgid = 0;
}
}
}
if (is_libonly()) {
- procs = get_proc_probes_by_task(task);
+ procs = sspt_procs_get_by_task(task);
} else {
if (task->tgid == us_proc_info.tgid) {
procs = us_proc_info.pp;
#include "sspt_procs.h"
#include <linux/slab.h>
#include <linux/list.h>
+#include <us_slot_manager.h>
-extern struct list_head proc_probes_list;
+static LIST_HEAD(proc_probes_list);
struct sspt_procs *sspt_procs_create(struct dentry* dentry, pid_t tgid)
{
#include "../storage.h"
extern inst_us_proc_t us_proc_info;
+struct sspt_procs *sspt_procs_get_by_task(struct task_struct *task)
+{
+ struct sspt_procs *procs, *tmp;
+
+ list_for_each_entry_safe(procs, tmp, &proc_probes_list, list) {
+ if (procs->tgid == task->tgid) {
+ return procs;
+ }
+ }
+
+ return NULL;
+}
+
+static void add_proc_probes(struct sspt_procs *procs)
+{
+ list_add_tail(&procs->list, &proc_probes_list);
+}
+
+struct sspt_procs *sspt_procs_get_by_task_or_new(struct task_struct *task)
+{
+ struct sspt_procs *procs = sspt_procs_get_by_task(task);
+ if (procs == NULL) {
+ procs = sspt_procs_copy(us_proc_info.pp, task);
+ procs->sm = create_sm_us(task);
+ add_proc_probes(procs);
+ }
+
+ return procs;
+}
+
void sspt_procs_free_all(void)
{
// is user-space instrumentation
struct sspt_procs *sspt_procs_create(struct dentry* dentry, pid_t tgid);
struct sspt_procs *sspt_procs_copy(struct sspt_procs *procs, struct task_struct *task);
void sspt_procs_free(struct sspt_procs *procs);
+
+struct sspt_procs *sspt_procs_get_by_task(struct task_struct *task);
+struct sspt_procs *sspt_procs_get_by_task_or_new(struct task_struct *task);
void sspt_procs_free_all(void);
void sspt_procs_add_ip_data(struct sspt_procs *procs, struct dentry* dentry,
int uretprobe_event_handler(struct uretprobe_instance *probe, struct pt_regs *regs, struct us_ip *ip);
-LIST_HEAD(proc_probes_list);
-
#define print_event(fmt, args...) \
{ \
char *buf[1024]; \
return !!us_proc_info.path;
}
-struct sspt_procs *get_proc_probes_by_task(struct task_struct *task)
-{
- struct sspt_procs *procs, *tmp;
-
- if (!is_libonly()) {
- if (task != current) {
- printk("ERROR get_proc_probes_by_task: \'task != current\'\n");
- return NULL;
- }
-
- return us_proc_info.pp;
- }
-
- list_for_each_entry_safe(procs, tmp, &proc_probes_list, list) {
- if (procs->tgid == task->tgid) {
- return procs;
- }
- }
-
- return NULL;
-}
-
-static void add_proc_probes(struct task_struct *task, struct sspt_procs *procs)
-{
- list_add_tail(&procs->list, &proc_probes_list);
-}
-
-struct sspt_procs *get_proc_probes_by_task_or_new(struct task_struct *task)
-{
- struct sspt_procs *procs = get_proc_probes_by_task(task);
- if (procs == NULL) {
- procs = sspt_procs_copy(us_proc_info.pp, task);
- procs->sm = create_sm_us(task);
- add_proc_probes(task, procs);
- }
-
- return procs;
-}
-
struct dentry *dentry_by_path(const char *path)
{
struct dentry *dentry;
unsigned long offset_addr = addr - vma->vm_start;
struct dentry *dentry = vma->vm_file->f_dentry;
char *name = dentry->d_iname;
- struct sspt_procs *procs = get_proc_probes_by_task(task);
+ struct sspt_procs *procs = sspt_procs_get_by_task(task);
struct ip_data pd = {
.offset = offset_addr,
.pre_handler = pre_handler,
struct sspt_procs *procs;
for_each_process(task) {
- procs = get_proc_probes_by_task(task);
+ procs = sspt_procs_get_by_task(task);
if (procs) {
int ret = uninstall_us_proc_probes(task, procs, US_UNREGS_PROBE);
if (ret) {
continue;
}
- procs = get_proc_probes_by_task_or_new(task);
+ procs = sspt_procs_get_by_task_or_new(task);
DPRINTF("trying process");
install_proc_probes(task, procs, 1);
//put_task_struct (task);
struct vm_area_struct;
enum US_FLAGS;
-extern struct list_head proc_probes_list;
-
int is_libonly(void);
int is_us_instrumentation(void);
int check_install_pages_in_file(struct task_struct *task, struct sspt_file *file);
int unregister_us_page_probe(struct task_struct *task,
struct sspt_page *page, enum US_FLAGS flag);
-struct sspt_procs *get_proc_probes_by_task_or_new(struct task_struct *task);
void install_proc_probes(struct task_struct *task, struct sspt_procs *procs, int atomic);
pid_t find_proc_by_task(const struct task_struct *task, struct dentry *dentry);
void install_page_probes(unsigned long page_addr, struct task_struct *task, struct sspt_procs *procs, int atomic);
int uninstall_us_proc_probes(struct task_struct *task, struct sspt_procs *procs, enum US_FLAGS flag);
int check_vma(struct vm_area_struct *vma);
int unregister_us_file_probes(struct task_struct *task, struct sspt_file *file, enum US_FLAGS flag);
-struct sspt_procs *get_proc_probes_by_task(struct task_struct *task);
#endif /* !defined(__US_PROC_INST_H__) */