From 8f8f637c81b2497a8097890fea2b0c31f33bef55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sat, 31 Oct 2026 02:52:21 -0400 Subject: [PATCH] fix(tools): register the inotify fd through tokio's unsafe constructor tokio 1.54 deprecates AsyncFd::with_interest as unsound (RUSTSEC-2026-0386) and Linux clippy flagged it. register_with_interest states the contract the OwnedFd already keeps: the fd stays open and the same while the AsyncFd owns it. --- crates/codegen/kigi-tools/src/computer/local/cgroup.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/codegen/kigi-tools/src/computer/local/cgroup.rs b/crates/codegen/kigi-tools/src/computer/local/cgroup.rs index 32040ef..55667ec 100644 --- a/crates/codegen/kigi-tools/src/computer/local/cgroup.rs +++ b/crates/codegen/kigi-tools/src/computer/local/cgroup.rs @@ -106,7 +106,8 @@ mod linux { // SAFETY: `raw` comes from a successful `inotify_init1`, so it is a // live fd that nothing else owns. let owned = unsafe { OwnedFd::from_raw_fd(raw) }; - let fd = AsyncFd::with_interest(owned, Interest::READABLE)?; + // SAFETY: the AsyncFd owns `owned`, so the fd stays open and fixed. + let fd = unsafe { AsyncFd::register_with_interest(owned, Interest::READABLE) }?; Ok(Inotify { fd }) }