5 * @file us_manager/sspt/sspt_proc.h
6 * @author Vyacheslav Cherkashin <v.cherkashin@samsung.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * Copyright (C) Samsung Electronics, 2013
27 #include <linux/types.h>
28 #include <linux/mutex.h>
29 #include "sspt_file.h"
37 /** Flags for sspt_*_uninstall() */
39 US_UNREGS_PROBE, /**< probes remove and disarm */
40 US_DISARM, /**< probes disarm */
41 US_UNINSTALL /**< probes remove from list install */
46 * @breaf Image of process for specified process
49 struct list_head list; /**< For global process list */
52 struct list_head file_head; /**< For sspt_file */
54 pid_t tgid; /**< Thread group ID */
55 struct task_struct *leader; /**< Ptr to the task leader */
56 struct mm_struct *__mm;
57 struct task_struct *__task;
58 struct slot_manager *sm; /**< Ptr to the manager slot */
61 unsigned after_exec:1;
62 unsigned after_fork:1;
66 struct mutex mtx; /**< Mutex for filter list */
67 struct list_head head; /**< Filter head */
70 unsigned first_install:1; /**< Install flag */
71 struct sspt_feature *feature; /**< Ptr to the feature */
74 /* FIXME: for preload (remove those fields) */
75 unsigned long r_state_addr; /**< address of r_state */
76 void *private_data; /**< Process private data */
80 void *(*priv_create)(struct sspt_proc *);
81 void (*priv_destroy)(struct sspt_proc *, void *);
85 struct list_head *sspt_proc_list(void);
87 void sspt_proc_cleanup(struct sspt_proc *proc);
88 struct sspt_proc *sspt_proc_get(struct sspt_proc *proc);
89 void sspt_proc_put(struct sspt_proc *proc);
91 void on_each_proc_no_lock(void (*func)(struct sspt_proc *, void *),
93 void on_each_proc(void (*func)(struct sspt_proc *, void *), void *data);
95 struct sspt_proc *sspt_proc_by_task(struct task_struct *task);
96 struct sspt_proc *sspt_proc_get_by_task_or_new(struct task_struct *task);
97 void sspt_proc_free_all(void);
99 struct sspt_file *sspt_proc_find_file(struct sspt_proc *proc,
100 struct dentry *dentry);
101 struct sspt_file *sspt_proc_find_file_or_new(struct sspt_proc *proc,
102 struct dentry *dentry);
103 void sspt_proc_install_page(struct sspt_proc *proc, unsigned long page_addr);
104 void sspt_proc_install(struct sspt_proc *proc);
105 int sspt_proc_uninstall(struct sspt_proc *proc,
106 struct task_struct *task,
109 int sspt_proc_get_files_by_region(struct sspt_proc *proc,
110 struct list_head *head,
111 unsigned long start, size_t len);
112 void sspt_proc_insert_files(struct sspt_proc *proc, struct list_head *head);
114 void sspt_proc_read_lock(void);
115 void sspt_proc_read_unlock(void);
116 void sspt_proc_write_lock(void);
117 void sspt_proc_write_unlock(void);
119 void sspt_proc_add_filter(struct sspt_proc *proc, struct pf_group *pfg);
120 void sspt_proc_del_filter(struct sspt_proc *proc, struct pf_group *pfg);
121 void sspt_proc_del_all_filters(struct sspt_proc *proc);
122 bool sspt_proc_is_filter_new(struct sspt_proc *proc, struct pf_group *pfg);
124 void sspt_proc_on_each_filter(struct sspt_proc *proc,
125 void (*func)(struct sspt_filter *, void *),
128 void sspt_proc_on_each_ip(struct sspt_proc *proc,
129 void (*func)(struct sspt_ip *, void *), void *data);
131 bool sspt_proc_is_send_event(struct sspt_proc *proc);
133 int sspt_proc_cb_set(struct sspt_proc_cb *cb);
134 void sspt_proc_priv_create(struct sspt_proc *proc);
135 void sspt_proc_priv_destroy(struct sspt_proc *proc);
137 void sspt_reset_proc(struct task_struct *task);
138 void sspt_change_leader(struct task_struct *prev, struct task_struct *next);
139 int sspt_proc_init(void);
140 void sspt_proc_uninit(void);
143 #endif /* __SSPT_PROC__ */