如果两个内核模块导出相同的符号会发生什么 [英] What will happen if two kernel module export same symbol
本文介绍了如果两个内核模块导出相同的符号会发生什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果两个内核模块包含EXPORT_SYMBOL(a),则a定义为:int a,如果插入两个模块会发生什么?将使用哪个"a"?
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?
推荐答案
您不能在内核中插入重复的符号.示例:
You can't insert duplicate symbols into the kernel. Example:
nwatkins@kyoto:~$ lsmod | grep xor
xor 4685 1 async_xor
xor
模块中导出的xor_blocks
符号
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
我创建的模块中的另一个导出的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
从insmod
报告的错误
Error reported from insmod
nwatkins@kyoto:~$ sudo insmod mod-t1.ko
insmod: error inserting 'mod-t1.ko': -1 Invalid module format
来自dmesg
的重复错误消息
Duplicate error message from dmesg
[422002.174033] mod_t1: exports duplicate symbol xor_blocks (owned by xor)
这篇关于如果两个内核模块导出相同的符号会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文