标有“T”的内核符号在/ proc / kallsyms不导出 [英] kernel symbol marked with "T" in /proc/kallsyms is not exported
问题描述
$ grep -w machine_power_off / proc / kallsyms
ffffffff8102391b T machine_power_off
但它是未导出。卡塔尔语中的T是否足以导出符号?在其他模块中使用导出必需和足够吗?
我使用它的模块编译时带有警告:
警告:machine_power_off[/path/to/module.ko]未定义!
在主机上(3.2.0-4-amd64)我可以加载这个模块,但是在VirtualBox(3.16.0-4-amd64)上它会产生以下消息:
insmod:错误:无法插入模块module.ko:模块
中的未知符号
为什么这个模块在我的主机系统中加载,但不在VirtualBox中?
标记T
但是,为了在内核模块的代码中可用,需要使用 EXPORT_SYMBOL
或类似的。导出的符号列表与内核中所有符号的列表分开维护。
导出的符号可以在文件 / lib / modules / ;内核版本> /build/Module.symvers
。
(此文件应该存在可以针对给定内核构建内核模块的可能性)。
Symbol machine_power_off
is marked with "T" in /proc/kallsyms:
$ grep -w machine_power_off /proc/kallsyms
ffffffff8102391b T machine_power_off
But it is not exported. Is "T" in kallsyms necessary and sufficient for a symbol to be exported? Is being exported necessary and sufficient for using in other modules?
My module using it is compiled with a warning:
WARNING: "machine_power_off" [/path/to/module.ko] undefined!
On host machine (3.2.0-4-amd64) I can load this module, but on VirtualBox (3.16.0-4-amd64) it produces the following message:
insmod: ERROR: could not insert module module.ko: Unknown symbol in module
Why is this module loaded in my host system, but not in VirtualBox?
Mark "T" in /proc/kallsyms
means that symbol is globally visible, and can be used in other kernel's code (e.g. by drivers, compiled built-in).
But for being usable in kernel module's code, symbol is needed to be exported using EXPORT_SYMBOL
or similar. List of exported symbols is maintained separately from list of all symbols in the kernel.
Exported symbols can be found in file /lib/modules/<kernel-version>/build/Module.symvers
.
(this file should exist for possibility to build kernel modules against given kernel).
这篇关于标有“T”的内核符号在/ proc / kallsyms不导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!