海思固件 V500R020,内核 4.4.197 ,加载 外部 自编译模块, 显示 PLT sections 问题

2021-07-01 09:54:19 +08:00
 guanyin8cnq12
linux 官方内核 4.4.197 中 arch/arm/kernel/module.lds 的内容是
SECTIONS {
.core.plt : { BYTE(0) }
.init.plt : { BYTE(0) }
}

编译成的 ko 模块,在海思中运行提示 错误。

module PLT section(s) missing

随便找一个海思固件中的 ko,拖到 ida 里查看,section 里 只能查到 .plt 和 .init.plt 。

尝试修改 arch/arm/kernel/module.lds 中的 .core.plt 为 .plt
能加载,但是,用 lsmod 查看,模块加载是失败的,显示 -1 。
dmsg 查看日志,显示

[ 5188.608302] ------------[ cut here ]------------
[ 5188.608360] WARNING: CPU: 1 PID: 10602 at kernel/module.c:1105 module_put+0x78/0x13c()
[ 5188.608373] Modules linked in: getshell(O) ...
[ 5188.609581] CPU: 1 PID: 10602 Comm: insmod Tainted: P W O 4.4.197 #1
[ 5188.609597] Hardware name: Hisilicon A9
[ 5188.609649] [<c0012d3c>] (rtos_unwind_backtrace) from [<c000e518>] (show_stack+0x10/0x14)
[ 5188.609686] [<c000e518>] (show_stack) from [<c023cd20>] (dump_stack+0x88/0xa8)


查阅了相关 Tainted P W O 似乎与问题无关。

我想可能还是修改的 sections 有问题。
将 core.plt 修改成 plt 虽然没报 PLT section(s) missing,但是似乎内核找不到相关 section 定义的内容。
问题非常奇怪,有米有知道的,望不吝赐教。

相关研究在这里,我已经 push 到 github
https://github.com/0neday/Exploit-HS8545M-ONT/tree/main/persist-root-shell/linux-4.4
1357 次点击
所在节点    程序员
3 条回复
ihipop
2021-07-01 11:54:22 +08:00
你是用的海狮官方 kernel header 编译的吗?如果是用官方的 Linux 内核代码编译,你怎么绕过海狮 Linux 内核的 magic ver 检测的?
guanyin8cnq12
2021-07-01 12:12:12 +08:00
@ihipop 不需要绕,直接在 config 里配。 第一次编译,不知道 magic,没关系,用 dmsg 查看,会有提示,你照着提示修改 config 就行了。很简单。
btworm
2021-11-18 00:10:11 +08:00
@guanyin8cnq12
config.gz 找到了,但您提到的用"dmesg 查看,...照着提示修改 config", 不大明白什么意思。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/786837

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX