Commit Graph
1460 Commits
Author SHA1 Message Date
github-actions[bot] ac64a322a5 Update translated documentation (#1534) V0.4.0 2025-12-22 20:13:24 +08:00
LoGin 6060705f7c docs: 新增发布助手能力说明文档和V0.4.0发行日志 (#1533)
- 新增`docs/agents/release_agent_capability.md`
文档,提供面向未来版本发布的通用“发布助手”能力说明和可复用模板
- 新增`docs/community/ChangeLog/V0.4.x/V0.4.0.md`
发行日志,详细记录V0.4.0版本的各项改进和变更
- 更新`docs/community/ChangeLog/index.rst`索引文件,添加V0.4.0版本条目
- 更新内核版本号至0.4.0(`kernel/Cargo.toml`和`kernel/Cargo.lock`)
- 更新`about`应用程序的版权信息和版本显示

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-22 19:52:20 +08:00
LoGin b6e9086087 fix(poll): 修复信号掩码恢复逻辑并优化pselect6实现 (#1531)
- 修复poll_select_finish中信号掩码恢复逻辑,避免在ERESTARTSYS时错误恢复
- 重构pselect6系统调用,正确处理sigmask参数和timeout验证
- 移除poll_select_finish中零超时提前返回的逻辑
- 为PosixTimeSpec添加as_millis方法
- 将select相关测试加入白名单

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-22 16:34:34 +08:00
Vitus a55ce567b1 chore: cleanup duplicate another_ext4 entry in Cargo.lock (#1530)
修复 Cargo.lock 中 another_ext4 包的重复条目问题。新版本的 Cargo
会自动清理这种重复条目并使用简化的依赖引用格式,这个提交统一了
lockfile 格式,避免不同开发者使用不同 Cargo 版本时产生冲突。
2025-12-22 13:45:35 +08:00
LoGin a59cc0e91e fix: 修复用户空间内存访问和页面回收问题 (#1522)
* fix: 修复用户空间内存访问和页面回收问题

- 修复 IoVecs 构造时对零长度缓冲区的验证,确保符合 Linux 语义
- 修复 scatter 方法在遇到不可访问内存时的错误处理,避免部分写入后返回错误
- 修复 readv/preadv 等系统调用,使其支持分块读取和部分成功写入
- 修复页面回收逻辑,避免回收仍被映射的文件页
- 修复 UserBufferReader/Writer 对空指针的检查,防止未定义行为
- 调整缓存阈值并添加 gVisor 测试的内存检测逻辑

Signed-off-by: longjin <longjin@DragonOS.org>

* refactor(vfs): 优化 IoVecs 的用户空间内存访问检查与拷贝逻辑

- 移除冗余的 verify_area 和 UserBufferReader/Writer 检查,统一使用
user_accessible_len 进行访问性验证
- 在 gather 方法中使用 copy_from_user_protected 进行异常保护的拷贝,与 scatter
方法保持一致
- 改进错误处理逻辑,当部分数据已成功读取时返回已读取的数据,否则返回 EFAULT

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-22 11:53:40 +08:00
LoGin e7fa64be1a fix(pipe): 修复阻塞模式下写端唤醒的竞态条件 (#1529)
- 在阻塞模式下先增加 writer 计数再等待读端,避免竞态条件
- 在增加 writer 计数后立即唤醒等待的读者
- 处理信号中断时回滚 writer 计数
- 确保非阻塞模式下也正确唤醒读者

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-21 22:18:09 +08:00
LoGin 03b8928161 fix(epoll): 正确处理普通文件的epoll事件 (#1528)
- 修复普通文件在epoll中总是就绪的逻辑,避免添加epitem
- 改进poll_select_finish函数以支持更多时间类型
- 修复select系统调用中timeout负值检查

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-21 22:17:43 +08:00
LoGin d1872d899a feat(ext4): 修复死锁问题并增强文件系统功能 (#1509)
* feat(ext4): 修复死锁问题并增强文件系统功能

- 修复了ext4 inode读写操作中的自旋锁死锁问题
- 添加了父目录指针支持,实现parent()方法
- 改进了块设备寻址逻辑,统一使用512字节LBA
- 增强了根文件系统探测机制,支持ext4和FAT自动识别
- 修复了ELF加载器中解释器路径查找问题
- 更新了another_ext4依赖版本

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(filesystem): 为ext4和fat文件系统添加探测方法并优化代码

- 在Ext4FileSystem和FATFileSystem中新增probe方法,用于探测gendisk是否包含对应文
件系统
- 重构vcore.rs中的文件系统探测逻辑,使用新的probe方法替代原有的独立探测函数
- 优化Ext4Inode构造函数中parent字段的默认值设置,使用unwrap_or_default替代unwrap
_or_else
- 在rcS启动脚本中添加PATH环境变量设置

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-21 21:04:12 +08:00
LoGin 22d60d9e41 refactor(net): 将 NapiManager 的锁机制改为 lock_irqsave (#1525)
- 修复在中断上下文中调用 napi_schedule 可能导致的死锁问题

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-21 21:03:41 +08:00
LoGin 9cbd72af99 chore: 删除gvisor测试中的fifo_test blocklist文件 (#1524)
Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-21 03:30:32 +08:00
LoGin b68e54cec9 fix(process): 修正POSIX定时器信号投递逻辑并支持SIGEV_THREAD (#1521)
- 修复`ProcessControlBlock::raw_tgid()`返回错误字段的问题
- 为POSIX定时器添加SIGEV_THREAD支持,兼容gVisor测试
- 放宽SIGEV_THREAD_ID限制,允许向同线程组的任意线程投递信号

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-21 02:55:27 +08:00
LoGin 1f4ee4719e fix: sys_exec test (#1518)
* fix(syscall): 修复execve系统调用中空路径和空参数处理问题

- 在解析符号链接前检查argv是否为空,避免空指针访问
- 添加对空路径字符串的检查,返回ENOENT错误码

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(tests): 为gvisor测试套件添加版本管理功能

- 引入版本变量和版本文件以支持自动检测和升级
- 重构现有测试检查逻辑,根据版本信息决定是否重新下载
- 解压后自动记录当前安装的测试版本

Signed-off-by: longjin <longjin@DragonOS.org>

* 1

* feat(exec): 增强执行文件权限检查与信号处理

- 在execve系统调用中增加文件类型和执行权限检查
- 移除shebang处理中冗余的interpreter_path字段
- 修复fork时信号掩码复制问题,确保POSIX合规性
- 完善execveat系统调用对AT_EMPTY_PATH和AT_SYMLINK_NOFOLLOW标志的处理

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(exec): Enhance fd_table management and path resolution in execve

- Implemented unsharing of fd_table in the execve process to ensure isolation when shared.
- Updated path resolution logic to only replace argv[0] if absolute_path() succeeds, maintaining original path on failure.

Signed-off-by: longjin <longjin@DragonOS.org>

* fix(exec): Correct argv handling in sys_execve for empty arguments

- Updated sys_execve to ensure that if argv is empty, an empty string is added as argv[0], maintaining proper argc behavior.
- Adjusted symlink resolution logic to only occur when argv[0] is non-empty, preventing unnecessary processing and potential errors.

Signed-off-by: longjin <longjin@DragonOS.org>

* fix(exec): 改进shebang解释器未找到时的错误日志

- 在shebang解释器查找失败时,将错误详情添加到警告日志中
- 调整gvisor测试列表,移除不支持的测试用例并添加注释说明

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-21 01:57:16 +08:00
LoGin f095a26655 feat(process): 实现进程与线程CPU时间统计及clock_nanosleep支持 (#1517)
* feat(process): 实现进程与线程CPU时间统计及clock_nanosleep支持

- 新增ProcessCpuTime结构体,用于统计用户态、内核态及总执行时间
- 为PCB添加cputime_wait_queue,支持CLOCK_PROCESS/THREAD_CPUTIME_ID的clock_nanosleep
- 在调度器CPU时间统计中增加CPU-time等待队列唤醒逻辑
- 扩展clock_gettime和clock_nanosleep系统调用,支持进程和线程CPU时间时钟
- 添加PosixTimeSpec::from_ns方法,便于从纳秒创建时间规格
- 更新测试白名单,添加clock_nanosleep_test

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(cputime): 增强进程CPU时间统计并添加多线程测试

- 在`process_cputime_ns`中添加对无效线程组关系的防御性回退和日志记录
- 为`thread_cputime_ns`添加原子操作顺序的注释说明
- 新增多线程CPU时间测试程序,验证进程CPU时间累加线程时间的功能

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-20 23:04:23 +08:00
LoGin ad30303a2b fix(process): 修复子进程退出时父进程唤醒逻辑 (#1516)
- 修正父进程唤醒条件,确保无论exit_signal为何值都唤醒父进程
- 修复线程组leader唤醒逻辑的位置错误

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-20 17:20:53 +08:00
LoGin adfac393ef feat(procfs): 添加/proc/<pid>/ns/目录支持及cgroup命名空间实现 (#1515)
- 新增/proc/<pid>/ns/目录,支持动态创建命名空间文件
- 实现cgroup命名空间基础结构,支持CLONE_NEWCGROUP标志
- 为命名空间文件添加ioctl支持(NS_GET_NSTYPE等命令)
- 扩展setns系统调用以支持cgroup命名空间切换

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-20 16:36:05 +08:00
LoGin c4c283d326 feat(vfs): 新增 copy_file_range 系统调用实现及测试 (#1513)
* feat(vfs): 新增 copy_file_range 系统调用实现及测试

- 实现 copy_file_range 系统调用,支持文件间高效数据拷贝
- 添加完整的测试用例,覆盖基本功能、边界条件和错误处理

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-20 14:26:25 +08:00
LoGin ce087f7a7a fix(vfs): 修复symlinkat中父目录路径为None时的处理逻辑 (#1512)
- 当路径只有文件名时,父目录应为起始inode本身
- 避免对None值调用lookup_follow_symlink导致错误

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-20 03:13:23 +08:00
LoGin c557b9b773 feat(exec): 添加shebang脚本支持 (#1511)
* feat(exec): 添加shebang脚本支持

- 新增shebang模块,实现脚本解析和递归执行
- 重构exec模块,支持递归加载和上下文跟踪
- 添加测试程序验证shebang功能

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(process): Add inline attribute to parse_shebang_line function

- Added #[inline(never)] attribute to the parse_shebang_line function for optimization purposes.
- This change aims to improve performance by controlling inlining behavior during compilation.

Signed-off-by: longjin <longjin@DragonOS.org>

* 1

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-20 02:30:50 +08:00
LoGin 514283011d feat(filesystem): Enhance symlink handling and VFS behavior (#1507)
* feat(filesystem): Enhance symlink handling and VFS behavior

- Updated tmpfs to require page cache for both regular files and symlinks to ensure proper read/write operations.
- Increased the maximum symlink follow count to 40, aligning with Linux 6.6 standards.
- Improved symlink handling in VFS to correctly follow symlinks based on path conditions and trailing slashes.
- Added validation for conflicting flags in vfs_statx to prevent invalid operations.
- Refined syscall implementations for symlink and lstat to adhere to Linux semantics, ensuring correct behavior for symlink creation and path resolution.

Signed-off-by: longjin <longjin@DragonOS.org>

* fix(vfs): 修正符号链接跟随次数的处理逻辑

- 将 VFS_MAX_FOLLOW_SYMLINK_TIMES 从 40 调整为 41,以保留 0 的禁用语义并实现最多
40 次跟随的 Linux 语义
- 重构路径解析逻辑,明确区分 max_follow_times 为
0(完全禁用跟随)、1(计数耗尽)及 >=2(允许继续跟随)三种情况
- 确保在计数耗尽(max_follow_times == 1)且需要跟随时正确返回 ELOOP 错误

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-19 20:24:10 +08:00
LoGin fa4d785eaa feat(kernel/posix-timer): 实现 POSIX interval timer,修复 gVisor timers_test (#1501)
- 新增 timer_create/timer_settime/timer_gettime/timer_getoverrun/timer_delete 系统调用处理,并接入 syscall table
- 实现进程级 POSIX interval timer:基于 CLOCK_MONOTONIC 的创建/删除/设置/查询、周期性重装与到期调度
- 完整实现 SIGEV_NONE/SIGEV_SIGNAL/SIGEV_THREAD_ID(限制 THREAD_ID 只能指向当前线程)与 SI_TIMER siginfo(含 si_timerid/si_overrun/si_value)
- 修复 overrun 语义与信号合并:按线程 pending 队列合并并累积 overrun,避免重复入队导致进程被信号杀死
- 修复周期性 timer 的 gettime 剩余时间计算与回调窗口返回 0 的问题(PeriodicSilent)
- 修复定时器回调中信号锁/队列访问导致的自锁死(PeriodicGroupDirectedSignal)
- clear_child_tid/robust futex 相关用户内存访问改为异常表保护,并避免在失败时继续 futex 操作

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-18 20:37:40 +08:00
LoGin 601ba6d092 feat(fs): implement umask and improve permission handling (#1500)
- Set default umask to 0022 for new filesystem instances
- Add apply_umask_for_create() and chmod_preserve_type() helper functions
- Implement proper permission checks for file creation and chmod operations
- Fix fchmod syscall to work correctly and reject O_PATH file descriptors
- Add open_create_test to gvisor test suite

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-18 19:51:21 +08:00
LoGin 92895534f7 fix(epoll): 修复epoll超时唤醒机制,确保定时器通过Waker唤醒等待队列 (#1492)
- 重构定时器创建逻辑,使用EpollTimeoutWaker结构体实现TimerFunction
- 将超时唤醒方式从直接唤醒PCB改为通过Waker::wake()触发

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-18 10:50:51 +08:00
LoGin 6ec1dd523e feat(procfs): 新增/proc/<pid>/stat和/proc/<pid>/task支持 (#1490)
- 添加/proc/<pid>/stat文件生成,支持BusyBox ps/pstree/top等工具
- 实现/proc/<pid>/task目录结构,支持主线程tid=pid的展示
- 新增proc_pid_stat和proc_pid_task模块处理相关逻辑
- 扩展ProcFileType枚举,添加ProcPidStat、ProcPidTaskDir等类型
- 在InodeInfo中新增tid字段以支持线程信息

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-17 23:55:52 +08:00
LoGin 839a0d589e feat(filesystem): 完善文件系统统计信息支持 (#1491)
- 为 FAT 文件系统实现 statfs 所需的 SuperBlock
字段(f_blocks、f_bfree、f_bavail、f_frsize)
- 为 tmpfs 添加默认容量策略(物理内存一半)并同步更新 SuperBlock 统计信息
- 修复 FAT32 FSInfo 空闲簇计数更新时的溢出问题
- 为挂载点提供稳定的 st_dev 标识符

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-17 19:59:26 +08:00
LoGin 2f19b3daa9 feat(procfs): 添加 /proc/cmdline 和 /proc/<pid>/cmdline 文件支持 (#1489)
- 新增 proc_pid_cmdline 模块,实现 /proc/cmdline 和 /proc/<pid>/cmdline
文件的读取逻辑
- 在进程控制块中增加 cmdline 字段,用于存储进程的命令行参数
- 在 execve、fork 和初始进程启动时正确设置和继承 cmdline 数据
- 在 procfs 中创建对应的文件节点并集成到文件类型枚举和打开逻辑中

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-17 14:15:58 +08:00
LoGin 0ed7d33c19 feat(filesystem): Implement EventFd filesystem and enhance VFS inode capabilities (#1486)
* feat(filesystem): Implement EventFd filesystem and enhance VFS inode capabilities

- Introduced EventFdFs as a new pseudo-filesystem to support eventfd file descriptors, including methods for root inode retrieval and filesystem information.
- Enhanced IndexNode trait with is_stream, supports_seek, supports_pread, and supports_pwrite methods to streamline file operation semantics for stream-like files.
- Updated file handling in VFS to utilize new inode capabilities, ensuring correct behavior for pread, pwrite, and lseek operations.
- Added eventfd_test to the syscall whitelist for testing purposes.

This implementation aligns with Linux semantics for eventfd and improves the overall VFS design by consolidating stream behavior checks.

Signed-off-by: longjin <longjin@DragonOS.org>

* fix(vfs): 修复pread/pwrite中O_PATH和流式对象的错误处理顺序

- 调整O_PATH文件描述符的错误处理顺序,确保优先返回EBADF
- 为流式对象(FMODE_STREAM)添加ESPIPE错误处理,避免权限检查导致的误报
- 分离权限检查逻辑,确保错误码符合Linux语义

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-17 12:09:17 +08:00
github-actions[bot] 405589a0af Update translated documentation (#1485) 2025-12-17 00:24:25 +08:00
LoGin 99de02d69c docs: 更新README和构建文档,添加DragonOS Playground体验方式 (#1484)
- 在README中新增云原生开发体验方式,提供CNB平台一键启动链接
- 更新社区新闻,添加Playground上线信息
- 在构建文档开头添加快速体验章节,推荐使用Playground

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-17 00:20:50 +08:00
LoGin 0d10f70691 feat(vfs): 新增creat系统调用支持 (#1482)
* feat(vfs): 新增creat系统调用支持

- 实现creat系统调用处理器,遵循Linux语义:创建新文件或截断现有文件并打开为只写模式
- 在x86_64架构下注册creat系统调用到系统调用表
- 在gvisor测试白名单中添加creat测试项

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(rust-jhash): Update Cargo.toml to specify Rust edition 2021

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-16 23:58:15 +08:00
LoGin b28f766956 feat(vfs): Implement append lock manager for file operations (#1483)
* feat(vfs): Implement append lock manager for file operations

- Introduced an `AppendLockManager` to ensure atomicity for append operations across filesystems, preventing data corruption in concurrent write scenarios.
- Updated file write methods to utilize the new append lock mechanism, ensuring that appending to files respects the latest end-of-file position.
- Enhanced `write_append` and `pwrite_append` methods to support forced append semantics, aligning with Linux behavior.
- Initialized the append lock manager during VFS initialization to ensure it is ready before any file write operations.

This addition improves the reliability of file operations in a multi-threaded environment, particularly for append scenarios.

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(kernel): 添加jhash库并用于append_lock的哈希计算

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-16 23:55:53 +08:00
LoGin d84adf400e refactor(vfs): 统一使用vfs_check_and_clone_cstr函数进行路径检查 (#1481)
- 将多个VFS系统调用中的check_and_clone_cstr替换为vfs_check_and_clone_cstr
- 在page_cache.rs中简化page_cache引用获取方式
- 在sys_mount.rs中新增copy_mount_path_string函数专门处理挂载路径
- 移除rename_utils.rs中冗余的路径长度检查

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-16 14:11:05 +08:00
LoGin 5450a4bfc7 fix: fix chroot and tmpfs (#1480)
* feat(procfs): Add /proc/[pid]/mountinfo and /proc/[pid]/maps support

- Introduced new ProcFileType variants for /proc/[pid]/mountinfo and /proc/[pid]/maps.
- Implemented content generation for /proc/[pid]/mountinfo and /proc/[pid]/maps to align with Linux semantics.
- Updated ProcFS inode creation to include these new files for each process.
- Enhanced path handling in the VFS to ensure correct resolution based on process-specific root and current working directory.

This addition improves the process filesystem's functionality and compatibility with Linux behavior.

* feat(filesystem): Enhance page cache management in tmpfs

- Added an unevictable flag to the PageCache structure, allowing pages to be marked as unevictable to prevent reclamation.
- Updated the TmpfsInode structure to integrate page cache management, replacing direct data manipulation with page cache operations for read and write methods.
- Refactored truncate and resize methods to utilize the new page cache functionality, ensuring consistency and improved memory management.

* feat(filesystem): Enhance tmpfs functionality and VFS constraints

- Implemented support for readahead in tmpfs, allowing for optimized data retrieval.
- Added checks for filename length across various VFS operations to prevent errors related to excessively long names.
- Updated the tmpfs implementation to handle read and write operations directly through the page cache, improving memory management.
- Enhanced rename functionality to ensure type compatibility and empty directory checks during operations.
- Increased maximum path length and defined maximum single filename length for better filesystem compliance.

* refactor(fs): 重构tmpfs重命名逻辑并修复MountFSInode的move_to委托

- 将tmpfs跨目录移动逻辑提取为独立函数`tmpfs_move_entry_between_dirs`
- 优化锁顺序以避免死锁,按inode_id顺序锁定目录
- 修复MountFSInode::move_to中目标inode解包问题,确保正确委托给底层文件系统

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(filesystem): Implement zero-page creation for tmpfs and enhance page fault handling

- Added `create_zero_pages` method to `InnerPageCache` for efficient zero-page creation, optimizing memory usage in tmpfs.
- Updated `Tmpfs` to utilize the new zero-page creation during read and write operations, ensuring seamless handling of page faults.
- Enhanced `PageFaultHandler` with `pagecache_fault_zero` to manage page faults specifically for tmpfs, allowing for direct page cache access without disk I/O.

This improves the performance and reliability of memory file systems by reducing unnecessary allocations and ensuring proper page management.

* refactor(syscall): Rename check_and_clone_cstr to vfs_check_and_clone_cstr for clarity

- Updated the user access module to introduce vfs_check_and_clone_cstr, enhancing clarity in its purpose for VFS operations.
- Refactored sys_openat and utimensat to utilize the new vfs_check_and_clone_cstr function, ensuring consistent handling of C string paths across the filesystem.

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-16 14:05:27 +08:00
LoGin c70c94579a feat(block_cache): Enhance CacheBlock and BlockCache functionality (#1465)
- Added `from_slice` method to `CacheBlock` for creating instances directly from slices, avoiding unnecessary allocations.
- Introduced `write_data` method in `CacheBlock` to allow in-place updates of block data.
- Updated `insert_one_block` and `immediate_write` methods in `BlockCache` to accept slices instead of vectors, improving performance and memory usage.
- Implemented error handling for block size validation in multiple locations to ensure data integrity.
- Change `FileMapInfo::page_cache` to `Weak<PageCache>` to fix a memory leak caused by reference cycles.

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-16 02:03:47 +08:00
kadoandlongjin 85989fdb49 fix(vfs): 修复truncate系统调用,添加截断时的页缓存截断,修复边界条件 (#1444)
* 限制缓冲区大小为 512KB,避免分配过大内存导致容量溢出;为resize加上页缓存截断

* 增加对len的检查,检查截断后的长度是否超过限度

* 检查filemode

* 回退在resize里限制文件大小

* fmt

* 添加测试

* 改进长度参数的类型转换逻辑;统一使用限制大小的缓冲区策略

* 在fat的resize中加入最大容量检查

* 统一定义ZERO_BUF_SIZE;增加对零写入的检查;在vfs层统一拒绝超出 isize::MAX 的长度

* fmt

---------

Co-authored-by: longjin <longjin@DragonOS.org>
2025-12-15 23:20:25 +08:00
LoGin cb33f73ce0 ci: Add checkout step in nightly build workflow (#1477)
- Introduced a step to checkout the DragonOS code in the nightly build workflow, ensuring the latest code is available for the build process.
2025-12-15 17:39:09 +08:00
LoGin 186b47c411 Feat add nightly build workflow (#1476)
* ci: Remove unused COMMIT_SHORT variable from nightly build workflow

- Eliminated the COMMIT_SHORT variable from the nightly build workflow as it was not being utilized, streamlining the script.

* ci: Update nightly build workflow to conditionally run build and publish jobs

- Added conditions to the build and publish jobs in the nightly build workflow to ensure they only execute for specific events or when the repository matches 'DragonOS-Community/DragonOS'. This enhances control over workflow execution.
2025-12-15 16:43:35 +08:00
LoGin c87e275610 ci: Restore HOME environment variable in nightly build workflow (#1475)
- Reintroduced the HOME environment variable in the nightly build workflow to ensure proper directory context for the build process.
2025-12-15 16:19:22 +08:00
LoGin f1d384a7ac ci: Update nightly build workflow to prepare directory for artifacts (#1474)
- Added a step to create a 'bin' directory in the nightly build workflow to organize build artifacts more effectively.
2025-12-15 15:49:15 +08:00
LoGin 6211826a7f ci: Refactor nightly build workflow to separate build and publish steps (#1473)
- Updated the nightly build workflow to include distinct build and publish jobs.
- Added steps to compress build artifacts into a tarball and upload them for later use.
- Modified the Dockerfile to copy the compressed artifacts instead of individual files, enhancing efficiency and organization.
2025-12-15 15:19:42 +08:00
LoGin 0d0c78fee0 ci: Update nightly build workflow with new environment variables (#1472)
- Added HOME, RUSTUP_DIST_SERVER, and RUSTUP_UPDATE_ROOT environment variables to the nightly build workflow to enhance Rust toolchain management and configuration.
2025-12-15 14:58:06 +08:00
LoGin a8d78be4c4 feat(mm,procfs): 添加/proc/<pid>/maps文件支持并改进缺页异常处理 (#1468)
* fix(interrupt): 修正缺页异常处理中的用户态判断逻辑

- 优先使用TrapFrame和错误码判断访问发起者,而非仅依赖地址范围
- 避免用户态访问高地址区域时触发内核panic,改为产生SIGSEGV
- 确保内核态访问用户地址时能正确走用户态fault处理路径

Signed-off-by: longjin <longjin@DragonOS.org>

* fix(time): 修复 sys_gettimeofday 用户空间访问保护

- 重构 sys_gettimeofday 系统调用处理逻辑,使用 buffer_protected 保护用户空间访问
- 修复 tv 和 timezone 指针为空时的处理逻辑,避免空指针错误
- 根据调用来源(用户/内核)动态设置用户空间访问保护标志

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(procfs): 添加/proc/<pid>/maps文件支持

- 新增proc_maps模块,实现/proc/<pid>/maps文件的生成逻辑
- 在ProcFS中注册maps文件,支持进程文件夹的创建和清理
- 更新gvisor测试白名单,添加time_test

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-15 14:43:39 +08:00
LoGin b5190986d4 ci: Update nightly build workflow to use containerized environment and streamline build steps (#1471) 2025-12-15 14:42:05 +08:00
LoGin 6e7deb9a0e ci: Remove HOME environment variable from nightly build workflow (#1470) 2025-12-15 14:29:50 +08:00
LoGin 200f6fdc35 ci: 新增夜间构建与发布工作流 (#1469)
Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-15 14:24:58 +08:00
LoGin 84443be280 fix: 修复slab分配器迭代器越界访问和并发安全问题 (#1464)
- 为ObjectPageIterMut添加remaining字段,防止迭代越界
- 将SLABALLOCATOR改为SpinLock保护,修复并发访问问题
- 在kernel_allocator中正确使用锁保护slab分配器操作

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-15 00:42:59 +08:00
Samuel Daiandlongjin 165fa8e8df fix(net): udp getsockname/getpeername (#1460)
* fix(net): udp getsockname/getpeername

* feat(ci): add test whitelist for new available inet syscall

---------

Co-authored-by: longjin <longjin@DragonOS.org>
2025-12-14 22:04:06 +08:00
LoGin 1245799ee1 fix(tty): Enhance TTY driver and device management (#1462)
* fix(tty): Enhance TTY driver and device management

- Updated the TTY driver to handle both master and slave types more effectively during close operations, ensuring proper cleanup of device entries in /dev/pts.
- Improved the handling of controlling TTY detachment for processes, adding support for the TIOCNOTTY command.
- Refactored the PTY device initialization to ensure correct metadata settings and device registration.
- Added a symlink for /dev/ptmx to point to the internal devpts node, preventing ENOENT errors during early access.

These changes enhance the robustness and compatibility of the TTY subsystem with Linux semantics.

Signed-off-by: longjin <longjin@DragonOS.org>

* refactor(tty): Improve PTY device management and cleanup logic

- Enhanced the `PtyDevPtsLink` structure to manage the lifecycle of PTY devices more effectively, including precise unlinking of directory entries and freeing of indices upon closure.
- Refactored the close operation in the TTY driver to utilize the new management logic, ensuring proper cleanup of master and slave PTY devices.
- Removed redundant code related to device entry removal, streamlining the cleanup process and aligning with Linux semantics.

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-14 16:22:18 +08:00
goldwind-ting 23ab2f3658 fix(lookup_kallsyms): 修复符号表查询问题 (#1443)
原有逻辑addr刚好等于kallsyms_adress_list[i+1]时,索引index值会是i,但是实际上是i+1;现在修改为通过二分查找符号
2025-12-13 16:17:12 +08:00
LoGin d40c3c0191 feat(filesystem): Add tmpfs support and integrate with devfs (#1459)
* feat(filesystem): Add tmpfs support and integrate with devfs

- Introduced a new tmpfs module for temporary file storage in memory.
- Updated devfs to mount /dev/shm as tmpfs, aligning with Linux semantics.
- Enhanced vfs module to include TMPFS_MAGIC for tmpfs identification.
- Added necessary methods and structures for tmpfs functionality, including inode management and file operations.

Signed-off-by: longjin <longjin@DragonOS.org>

* feat(filesystem): Implement atomic size management for tmpfs

- Added atomic operations to manage the current size of the tmpfs filesystem, including methods to increase and decrease size based on file operations.
- Integrated size management into inode operations, ensuring that size updates are thread-safe and adhere to specified limits.
- Enhanced the resize and truncate methods to adjust the filesystem size accordingly during file modifications.

Signed-off-by: longjin <longjin@DragonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-12 15:54:45 +08:00
LoGin aa695d46dd feat(filesystem): Add pwritev2 syscall implementation (#1461)
* feat(filesystem): Add pwritev2 syscall implementation

- Introduced the pwritev2 syscall, allowing vectorized writes with offset and flags, enhancing compatibility with Linux semantics.
- Implemented validation for file descriptors and offsets, ensuring robust error handling.
- Reused core logic from pwritev for the new syscall, maintaining consistency in file writing operations.

This addition improves the VFS layer's functionality and aligns with Linux behavior for vectorized writing operations.

Signed-off-by: longjin <longjin@DragonOS.org>

* fmt

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-12 13:44:41 +08:00