`F_SETFL(O_NONBLOCK)` in a child does not reach the parent's fd for the same pipe
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
Start with fd_apply_guest_nonblock and fd_entry_t.linux_flags in src/syscall/fdtable.c, then the fd_host_flag_mask check, to see how guest status flags are stored per process after fork. The reproducer in the issue shows the parent's read returning EINTR instead of EAGAIN; src/syscall/net-msg.c has the related SCM_RIGHTS comment. Done means the parent sees the child's O_NONBLOCK change, confirmed by running the reproducer, with the design choice for the other status flags settled.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A fork leaves parent and child with fds for one open file description. Linux keeps the status flags there, so F_SETFL through either fd changes what both see.
elfuse sets O_NONBLOCK on every host pipe and socket it opens and keeps the guest's own O_NONBLOCK in fd_entry_t.linux_flags (fd_apply_guest_nonblock, src/syscall/fdtable.c). Fork copies that table to the child, and from then on each process changes its own copy.
Reproducer:
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
static void on_alarm(int signo)
{
(void) signo;
}
int main(void)
{
int p[2];
char c;
struct sigaction sa = {.sa_handler = on_alarm};
sigaction(SIGALRM, &sa, NULL);
pipe(p);
if (fork() == 0) {
fcntl(p[0], F_SETFL, fcntl(p[0], F_GETFL) | O_NONBLOCK);
_exit(0);
}
wait(NULL);
int nonblock = (fcntl(p[0], F_GETFL) & O_NONBLOCK) != 0;
alarm(1);
errno = 0;
long r = read(p[0], &c, 1);
printf("O_NONBLOCK in the parent=%d read=%ld errno=%d\n", nonblock, r,
errno);
return 0;
}
O_NONBLOCK in the parent |
read on the empty pipe |
|
|---|---|---|
elfuse b57f367 |
0 | waits until SIGALRM 1 s later, then EINTR |
| Linux 6.12 under qemu | 1 | EAGAIN at once |
The same field holds every status flag elfuse answers without asking the host (fd_host_flag_mask), so O_ASYNC, O_DIRECT and O_NOATIME are per process as well. Only O_NONBLOCK was measured. The comment on a descriptor received over SCM_RIGHTS in src/syscall/net-msg.c states the same limit for that path.
- Ngôn ngữ chính
- C
- Star
- 273
- Fork
- 29
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sysprog21/elfuse
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 40/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của sysprog21/elfuse
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Xinyuan-LilyGO/T-Display-S3#352 · 3 bình luận ·
-
documentation severity/minor
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: AGENTS.md has no rule against running deploy scripts into the owner's game installCó thể đã có người làm @thesprockee đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
EchoTools/nevr-runtime#524 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
python library: btc_sign() sends antiklepto host nonce for taproot miniscript (tr() policy) inputs because is_taproot() only recognizes simple P2TRCó thể đã có người làm @benma-agent đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
BitBoxSwiss/bitbox02-firmware#2145 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
Genymobile/scrcpy#7097 ·
Maintainer thường phản hồi trong vòng 1 ngày