Skip to content

fix(arch/x86_64): 重构信号栈帧结构以兼容Linux#1357

Merged
fslongjin merged 1 commit intoDragonOS-Community:masterfrom
fslongjin:fix-sig-ucontext
Nov 11, 2025
Merged

fix(arch/x86_64): 重构信号栈帧结构以兼容Linux#1357
fslongjin merged 1 commit intoDragonOS-Community:masterfrom
fslongjin:fix-sig-ucontext

Conversation

@fslongjin
Copy link
Member

  • 新增与Linux完全兼容的ucontext、sigcontext、fpstate结构体
  • 实现内核与用户态FP状态的安全转换
  • 改进信号处理函数的寄存器恢复逻辑
  • 增强SROP攻击防护机制
  • 修复信号处理中FP状态保存与恢复的问题

- 新增与Linux完全兼容的ucontext、sigcontext、fpstate结构体
- 实现内核与用户态FP状态的安全转换
- 改进信号处理函数的寄存器恢复逻辑
- 增强SROP攻击防护机制
- 修复信号处理中FP状态保存与恢复的问题

Signed-off-by: longjin <longjin@DragonOS.org>
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 refactors the x86_64 signal stack frame structure to achieve full Linux compatibility. It replaces the previous custom signal handling implementation with Linux-compatible structures for ucontext, sigcontext, and fpstate, enabling safer conversion of FP state between kernel and userspace while improving SROP attack protection.

Key changes:

  • Introduced Linux-compatible signal structures (UserUContext, UserSigContext, UserFpState64) with compile-time offset verification
  • Implemented bidirectional FP state conversion with FXSAVE format handling
  • Enhanced SROP protection by validating fpstate pointer integrity during restoration

Reviewed Changes

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

File Description
user/apps/tests/syscall/gvisor/whitelist.txt Added new test case fpsig_mut_test to the test whitelist
kernel/src/arch/x86_64/ipc/signal.rs Complete refactoring of signal handling: new Linux-compatible structures, FP state conversion methods, improved sys_rt_sigreturn and setup_frame functions with better error handling and SROP protection

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

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@fslongjin fslongjin merged commit ca2bf5f into DragonOS-Community:master Nov 11, 2025
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants