Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

SPLICE_F_NONBLOCK can block on a pipe shared with another process

Đang mở
#473 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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, macos
Lĩnh vực
operating-systems

Hướng nghiên cứu

Start in src/syscall/io.c and read the io_xfer, io_xfer_once, sys_splice, and splice_drain_chunk paths described in the issue. Compare the input and output pipe races, then investigate macOS pipe APIs for a per-operation nonblocking transfer that preserves data already read. Done means SPLICE_F_NONBLOCK returns without parking the vCPU in both races, without changing nonblocking behavior for other processes sharing the pipe.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

splice with SPLICE_F_NONBLOCK can still block when another process works on the same pipe between a readiness check and the host transfer. There are two windows, both in src/syscall/io.c:

  • Input: on a pipe that elfuse does not own (for example inherited stdin), io_xfer answers a per-call nonblocking read with poll(0) and then a plain read. When a sibling process drains the pipe between the two calls and the writer stays open, the read parks the vCPU thread, so the splice hangs instead of returning EAGAIN, and guest signal and teardown checks cannot run. A socket input is not affected, because io_xfer_once already passes MSG_DONTWAIT.
  • Output: before each read, sys_splice checks the output pipe's free room with poll and fstat, but that reserves nothing. When another writer fills the pipe between the check and the write, the chunk has already been read, and splice_drain_chunk blocks in io_xfer on the output despite the flag.

Linux holds the pipe lock across the check and the transfer. macOS has no per-call nonblocking read or write for a pipe, and setting O_NONBLOCK on the description would change it for every process that shares it. Making the output write nonblocking would close the second window, but it would lose the chunk already taken from a pipe or socket input.

Found in review on #463, where both windows are now stated in the code comments.

Ngôn ngữ chính
C
Star
278
Fork
31
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
17

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sysprog21/elfuse

Tất cả issue của sysprog21/elfuse

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.