Skip to content

sock_hc: only report releases for listening TCP sockets#75

Draft
lacraig2 wants to merge 1 commit into
mainfrom
fix/sock-release-listeners-only
Draft

sock_hc: only report releases for listening TCP sockets#75
lacraig2 wants to merge 1 commit into
mainfrom
fix/sock-release-listeners-only

Conversation

@lacraig2
Copy link
Copy Markdown
Contributor

@lacraig2 lacraig2 commented Jun 6, 2026

Summary

igloo_sock_release fired a release hypercall for any socket release, including accepted/connected sockets that share a listener's local port. A client disconnecting from a service therefore looked like the listener itself closing — most damaging for loopback services bound to 127.0.0.1, whose connections share the bound address.

Gate TCP releases on sk->sk_state == TCP_LISTEN (both IPv4 and IPv6) so only genuine listener shutdowns are reported. UDP behavior is unchanged. Adds #include <net/tcp_states.h> for the constant.

The hook runs before inet_release/tcp_close (it already reads a live inet_sport), so a listener is still in TCP_LISTEN at this point.

Why

Pairs with the host-side socket lifecycle tracking in rehosting/penguin#822 (NetBinds debounce + transient labeling): without this guard, connection teardowns would be mislabeled as service closes / flaps.

Validation

  • Compiles clean against armel/4.10 kernel-devel via ./build.sh (no warnings from sock_hc.c); module loads in-guest.
  • Logical review of state ordering; TCP_LISTEN/sk_state are stable across 4.10 and 6.13.
  • Full in-guest behavioral test pending a matched kernel+driver rebuild (see paired penguin PR).

@lacraig2
Copy link
Copy Markdown
Contributor Author

lacraig2 commented Jun 6, 2026

Paired host-side change: rehosting/penguin#822 (NetBinds debounce + transient lifecycle tracking).

igloo_sock_release fired for any socket release, including accepted and
connected sockets that share a listener's local port. A client disconnecting
from a service therefore looked like the listener itself closing — most
damaging for loopback services bound to 127.0.0.1, whose connections share the
bound address. Gate TCP releases on sk_state == TCP_LISTEN so only genuine
listener shutdowns are reported; UDP behavior is unchanged.

This pairs with the host-side NetBinds lifecycle tracking in rehosting/penguin.
@lacraig2 lacraig2 force-pushed the fix/sock-release-listeners-only branch from 9e60552 to 8336a3b Compare June 6, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant