*/
#include <linux/list.h>
-//#include "../../kprobe/dbi_kprobes.h"
#include <uprobe/swap_uprobes.h>
-// TODO: tmp struct ip_data
-struct ip_data {
- unsigned long offset;
- unsigned long got_addr;
-
- kprobe_pre_entry_handler_t pre_handler;
- unsigned long jp_handler;
- uretprobe_handler_t rp_handler;
-
- unsigned flag_retprobe:1;
-};
-
struct sspt_page;
-struct sspt_file;
struct us_ip {
struct list_head list;
char *args;
unsigned long offset;
- unsigned long got_addr;
-
- unsigned flag_retprobe:1;
- unsigned flag_got:1;
};
#include "sspt_file.h"
#include "sspt_proc.h"
#include "sspt_debug.h"
-#include "us_proc_types.h"
#include <swap_uprobes.h>
#include <us_manager.h>
#include <pf/pf_group.h>
-static void print_proc_probes(const struct sspt_proc *proc);
-
-struct sspt_proc;
-
-static inline struct sspt_proc *get_file_probes(inst_us_proc_t *task_inst_info)
-{
- int i, ret;
- struct pf_group *pfg;
-
- pfg = get_pf_group_by_dentry(task_inst_info->m_f_dentry,
- task_inst_info->m_f_dentry);
-
- for (i = 0; i < task_inst_info->libs_count; ++i) {
- int k, j;
- us_proc_lib_t *p_libs = &task_inst_info->p_libs[i];
- struct dentry *dentry = p_libs->m_f_dentry;
- char *path = p_libs->path;
- char *name = strrchr(path, '/');
- name = name ? name + 1 : path;
-
- for (k = 0; k < p_libs->ips_count; ++k) {
- us_proc_ip_t *ip = &p_libs->p_ips[k];
- unsigned long got_addr = 0;
-
- for (j = 0; j < p_libs->plt_count; ++j) {
- if (ip->offset == p_libs->p_plt[j].func_addr) {
- got_addr = p_libs->p_plt[j].got_addr;
- break;
- }
- }
-
- ret = pf_register_probe(pfg, dentry, ip->offset, "dddd");
- if (ret)
- printk("### ERROR: pf_register_probe ret=%d\n", ret);
- }
- }
-
- printk("####### get END #######\n");
-
- pfg_print(pfg);
-
- return NULL;
-}
static int check_vma(struct vm_area_struct *vma)
{
static inline int sspt_register_usprobe(struct us_ip *ip)
{
- int ret = 0;
+ int ret;
/* for retuprobe */
ip->retprobe.up.task = ip->page->file->proc->task;
ip->retprobe.up.sm = ip->page->file->proc->sm;
- if (ip->flag_retprobe) {
- ret = dbi_register_uretprobe(&ip->retprobe);
- if (ret) {
- struct sspt_file *file = ip->page->file;
- char *name = file->dentry->d_iname;
- unsigned long addr =ip->retprobe.up.kp.addr;
- unsigned long offset = addr - file->vm_start;
-
- printk("dbi_register_uretprobe() failure %d (%s:%x|%x)\n",
- ret, name, offset, ip->retprobe.up.kp.opcode);
+ ret = dbi_register_uretprobe(&ip->retprobe);
+ if (ret) {
+ struct sspt_file *file = ip->page->file;
+ char *name = file->dentry->d_iname;
+ unsigned long addr =ip->retprobe.up.kp.addr;
+ unsigned long offset = addr - file->vm_start;
- return ret;
- }
+ printk("dbi_register_uretprobe() failure %d (%s:%x|%x)\n",
+ ret, name, offset, ip->retprobe.up.kp.opcode);
}
- return 0;
+ return ret;
}
static inline int do_unregister_usprobe(struct us_ip *ip)
{
- if (ip->flag_retprobe) {
- dbi_unregister_uretprobe(&ip->retprobe);
- }
+ dbi_unregister_uretprobe(&ip->retprobe);
return 0;
}
+++ /dev/null
-#ifndef __US_PROC_TYPES_H__
-#define __US_PROC_TYPES_H__
-
-/*
- * SWAP uprobe manager
- * modules/us_manager/sspt/us_proc_types.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright (C) Samsung Electronics, 2013
- *
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: Porting structures
- * declarations from old driver
- *
- */
-
-typedef struct
-{
- struct list_head list;
- char *name;
- int installed;
- struct jprobe jprobe;
- struct kretprobe retprobe;
- unsigned long offset;
- unsigned long got_addr;
-
- unsigned flag_retprobe:1;
- unsigned flag_got:1;
-} us_proc_ip_t;
-
-typedef struct
-{
- int installed;
- struct jprobe jprobe;
- unsigned long addr;
- struct list_head list;
-} us_proc_vtp_t;
-
-typedef struct
-{
- unsigned func_addr;
- unsigned got_addr;
- unsigned real_func_addr;
-} us_proc_plt_t;
-
-typedef struct
-{
- char *path;
- char *path_dyn;
- struct dentry *m_f_dentry;
- unsigned ips_count;
- us_proc_ip_t *p_ips;
- unsigned vtps_count;
- us_proc_vtp_t *p_vtps;
- int loaded;
- unsigned plt_count;
- us_proc_plt_t *p_plt;
- unsigned long vma_start;
- unsigned long vma_end;
- unsigned vma_flag;
-} us_proc_lib_t;
-
-typedef struct {
- char *path;
- struct dentry *m_f_dentry;
- pid_t tgid;
- unsigned unres_ips_count;
- unsigned unres_vtps_count;
- int is_plt;
- unsigned libs_count;
- us_proc_lib_t *p_libs;
-
- // new_dpf
- struct sspt_proc *pp;
-} inst_us_proc_t;
-
-#endif /* __US_PROC_TYPES_H__ */