fix: 修复用户空间内存访问和页面回收问题#1522
Merged
fslongjin merged 3 commits intoDragonOS-Community:masterfrom Dec 22, 2025
Merged
Conversation
Member
fslongjin
commented
Dec 20, 2025
- 修复 IoVecs 构造时对零长度缓冲区的验证,确保符合 Linux 语义
- 修复 scatter 方法在遇到不可访问内存时的错误处理,避免部分写入后返回错误
- 修复 readv/preadv 等系统调用,使其支持分块读取和部分成功写入
- 修复页面回收逻辑,避免回收仍被映射的文件页
- 修复 UserBufferReader/Writer 对空指针的检查,防止未定义行为
- 调整缓存阈值并添加 gVisor 测试的内存检测逻辑
- 修复 IoVecs 构造时对零长度缓冲区的验证,确保符合 Linux 语义 - 修复 scatter 方法在遇到不可访问内存时的错误处理,避免部分写入后返回错误 - 修复 readv/preadv 等系统调用,使其支持分块读取和部分成功写入 - 修复页面回收逻辑,避免回收仍被映射的文件页 - 修复 UserBufferReader/Writer 对空指针的检查,防止未定义行为 - 调整缓存阈值并添加 gVisor 测试的内存检测逻辑 Signed-off-by: longjin <longjin@DragonOS.org>
Member
Author
|
@claude review this PR in Chinese |
|
Claude finished @fslongjin's task in 6m 27s —— View job PR 代码审查我将对这个 PR 进行全面的代码审查。以下是审查任务清单:
总体评价这个 PR 修复了用户空间内存访问和页面回收的关键问题,主要改进包括:
详细审查反馈1. IoVecs 构造修复 (
|
- 移除冗余的 verify_area 和 UserBufferReader/Writer 检查,统一使用 user_accessible_len 进行访问性验证 - 在 gather 方法中使用 copy_from_user_protected 进行异常保护的拷贝,与 scatter 方法保持一致 - 改进错误处理逻辑,当部分数据已成功读取时返回已读取的数据,否则返回 EFAULT Signed-off-by: longjin <longjin@DragonOS.org>
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.