Repository navigation
任务管理器使用 pidfd,防止 PID 复用时结束错误进程 - #126
Merged
Merged
Conversation
Capture a close-on-exec pidfd with each available process snapshot entry and retain the selected handle through confirmation. Recheck the selected process through its descriptor so PID reuse cannot redirect a signal. Update the runtime API, catalogs, documentation and the ReliefNT gitlink together.
Leonmmcoset
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与效果
在任务管理器中打开“结束任务”确认框后,原进程可能先退出,系统也可能把同一个 PID 分配给新进程。现在确认操作始终绑定最初选中的进程。若它已经退出,界面会提示用户,新进程不会收到信号。
流程与实现
reliefos_task_snapshot_pidfds()为快照中的每个进程返回一个独立的FD_CLOEXEC描述符。确认框保留选中行的描述符,用户确认后通过pidfd_send_signal()发送SIGTERM。列表刷新和关闭确认框时会释放对应的描述符。此提交也更新了任务管理器翻译和运行时 API 文档。验证
python3 -m unittest tools.test_procfs_taskmgr.ProcfsTaskmgrTests.test_status_snapshot_consumer通过,覆盖描述符所有权、过期快照和旧内核行为。make all test-header-export test-abi,内核构建成功,98 个导出头文件、70 个 ABI 记录和 27 个常量通过检查。tools/tests/pidfd_probe.c,7 项通过,退出状态为 0。覆盖 PID 复用、退出通知、信号权限、描述符继承和waitid(P_PIDFD)。兼容性与发布影响
保留原有
reliefos_task_snapshot()接口。旧内核仍可显示进程列表,无法获得稳定描述符时会禁用对应目标的结束操作。kernel/reliefnt更新到已推送至 ReliefNTmain的b63f26ef。