已合并
support mark mount entry flags by dec. #2902
support mark mount entry flags by dec. #2902
已合并
AsterNighT创建于 1 天前
AsterNighT
AsterNighT
1 天前

相关的Issue

#2105

原因(目的、解决的问题等)

appspawn 完成沙箱挂载后未向 DEC 子系统的 /dev/dec 设备下发路径类型标记,文件系统无法区分 UGC / isolate 类型的挂载路径,导致基于路径标签的安全隔离策略无法生效。详见 #2105。

描述(做了什么,变更了什么)

modules/common/appspawn_isolate.c 中新增通过 DEC ioctl 标记挂载项路径类型的能力:

  1. 新增路径类型宏:SEC_UGC_PATH_TYPE (1 << 0)、SEC_ISOLATE_PATH_TYPE (1 << 1)
  2. 新增路径信息表:
    • g_ugcPathInfos/storage/Users/currentUser → UGC 类型
    • g_isolatePathInfos/storage/Users/currentUser/data/storage/el1/base/data/storage/el2/base → isolate 类型
  3. 新增 SetMark():打开 /dev/dec,通过 ADD_PATH_MARK_CMD ioctl 批量下发路径标记,失败仅打印告警日志(不阻断启动流程)
  4. 新增 SpawnSetPathMark() hook,注册到 STAGE_CHILD_EXECUTE + HOOK_PRIO_SANDBOX_MARK_PATH 阶段,位于 MarkSandboxMounts 之前,确保在 sandbox 挂载之后、setuid 之前完成标记下发

变更文件:

  • modules/common/appspawn_isolate.c(+52 行)

测试用例(新增、改动、可能影响的功能)

  • 可能影响功能:appspawn 子进程沙箱挂载流程(STAGE_CHILD_EXECUTE 阶段)、DEC 路径标记行为
  • 建议关注:冷启动场景下 /dev/dec ioctl 调用时序、UGC/isolate 路径标记是否生效、open(/dev/dec) 失败时不阻断 app 启动(仅告警)
  • 建议补充 test/unittest/ 中针对 SpawnSetPathMark 的单测,以及 test/moduletest/ 中 DEC 路径标记的模块测试

image.png

likedislike
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 AsterNighT 的贡献)
AsterNighTAsterNighT
1 天前 关联了issue:支持通过 DEC 标记挂载项路径类型 (UGC/isolate)
AsterNighT
AsterNighT
1 天前 评论:

start build

likedislike
openharmony_ciopenharmony_ci成员
1 天前 添加了label:waiting_on_author
openharmony_ci
openharmony_ci成员
1 天前 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
1 天前 添加了label:dco检查成功
此处折叠了76条消息 查看更多
Wwangfenging成员
1 天前 通过审查
openharmony_ciopenharmony_ci成员
1 天前 关闭了关联的issue
openharmony_ciopenharmony_ci成员
1 天前 合入了pull request,合并节点 SHA:802434c49112d209eb97b07414987a3ea3368b33
openharmony_ciopenharmony_ci成员
1 天前 删除了label:waiting_for_review
openharmony_ciopenharmony_ci成员
1 天前 添加了label:merged