If you're using it explicitly (you have call of fun_1 from mod_2.ko and fun_2 from mod_1.ko ) then kernel won't let you load your modules. This is happened because it reads symbol table and look for kernel existing modules - the one you can see in /proc/kallsyms. So mod_1 has fun_2 reference and need mod_2 to be loaded. And mod_2 has fun_1 reference and need mod_1 to be loaded. There you have dependency lock)
I can think of 2 solutions for your problem:
- Take out fun_1 and fun_2 into separate module that you'll load first.
- Don't make explicit call to function. Do this implicitly with help of
find_symbol
. You declare function pointers, then you resolve that pointer in runtime with call tofind_symbol
and then you call your functions via function pointers.