您的位置:首页 > 其它

kprobe探测中使用offset存在兼容性问题

2012-11-23 10:48 316 查看
kprobe通过插入内核模块来做探测内核的工作。

使用offset成员,可以来指定从symbol指定的函数开始,距离该函数offset的位置的指令。

在kprobe的文档里有这么一句话:

Use the "offset" field of struct kprobe if the offset into the symbol to install a probepoint is known. This field is used to calculate the probepoint.

这里就存在一个问题。。兼容性。不同版本的内核,探测同一条指令时所需要的offset 是不一样的。

所以说如果使用kprobe来做内核探测,使用了offset之后,基本上只能在本系统中用。

把相同的代码(即不改变offset的情况)放到另外一个内核版本的系统中运行,插入模块时报错。

insmod:error inserting 'kprobe_switch_1.ko' : -1 Invalid or incomplete multibyte or wide character
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐