* [PATCH v2] net: unix: remove outdated BSD behavior comment in unix_release_sock() [not found] <20251021195906.20389-1-adelodunolaoluwa.ref@yahoo.com> @ 2025-10-21 19:59 ` Sunday Adelodun 2025-10-22 7:22 ` Kuniyuki Iwashima 2025-10-24 0:30 ` patchwork-bot+netdevbpf 0 siblings, 2 replies; 3+ messages in thread From: Sunday Adelodun @ 2025-10-21 19:59 UTC (permalink / raw) To: kuniyu, davem, edumazet, kuba, pabeni, horms Cc: netdev, linux-kernel, skhan, david.hunter.linux, Sunday Adelodun Remove the long-standing comment in unix_release_sock() that described a behavioral difference between Linux and BSD regarding when ECONNRESET is sent to connected UNIX sockets upon closure. As confirmed by testing on macOS (similar to BSD behavior), ECONNRESET is only observed for SOCK_DGRAM sockets, not for SOCK_STREAM. Meanwhile, Linux already returns ECONNRESET in cases where a socket is closed with unread data or is not yet accept()ed. This means the previous comment no longer accurately describes current behavior and is misleading. Suggested-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Sunday Adelodun <adelodunolaoluwa@yahoo.com> --- Changelog: Changes since v1: - Remove the entire outdated BSD behavior comment, per review feedback. - Update commit message to reflect testing results and reviewer input. net/unix/af_unix.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 768098dec231..54177caa9c12 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -733,17 +733,6 @@ static void unix_release_sock(struct sock *sk, int embrion) /* ---- Socket is dead now and most probably destroyed ---- */ - /* - * Fixme: BSD difference: In BSD all sockets connected to us get - * ECONNRESET and we die on the spot. In Linux we behave - * like files and pipes do and wait for the last - * dereference. - * - * Can't we simply set sock->err? - * - * What the above comment does talk about? --ANK(980817) - */ - if (READ_ONCE(unix_tot_inflight)) unix_gc(); /* Garbage collect fds */ } -- 2.43.0 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: unix: remove outdated BSD behavior comment in unix_release_sock() 2025-10-21 19:59 ` [PATCH v2] net: unix: remove outdated BSD behavior comment in unix_release_sock() Sunday Adelodun @ 2025-10-22 7:22 ` Kuniyuki Iwashima 2025-10-24 0:30 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 3+ messages in thread From: Kuniyuki Iwashima @ 2025-10-22 7:22 UTC (permalink / raw) To: Sunday Adelodun Cc: davem, edumazet, kuba, pabeni, horms, netdev, linux-kernel, skhan, david.hunter.linux On Tue, Oct 21, 2025 at 12:59 PM Sunday Adelodun <adelodunolaoluwa@yahoo.com> wrote: > > Remove the long-standing comment in unix_release_sock() that described a > behavioral difference between Linux and BSD regarding when ECONNRESET is > sent to connected UNIX sockets upon closure. > > As confirmed by testing on macOS (similar to BSD behavior), ECONNRESET I tested on FreeBSD and the behaviour was the same with macOS. ---8<--- $ qemu-system-x86_64 -drive file=FreeBSD-14.3-RELEASE-amd64.qcow2 \ -enable-kvm -cpu host -serial mon:stdio -nographic ... root@freebsd:~ # uname -r 14.3-RELEASE root@freebsd:~ # python a.py test 1 b'hello' b'' test 2 b'' b'' test 3 [Errno 54] Connection reset by peer ---8<--- > is only observed for SOCK_DGRAM sockets, not for SOCK_STREAM. Meanwhile, > Linux already returns ECONNRESET in cases where a socket is closed with > unread data or is not yet accept()ed. This means the previous comment no > longer accurately describes current behavior and is misleading. > > Suggested-by: Kuniyuki Iwashima <kuniyu@google.com> > Signed-off-by: Sunday Adelodun <adelodunolaoluwa@yahoo.com> The comment is outdated anyway, so Link: https://lore.kernel.org/netdev/20251018235325.897059-1-kuniyu@google.com/ Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: unix: remove outdated BSD behavior comment in unix_release_sock() 2025-10-21 19:59 ` [PATCH v2] net: unix: remove outdated BSD behavior comment in unix_release_sock() Sunday Adelodun 2025-10-22 7:22 ` Kuniyuki Iwashima @ 2025-10-24 0:30 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 3+ messages in thread From: patchwork-bot+netdevbpf @ 2025-10-24 0:30 UTC (permalink / raw) To: Sunday Adelodun Cc: kuniyu, davem, edumazet, kuba, pabeni, horms, netdev, linux-kernel, skhan, david.hunter.linux Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Tue, 21 Oct 2025 20:59:06 +0100 you wrote: > Remove the long-standing comment in unix_release_sock() that described a > behavioral difference between Linux and BSD regarding when ECONNRESET is > sent to connected UNIX sockets upon closure. > > As confirmed by testing on macOS (similar to BSD behavior), ECONNRESET > is only observed for SOCK_DGRAM sockets, not for SOCK_STREAM. Meanwhile, > Linux already returns ECONNRESET in cases where a socket is closed with > unread data or is not yet accept()ed. This means the previous comment no > longer accurately describes current behavior and is misleading. > > [...] Here is the summary with links: - [v2] net: unix: remove outdated BSD behavior comment in unix_release_sock() https://git.kernel.org/netdev/net-next/c/ec538867a376 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-24 0:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20251021195906.20389-1-adelodunolaoluwa.ref@yahoo.com>
2025-10-21 19:59 ` [PATCH v2] net: unix: remove outdated BSD behavior comment in unix_release_sock() Sunday Adelodun
2025-10-22 7:22 ` Kuniyuki Iwashima
2025-10-24 0:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®