在开启 ASAN(AddressSanitizer)的运行环境下,KernelMgr::LoadStaticBinJson() 加载静态内核配置 JSON 时存在卡死问题。
KernelMgr::LoadStaticBinJson()
原实现中,函数在拼装出配置文件路径 configJsonPath(<staticKernelBasePath>/static_kernel/ai_core/config/<socPath>/binary_info_config.json)后,直接使用 ifstream f(configJsonPath) 打开文件并调用 nlohmann::json::parse(f) 解析。当该配置文件实际不存在时,文件打开与解析流程在 ASAN 场景下会触发异常并导致进程卡死,无法正常返回。
configJsonPath
<staticKernelBasePath>/static_kernel/ai_core/config/<socPath>/binary_info_config.json
ifstream f(configJsonPath)
nlohmann::json::parse(f)
OpKernelLib::GetInstance().GetSocPath()
json::parse(f)
ACLNN_SUCCESS
当静态内核配置 JSON 文件不存在时,LoadStaticBinJson() 应能正常返回,不应进入会触发异常并导致进程卡死的文件打开与解析流程。
LoadStaticBinJson()
在 ASAN 场景下复现时,表现为进程卡死于 LoadStaticBinJson 的文件打开与解析流程,无法正常返回。
LoadStaticBinJson
关联 PR:https://gitcode.com/cann/opbase/pull/689
/assign @ren-botao
Describe the current behavior / 问题描述
在开启 ASAN(AddressSanitizer)的运行环境下,
KernelMgr::LoadStaticBinJson()加载静态内核配置 JSON 时存在卡死问题。原实现中,函数在拼装出配置文件路径
configJsonPath(<staticKernelBasePath>/static_kernel/ai_core/config/<socPath>/binary_info_config.json)后,直接使用ifstream f(configJsonPath)打开文件并调用nlohmann::json::parse(f)解析。当该配置文件实际不存在时,文件打开与解析流程在 ASAN 场景下会触发异常并导致进程卡死,无法正常返回。Environment / 环境信息
OpKernelLib::GetInstance().GetSocPath()动态获取,无固定型号)Steps to reproduce the issue / 重现步骤
KernelMgr::LoadStaticBinJson()所拼装的配置文件路径<staticKernelBasePath>/static_kernel/ai_core/config/<socPath>/binary_info_config.json在文件系统中不存在(例如对应 SoC 的静态内核配置未生成);ifstream f(configJsonPath)及后续json::parse(f);ACLNN_SUCCESS。Describe the expected behavior / 预期结果
当静态内核配置 JSON 文件不存在时,
LoadStaticBinJson()应能正常返回,不应进入会触发异常并导致进程卡死的文件打开与解析流程。Related log / screenshot / 日志 / 截图
在 ASAN 场景下复现时,表现为进程卡死于
LoadStaticBinJson的文件打开与解析流程,无法正常返回。Special notes for this issue/备注
关联 PR:https://gitcode.com/cann/opbase/pull/689