#916

virtio/vsock: stop polling a unix proxy closed by a full shutdown

Openmitodrummerwants to merge intofrom

Since b13ddc5 ("virtio/vsock: release proxies after clean shutdown"), a guest's full shutdown of a stream mapped to a host unix socket shuts down the host socket, marks the UnixProxy Closed and returns the release update. The update carries no polling, so the fd stays registered for EventSet::IN until the reaper removes the proxy.

On Linux that's harmless: the shut-down socket reports EPOLLHUP, process_event() takes the HANG_UP arm, and that arm disarms the fd.

On macOS it can spin. The kqueue-based epoll emulation reports an EOF on EVFILT_READ as IN | READ_HANG_UP and never as HANG_UP. process_event() ignores IN on a proxy that isn't Connected, so nothing disarms the level-triggered read filter, and the vsock muxer thread wakes on it in a tight loop until the reaper drops the proxy. Before b13ddc5 the proxy stayed Connected, so recv() returned 0 and the close path disarmed the fd.

This returns polling = Some((id, fd, EventSet::empty())) from the full-shutdown branch, as the other paths that close a proxy already do.

Testing

  • cargo fmt -- --check
  • cargo clippy --locked -p krun-devices --features blk,net -- -D warnings
  • We carry the same one-line change on top of v1.19.6 in a downstream build. The spin came from code review of the macOS path; we haven't reproduced it on a macOS host yet, and one trigger shape we tried did not spin.

🤖 Generated with Claude Code