Commit Graph

1555 Commits

Author SHA1 Message Date
LoGin fc322fb0ba
fix(filesystem): update directory link count management in FAT and RAM filesystems (#1454)
- Adjusted the link count for directories to ensure it starts at 2, accounting for the self-reference and parent directory link.
- Updated the logic for incrementing and decrementing link counts when creating and deleting directories.
- Enhanced the dynamic calculation of directory link counts in the VFS layer to ensure accuracy when metadata is unreliable.

This change improves the consistency of link count management across different filesystem implementations.

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-10 15:30:34 +08:00
github-actions[bot] d0c31bdd38
Update translated documentation (#1453) 2025-12-10 14:14:03 +08:00
LoGin f2cca87d2b
refactor(wait_queue): 重构等待队列机制,引入Waiter/Waker模式 (#1452)
* refactor(wait_queue): 重构等待队列机制,引入Waiter/Waker模式

- 重构WaitQueue,引入Waiter/Waker模式避免唤醒丢失
- 统一等待接口,提供wait_event_interruptible/uninterruptible方法
- 重构futex、epoll、eventfd、semaphore、completion等模块使用新等待队列
- 优化进程等待子进程退出逻辑,使用新等待队列接口
- 添加等待队列设计文档说明新机制

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

* feat: 添加SKIP_GRUB选项以支持在CI或无图形界面环境中跳过GRUB安装

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

* fix: 修复信号处理和futex唤醒的错误码

- 在sys_rt_sigtimedwait中消费信号后及时刷新HAS_PENDING_SIGNAL状态,避免后续等待路
径误判
- 将futex可中断唤醒的错误码从ERESTARTSYS改为EINTR,以符合Linux语义

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

* ci: Update Docker image source in test-x86 workflow

- Changed the Docker image source from `docker.cnb.cool/dragonos-community/dragonos/dragonos-dev:v1.19` to `dragonos/dragonos-dev:v1.19` for consistency in CI workflows.

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

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-10 14:04:05 +08:00
LoGin d0448019ea
feat(filesystem): 新增preadv2系统调用支持 (#1451)
* feat(filesystem): 新增preadv2系统调用支持

- 实现preadv2系统调用,支持带偏移量和标志位的向量化读取
- 处理offset为-1时使用当前文件偏移量,其他情况复用preadv逻辑
- 添加RWF标志位验证,遵循Linux兼容性要求

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

* refactor(open): remove follow_symlink parameter from do_sys_open and related functions

- Simplified the do_sys_open and do_open functions by removing the follow_symlink parameter.
- Updated all calls to these functions to reflect the change, ensuring that symlink following behavior is determined by the O_NOFOLLOW flag in the file flags.
- Enhanced code readability and maintainability by streamlining function signatures.

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

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-10 00:57:17 +08:00
xboHodx fd5cc66440
feat(fadvise64): 实现fadvise64系统调用和页面缓存管理功能 (#1439)
* feat(fs): 实现fadvise64系统调用和页面缓存管理功能

- 新增fadvise64系统调用实现
- 添加页面缓存范围写回和驱逐功能
- 改进预读机制,支持随机访问模式
- 扩展文件访问模式标志管理

* fmt

* feat(vfs): 添加带权限检查的文件描述符获取方法

- 在FileDescriptorVec中新增get_file_by_fd_not_raw方法
- 修改sys_fadvise64使用新方法进行权限检查

* 增强可读性

* 修改gvisor白名单


* refactor(vfs): 封装文件预读状态访问并优化fadvise64实现

- 将File结构体的ra_state字段改为私有并提供get/set方法
- 在sys_fadvise64中使用新的访问方法
- 修复fadvise64中页边界检查逻辑
- 移除syscall模块中未实现的fadvise64 stub


Signed-off-by:  xbohodx <xbohodx2024@gmail.com>
2025-12-09 23:22:47 +08:00
Vitus 00f7253f6e
fix(open): 修复open系统调用在gvisor下的异常表现 (#1417)
* - 调整readable和writable返回的错误码类型

* - fix 修复以下测试
OpenTest.OTrunc
OpenTest.OTruncAndReadOnlyDir
OpenTest.OCreateDirectory
OpenTest.MustCreateExisting
OpenTest.CreateWithAppend
OpenTest.AppendOnly
OpenTest.AppendConcurrentWrite
OpenTest.DirectoryWritableFails
OpenTest.DirectoryDirectFails
OpenTest.Null
OpenTest.CanTruncateReadOnly
OpenTest.OpenNonDirectoryWithTrailingSlash
OpenTest.OpenWithStrangeFlags

* - 添加open_test 的block
2025-12-09 22:56:52 +08:00
Samuel Dai c989c6b13b
feat(ci): Bump build container to v1.19 and CI fixes (#1442)
* Bump build container to v1.18 and CI fixes

Add --ci install mode and APT_FLAG (--no-install-recommends) to
bootstrap.sh, skip grub/docs on CI, and remove legacy RUST_VERSION_OLD
install steps. Use --no-install-recommends in Dockerfile, adjust build
scripts and BUILD_CONTAINER_VERSION, and apply minor whitespace and echo
message updates.

* chore: 更新DADK版本至v0.5.1并调整构建脚本

- 将DADK安装版本从v0.5.0升级至v0.5.1
- 调整bootstrap.sh中install_python_pkg的调用位置,确保在CI和非CI环境下都能正确执行
- 更新DragonReach的git修订版本号

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

* ci: 更新CI工作流中的Docker镜像源

- 将所有工作流中的容器镜像源从
``dragonos/dragonos-dev:v1.18``更改为
``docker.cnb.cool/dragonos-community/dragonos/dragonos-dev:v1.18``

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

* ci: Bump build container to v1.19 and add riscv64 libc

Add linux-libc-dev-riscv64-cross to the Ubuntu/Debian bootstrap install
list to provide riscv64 cross libc headers for cross-compilation.

* ci: 更新CI工作流中的Docker镜像仓库地址

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

---------

Signed-off-by: longjin <longjin@DragonOS.org>
Co-authored-by: longjin <longjin@DragonOS.org>
2025-12-09 13:59:57 +08:00
aLinChe c7c54977bd
fix(signal): correct pid retrieval and signal ignoring logic (#1434)
* fix(syscall): make getpid return correct tgid in namespaces

Signed-off-by: aLinChe <1129332011@qq.com>

* feat(signal): implement signal ignore checking logic

Signed-off-by: aLinChe <1129332011@qq.com>

* fix(fork): change copy_process order

Signed-off-by: aLinChe <1129332011@qq.com>

* clean log::debug()

Signed-off-by: aLinChe <1129332011@qq.com>

* clean log::debug() twice

Signed-off-by: aLinChe <1129332011@qq.com>

* fix(init): remove flags CloneFlags::CLONE_SIGHAND

Signed-off-by: aLinChe <1129332011@qq.com>

* update comment

Signed-off-by: aLinChe <1129332011@qq.com>

---------

Signed-off-by: aLinChe <1129332011@qq.com>
2025-12-08 23:44:02 +08:00
LoGin 264b36b4f8
ci: 优化Claude代码审查工作流的配置和提示词 (#1447)
- 启用进度跟踪功能
- 扩展Claude参数以支持更多工具
- 重构提示词结构,明确代码审查的五个重点领域
- 移除重复的注释更新指令,简化工作流逻辑

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-08 23:23:08 +08:00
LoGin d47501b254
docs: 更新代码审查工作流中的反馈说明 (#1446)
- 明确使用特定工具进行内联评论和状态更新
- 提供单行和多行评论的具体操作指导
- 简化PR状态总结的要求

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-08 17:21:03 +08:00
LoGin c7c6757e52
fix: fix claude cr (#1445)
Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-08 11:41:05 +08:00
LoGin 67643974ed
ci: add auto CR by claude code (#1440)
Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-05 17:25:57 +08:00
LoGin f9e19e55d8
ci: fix claude action (#1438)
Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-05 15:40:31 +08:00
LoGin 4d43c2250c
ci: fix claude action (#1437)
Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-05 15:27:33 +08:00
LoGin fe5fd4fad7
ci: fix claude action (#1436)
Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-05 14:32:55 +08:00
LoGin 83707759b4
ci: add claude review (#1435)
Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-05 14:12:01 +08:00
kaleidoscope416 7fd6e3f052
fix(vfs): 修复 utimensat/futimesat 系统调用边界情况以兼容 gVisor 测试 (#1431)
* fix(vfs): 修复 utimensat/futimesat 系统调用边界情况以兼容 gVisor 测试
2025-12-05 13:23:53 +08:00
LoGin e8eb1e3d12
fix(tty): 修复tty、会话的权限检查逻辑 (#1430)
通过pty_root_test

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-05 12:11:40 +08:00
LoGin 1033f83200
feat(ipc): 实现 FIFO 的阻塞打开语义 (#1429)
- 为 LockedPipeInode 添加 open_wait_queue 用于 FIFO 打开时的阻塞等待
- 实现 Linux FIFO 的阻塞/非阻塞打开语义(O_RDONLY/O_WRONLY/O_RDWR)
- 添加 has_reader/has_writer 辅助方法检查管道状态
- 更新测试配置,将 fifo_test 加入白名单

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-05 12:11:28 +08:00
Yuming Jiang 8a5c7606f6
feat(user/profile): 修正 PS1 环境变量使其与 bash 默认高亮一致 (#1432) 2025-12-03 22:44:39 +08:00
LoGin b466adff52
feat(tty): 为TTY设备添加page_cache方法并处理无页面缓存的情况 (#1428)
- 在TTY设备中实现page_cache方法,返回None以表明字符设备不需要页面缓存
- 在页面错误处理中增加对无页面缓存情况的处理,避免panic并返回VM_FAULT_SIGBUS

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-03 01:01:57 +08:00
LoGin 963ccded97
fix(process): fix wait semantics for child processes in thread groups (#1427)
* fix(process): fix wait semantics for child processes in thread groups

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

* ci: enable unshare_test

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

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-03 00:01:57 +08:00
LoGin 2d48f12b2f
feat(pipe): 修复&完善pipe的行为,并且在procfs新增fd相关支持。 (#1426)
* feat(pipe): 改进管道实现,支持命名管道和符合POSIX的行为

- 新增管道文件系统(PipeFS)并注册PIPEFS_MAGIC
- 扩展管道缓冲区至65536字节,支持原子写入
- 实现命名管道(FIFO)支持,允许O_RDWR模式打开
- 改进fcntl的F_SETFL实现,仅允许修改特定标志位
- 修复写入只读文件描述符的错误码为EBADF
- 为命名管道自动添加O_LARGEFILE标志
- 优化管道读写逻辑,支持循环写入和部分写入

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

* fix(vfs): 在preadv/pwrite64/pwritev系统调用中增加对管道、Socket和字符设备的ESPIPE错误检查

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

* feat(vfs): 为fcntl系统调用添加管道缓冲区大小查询功能

- 实现F_GETPIPE_SZ和F_SETPIPE_SZ命令,支持获取和设置管道缓冲区大小
- 优化管道关闭逻辑,避免潜在死锁问题
- 公开PIPE_BUFF_SIZE常量供系统调用使用

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

* feat(procfs): 支持/proc/self/fd/N魔法链接并实现管道FIONREAD

- 为procfs的InodeInfo添加target_inode字段,用于存储魔法链接的原始文件inode
- 实现IndexNode::special_node方法,使/proc/self/fd/N能返回原始文件的引用
- 在VFS中处理SpecialNodeData::Reference,支持魔法链接的路径解析
- 为管道文件实现ioctl的FIONREAD命令,获取可读字节数

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

* feat(procfs): 添加/proc/<pid>/fdinfo目录支持并实现管道缓冲区动态调整

- 新增ProcFdInfoDir和ProcFdInfoFile枚举类型,支持/proc/<pid>/fdinfo目录和文件
- 实现fdinfo目录的动态查找和列表功能,与fd目录共享文件描述符列表逻辑
- 重构fcntl系统调用,支持F_GETPIPE_SZ和F_SETPIPE_SZ命令的动态管道缓冲区管理
- 修改管道实现,使用动态分配的Vec缓冲区替代固定大小数组,支持运行时调整大小
- 添加管道缓冲区大小验证和迁移逻辑,确保数据完整性

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

* feat(filesystem): 提升文件描述符表最大容量并优化分配策略

- 将文件描述符表最大容量从65536提升至1048576
- 优化文件描述符分配算法,支持动态扩容
- 更新进程资源限制以匹配新的最大容量

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

* perf(pipe): 实现管道缓冲区延迟分配以优化内存使用

- 修改管道缓冲区初始化逻辑,从立即分配改为首次写入时分配
- 优化缓冲区大小调整逻辑,避免不必要的内存分配
- 更新管道元数据返回逻辑,移除冗余计算
- 添加管道测试黑名单文件以排除已知卡死问题

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

* perf(filesystem): 优化文件描述符分配性能

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

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-02 23:11:50 +08:00
xboHodx c0122b5e6a
refactor(vfs): 重构文件系统标志体系,区分打开标志与访问模式 (#1414)
- 将 `ModeType` 重命名为 `InodeMode`,明确其为inode权限位
  - 将 `FileMode` 重命名为 `FileFlags`,明确其为文件打开标志(O_RDONLY等)
  - 新增 `FileMode` 结构体,对应Linux内核的 `file.f_mode`,表示内核专用访问模式(FMODE_READ/FMODE_WRITE/FMODE_LSEEK等)
  - 新增 `InodeFlags` 结构体,支持 S_SYNC、S_APPEND、S_IMMUTABLE 等inode标志
  - 修复管道 `poll` 函数中的标志判断逻辑
2025-12-02 22:17:42 +08:00
LoGin 8d9ea81d4e
feat(vfs): 实现异步I/O通知机制和ioctl系统调用增强 (#1425)
* fix(vfs): 在ioctl系统调用中增加O_PATH文件检查及错误码转换

- 增加对以O_PATH模式打开的文件的检查,若文件以O_PATH打开则返回EBADF错误
- 在ioctl调用失败时,将内部错误码ENOIOCTLCMD转换为用户空间错误码ENOTTY

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

* feat(vfs): 实现异步I/O通知机制和通用文件描述符ioctl支持

- 新增fasync模块,提供SIGIO信号通知机制
- 扩展PollableInode接口,支持fasync注册和移除
- 实现通用文件描述符ioctl命令(FIONBIO、FIOASYNC、FIOSETOWN等)
- 为TCP、UDP、Unix域套接字添加fasync支持
- 修复Unix域套接字send返回值错误
- 实现SIOCGIFCONF网络接口配置ioctl

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

* ci: add ioctl test to whitelist

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

* feat(net): 新增Unix域数据报socket实现

- 实现Unix域数据报socket(SOCK_DGRAM)核心功能
- 支持bind、connect、sendto、recvfrom等操作
- 添加socket pair创建功能
- 集成到socket创建和系统调用流程中

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

* refactor(net): 引用已有的SockAddrIn结构体并更新注释

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* refactor(ipc): 重命名信号发送函数以提高可读性和一致性

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* fmt

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
Co-authored-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
2025-12-02 17:02:39 +08:00
LoGin 91f4d93106
fix(ipc): 修复kill进程组的bug (#1424)
使得KillTest.ProcessGroups 通过

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-02 14:15:28 +08:00
LoGin d239b7b4e1
feat(ipc): implement enhanced signal handling and IPC mechanisms (#1423)
- Add rt_sigqueueinfo and rt_tgsigqueueinfo system calls for POSIX-compliant signal delivery
- Enhance kill process functionality with proper signal validation and permission checks
- Improve process exit handling with signal cleanup and parent notification
- Update fork implementation to handle signal inheritance properly
- Implement setresuid system call with proper privilege management
- Add comprehensive test coverage for signal-related syscalls

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-01 22:51:46 +08:00
kaleidoscope416 b5b18b765f
fix(vfs): 修复 pread64 系统调用的兼容性和错误处理 (#1398)
* fs: 修复 pread64 系统调用的兼容性和错误处理

- 验证 `offset` 参数:当偏移量为负数或发生溢出时返回 `EINVAL`。
- 验证用户缓冲区:使用 `new_checked` 确保内存已映射,从而正确返回 `EFAULT`。
- 检查文件类型:对不可定位的文件(如管道、Socket)返回 `ESPIPE`。
- 修复 `File::readable()` 中的权限检查:
    - 对 `O_PATH` 文件描述符返回 `EBADF`。
    - 对只写模式(Write-only)打开的文件返回 `EBADF` 而不是 `EPERM`。
- 修复了 gVisor `pread64` 测试集中的多个失败项,包括 `BadBuffer`、`CantReadSocketPair`、`WriteOnlyNotReadable`、`Pread64WithOpath`、`BadOffset` 和 `Overflow`。

* test

* copilot

* fmt

* 删去冗余的负数判断

* 增加注释

* refactor(syscall): improve user buffer access checks in pread64 and user access modules

- Updated SysPread64Handle to use new_checked for user buffer writing.
- Enhanced user access validation by replacing direct checks with user_accessible_len in UserBufferReader and UserBufferWriter.

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

* 禁用preadv的不稳定测试

* fix(vfs): 修复文件可读性检查中的模式比较错误

- 将直接比较FileMode枚举改为比较访问模式位,确保O_WRONLY模式下的文件被正确识别为不
可读

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

---------

Signed-off-by: longjin <longjin@DragonOS.org>
Co-authored-by: longjin <longjin@DragonOS.org>
2025-12-01 22:24:01 +08:00
LoGin bb7a632c2b
feat(sched): implement POSIX scheduling system calls (#1416)
- Add sched_getparam syscall to retrieve process scheduling parameters
- Add sched_getscheduler syscall to get process scheduling policy
- Refactor sched_yield into separate module with proper syscall handler
- Add utility functions for scheduling permission checks
- Remove old do_sched_yield implementation from main syscall module

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-01 21:39:57 +08:00
aLinChe cd45a996f4
fix(mkdir): 修复sys_mkdir逻辑错误和权限截断问题,并添加sys_umask (#1419)
* fix(sys_mkdir): fix ModeType and feat sys_umask

Signed-off-by: aLinChe <1129332011@qq.com>

* fix(sys_mknod): fix mknod

Signed-off-by: aLinChe <1129332011@qq.com>

* use ModeType to set_umask

Signed-off-by: aLinChe <1129332011@qq.com>

---------

Signed-off-by: aLinChe <1129332011@qq.com>
2025-12-01 21:34:49 +08:00
LoGin b0a7948372
feat(klog): Implement kernel log level management and procfs interface (#1415)
- Introduced a new module for managing kernel log levels, mimicking Linux behavior.
- Added support for dynamic log level configuration via command line and procfs interface.
- Created a new `/proc/sys/kernel/printk` file for reading and writing log level settings.
- Updated existing logging mechanisms to utilize the new log level management system.
- Enhanced the QEMU startup script to allow setting log levels through environment variables.

This implementation improves logging flexibility and aligns with expected Linux functionality.

Signed-off-by: longjin <longjin@DragonOS.org>
2025-12-01 18:08:57 +08:00
aLinChe 82786fa10f
feat(PS1): use colorful PS1 (#1422)
Signed-off-by: aLinChe <1129332011@qq.com>
2025-12-01 18:08:13 +08:00
LoGin ecf7749df2
fix(procfs): resolve race condition in namespace file creation (#1413)
- Add proper error handling for concurrent namespace file creation
- Move namespace type validation earlier in the creation process
- Ensure child inodes are fully initialized before being visible in children map
- Handle EEXIST race condition by re-checking children map

Signed-off-by: longjin <longjin@DragonOS.org>
2025-11-27 19:15:39 +08:00
LoGin 147241e7cd
feat(procfs): Add support for /proc/thread-self/ns namespace files (#1412)
* feat(procfs): Add support for /proc/thread-self/ns namespace files

- Introduced a new module for handling namespace files under /proc/thread-self/ns, allowing applications to reference namespaces via symlinks.
- Implemented dynamic creation of namespace files and their corresponding IDs, ensuring compatibility with Linux behavior.
- Updated ProcFS to create necessary directory structures and files for thread-specific namespaces.
- Enhanced existing ProcFileType enum to include new types for thread self namespaces.

This addition improves the process namespace management and aligns with expected Linux functionality.

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

* feat(namespace): Implement setns syscall for namespace management

- Added the `setns` syscall to allow processes to join existing namespaces using a file descriptor.
- Implemented kernel-level logic to handle namespace switching based on provided flags, supporting pidfd and namespace fd types.
- Enhanced the namespace management by integrating with the existing `NsProxy` structure, ensuring compatibility with Linux behavior.
- Updated related modules and added necessary error handling for invalid flags and file descriptors.

This addition improves the flexibility of namespace management in the kernel, aligning with expected Linux functionality.

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

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-11-27 19:08:48 +08:00
github-actions[bot] 3e82efc584
Update translated documentation (#1411) 2025-11-27 14:07:56 +08:00
LoGin 43263c1a11
feat(vfs): Implement mount propagation mechanism in VFS (#1410)
* feat(vfs): Implement mount propagation mechanism in VFS

- Added support for mount propagation types: Shared, Private, Slave, and Unbindable.
- Introduced a new module for managing mount propagation semantics, including peer group registration and event propagation.
- Updated existing mount functions to handle propagation logic during mount and unmount operations.
- Enhanced documentation to include details on the new mount propagation features and their usage.
- Added unit tests to verify the correctness of mount propagation behavior across different scenarios.

This implementation aligns with Linux semantics for mount propagation, ensuring compatibility and expected behavior in containerized environments.;

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

* refactor(filesystem): optimize mount propagation and logging

- Replace ID allocator with atomic counter for propagation groups
- Refactor peer group registry into structured class with better APIs
- Remove verbose debug logs to reduce noise

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

* fix(namespace): correct mount propagation peer group handling

- Fix peer group registration when changing propagation type from shared
- Ensure propagated mounts join source child's peer group instead of target
parent's group
- Add proper peer group cleanup when transitioning from shared propagation

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

* feat(vfs): implement recursive bind mount support

- Add recursive bind mount functionality with MS_BIND | MS_REC flags
- Implement BFS traversal for copying submounts in do_recursive_bind_mount
- Fix mount registration order to prevent dangling registrations on failure
- Add comprehensive test cases for recursive and non-recursive bind mounts

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

---------

Signed-off-by: longjin <longjin@DragonOS.org>
2025-11-27 01:07:16 +08:00
xboHodx 53df56cb94
feat(fs): 添加文件预读功能支持 (#1391)
- 新增readahead模块实现文件预读算法
- 修改page_cache模块支持预读标记
- 在File结构体中添加预读状态管理
- 为PageFlags添加PG_READAHEAD标志位

Signed-off-by: xbohodx <xbohodx2024@gmail.com>
2025-11-26 23:32:03 +08:00
kaleidoscope416 94c1f4cd20
feat(vfs): 增加sys_preadv 增加对readable中对 O_PATH的检查 (#1404)
* 实现preadv系统调用, 增加对对 O_PATH 的可读检查

Signed-off-by: 2448956191@qq.com <2448956191@qq.com>
2025-11-26 00:45:16 +08:00
aLinChe cb6237403a
fix(syscall): 修复cputime, sys_rt_sigtimedwait and sys_rt_sigreturn (#1406)
1. **修复:** 进程 CPU 时间统UserUContext 计精度,将统计基准调整为扣除 IRQ 和 Steal 时间后的净时间(accounted_cputime),避免将硬件中断处理时间错误计入进程的 utime/stime
2. **修复:** `sys_rt_sigtimedwait`: 
- 修复了信号等待逻辑,确保即使 等待信号集 为空也能正确进入 do_kernel_rt_sigtimedwait,符合 Linux 行为。
- 修复潜在的无限睡眠问题:当线程被非目标信号或非超时事件唤醒时,将正确返回 EINTR,避免进程一直挂起。
- 修复了bitflags错误移除的bug,应该使用remove()。
3. **修复:** `sys_rt_sigreturn:`:
- 当从信号处理函数返回用户态时,内核错误地使用 sysretq 来处理 sys_rt_sigreturn 的返回,%rcx 和 %r11 这两个寄存器被意外破坏。
- 修复:如果待恢复的 %rcx / %r11 与 sysretq 的行为冲突,则强制跳转到 .L_syscall_must_use_iret 分支,使用 iretq 指令精确恢复完整的上下文。

TODO: 目标线程的 TGID 没有正确设置为 leader 的 PID,导致还有两个sys_rt_sigtimedwait的测例无法通过。
```sh
Value of: tgkill(getpid(), tid, kSigno)
Expected: not -1 (success)
  Actual: -1 (of type int), with errno PosixError(errno=3 No such process)
```

---------

Signed-off-by: aLinChe <1129332011@qq.com>
2025-11-26 00:21:03 +08:00
github-actions[bot] a69dad1bb2
Update translated documentation (#1408) 2025-11-26 00:06:31 +08:00
Yuming Jiang 9420fe09cd
fix(gvisor): 修复自动化开启/关闭 gvisor syscall测例打包的脚本 (#1405)
* fix(tools): 修复缺失 /tmp 目录导致 gvisor 测例运行错误的问题

- 在 `write_disk_image.sh` 中添加创建 /tmp 目录的命令。

Signed-off-by: yuming <mingjiangyu1@qq.com>

* ci: 优化启用/关闭gvisor测试的脚本

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


---------

Signed-off-by: yuming <mingjiangyu1@qq.com>
Signed-off-by: longjin <longjin@DragonOS.org>
Co-authored-by: longjin <longjin@DragonOS.org>
2025-11-26 00:00:04 +08:00
kaleidoscope416 54c2a45d36
fix(fs): 修复 sys_rename 逻辑并支持 RENAME_NOREPLACE (#1393)
逻辑修复:
· 修正覆盖现有文件/目录时的逻辑,确保目标被正确截断和删除。
· 增加文件类型检查,禁止文件与目录之间的非法覆盖。
· 增加祖先关系检查,防止将目录移动到其子目录下。
· 修复同名重命名及非空目录覆盖的边界情况。
· 拦截源或目标路径以 . 或 .. 结尾的非法操作。

功能增强:
引入RenameFlags支持,实现了 RENAME_NOREPLACE 语义。

相关 Commits:

· 添加 RenameFlags 支持 (NOREPLACE)
· 完善路径拦截 (. / ..)
·修复覆盖
截断及类型检查逻辑

· 增加祖先关系判断

---------

Signed-off-by: kaleidoscope416 <2448956191@qq.com>
2025-11-24 13:44:18 +08:00
LoGin 1e6ccecc17
fix(ci): 修复CI流程中测试失败但返回成功状态的问题 (#1403)
- 移除syscall测试的continue-on-error配置,确保测试失败时CI流程正确失败
- 优化上传步骤的条件判断,使用always()确保上传步骤始终执行
- 改进dry-run模式输出,添加verbose选项显示详细信息
- 修复API密钥检查逻辑,在密钥不存在时使用dry-run模式继续执行

Signed-off-by: longjin <longjin@DragonOS.org>
2025-11-24 13:32:02 +08:00
github-actions[bot] b99a54455d
Update translated documentation (#1402)
Co-authored-by: fslongjin <fslongjin@users.noreply.github.com>
2025-11-22 14:53:23 +08:00
linfeng a9576e3b9c
feat: support ssh app(dropbear). (#1392)
* feat: support ssh app(dropbear).

fix tty errors.
fix socket errors.
fix select syscall errors.
update some init configs.
add docs.

Signed-off-by: Godones <chenlinfeng25@outlook.com>

* remove bad code

Signed-off-by: Godones <chenlinfeng25@outlook.com>

* fix: drop lockguard

Signed-off-by: Godones <chenlinfeng25@outlook.com>

---------

Signed-off-by: Godones <chenlinfeng25@outlook.com>
Co-authored-by: longjin <longjin@DragonOS.org>
2025-11-22 14:49:12 +08:00
LoGin 48c2be0c5e
fix: 修复getdents系统调用实现 (#1397)
- 修复目录项缓存逻辑,避免动态目录读取时丢失条目
- 添加O_PATH文件描述符和文件类型检查
- 支持getdents和getdents64两种格式
- 改进用户缓冲区写入安全性和错误处理
- 修复/proc/self/fd目录列表包含"."和".."

Signed-off-by: longjin <longjin@DragonOS.org>
2025-11-22 00:46:30 +08:00
LoGin 690602368c
ci: 更新构建容器版本至v1.17 (#1399)
将容器内的镜像源改为crates.io

Signed-off-by: longjin <longjin@DragonOS.org>
2025-11-22 00:43:23 +08:00
LoGin 72300f15c6
Revert "fix: cputime, sys_rt_sigtimedwait and sys_rt_sigreturn (#1394)" (#1400)
This reverts commit 3be439e54e.

由于 #1394 这个pr的测例 SigtimedwaitTest.SIGKILLUncaught 会卡死,因此撤回。
2025-11-22 00:41:46 +08:00
Yuming Jiang 3f18af7c5a
fix(syscall/vfs): fix SIG derivative when writing partial readable buffer (#1375)
* fix(mm/vfs): 修复 writev 无法正确处理部分 iov 为受保护内存空间的情况

- 引入 user_accessible_len() 以测量从给定地址 `address` 开始,能够被拷贝的最长连续字节长度(注:使用vma进行校验)
- 使 IoVecs::gather 返回 Result 并仅聚合可以被读取的 `buf` 部分(注意,一旦碰到不可访问的 iov,后面的iov都会被抛弃)
- 在 writev/pwritev 中传播新的 Result 以支持 gVisor 下的部分写入

* docs(vfs/syscall): 添加文件系统实现分散写入的 TODO 注释

- 添加了对于 IoVecs 发起的分散写入的处理方式目前处理方式的注释。
- 添加了实现分散写入依赖于文件系统对于 IoVecs 写入支持的注释。

* feat(test): 添加 pwritev 性能测试程序

* fix(syscall/user_access): 修复 潜在的死锁问题

* test(gvisor): 在自动测试中启用所有的 writev 测试


Signed-Off-By: mingjiangyu1 <mingjiangyu1@qq.com>
2025-11-22 00:00:57 +08:00
aLinChe 3be439e54e
fix: cputime, sys_rt_sigtimedwait and sys_rt_sigreturn (#1394)
* fix cputime

Signed-off-by: aLinChe <1129332011@qq.com>

* fix sigtimedwait

Signed-off-by: aLinChe <1129332011@qq.com>

* fix(sys_rt_sigreturn): use iretq

Signed-off-by: aLinChe <1129332011@qq.com>

* fix sigtimedwait sigset remove SIGKILL SIGSTOP

Signed-off-by: aLinChe <1129332011@qq.com>

* modify to use pcb.recalc_sigpending()

Signed-off-by: aLinChe <1129332011@qq.com>

* fix remove remove

Signed-off-by: aLinChe <1129332011@qq.com>

---------

Signed-off-by: aLinChe <1129332011@qq.com>
2025-11-21 23:51:06 +08:00