If two kernel module contain EXPORT_SYMBOL(a), a is defined as: int a, what will happen if two module was inserted? which "a" will be used?
+1
A:
The
The exported
Another exported
Error reported from
Duplicate error message from
You can't insert duplicate symbols into the kernel. Example:
The xor
module loaded in my kernel
nwatkins@kyoto:~$ lsmod | grep xor
xor 4685 1 async_xor
The exported xor_blocks
symbol in the xor
module
nwatkins@kyoto:~$ nm /lib/modules/2.6.32-24-generic/kernel/crypto/xor.ko | grep xor_blocks
0000000000000000 r __kcrctab_xor_blocks
0000000000000000 r __kstrtab_xor_blocks
0000000000000000 r __ksymtab_xor_blocks
0000000000000bb0 T xor_blocks
Another exported xor_blocks
symbol in a module I created
nwatkins@kyoto:~$ nm mod-t1.ko | grep xor
0000000000000000 r __kcrctab_xor_blocks
0000000000000000 r __kstrtab_xor_blocks
0000000000000000 r __ksymtab_xor_blocks
0000000000000000 T xor_blocks
Error reported from insmod
nwatkins@kyoto:~$ sudo insmod mod-t1.ko
insmod: error inserting 'mod-t1.ko': -1 Invalid module format
Duplicate error message from dmesg
[422002.174033] mod_t1: exports duplicate symbol xor_blocks (owned by xor)
Noah Watkins
2010-08-13 14:50:30