Skip to content

fix(syscall): 修复cputime, sys_rt_sigtimedwait and sys_rt_sigreturn#1406

Merged
fslongjin merged 5 commits intoDragonOS-Community:masterfrom
oeasy1412:fix-gvisortest
Nov 25, 2025
Merged

fix(syscall): 修复cputime, sys_rt_sigtimedwait and sys_rt_sigreturn#1406
fslongjin merged 5 commits intoDragonOS-Community:masterfrom
oeasy1412:fix-gvisortest

Conversation

@oeasy1412
Copy link
Member

@oeasy1412 oeasy1412 commented Nov 25, 2025

  1. 修复: 进程 CPU 时间统UserUContext 计精度,将统计基准调整为扣除 IRQ 和 Steal 时间后的净时间(accounted_cputime),避免将硬件中断处理时间错误计入进程的 utime/stime
  2. 修复: sys_rt_sigtimedwait:
  • 修复了信号等待逻辑,确保即使 等待信号集 为空也能正确进入 do_kernel_rt_sigtimedwait,符合 Linux 行为。
  • 修复潜在的无限睡眠问题:当线程被非目标信号或非超时事件唤醒时,将正确返回 EINTR,避免进程一直挂起。
  • 修复了bitflags错误移除的bug,应该使用remove()。
  1. 修复: 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的测例无法通过。

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>
Signed-off-by: aLinChe <1129332011@qq.com>
Signed-off-by: aLinChe <1129332011@qq.com>
@github-actions github-actions bot added the ambiguous The title of PR/issue doesn't match the format label Nov 25, 2025
@fslongjin
Copy link
Member

这个pr的title不符合约定式提交的规范
image

@oeasy1412 oeasy1412 changed the title fix cputime, sys_rt_sigtimedwait and sys_rt_sigreturn fix(sig syscall): cputime, sys_rt_sigtimedwait and sys_rt_sigreturn Nov 25, 2025
@github-actions github-actions bot removed the ambiguous The title of PR/issue doesn't match the format label Nov 25, 2025
@oeasy1412 oeasy1412 changed the title fix(sig syscall): cputime, sys_rt_sigtimedwait and sys_rt_sigreturn fix(syscall): 修复cputime, sys_rt_sigtimedwait and sys_rt_sigreturn Nov 25, 2025
@github-actions github-actions bot added the Bug fix A bug is fixed in this pull request label Nov 25, 2025
@cursor
Copy link

cursor bot commented Nov 25, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on December 26.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

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

Labels

Bug fix A bug is fixed in this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants