Skip to content

feat(process): 添加对fs/gs的用户空间地址验证#1336

Merged
fslongjin merged 1 commit intoDragonOS-Community:masterfrom
fslongjin:add-verify-to-fs-and-gs
Nov 4, 2025
Merged

feat(process): 添加对fs/gs的用户空间地址验证#1336
fslongjin merged 1 commit intoDragonOS-Community:masterfrom
fslongjin:add-verify-to-fs-and-gs

Conversation

@fslongjin
Copy link
Member

  • 在ARCH_SET_FS和ARCH_SET_GS系统调用中添加FS/GS地址的用户空间验证
  • 在进程克隆时添加TLS地址的用户空间验证
  • 新增KernelCloneArgs::verify()方法用于验证克隆参数

@fslongjin fslongjin requested review from Copilot and sparkzky November 3, 2025 14:43
@github-actions github-actions bot added the enhancement New feature or request label Nov 3, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables fork test support and adds address validation for thread-local storage (TLS) and segment base addresses. The changes improve security by verifying user-space addresses before they are used in clone operations and arch_prctl syscalls.

  • Enabled fork_test in the gvisor test whitelist with an associated blocklist
  • Added TLS address validation in KernelCloneArgs::verify()
  • Added address validation for FS/GS base registers in arch_prctl syscall
  • Modified process cleanup to ignore errors when unregistering from procfs

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
user/apps/tests/syscall/gvisor/whitelist.txt Enabled fork_test in the test suite
user/apps/tests/syscall/gvisor/blocklists/fork_test Added blocklist for fork test cases that are known to fail
kernel/src/process/syscall/clone_utils.rs Added verification call before processing clone arguments
kernel/src/process/mod.rs Changed procfs unregistration to ignore errors during cleanup
kernel/src/process/fork.rs Added verify method to validate TLS address and moved verification before PCB creation
kernel/src/arch/x86_64/process/syscall.rs Added address validation for FS and GS base addresses in arch_prctl

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- 在ARCH_SET_FS和ARCH_SET_GS系统调用中添加FS/GS地址的用户空间验证
- 在进程克隆时添加TLS地址的用户空间验证
- 新增KernelCloneArgs::verify()方法用于验证克隆参数

Signed-off-by: longjin <longjin@DragonOS.org>
@fslongjin fslongjin force-pushed the add-verify-to-fs-and-gs branch from dc9e9b1 to b55f987 Compare November 4, 2025 05:34
@fslongjin fslongjin merged commit 9c215fb into DragonOS-Community:master Nov 4, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants