#include "gt_module.h"
#include "gt_debugfs.h"
-#define page_to_proc(page) ((page)->file->proc)
-#define ip_to_proc(ip) page_to_proc((ip)->page)
-#define urp_to_ip(rp) container_of(rp, struct sspt_ip, retprobe)
enum task_id_t {
GT_SET_BY_DENTRY,
return _is_bin_data_available(&_pthread_init);
}
-static inline struct pd_t *_get_process_data(struct uretprobe *rp)
-{
- struct sspt_ip *ip = urp_to_ip(rp);
- struct sspt_proc *proc = ip_to_proc(ip);
-
- return lpd_get(proc);
-}
-
static int _process_eh(struct uretprobe_instance *ri, struct pt_regs *regs,
rh_t rh, struct dentry *dentry)
{
- struct pd_t *pd = _get_process_data(ri->rp);
+ struct pd_t *pd = lpd_get_by_task(current);
struct hd_t *hd;
unsigned long vaddr = 0;
unsigned long old_pc = swap_get_upc(regs);
static int _process_rh(struct uretprobe_instance *ri, struct pt_regs *regs,
rh_t rh, struct dentry *dentry)
{
- struct pd_t *pd = _get_process_data(ri->rp);
+ struct pd_t *pd = lpd_get_by_task(current);
struct hd_t *hd;
if (dentry == NULL)
static int pthread_init_eh(struct uretprobe_instance *ri, struct pt_regs *regs)
{
- struct pd_t *pd = _get_process_data(ri->rp);
+ struct pd_t *pd = lpd_get_by_task(current);
/* Wait until pthread is inited, if it is going to be inited before
* loading our library */
static int pthread_init_rh(struct uretprobe_instance *ri, struct pt_regs *regs)
{
- struct pd_t *pd = _get_process_data(ri->rp);
+ struct pd_t *pd = lpd_get_by_task(current);
lpd_set_init_state(pd, true);
struct pd_t;
struct hd_t;
-struct uretprobe;
struct uretprobe_instance;
+struct task_struct;
/* process loader states */
enum ps_t {
struct pd_t *lpd_get(struct sspt_proc *proc);
+struct pd_t *lpd_get_by_task(struct task_struct *task);
struct hd_t *lpd_get_hd(struct pd_t *pd, struct dentry *dentry);
bool lpd_get_init_state(struct pd_t *pd);
#include "loader_storage.h"
#include "loader_defs.h"
+
struct pd_t {
unsigned long loader_base;
unsigned long data_page;
}
EXPORT_SYMBOL_GPL(lpd_get);
+struct pd_t *lpd_get_by_task(struct task_struct *task)
+{
+ struct sspt_proc *proc = sspt_proc_by_task(task);
+
+ return lpd_get(proc);
+}
+EXPORT_SYMBOL_GPL(lpd_get_by_task);
+
struct hd_t *lpd_get_hd(struct pd_t *pd, struct dentry *dentry)
{
struct hd_t *hd;
#include "preload_control.h"
#include "preload_threads.h"
-#define page_to_proc(page) ((page)->file->proc)
-#define ip_to_proc(ip) page_to_proc((ip)->page)
-#define urp_to_ip(rp) container_of(rp, struct sspt_ip, retprobe)
-
enum {
/* task preload flags */
HANDLER_RUNNING = 0x1
char *call_type;
};
-static inline struct pd_t *__get_process_data(struct uretprobe *rp)
-{
- struct sspt_ip *ip = urp_to_ip(rp);
- struct sspt_proc *proc = ip_to_proc(ip);
-
- return lpd_get(proc);
-}
static inline struct vm_area_struct *__get_vma_by_addr(struct task_struct *task,
unsigned long caddr)
static int preload_us_entry(struct uretprobe_instance *ri, struct pt_regs *regs)
{
- struct pd_t *pd = __get_process_data(ri->rp);
+ struct pd_t *pd = lpd_get_by_task(current);
struct hd_t *hd;
unsigned long old_pc = swap_get_upc(regs);
unsigned long flags = pt_get_flags(current);
static int preload_us_ret(struct uretprobe_instance *ri, struct pt_regs *regs)
{
- struct pd_t *pd = __get_process_data(ri->rp);
+ struct pd_t *pd = lpd_get_by_task(current);
struct sspt_ip *ip = container_of(ri->rp, struct sspt_ip, retprobe);
struct dentry *dentry = ip->desc->info.pl_i.dentry;
struct hd_t *hd;
static struct dentry *uihv_dentry = NULL;
-static inline struct pd_t *__get_process_data(struct uretprobe *rp)
-{
- struct sspt_ip *ip = urp_to_ip(rp);
- struct sspt_proc *proc = ip_to_proc(ip);
-
- return lpd_get(proc);
-}
-
/* ============================================================================
* = ui_viewer =
*/
static int uihv_main_eh(struct uretprobe_instance *ri, struct pt_regs *regs)
{
- struct pd_t *pd = __get_process_data(ri->rp);
+ struct pd_t *pd = lpd_get_by_task(current);
struct hd_t *hd;
unsigned long old_pc = swap_get_upc(regs);
unsigned long vaddr = 0;
static int uihv_main_rh(struct uretprobe_instance *ri, struct pt_regs *regs)
{
- struct pd_t *pd = __get_process_data(ri->rp);
+ struct pd_t *pd = lpd_get_by_task(current);
struct hd_t *hd;
if (uihv_dentry == NULL)