insmod的:init_module的失败(执行格式错误) [英] insmod: init_module failed (Exec format error)
问题描述
我能够编译内核模块银河S4内核3.4.xx,但我得到以下模块插入过程中的错误。可能有人请阐明什么在这里失踪的一些情况。
内核模块与基本的初始化和清理功能的纯HelloWorld的模块。
insmod的错误:
insmod的/data/local/tmp/testHello.ko
insmod的:init_module的/data/local/tmp/testHello.ko失败(执行格式错误)
dmesg的日志
4;> [2127.554107] TIMA:lkmauth - 启动tzapp检查内核模块;模块len为71334
&其中4是氢; [2127.554168] TIMA:lkmauth - HDR kreq之前是:e337b000
4;> [2127.554199] TIMA:lkmauth - 发送CMD(lkmauth)为cmdlen(304:320),rsplen(264:320)的ID 0x00050000,REQ(0xE352A000),可吸入悬浮粒子(0xE352A140),module_start_addr(0xE337B000)module_len 71334
3;> [2127.581909] TIMA:lkmauth - 验证失败-1
&其中4是氢; [2127.582183] TIMA:MSG = lkm_modified;结果(TIMA_RESULT = MSG = lkm_modified;)
&其中6个; [2129.417541] [debug_wake_locks]活性唤醒锁msm_otg
您的答案是正确的,在dmesg的日志:S4内核硬化只接受这些认证模块(即数字签名)。你编译的模块是不是这样签名,这样的init_module失败(虽然可以说是回归code本来可以更好 - EXEC格式错误通常是指ELF格式错误,这在技术上是不是)。
检查随附S4(/系统/ lib中/模块或/供应商/ lib目录/模块)与mod信息(在Linux上)的模块,你会看到带有签名的ELF节。这是一个功能,主流Linux也增加,在3.7。
I'm able to compile kernel module for Galaxy S4 Kernel 3.4.xx but I get following errors during module insertion. could someone please shed some light on what's missing here.
The kernel module is a plain helloworld module with basic init and cleanup functions.
insmod error:
insmod /data/local/tmp/testHello.ko
insmod: init_module '/data/local/tmp/testHello.ko' failed (Exec format error)
Dmesg logs
<4>[ 2127.554107] TIMA: lkmauth--launch the tzapp to check kernel module; module len is 71334
<4>[ 2127.554168] TIMA: lkmauth -- hdr before kreq is : e337b000
<4>[ 2127.554199] TIMA: lkmauth--send cmd (lkmauth) cmdlen(304:320), rsplen(264:320) id 0x00050000, req (0xE352A000), rsp(0xE352A140), module_start_addr(0xE337B000) module_len 71334
<3>[ 2127.581909] TIMA: lkmauth--verification failed -1
<4>[ 2127.582183] TIMA: MSG=lkm_modified; result (TIMA_RESULT=MSG=lkm_modified;)
<6>[2129.417541] [debug_wake_locks]active wake lock msm_otg
Your answer is right there in the dmesg log: The S4 kernel is hardened to only accept modules which are authenticated (i.e. digitally signed). Your compiled module is not thus signed, so init_module failed (though arguably the return code could have been better - exec format error usually means the ELF is malformed, which it technically isn't).
Check the modules that came with the S4 (/system/lib/modules or /vendor/lib/modules) with mod info (on Linux), and you'll see the ELF section with the signature. This is a feature that mainstream Linux has also added, in 3.7.
这篇关于insmod的:init_module的失败(执行格式错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!