Commit 6c637138 authored by 恒宇 梁's avatar 恒宇 梁
Browse files

achieve real global variables

parent 09e77d26
......@@ -3651,8 +3651,9 @@ long do_mkdirat(int dfd, const char __user *pathname, umode_t mode)
{
/////////////////////change start:
if (print_flag_namei == 0){
printk("from namei, address of print_flag_namei: %llu\n", &print_flag_namei);
printk("from namei, number of flag_openat_sBPF: %d\n", get_flag_openat_sBPF());
printk("from namei: address of print_flag: %llu\n", &print_flag);
printk("from namei: address of flag_openat_sBPF: %llu\n", &flag_openat_sBPF);
printk("from namei: address of sBPF_hook_openat_prog: %llu\n", &sBPF_hook_openat_prog);
print_flag_namei = 1;
}
/////////////////////change end
......
......@@ -1162,24 +1162,15 @@ EXPORT_SYMBOL(file_open_root);
///////////////////////////////////change start:
int flag_openat_sBPF = 0;
const char* (*sBPF_hook_openat_prog)(const char * filename) = NULL;
int print_flag = 0;
int get_flag_openat_sBPF()
{
return flag_openat_sBPF;
}
void set_flag_openat_sBPF(int num)
{
flag_openat_sBPF = num;
}
EXPORT_SYMBOL(get_flag_openat_sBPF);
EXPORT_SYMBOL(set_flag_openat_sBPF);
static const char* (*sBPF_hook_openat_prog)(const char * filename)=NULL;
EXPORT_SYMBOL(flag_openat_sBPF);
EXPORT_SYMBOL(sBPF_hook_openat_prog);
EXPORT_SYMBOL(print_flag);
//////////////////////////////////change end
int print_flag = 0;
////////////////////////////////////
static long do_sys_openat2(int dfd, const char __user *filename,
......
......@@ -91,8 +91,9 @@ extern int sysctl_protected_regular;
//static int flag_openat_sBPF=0;
//static const char* (*sBPF_hook_openat_prog)(const char * filename)=NULL;
extern int get_flag_openat_sBPF(void);
extern void set_flag_openat_sBPF(int num);
extern int flag_openat_sBPF;
extern const char* (*sBPF_hook_openat_prog)(const char * filename);
extern int print_flag;
/////////////////////////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment