sys_epoll_wait/sys_epoll_pwait2 drop syscalls when 4 FDs ready for operation

未关闭 适合新手
#4,145 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c, linux

调研方向

错误位于 src/preload/syscallbuf.c 的系统调用缓冲预加载代码中,大约第 2827-2828 行,那里将 epoll_wait 调用的返回值与 EINTR 进行比较。请在 sys_epoll_pwait2 处理程序中检查同样的模式。阅读链接的 man 手册中关于返回值的章节,然后通过录制一个获得四个就绪文件描述符的程序来确认修复,并检查没有系统调用丢失。当返回值检查测试的是 -1 和 errno,而不是返回值本身时,即完成。

由索引模型根据 Issue 内容生成。

描述

per https://www.man7.org/linux/man-pages/man2/epoll_wait.2.html

On success, epoll_wait() returns the number of file descriptors
ready for the requested I/O operation, or zero if no file
descriptor became ready during the requested timeout milliseconds.
On failure, epoll_wait() returns -1 and errno is set to indicate
the error.

https://github.com/rr-debugger/rr/blob/master/src/preload/syscallbuf.c#L2827-L2828 (and corresponding code for sys_epoll_pwait2) check the return value of the syscall against EINTR (defined to be 4). This is a bug, and drops syscalls when using rr recording.
Instead, ret should be checked against -1, and errno against EINTR.

Thanks to my AI for finding this bug 😅

主要语言
C++
星标
10.7k
派生
666
平均合并
1 天 21 小时
30 天内合并 PR
31

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rr-debugger/rr 的其他 Issue

查看 rr-debugger/rr 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。