问题现象:

通过 insmod 加载 XXX.ko 时候提示:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

hello: module verification failed: signature and/or required key missing - tainting kernel

 

问题原因:

自 3.7 内核之后有了内核签名机制。

编译内核时 .config 中有跟内核签名相关的选项有如下:

CONFIG_MODULE_SIG=y
# CONFIG_MODULE_SIG_FORCE is not set
CONFIG_MODULE_SIG_ALL=y

 

 

如何解决:

往 XXX.ko 中添加签名

/usr/src/linux-4.9.61/scripts/sign-file sha512 /usr/src/linux-4.9.61/certs/signing_key.pem /usr/src/linux-4.9.61/certs/signing_key.x509 hello.ko

 

参考文档:

https://blog.csdn.net/lyw13522476337/article/details/79486326

https://blog.csdn.net/Zhu_Zhu_2009/article/details/84884108

https://www.ibm.com/developerworks/cn/linux/l-cn-kernelmodules/

https://bbs.csdn.net/topics/392179473?page=1

https://www.cnblogs.com/zengkefu/p/5859954.html

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄