标有“T"的内核符​​号在/proc/kallsyms 中没有导出 [英] kernel symbol marked with "T" in /proc/kallsyms is not exported

查看:32
本文介绍了标有“T"的内核符​​号在/proc/kallsyms 中没有导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

符号machine_power_off/proc/kallsyms中用T"标记:

$ grep -w machine_power_off /proc/kallsyms 
ffffffff8102391b T machine_power_off

但它未导出.kallsyms 中的T"对于要导出的符号是否必要和充分?导出在其他模块中使用是否必要和充分?

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!

在主机 (3.2.0-4-amd64) 上我可以加载这个模块,但在 VirtualBox (3.16.0-4-amd64) 上它产生以下消息:

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

为什么这个模块加载在我的主机系统中,而不是在 VirtualBox 中?

Why is this module loaded in my host system, but not in VirtualBox?

推荐答案

/proc/kallsyms中标记T"表示该符号是全局可见的,可以在其他内核中使用代码(例如通过驱动程序,编译内置).

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).

但是为了在内核模块的代码中可用,需要使用EXPORT_SYMBOL或类似方法导出符号.导出的符号列表与内核中所有符号的列表分开维护.

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.

导出的符号可以在文件 /lib/modules//build/Module.symvers 中找到.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆