We have written a number of kernel modules and many with exported symbols that all work fine except for 2 symbols (which is baffling). We have exported them as all the others but the 2 symbols are not globally exported once they are inserted into the kernel.
In our C code we have (in wdt.ko):
EXPORT_SYMBOL(WDT_Enable);
EXPORT_SYMBOL(WDT_Disable);
If we run nm
on the generated kernel object, they appear correctly:
nm wdt.ko | grep WDT
00000000 T WDT_Enable
00000000 T WDT_Disable
This should mean that those symbols are globally exported. Once we insmod the kernel object:
# insmod wdt.ko
# insmod apphandler.ko
apphandler: Unknown symbol WDT_Enable
apphandler: Unknown symbol WDT_Disable
If we look at the kallsyms:
# cat /proc/kallsyms | grep WDT
c12504dc t WDT_Enable [wdt]
c12502d8 t WDT_Disable [wdt]
Once they are inside the kernel, they are not global.
We have confirmed that correct file is being inserted into the kernel and that the functions are visible in the same module, but we cannot explain why the symbols suddenly become local and not global like nm
suggests.
Does anyone know where our error might be?