Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

SPLICE_F_NONBLOCK can block on a pipe shared with another process

オープン
#473 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c, macos

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C
スター
275
フォーク
29
平均マージ
2日 22時間
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sysprog21/elfuse のほかの issue

sysprog21/elfuse の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。