已合并
fix(kernel_mgr): 修复 ASAN 场景下 LoadStaticBinJson 抛异常时卡死的问题 #689
ren-botao创建于 7月31日
fix(kernel_mgr): 修复 ASAN 场景下 LoadStaticBinJson 抛异常时卡死的问题 #689
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 ren-botao 的贡献)atomgit-bot
7月31日 评论:
7月31日 评论:
变更摘要
本 PR 主要修复 ASAN 场景下 KernelMgr::LoadStaticBinJson 抛异常时卡死的问题。改动在打开静态内核配置 JSON 文件前,先通过 RealPath(configJsonPath) 校验路径并解析出真实路径,当文件不存在时打印告警并提前返回 ACCLNN_SUCCESS,从而绕开可能触发异常并导致卡死的文件打开与解析流程;同时将 ifstream 改为使用真实路径打开,并将局部变量由 string 统一规范为 std::string。
主要改动
- 新增真实路径校验:在打开配置文件前新增
std::string realConfigJsonPath = RealPath(configJsonPath),提前确认配置 JSON 路径有效性,避免 ASAN 场景下抛异常导致卡死。 - 路径不存在时提前返回:通过
OP_CHECK判断realConfigJsonPath为空时打印告警日志并直接返回ACCLNN_SUCCESS,不再进入nlohmann::json::parse的文件读取流程。 - 改用真实路径打开文件:将
ifstream f(configJsonPath)改为ifstream f(realConfigJsonPath),日志中输出的路径也同步改为realConfigJsonPath.c_str()。 - 类型规范化:将
staticKernelBasePath、configJsonPath两个局部变量的声明由string改为std::string。


不准确?
atomgit-bot
7月31日 评论:
7月31日 评论:
7月31日 添加了label:cann-cla/yes
CANN-robot
7月31日 评论:
7月31日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/opbase | ✅ 宋恺, 张磊 (2/2) | ✅ 宋恺, 张磊 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


CANN-robot
7月31日 评论:
7月31日 评论:
7月31日 将zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng设为评审人
7月31日 将zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng设为评审人
7月31日 将zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng设为审查人
7月31日 将zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng设为审查人
8月4日 添加了label:ci-pipeline-running
CANN-robot
8月4日 评论:
8月4日 评论:
流水线任务触发成功
任务链接 [aaeb1ace755746daab04495a5f60d627][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| precommit | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> |
[2026-08-04 09:48:16] CI执行结束


8月4日 添加了label:api-check-pass
8月4日 删除了label:ci-pipeline-running
8月4日 添加了label:ci-pipeline-passed
CANN-robot
8月4日 评论:
8月4日 评论:
流水线 PR-pipeline_cann_opbase#1594 [ commitID:5d3cfbbd ] 已完成


songkai111
8月4日 评论:
8月4日 评论:
/approve


8月4日 添加了label:approved
8月4日 添加了label:lgtm
8月4日 关闭了关联的issue
8月4日 合入了pull request
描述
修复 ASAN 场景下
KernelMgr::LoadStaticBinJson()在静态内核配置 JSON 文件不存在时,文件打开与解析流程触发异常导致进程卡死的问题。改动在打开配置文件前先通过RealPath(configJsonPath)校验路径,文件不存在时打印告警并提前返回ACLNN_SUCCESS,绕开会触发异常的文件打开与解析流程。关联的Issue
#295 修复 ASAN 场景下 KernelMgr::LoadStaticBinJson 抛异常时卡死的问题
测试
冒烟、端到端验证ASAN场景下是否还会卡死
文档更新
不涉及
类型标签