csdlock_debug 在 early_param 中使用 static_branch_enable 控制功能branch开关
在arm64上当关闭了CONFIG_SPARSEMEM_VMEMMAP=n 时启动触发panic
复现:
开启CONFIG_SPARSEMEM_EXTREME 同时关闭 CONFIG_SPARSEMEM_VMEMMAP
设置启动参数csdlock_debug=1
启动虚拟机,虚拟机在启动过程中卡死
调用栈:
virtual address ", '0' <repeats 16 times>, "
...
Call trace:
__aarch64_insn_write+0x9c/0x18c
...
static_key_enable+0x1c/0x30
csdlock_debug+0x4c/0x78
do_early_param+0x9c/0xcc
parse_args+0x26c/0x3a8
parse_early_options+0x34/0x40
parse_early_param+0x80/0xa4
setup_arch+0x150/0x6c8
start_kernel+0x8c/0x720
...
Kernel panic - not syncing: Oops: Fatal exception
__aarch64_insn_write中调用:
__nr_to_section
__pfn_to_page
phys_to_page
patch_map
__aarch64_insn_write
__nr_to_section 返回NULL并导致空指针引用,因为返回的mem_section在 sparse_init 之后初始化的,晚于parse_early_param的阶段。
因此 static_branch_enable 不应该在 early_param 阶段使用,将 early_param 改为 __setup 以规避此问题。
Hi chenzhongjin641354, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers: @YangYingliang , @pi3orama , @成坚 (CHENG Jian) , @jiaoff , @zhengzengkai , @Qiuuuuu , @刘勇强 , @Xie XiuQi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论