Issue
Is it possible in a linux kernel module to get the pointer of a function exported by another kernel module (something like cat /proc/kallsyms
) but with api calls. Also if it would be possbile to load the intended module into memory if it doesn't exist.
Basically what i am trying to do is to introduce a soft dependency between 2 modules. so i can execute one with or without the other.
Solution
Yes, this is possible. Using following Linux Kernel APIs,
- Using
find_symbol
API, you can search for desired symbol exists or not - If it fails to find symbol, then you can try to load desired module which exports symbol which you intended to use using APIs called
find_module
andrequest_module
. Here is sample code for these APIs here
Answered By - Abhijeet Kasurde Answer Checked By - Robin (WPSolving Admin)