Closed
修复 MoeGatingTopKSoftmax V1/V2 tiling 的 rawTilingData 判空缺失 #8634
何宇航Add on  4 days agoClosed at  2 days ago
何宇航
何宇航Collaborators
4 days ago Create

Describe the current behavior / 问题描述 (Mandatory / 必填)

MoeGatingTopKSoftmax 及 V2 的多条 tiling 路径直接解引用 GetRawTilingData() 返回值。在该接口返回空指针的异常上下文中,序列化和设置数据长度前缺少检查,存在空指针解引用风险。

Environment Information / 环境信息 (Mandatory / 必填)

  • 昇腾硬件型号:Ascend 910B(A2)
  • CANN 版本:9.3.0
  • 代码分支:master

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

  1. 构造输入、属性、平台信息和 workspace 有效的 tiling 上下文,将 rawTilingData 输出对象设为空。
  2. 调用 MoeGatingTopKSoftmax 或 V2 的 tiling 入口。
  3. 对应 PostTiling 路径直接调用 GetRawTilingData()->GetData() 等接口,缺少异常返回检查。

Describe the expected behavior / 预期结果 (Mandatory / 必填)

获取并缓存 rawTilingData,使用 OP_CHECK_NULL_WITH_CONTEXT 判空;为空时返回失败,非空时继续序列化。

补充判空后,Host UT 96/96 通过,包含 V1/V2 的正常缓冲区和空 rawTilingData 回归验证;A2 两个算子的包构建通过;原有 ATK 精度用例 V1 200/200、V2 200/200 通过。

Special notes for this issue/备注 (Optional / 选填)

该问题针对异常上下文处理,不代表正常框架调用已复现崩溃。

关联 PR

https://gitcode.com/cann/ops-transformer/merge_requests/17065

likedislike
何宇航何宇航Collaborators
4 days ago Associated pull request
周云飞周云飞Collaborators
4 days ago Assign weixin_44156099 as responsible person
周云飞
周云飞Collaborators
4 days ago Comments:

感谢反馈。如果 GetRawTilingData() 返回空指针,如描述中那样直接调用其成员函数会导致空指针解引用;目前尚不能确认 V1/V2 各条路径的具体情况。

一个可行的处理方向是在相关 PostTiling 路径中缓存返回值,并在序列化和设置数据长度前使用 OP_CHECK_NULL_WITH_CONTEXT 判空:为空时返回失败,非空时保持原有处理逻辑。感谢提供补丁后的测试结果,我们会继续确认相关路径;该报告不代表正常框架调用已发生崩溃。

likedislike
何宇航何宇航Collaborators
4 days ago Modify description of issue
CANN-robotCANN-robotCollaborators
2 days ago Close issue
CANN-robotCANN-robotCollaborators
2 days ago changed custom state from 待办的 to 已完成
CANN-robotCANN-robotCollaborators
2 days ago Added label: resolved
周云飞
周云飞Collaborators
2 days ago Comments:

PR #17065 已为 MoeGatingTopKSoftmax V1/V2 的相关 tiling 代码补充 rawTilingData 判空:序列化前缓存 GetRawTilingData() 的返回值,判空失败时返回失败;后续序列化和设置数据大小时复用已检查的指针。

关联 PR:PR #17065

likedislike