`F_GETPIPE_SZ` returns `EINVAL`, and `F_SETLEASE` returns 65536
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
调研方向
从 src/syscall/fs.c 中的 sys_fcntl 开始,其中 switch 使用 case 1024 对应 F_GETPIPE_SZ,并将其命令编号与 issue 中 Linux 的 F_LINUX_SPECIFIC_BASE 偏移量进行比较。编译 reproducer,并分别在管道和普通文件上运行。完成的标准是:F_GETPIPE_SZ 返回管道大小,管道上的 F_SETLEASE 返回 EINVAL,文件上的 F_SETLEASE 返回 0,与表格中的 Linux 行一致。
由索引模型根据 Issue 内容生成。
描述
sys_fcntl (src/syscall/fs.c) answers F_GETPIPE_SZ under case 1024. Linux counts these commands from F_LINUX_SPECIFIC_BASE, which is 1024: F_SETLEASE is 1024, F_GETLEASE is 1025, F_SETPIPE_SZ is 1031 and F_GETPIPE_SZ is 1032. The real F_GETPIPE_SZ therefore reaches the default arm and returns EINVAL, and F_SETLEASE returns 65536 on any fd, which its caller reads as success.
Reproducer:
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
int main(void)
{
int p[2];
pipe(p);
int file = open("/tmp/lease-file", O_CREAT | O_RDONLY, 0600);
errno = 0;
printf("F_GETPIPE_SZ on a pipe: %d errno=%d\n", fcntl(p[0], F_GETPIPE_SZ),
errno);
errno = 0;
printf("F_SETLEASE on a pipe: %d errno=%d\n",
fcntl(p[0], F_SETLEASE, F_RDLCK), errno);
errno = 0;
printf("F_SETLEASE on a file: %d errno=%d\n",
fcntl(file, F_SETLEASE, F_RDLCK), errno);
unlink("/tmp/lease-file");
return 0;
}
F_GETPIPE_SZ on a pipe |
F_SETLEASE on a pipe |
F_SETLEASE on a file |
|
|---|---|---|---|
elfuse b57f367 |
-1, EINVAL |
65536 | 65536 |
| Linux 6.12 under qemu | 65536 | -1, EINVAL |
0 |
F_SETPIPE_SZ is under the right number. It returns its argument and leaves the host pipe as it is, which the comment beside it says.
- 主要语言
- C
- 星标
- 275
- 派生
- 29
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 17
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/elfuse 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 3 天内回复
相似的 Issue
-
v9.6.0: CMake incorrectly enforces presence of libevdev可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug Component component: net
难度 2/5 1-3 小时 新手友好度 78/100
RT-Thread/rt-thread#11913 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
contiki-ng/contiki-ng#3289 ·
维护者通常 3 天内回复
-
area:docs help wanted type:enhancement
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复