I have a kernel module which was probably written for the 2.6xx kernel version. Now I currently want to plug that module onto kernel version 3.1x and above. I have tweaked and changed the code and apparently now there is compilation error except the below mentioned warnings.
WARNING: "do_mmap_pgoff" [/home/abdullah/Downloads/my_mod.ko] undefined!
WARNING: "putname" [/home/abdullah/Downloads/my_mod.ko] undefined!
WARNING: "get_task_cred" [/home/abdullah/Downloads/my_mod.ko] undefined!
Now when I checked my kernel Module.symvers I did not find all three of the functions in it for exports. Which results in a fatal error when inserting the module. Now my question: Does anybody know the alternative to these functions? Any help will be really appreciated. Below is a sample function which illustrates the scenario as the complete function is to long.
int function_1(const char *fname)
{
struct cred *task_cred;
struct filename *filename = NULL;
filename = getname(__user(fname));
task_cred = (struct cred *)get_task_cred(current);
putname(filename);
filename = NULL;
return 1;
}
嗯,还有另一种方法是有点不安全的,任何不在生产系统上的人都可以像我一样将这些函数导出到内核源文件中
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.