fix(arch/x86_64): 重构信号栈帧结构以兼容Linux#1357
Merged
fslongjin merged 1 commit intoDragonOS-Community:masterfrom Nov 11, 2025
Merged
Conversation
Member
fslongjin
commented
Nov 11, 2025
- 新增与Linux完全兼容的ucontext、sigcontext、fpstate结构体
- 实现内核与用户态FP状态的安全转换
- 改进信号处理函数的寄存器恢复逻辑
- 增强SROP攻击防护机制
- 修复信号处理中FP状态保存与恢复的问题
- 新增与Linux完全兼容的ucontext、sigcontext、fpstate结构体 - 实现内核与用户态FP状态的安全转换 - 改进信号处理函数的寄存器恢复逻辑 - 增强SROP攻击防护机制 - 修复信号处理中FP状态保存与恢复的问题 Signed-off-by: longjin <longjin@DragonOS.org>
Contributor
There was a problem hiding this comment.
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.
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.