RUSTSEC-2026-0386: `AsyncFd::new` and related constructors violate I/O safety

オープン 初心者向け
#3,495 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go, rust
領域
backend, security

調査の方向性

まず、ev-node が Tokio への依存関係をどこで宣言または更新しているかを見つけ、このリポジトリで影響を受ける AsyncFd コンストラクターが使われているか確認してください。レポートにはソースファイルやテストが記載されていません。該当箇所を呼び出し元までたどり、依存関係のバージョンと使用状況を確認してください。リポジトリが影響を受ける安全なコンストラクターに依存しなくなり、関連するチェックに合格すれば完了です。

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

説明

Details
Package tokio
Version 1.52.3
Warning unsound
URL https://github.com/tokio-rs/tokio/pull/8587
Patched Versions >=1.51.6, <1.52.0 OR >=1.53.3
Unaffected Versions <0.3.2

tokio::io::unix::AsyncFd provides safe constructors (new, with_interest, try_new, and try_with_interest) that accept any T: AsRawFd rather than requiring proof of ownership or validity of the file descriptor. Because RawFd implements AsRawFd, safe code can construct an AsyncFd from an arbitrary or closed file descriptor, or close/replace the underlying file descriptor while the AsyncFd is still alive.

This violates I/O safety in two ways:

  1. AsyncFd<T> implements AsFd for all T: AsRawFd by calling BorrowedFd::borrow_raw(self.as_raw_fd()), allowing safe code to obtain an arbitrary BorrowedFd<'_> without owning the file descriptor.
  2. Tokio's I/O driver stores a pointer to an internal allocation in the epoll/kqueue user data for registered file descriptors. If the underlying file descriptor is duplicated and then closed while an AsyncFd is alive, and the OS reuses that file descriptor number for a another IO resource on the same runtime, dropping the first AsyncFd deregisters the reused file descriptor number and frees the first while the original file description remains registered in epoll, leading to a use-after-free when a readiness event fires.

Starting in Tokio 1.51.6, 1.53.3, and 1.54.0, AsyncFd::new, AsyncFd::with_interest, AsyncFd::try_new, and AsyncFd::try_with_interest are deprecated in favor of the unsafe constructors AsyncFd::register and AsyncFd::register_with_interest. Callers must ensure that the file descriptor remains valid, open, and unchanged for the lifetime of the AsyncFd.

主要言語
Go
スター
362
フォーク
295
平均マージ
9時間 29分
マージ済み PR(30日)
3

環境構築

はじめの一歩

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

evstack/ev-node のほかの issue

evstack/ev-node の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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