已关闭
[Bug-Report|缺陷反馈][工具检测]: simd_simt_gather_and_adds存在内存越界 #1743
liusa002创建于 8 天前关闭于 6 天前
6 天前 将 ruoshuisixue 设为负责人
6 天前 移除了负责人 shaonaite
ruoshuisixue
6 天前 评论:
6 天前 评论:
使用c65e4db9已复现问题,代码中ub的申请为4096,申请为2048,后续代码整改过程中已发现问题整改,最新代码已修复此问题,可以使用最新版进行复测


ruoshuisixue
6 天前 评论:
6 天前 评论:
最新代码已修复此问题,issue先关闭,如有问题后续可通过issue在进行交流


6 天前 issue状态由 待办的 改变为 已完成
6 天前 关闭了 issue
2 天前 关联了pull request:SIMD与SIMT混合算子实现资料优化
2 天前 删除了关联的pull request:SIMD与SIMT混合算子实现资料优化
Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
Describe the current behavior / 问题描述 (Mandatory / 必填)
使用内存检测拉起算子,报了512条非法写,非误报,需要算子修复。
Environment / 环境信息 (Mandatory / 必填)
Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
1.下载并安装CANN包
https://cmc-szv.clouddragon.huawei.com/cmcversion/index/releaseView?deltaId=14913606472500480&isSelect=Software
2.下载asc-devkit并切换到对应版本:

git clone https://gitcode.com/cann/asc-devkit.gitgit checkout c65e4db93.切到算子路径:
cd asc-devkit/examples/05_simd_simt_hybrid/00_introduction/simd_simt_gather_and_adds4.在
CMakeLists.txt中加上检测编译选项--cce-enable-sanitizer -g:5.编译算子并使用检测拉起:
6.能够看到类似这样的告警:
Describe the expected behavior / 预期结果 (Mandatory / 必填)
预期没有非法读告警。
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
算子168行分配的动态UB大小只有2048字节,而后续105行和111行申请UB空间各需要4096字节,因此gather_output前512个thread写满2048字节,后512个threads越界,每个thread越界写4字节。将168行改为4096就不会报越界,考虑到111行也申请了UB空间,建议改为8192。
Special notes for this issue/备注 (Optional / 选填)