已开启
ssam virtio-fs fsdev #29
thomson437创建于 7 天前
ssam virtio-fs fsdev #29
已开启
thomson437创建于 7 天前
thomson437
7 天前

当前PR是否有AI参与:

[x] 否

[ ] 是
__1. AI Agent 平台:
__2. AI 模型:
__3. Prompt上下文 :

参考:openEuler社区《生成式AI工具使用与开源贡献政策》

PR功能描述 / 为什么需要这个合入**:

该PR关联的issue

(格式为fixes #<issue号>, 或者resolves #<issue号>): fixes #

希望检视人员了解:

likedislike
合并受阻
Tthomson437
7 天前 创建了 pull request,commit d0f3c788
atomgit-bot
atomgit-bot
7 天前 评论:

变更摘要

本 PR(#29)仅包含一处改动:在 dpu-spdk-25.09/ 目录下新增补丁文件 0002-ssam_fsdev.patch,共新增 3544 行。从 PR 标题"ssam virtio-fs fsdev"推断,该改动主要围绕 virtio-fs 的 fsdev(文件系统设备)支持展开,服务于 SSAM 相关场景。由于任务中未嵌入该补丁的实际内容,且 PR 功能描述为空,本摘要仅能基于标题、文件路径与增删统计进行概括,无法确认具体实现细节。

主要改动

  • 新增补丁文件 0002-ssam_fsdev.patch:在 dpu-spdk-25.09/ 目录下新增一个 3544 行的补丁文件,这是本 PR 的全部代码改动。
  • 围绕 virtio-fsfsdev 的主题方向:根据 PR 标题,该补丁内容与 virtio-fs 的 fsdev(文件系统设备)支持相关,可能涉及 SSAM 场景下的文件系统设备配置或接入。
  • 补丁内容未嵌入:任务中的补丁内容为空(The file is empty),且 PR 描述未提供功能说明,因此该补丁内部的具体接口、数据结构或配置变更无法从现有材料中确认。
likedislike
atomgit-bot
atomgit-bot
7 天前 评论:

代码审查

关闭总结

已审阅文件:

  • dpu-spdk-25.09/0002-ssam_fsdev.patch(新增,+3544 行)—— 已逐段审阅全部内容(Makefile、include/spdk/ssam.hlib/ssam/ssam.cssam_config.c/h、新增 ssam_fs.c(1921 行)、ssam_fs_internal.hssam_internal.hssam_rpc.cpython/spdk/rpc/ssam.pyscripts/hw_dpu_rpc.py)。该 patch 为 SPDK SSAM 引入 virtio-fs 设备支持(fsdev/fuse 数据通路、fs 会话、fs 控制器 RPC、FLR 轮询、共享内存 remount 等)。

发现问题数(共 9 条):

  • P0:0
  • P1:0
  • P2:4 条
    • fsdev_destroy 使用未初始化的全零 name 调用 shm_open,FUSE_DESTROY 请求必然失败、FLR/销毁场景下后端挂载永不拆除(0.85)
    • ssam_fs_destory 无锁且重复 delete 会重复注册 pf_poller,导致请求被重复 complete、首次 RPC 无应答(0.50)
    • ssam_dev_io_scan_poller 直接 close() 客户机伪造的 fh,可关闭宿主任意 fd(安全,0.50)
    • dynamic_buf mempool 分配失败仍将 NULL 缓冲提交给 fuse dispatcher,可能崩溃(0.50)
  • P3:5 条
    • ssam_fs_construct err_out 路径对已释放 session 的 use-after-free 读取(0.55)
    • spdk_ssam_fs_poller_destroy 在 virtio-fs 未启用时关闭 fd 0(stdin)(0.70)
    • ssam_fs_shm_ctx_load 缓冲区尺寸不匹配 + 失败路径泄漏 _ctx/mmap(0.60)
    • ssam_fs_construct 在 gfunc_id 校验前取 fsdev_map[gfunc_id] 地址(0.45)
    • spdk_ssam_fs_poller_init mmap 失败后未复位 flr_fd 导致 double-close(0.50)

总体风险判断: 该 patch 体量大且涉及设备热插拔/FLR/异步 DMA/共享内存等多条高复杂度路径,存在若干确定性缺陷(其中 fsdev_destroy 的函数失效最为明确),以及错误路径上的内存安全与并发问题。部分缺陷(如 fd 误关、NULL 缓冲提交、UAF)在特定触发条件(FLR、重复 delete、内存压力、客户机异常)下可导致进程崩溃或资源泄漏。建议合入前重点修复 P2 级别问题,并对 fsdev 的创建/销毁/FLR 全链路补充错误路径测试。

类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论

likedislike
openeuler-ci-botopeneuler-ci-bot成员
7 天前 将VICTORY2017,mszjaas,swf504,liuzhiqiang26,louhongxiang,kouwq,dragon1147e3设为审查人
openeuler-ci-botopeneuler-ci-bot成员
7 天前 添加了label:sig/Storage
openeuler-ci-bot
openeuler-ci-bot成员
7 天前 评论:

Welcome To openEuler Community

Hey @thomson437 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: Storage ,
and any of the maintainers: @VICTORY2017, @dragon1147e3, @kouwq, @liuzhiqiang26, @louhongxiang, @mszjaas, @swf504 ,
and any of the committers: @budaikedewoniu, @hu-xiujie, @lijie_printk .

likedislike
openeuler-ci-botopeneuler-ci-bot成员
7 天前 添加了label:openeuler-cla/yes
openeuler-ci-bot
openeuler-ci-bot成员
7 天前 评论:

CLA Signature Pass

thomson437, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
openeuler-ci-botopeneuler-ci-bot成员
7 天前 添加了label:ci_processing
openeuler-ci-bot
openeuler-ci-bot成员
7 天前 评论:

门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/openeuler/trigger/spdk/135/console

likedislike
atomgit-bot
atomgit-bot7 天前进行代码检视1
dpu-spdk-25.09/0002-ssam_fsdev.patch
@@ -0,0 +1121,4 @@
1121++ if (shm_fd < 0 || fsdev_obj->have_shm == true) {
1122++ close(shm_fd);
1123++ return;
1124++ }
atomgit-bot
atomgit-bot7 天前评论:

🟡 Medium Priority

changed line:fsdev_destroy() 中第 1114 行声明 char name[SHM_NAME] = {0};,随后第 1120 行直接 shm_fd = shm_open(name, O_RDWR, 0600);name 从未被填充(对比 ssam_fuse_share_memory 第 930 行与 ssam_fs_read_shm_mem 第 1866 行都有 snprintf(name, sizeof(name), "shm_name%d", ...))。空字符串传给 shm_open 返回 EINVAL,shm_fd < 0 恒成立,函数在第 1122 行 close(shm_fd) 后立即返回。

affected behavior/contract:fsdev_destroy 的唯一职责是读取共享内存中的 mount 信息并构造 FUSE_DESTROY 请求提交给 fuse dispatcher,以便在 FLR / 主机重启场景下通知后端拆除挂载、关闭已打开的文件描述符。它被 ssam_fs_flr_poller(第 2234 行)和 udaa_eml_queue_progress_retrieve(第 1232 行,检测到 flr_seq 变化且 mounted 时)调用。

failure mode:任何调用都静默失败,DESTROY 请求从不发送,但调用方仍会执行 fsdev_map[i].mounted = false;,导致后端文件/句柄泄漏、挂载状态与实际不符,FLR 场景下可能造成数据一致性问题;同时 fsdev_destroy 实际成为死代码。

suggested fix:在 shm_open 之前补上 snprintf(name, sizeof(name), "shm_name%d", fsdev_obj->gfunc_id);,并复核 shm_fd < 0 || fsdev_obj->have_shm == true 的早退条件是否符合预期(have_shm 为 true 时也需要下发 DESTROY)。

建议:在 shm_open 前用 gfunc_id 构造共享内存名,并复核 have_shm 早退逻辑。

改动建议
1124
+ snprintf(name, sizeof(name), "shm_name%d", fsdev_obj->gfunc_id);
1124
- + }
1125
+ shm_fd = shm_open(name, O_RDWR, 0600);
应用建议
likedislike
openeuler-ci-botopeneuler-ci-bot成员
7 天前 删除了label:ci_processing
openeuler-ci-bot
openeuler-ci-bot成员
7 天前 评论:
Check Name Build Result 详情 Build Details
check_sca SUCCESS #135
check_code SUCCESS
check_package_license WARNING • 仓库copyright检查未通过: spdk/dpu-spdk-25.09/0002-ssam_fsdev.patch、spdk/dpu-spdk-25.09/0002-ssam_fsdev.patch、spdk/dpu-spdk-25.09/0002-ssam_fsdev.patch文件Copyright校验不通过, Copyright path:缺少项目级Copyright声明文件
x86_64 check_build SUCCESS #135
aarch64 check_build SUCCESS #137
likedislike
openeuler-ci-botopeneuler-ci-bot成员
7 天前 添加了label:ci_successful
openeuler-ci-bot
openeuler-ci-bot成员
7 天前 评论:
likedislike