RUSTSEC-2026-0386: `AsyncFd::new` and related constructors violate I/O safety
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先,将项目的 Tokio 依赖项与安全公告中的已修复版本范围进行核对。检查 AsyncFd::new、with_interest、try_new 和 try_with_interest 的每一种用法,然后改用文档中提供的 unsafe 构造函数,在这些构造函数中可以确保所有权和描述符生命周期。选定版本的 Tokio 不受该问题影响,并且相关测试在不 unsafe 使用文件描述符的情况下通过,即表示工作完成。
由索引模型根据 Issue 内容生成。
描述
| Details | |
|---|---|
| Package | tokio |
| Version | 1.45.1 |
| 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:
AsyncFd<T>implementsAsFdfor allT: AsRawFdby callingBorrowedFd::borrow_raw(self.as_raw_fd()), allowing safe code to obtain an arbitraryBorrowedFd<'_>without owning the file descriptor.- Tokio's I/O driver stores a pointer to an internal allocation in the
epoll/kqueueuser data for registered file descriptors. If the underlying file descriptor is duplicated and then closed while anAsyncFdis alive, and the OS reuses that file descriptor number for a another IO resource on the same runtime, dropping the firstAsyncFdderegisters the reused file descriptor number and frees the first while the original file description remains registered inepoll, 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.
- 主要语言
- Rust
- 星标
- 10
- 派生
- 8
- 平均合并
- 11 天 12 小时
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bitcoindevkit/electrum_streaming_client 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
bitcoindevkit/electrum_streaming_client#56 ·
维护者通常 2 天内回复
-
documentation
难度 1/5 1-3 小时 新手友好度 78/100
bitcoindevkit/electrum_streaming_client#29 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 18/100
bitcoindevkit/electrum_streaming_client#55 ·
维护者通常 2 天内回复
-
RUSTSEC-2026-0221: `event-listener` allows `!Send` tags to cross thread boundaries via `StackSlot`未关闭
难度 2/5 1-3 小时 新手友好度 51/100
bitcoindevkit/electrum_streaming_client#54 ·
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 1/100
bitcoindevkit/electrum_streaming_client#53 ·
维护者通常 2 天内回复
查看 bitcoindevkit/electrum_streaming_client 的全部 Issue
相似的 Issue
-
checkpoint/verify/rebuild_indexes on a thread holding a WriteTransaction deadlock instead of INT-001未关闭bug known-issue
难度 2/5 1-3 小时 新手友好度 74/100
project-minigraf/minigraf#734 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复