EpiRootkit
By STDBOOL
Loading...
Searching...
No Matches
ftrace.h
Go to the documentation of this file.
1#ifndef FTRACE_H
2#define FTRACE_H
3
4#include <linux/file.h>
5#include <linux/ftrace.h>
6#include <linux/types.h>
7
8// Hooks and Ftrace parameters
10 const char *name; // Name of the target symbol
11 void *function; // Address of the hook function
12 void *original; // Pointer to storage for the original address
13 unsigned long address; // Resolved address of the target symbol
14 struct ftrace_ops ops;
15};
16
17#define SYSCALL_NAME(name) ("__x64_" name)
18#define HOOK_SYS(_name, _hook, _orig) { \
19 .name = SYSCALL_NAME(_name), \
20 .function = (_hook), \
21 .original = (_orig), \
22}
23
24#define HOOK(_name, _hook, _orig) { \
25 .name = (_name), \
26 .function = (_hook), \
27 .original = (_orig), \
28}
29
30extern struct ftrace_hook hooks[];
31extern size_t hook_array_size;
32
33unsigned long (*fh_init_kallsyms_lookup(void))(const char *);
34int fh_install_hook(struct ftrace_hook *hook);
35void fh_remove_hook(struct ftrace_hook *hook);
36int fh_install_hooks(struct ftrace_hook *hooks, size_t count);
37void fh_remove_hooks(struct ftrace_hook *hooks, size_t count);
38
39#endif // FTRACE_H
void fh_remove_hooks(struct ftrace_hook *hooks, size_t count)
Remove multiple ftrace hooks.
Definition ftrace.c:136
void fh_remove_hook(struct ftrace_hook *hook)
Remove an individual ftrace hook.
Definition ftrace.c:97
int fh_install_hooks(struct ftrace_hook *hooks, size_t count)
Install multiple ftrace hooks.
Definition ftrace.c:116
int fh_install_hook(struct ftrace_hook *hook)
Install an individual ftrace hook.
Definition ftrace.c:58
struct ftrace_hook hooks[]
Definition array.c:6
unsigned long(*)(const char *) fh_init_kallsyms_lookup(void)
Definition ftrace.h:33
size_t hook_array_size
Definition array.c:22
unsigned long address
Definition ftrace.h:13
const char * name
Definition ftrace.h:10
struct ftrace_ops ops
Definition ftrace.h:14
void * original
Definition ftrace.h:12
void * function
Definition ftrace.h:11