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 <linux/rwsem.h>
30 #include "sspt_file.h"
38 /** Flags for sspt_*_uninstall() */
40 US_UNREGS_PROBE, /**< probes remove and disarm */
41 US_DISARM, /**< probes disarm */
42 US_UNINSTALL /**< probes remove from list install */
47 * @breaf Image of process for specified process
50 struct list_head list; /**< For global process list */
54 struct rw_semaphore sem;/**< Semaphore for files list */
55 struct list_head head; /**< For sspt_file */
58 pid_t tgid; /**< Thread group ID */
59 struct task_struct *leader; /**< Ptr to the task leader */
60 struct mm_struct *__mm;
61 struct task_struct *__task;
62 struct slot_manager *sm; /**< Ptr to the manager slot */
65 unsigned after_exec:1;
66 unsigned after_fork:1;
70 struct mutex mtx; /**< Mutex for filter list */
71 struct list_head head; /**< Filter head */
74 unsigned first_install:1; /**< Install flag */
75 struct sspt_feature *feature; /**< Ptr to the feature */
78 /* FIXME: for preload (remove those fields) */
79 unsigned long r_state_addr; /**< address of r_state */
80 void *private_data; /**< Process private data */
84 void *(*priv_create)(struct sspt_proc *);
85 void (*priv_destroy)(struct sspt_proc *, void *);
89 struct list_head *sspt_proc_list(void);
91 struct sspt_proc *sspt_proc_by_task(struct task_struct *task);
92 struct sspt_proc *sspt_proc_get_by_task(struct task_struct *task);
93 struct sspt_proc *sspt_proc_get_by_task_or_new(struct task_struct *task);
94 struct sspt_proc *sspt_proc_get(struct sspt_proc *proc);
95 void sspt_proc_put(struct sspt_proc *proc);
96 void sspt_proc_cleanup(struct sspt_proc *proc);
98 void on_each_proc_no_lock(void (*func)(struct sspt_proc *, void *),
100 void on_each_proc(void (*func)(struct sspt_proc *, void *), void *data);
102 void sspt_proc_check_empty(void);
104 struct sspt_file *sspt_proc_find_file(struct sspt_proc *proc,
105 struct dentry *dentry);
106 struct sspt_file *sspt_proc_find_file_or_new(struct sspt_proc *proc,
107 struct dentry *dentry);
108 void sspt_proc_install_page(struct sspt_proc *proc, unsigned long page_addr);
109 void sspt_proc_install(struct sspt_proc *proc);
110 int sspt_proc_uninstall(struct sspt_proc *proc,
111 struct task_struct *task,
114 int sspt_proc_get_files_by_region(struct sspt_proc *proc,
115 struct list_head *head,
116 unsigned long start, size_t len);
117 void sspt_proc_insert_files(struct sspt_proc *proc, struct list_head *head);
119 void sspt_proc_read_lock(void);
120 void sspt_proc_read_unlock(void);
121 void sspt_proc_write_lock(void);
122 void sspt_proc_write_unlock(void);
124 void sspt_proc_add_filter(struct sspt_proc *proc, struct pf_group *pfg);
125 void sspt_proc_del_filter(struct sspt_proc *proc, struct pf_group *pfg);
126 void sspt_proc_del_all_filters(struct sspt_proc *proc);
127 bool sspt_proc_is_filter_new(struct sspt_proc *proc, struct pf_group *pfg);
129 void sspt_proc_on_each_filter(struct sspt_proc *proc,
130 void (*func)(struct sspt_filter *, void *),
133 void sspt_proc_on_each_ip(struct sspt_proc *proc,
134 void (*func)(struct sspt_ip *, void *), void *data);
136 bool sspt_proc_is_send_event(struct sspt_proc *proc);
138 int sspt_proc_cb_set(struct sspt_proc_cb *cb);
139 void sspt_proc_priv_create(struct sspt_proc *proc);
140 void sspt_proc_priv_destroy(struct sspt_proc *proc);
142 void sspt_change_leader(struct task_struct *prev, struct task_struct *next);
143 int sspt_proc_init(void);
144 void sspt_proc_uninit(void);
147 #endif /* __SSPT_PROC__ */