Subject
mio 0.8.11 is a low-level, non-blocking I/O event-notification library for Rust. It wraps OS selectors (epoll on Linux/Android/illumos, kqueue on macOS/BSD, IOCP on Windows, poll_oneoff on WASI) behind a unified Poll / Registry / event::Source API. The crate's primary consumers are async runtimes such as tokio; it is rarely used directly by application code.
Methodology
The published crate contents were compared against the upstream Git repository at the commit recorded in .cargo_vcs_info.json using diff -rq. Source was read with the Read tool; surveys of unsafe blocks, FFI declarations, and concurrency primitives used grep. All 57 Rust source files were read. Total source is approximately 12 300 lines. Tools: openvet 0.6.0, diff, grep.
Results
The diff between published contents and VCS shows only the expected Cargo.toml normalisation. No source files differ; no unexpected binaries are present, justifying has-binaries and has-build-exec.
The codebase contains 146 unsafe blocks across all platform backends. Only one carries a // SAFETY: comment (src/sys/unix/pipe.rs:225). This is the subject of the single medium-severity finding (FINDING-1), which justifies unsafe-documented. Despite the absence of inline documentation, the unsafe sites were reviewed individually and the invariants hold: set_len calls after epoll_wait/kevent are bounded by the kernel-returned count; FromRawFd/from_raw_fd calls correctly take ownership of freshly created fds; the IOCP overlapped pointer round-trips through Arc::into_raw / Arc::from_raw maintain correct reference counts, with the SelectorInner Drop impl draining the completion port to prevent leaks. Justifies unsafe-safe and unsafe-minimal.
The crate opens sockets and files (pipe ends, eventfds, kqueues, epoll fds, AFD handles), justifying uses-network and uses-filesystem. All socket and pipe fds are created with O_NONBLOCK | O_CLOEXEC (or the Windows equivalent) and are closed by the respective Drop impls. The filesystem access is limited to internal mechanism fds — no arbitrary path operations. Justifies filesystem-safe and network-safe. The crate does not implement a security protocol, so network-secure is not applicable and is set to false.
The crate implements a reactor/selector abstraction — the core concurrency primitive of an async runtime — justifying impl-concurrency. Shared mutable state in the Windows backend is guarded by Mutex; polling state is tracked by AtomicBool; the epoll and kqueue backends are stateless between calls. Public types document their thread-safety contracts through Rust's Send/Sync type system. Justifies concurrency-safe, concurrency-documented, concurrency-impl-safe, concurrency-impl-correct, and concurrency-impl-documented. The concurrency implementation is not tested with loom or ThreadSanitizer in the published crate, justifying concurrency-impl-tested as false and unsafe-tested as false.
No malicious code, obfuscated payloads, network exfiltration, or telemetry were found. Justifies is-benign. The crate uses no environment variables, no child-process spawning, no JIT, no cryptography, and no interpreter. Justifies uses-environment, uses-exec, uses-jit, uses-interpreter, and uses-crypto. The crate implements no cryptographic algorithms (impl-crypto), parsers (impl-parser), interpreters (impl-interpreter), JIT compilers (impl-jit), network protocols (impl-protocol), data structures (impl-datastructure), or general algorithms (impl-algorithm). There is no install-time code execution (has-install-exec).
Integration tests live in tests/ (17 files covering TCP, UDP, Unix domain sockets, pipe, waker, poll, and regression cases), justifying has-integration-tests. Unit tests in-source total 8 functions including a layout-correctness test for NamedPipe::Inner, justifying has-unit-tests. No fuzz tests or property tests are present, justifying has-fuzz-tests and has-property-tests.
Conclusion
One medium-severity quality finding was identified: 145 of 146 unsafe blocks carry no // SAFETY: comment, which makes invariant review costly and is atypical for a crate at this level of unsafe density. The unsafe sites themselves were found to be correct on review. The IOCP/AFD backend on Windows is the most complex surface; its overlapped-pointer ownership protocol is sound but relies on undocumented conventions between into_overlapped, from_overlapped, and the named-pipe dispatch path. The selector implementations correctly map between the OS completion/readiness models and mio's edge-triggered API.