From: Christian Brauner <brauner@kernel.org>
To: Kuniyuki Iwashima <kuni1840@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Rao Shoaib <rao.shoaib@oracle.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v2 net 3/4] af_unix: Don't set -ECONNRESET for consumed OOB skb.
Date: Mon, 23 Jun 2025 14:12:14 +0200 [thread overview]
Message-ID: <20250623-couch-pragmatisch-c0155fd10a11@brauner> (raw)
In-Reply-To: <20250619041457.1132791-4-kuni1840@gmail.com>
On Wed, Jun 18, 2025 at 09:13:57PM -0700, Kuniyuki Iwashima wrote:
> From: Kuniyuki Iwashima <kuniyu@google.com>
>
> Christian Brauner reported that even after MSG_OOB data is consumed,
> calling close() on the receiver socket causes the peer's recv() to
> return -ECONNRESET:
>
> 1. send() and recv() an OOB data.
>
> >>> from socket import *
> >>> s1, s2 = socketpair(AF_UNIX, SOCK_STREAM)
> >>> s1.send(b'x', MSG_OOB)
> 1
> >>> s2.recv(1, MSG_OOB)
> b'x'
>
> 2. close() for s2 sets ECONNRESET to s1->sk_err even though
> s2 consumed the OOB data
>
> >>> s2.close()
> >>> s1.recv(10, MSG_DONTWAIT)
> ...
> ConnectionResetError: [Errno 104] Connection reset by peer
>
> Even after being consumed, the skb holding the OOB 1-byte data stays in
> the recv queue to mark the OOB boundary and break recv() at that point.
>
> This must be considered while close()ing a socket.
>
> Let's skip the leading consumed OOB skb while checking the -ECONNRESET
> condition in unix_release_sock().
>
> Fixes: 314001f0bf92 ("af_unix: Add OOB support")
> Reported-by: Christian Brauner <brauner@kernel.org>
> Closes: https://lore.kernel.org/netdev/20250529-sinkt-abfeuern-e7b08200c6b0@brauner/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
> ---
Thanks for fixing this!
Acked-by: Christian Brauner <brauner@kernel.org>
next prev parent reply other threads:[~2025-06-23 12:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 4:13 [PATCH v2 net 0/4] af_unix: Fix two OOB issues Kuniyuki Iwashima
2025-06-19 4:13 ` [PATCH v2 net 1/4] af_unix: Don't leave consecutive consumed OOB skbs Kuniyuki Iwashima
2025-06-19 4:13 ` [PATCH v2 net 2/4] af_unix: Add test for consecutive consumed OOB Kuniyuki Iwashima
2025-06-19 4:13 ` [PATCH v2 net 3/4] af_unix: Don't set -ECONNRESET for consumed OOB skb Kuniyuki Iwashima
2025-06-23 12:12 ` Christian Brauner [this message]
2025-06-19 4:13 ` [PATCH v2 net 4/4] selftest: af_unix: Add tests for -ECONNRESET Kuniyuki Iwashima
2025-06-24 8:30 ` [PATCH v2 net 0/4] af_unix: Fix two OOB issues patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250623-couch-pragmatisch-c0155fd10a11@brauner \
--to=brauner@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rao.shoaib@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox