I am trying to test getname
in a kernel module. My code for the hijacked system call looks like:
asmlinkage long (*real_open)(const char __user *, int, int);
struct filename *getname_filename;
asmlinkage long hijacked_open(const char __user *filename, int flags, int mode) {
getname_filename = getname(filename);
printk("Opened: %s", getname_filename->name);
return real_open(filename, flags, mode);
}
The code compiles without any problems, but when I insert the module using insmod
, I get the error Unknown symbol in module
with AND without the printk
line. But in /proc/kallsyms
, I can find getname
, so it IS exported. Why can't I use it and how can I use it?
I am using Ubuntu 16.04.