Pull Request已成功合入, 合并人@CANN-robot
(感谢 guo-yanjun 的贡献)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/runtime | ✅ Reyn52166, 侯延保 (2/2) | ✅ Reyn52166 (1/1) |
| src/acl | ✅ Reyn52166, 侯延保 (2/2) | ✅ Reyn52166 (1/1) |
| src/dfx/error_manager/error_code.json | ✅ ycm0028, 侯延保 (2/2) | ✅ ycm0028 (1/1) |
| src/runtime | ✅ 侯延保, Reyn52166 (2/2) | ✅ Reyn52166 (1/1) |
| tests/ut/acl | ✅ Reyn52166, 侯延保 (2/2) | ✅ Reyn52166 (1/1) |
| tests/ut/runtime | ✅ Reyn52166, 侯延保 (2/2) | ✅ Reyn52166 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
guo-yanjun, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/compile


流水线任务触发成功
任务链接 [a4ca601198ec4b50b91e9e49ec88578e][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_acl | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_v201 | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_c | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_david | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_910b | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_common | ✅ SUCCESS | >>>>> | |
| UT_Test_platform | ✅ SUCCESS | >>>>> | |
| UT_Test_qs | ✅ SUCCESS | >>>>> | |
| UT_Test_aicpusd | ✅ SUCCESS | >>>>> | |
| UT_Test_tsd | ✅ SUCCESS | >>>>> | |
| UT_Test_error_manager | ✅ SUCCESS | >>>>> | |
| UT_Test_slog | ✅ SUCCESS | >>>>> | |
| UT_Test_atrace | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_part1 | ✅ SUCCESS | ||
| UT_Test_msprof_part2 | ✅ SUCCESS | ||
| UT_Test_adump | ✅ SUCCESS | >>>>> | |
| UT_Test_mmpa | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_report | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_report | ✅ SUCCESS |
[2026-06-18 15:45:17] CI执行结束


流水线任务触发成功
任务链接 [440554b8b35d4021b9c36b1e059e2d78][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Check_Pr | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS |
[2026-06-18 15:33:43] CI执行结束


Now I have thoroughly reviewed all 14 changed files. Let me compile my findings.
变更摘要
This PR focuses on Error Message related bugfixes, including removing [] brackets from error message templates, punctuation corrections, deleting the unused error code EE1008, fixing memcpy_s error reporting to use hex-formatted pointer addresses instead of string concatenation, and correcting the FillAttrValue function to use the caller's funcName parameter instead of __func__. It also adds new unit test cases for memcpy_s/strcpy_s failure paths.
主要改动
-
Error Message 格式修正(去括号/标点): 在
error_code.json、error_manager.c中,将"Value [%s] for [%s]"、"Argument [%s] must not be null"等模板中的[]括号移除;EH0012 消息中"failed, Parameter"改为"failed. Parameter"(逗号改句号)。相关的单元测试期望字符串同步更新。 -
删除无用错误码 EE1008: 从
error_code.json(RTS Errors 中 Execution_Error_Load_OP_Kernel)、error_code_meta.h(X 宏定义)和rt_log.h(ErrorCode枚举)中完全移除EE1008,相关的测试代码和引用一并清理。 -
memcpy_s/strcpy_s错误报告重构: 在tensor_data_transfer.cpp、queue.cpp、acl.cpp、group.cpp、memory.cpp中,将extendInfo从字符串拼接方式("src=" + std::to_string(...))改为std::stringstream以十六进制格式输出指针地址(如src=0x...),使错误信息更便于定位内存问题。同时将memcpy_s的 count/destMax 计算提取为独立变量以提高可读性。 -
group.cpp中FillAttrValue的funcName修复:ReportInputError调用的第一个参数从__func__(始终为"FillAttrValue")修正为函数参数funcName,使错误报告能正确显示调用方 ACL API 的函数名。 -
新增单元测试: 在
acl_common_unittest.cpp中新增aclsysGetVersionStr_CopyVersionFailed测试覆盖版本字符串长度等于ACL_PKG_VERSION_MAX_SIZE时strcpy_s失败的场景;在acl_runtime_unittest.cpp中新增aclrtGetGroupInfoDetail_Fail_MemcpySecurecRange、aclrtGetBufUserData_failed_when_memcpy_returns_error、aclrtSetBufUserData_failed_when_memcpy_returns_error测试覆盖memcpy_s返回错误的路径。
逐文件审查确认:
src/acl/acl_tdt_channel/tensor_data_transfer.cpp— no issuessrc/acl/acl_tdt_queue/queue.cpp— no issuessrc/acl/aclrt_impl/acl.cpp— no issuessrc/acl/aclrt_impl/group.cpp— no issuessrc/acl/aclrt_impl/memory.cpp— no issuessrc/dfx/error_manager/error_code.json— no issuessrc/runtime/core/inc/common/error_code_meta.h— no issuessrc/runtime/core/inc/common/rt_log.h— no issuessrc/runtime_compact/c_base/src/error_manager.c— no issuestests/ut/acl/testcase/acl_common_unittest.cpp— no issuestests/ut/acl/testcase/acl_runtime_unittest.cpp— no issuestests/ut/acl/testcase_c/acl_rt_unittest.cpp— no issuestests/ut/runtime/runtime/test/rt_error_code_test.cc— no issuestests/ut/runtime/runtime_c/testcase/c_base/error_manager_test.cc— no issues


代码审查
All EE1008 references are cleanly removed from the entire codebase. The cleanup is thorough.
审查总结
本次审查覆盖了全部 14 个变更文件,逐文件审查结论如下:
| 文件 | 审查结论 |
|---|---|
src/acl/acl_tdt_channel/tensor_data_transfer.cpp |
无问题:提取 count 变量、新增 <sstream>、日志格式改进均正确 |
src/acl/acl_tdt_queue/queue.cpp |
无问题:日志格式改进正确 |
src/acl/aclrt_impl/acl.cpp |
无问题:新增 <cstdint> 用于 uintptr_t、日志格式改进正确 |
src/acl/aclrt_impl/group.cpp |
无问题:__func__ → funcName 修复了入口函数名打印问题、日志格式改进正确 |
src/acl/aclrt_impl/memory.cpp |
无问题:提取 srcAddr/destAddr/destMax 变量为纯重构,逻辑不变 |
src/dfx/error_manager/error_code.json |
无问题:EE1008 删除、EH* 消息去括号、EH0012 逗号改句号均一致 |
src/runtime/core/inc/common/error_code_meta.h |
无问题:EE1008 X-macro 已删除 |
src/runtime/core/inc/common/rt_log.h |
无问题:EE1008 枚举值已删除 |
src/runtime_compact/c_base/src/error_manager.c |
无问题:EH* 消息去括号、注释同步更新;EK0001 保留方括号为预存差异,非本次引入 |
tests/ut/acl/testcase/acl_common_unittest.cpp |
无问题:新增测试覆盖 strcpy_s 失败路径 |
tests/ut/acl/testcase/acl_runtime_unittest.cpp |
P3×2:两个新增测试依赖 memcpy_s(dest,0,src,0) 的实现定义行为 |
tests/ut/acl/testcase_c/acl_rt_unittest.cpp |
无问题:断言消息同步去括号 |
tests/ut/runtime/runtime/test/rt_error_code_test.cc |
无问题:EE1008 相关测试代码已清理 |
tests/ut/runtime/runtime_c/testcase/c_base/error_manager_test.cc |
无问题:断言消息同步去括号 |
发现统计:P0: 0, P1: 0, P2: 0, P3: 2
整体风险评估:低风险。主体变更为错误消息格式优化(去括号、标点修正)、EE1008 错误码清理、以及 memcpy_s 调用前提取变量的纯重构。两个 P3 发现均针对新增单元测试中 memcpy_s(dest,0,src,0) 返回值依赖实现定义行为导致的潜在脆弱性,不影响生产代码正确性。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 0 |
| 🟡 建议 | 2 |
💬 仅评论


🔵 Low Priority
在 aclrtSetBufUserDataImpl(memory.cpp:1736-1737)中,当 offset=96, bufSize=96 时 destMax = 96 - 96 = 0,随后调用 memcpy_s(destAddr, 0, dataPtr, 0),即 destMax 和 count 均为 0。新增测试 aclrtSetBufUserData_failed_when_memcpy_returns_error(acl_runtime_unittest.cpp:6257)通过传入 size=0U, offset=sizeof(privateData)=96 触发此路径,并期望返回 ACL_ERROR_FAILURE。
与 GetBuf 测试同理,memcpy_s(dest, 0, src, 0) 的行为是实现定义的:C11 Annex K 在 count=0 时允许返回 EOK,而部分 securec 实现会对 destMax=0 报告约束错误。此测试不具备跨平台可移植性。
触发条件:同 GetBuf 测试,在 memcpy_s(dest, 0, src, 0) 返回 EOK 的平台上运行此测试。
建议:使用 mock 控制 memcpy_s 返回值,或改用 count > destMax > 0 的参数组合来可靠触发 memcpy_s 错误;同时在测试注释中说明当前 securec 对 destMax=0 的处理行为。


🔵 Low Priority
在 aclrtGetBufUserDataImpl(memory.cpp:1694)中,当 size=0 时调用 memcpy_s(dataPtr, 0, srcAddr, 0),即 destMax 和 count 均为 0。新增测试 aclrtGetBufUserData_failed_when_memcpy_returns_error(acl_runtime_unittest.cpp:6244)通过传入 size=0U 触发此路径,并期望返回 ACL_ERROR_FAILURE。
然而,C11 Annex K 规定当 count=0 时 memcpy_s 应返回 0(EOK),无需执行拷贝。部分实现(如某些版本的 securec)可能对 destMax=0 进行约束检查并返回错误。该测试的正确性依赖于具体 memcpy_s 实现的行为,不具备跨平台可移植性。如果 memcpy_s 实现返回 EOK,此测试将失败。
触发条件:在 memcpy_s(dest, 0, src, 0) 返回 EOK 而非错误的平台上运行此测试。
建议:使用 mock 控制 memcpy_s 返回值,或改用 count > destMax > 0 的参数组合来可靠触发 memcpy_s 错误;同时在测试注释中说明当前 securec 对 destMax=0 的处理行为。


/compile


流水线任务触发成功
任务链接 [87a4de22d3ab46f8a36751517d2f51df][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_acl | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_v201 | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_c | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_david | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_910b | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_common | ✅ SUCCESS | >>>>> | |
| UT_Test_platform | ✅ SUCCESS | >>>>> | |
| UT_Test_qs | ✅ SUCCESS | >>>>> | |
| UT_Test_aicpusd | ✅ SUCCESS | >>>>> | |
| UT_Test_tsd | ✅ SUCCESS | >>>>> | |
| UT_Test_error_manager | ✅ SUCCESS | >>>>> | |
| UT_Test_slog | ✅ SUCCESS | >>>>> | |
| UT_Test_atrace | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_part1 | ✅ SUCCESS | ||
| UT_Test_msprof_part2 | ✅ SUCCESS | ||
| UT_Test_adump | ✅ SUCCESS | >>>>> | |
| UT_Test_mmpa | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_report | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_report | ✅ SUCCESS |
[2026-06-22 09:41:40] CI执行结束


流水线任务触发成功
任务链接 [fd8d8c902673496e939c24c9e1356da6][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Check_Pr | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS |
[2026-06-22 09:36:17] CI执行结束


Pull Request
描述
Error Message相关bugfix修复:
去掉[]、标点符号修改、无用错误码删除、修改参数打出实际入口传入参数名、安全函数memcpy_s确认问题修改
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
UT测试、ErrorMessage打印测试
核对清单
其他信息
在此添加任何其他关于本次 PR 的说明。