Repository navigation
fix: keep ddm in the init mount namespace - #120
Conversation
Reviewer's GuideConfigurationRemove the systemd hardening options that place ddm in a private mount namespace, while retaining ProtectClock, so session mounts remain visible system-wide.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. ProtectKernelModules and PrivateIPC both make systemd create a private (slave) mount namespace for the unit: the former hides /usr/lib/modules, the latter needs its own mqueuefs on /dev/mqueue. Every child of ddm inherits that namespace, so mounts made in the PAM session stage, such as the dlnfs long-file-name mount, never propagate to the rest of the system. lightdm.service sets neither option and runs in the init namespace. ProtectClock only installs a seccomp filter and is kept. Log: Fix dlnfs mounts made during login being invisible to the desktop Influence: 1. Enable the long-file-name feature, log in through ddm and check that findmnt shows the dlnfs mount on the home directory 2. Verify the mount is visible to a newly started desktop application 3. Verify readlink /proc/$(pgrep -x ddm)/ns/mnt equals /proc/1/ns/mnt 4. Check that modprobe and pam_mount style mounts work inside a session fix: 让 ddm 运行在 init 挂载命名空间,与 lightdm 保持一致 1. ProtectKernelModules 和 PrivateIPC 都会让 systemd 为 unit 创建私有 (slave)挂载命名空间:前者把 /usr/lib/modules 隐藏,后者需要在 /dev/mqueue 上挂自己的 mqueuefs。ddm 的所有子进程都继承该命名空间, 于是在 PAM session 阶段做的挂载(如 dlnfs 长文件名挂载)不会传播到 系统其它部分。lightdm.service 没有这两个选项,运行在 init 命名空间。 ProtectClock 只安装 seccomp 过滤,故保留 Log: 修复登录时挂载的 dlnfs 文件系统对桌面应用不可见的问题 Influence: 1. 开启长文件名功能后用 ddm 登录,确认 findmnt 能看到主目录上的 dlnfs 挂载 2. 确认新启动的桌面应用能访问该挂载 3. 确认 readlink /proc/$(pgrep -x ddm)/ns/mnt 与 /proc/1/ns/mnt 相同 4. 确认会话内 modprobe 及 pam_mount 类挂载正常 PMS: BUG-346181
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['无需修改,语法和逻辑均正确。'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['注释质量优秀,建议保持这种 documenting-the-rationale 的风格。'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['无性能优化建议。'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['建议在未来版本中探索替代方案,例如使用 BindReadOnlyPaths=/usr/lib/modules 来替代 ProtectKernelModules,或通过其他 systemd 指令组合实现既保持挂载传播又限制内核模块加载的安全目标。', '可考虑通过 After/Requires 依赖确保 dlnfs 挂载在 ddm 启动前完成,从而避免依赖挂载命名空间传播。'] 💡 改进建议代码示例# 当前方案(功能正确,但安全姿态略降):
# services/ddm.service.in
#PrivateIPC=true
#ProtectKernelModules=true
# 建议的未来替代方案(兼顾功能与安全):
# 保留 ProtectKernelModules 的等效保护,同时不影响挂载传播:
#ProtectKernelModules=true
# 使用 BindReadOnlyPaths 替代,仅以只读方式映射模块目录,
# 不会创建新的挂载命名空间:
#BindReadOnlyPaths=/usr/lib/modules
# 或者,确保 dlnfs 在 ddm 启动前完成挂载,避免依赖命名空间传播:
# 在 ddm.service.in 中添加:
#After=dlnfs-mount.service
#Requires=dlnfs-mount.service本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Groveer, zccrs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Log: Fix dlnfs mounts made during login being invisible to the desktop
Influence:
fix: 让 ddm 运行在 init 挂载命名空间,与 lightdm 保持一致
Log: 修复登录时挂载的 dlnfs 文件系统对桌面应用不可见的问题
Influence:
PMS: BUG-346181
Summary by Sourcery
Keep ddm in the init mount namespace to ensure session-created mounts propagate correctly.
Bug Fixes:
Enhancements: