All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: "Nguyen Dinh Phi [SG]" <phind.uet@gmail.com>
Cc: Michal Luczaj <mhal@rbox.co>,
	"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>,
	 syzbot+1b2c9c4a0f8708082678@syzkaller.appspotmail.com,
	virtualization@lists.linux.dev, netdev@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vsock: use sock_error() to consume sk_err after connect timeout
Date: Wed, 29 Jul 2026 15:03:57 +0200	[thread overview]
Message-ID: <amn5vWcyY0f5ErEM@sgarzare-redhat> (raw)
In-Reply-To: <a4c89c00-ddbe-4278-b386-b83d2b859a70@gmail.com>

On Wed, Jul 29, 2026 at 05:46:29PM +0800, Nguyen Dinh Phi [SG] wrote:
>On 28/7/26 16:21, Stefano Garzarella wrote:
>>On Fri, Jul 24, 2026 at 03:34:23PM +0800, Nguyen Dinh Phi [SG] wrote:
>>>On 24/7/26 05:43, Michal Luczaj wrote:
>>>>On 7/23/26 12:26, Nguyen Dinh Phi [SG] wrote:
>>>>>>>>>...
>>>>>>>>>Yeah, we need to handle that part better, I think it's 
>>>>>>>>>a leftover when
>>>>>>>>>we generalized AF_VSOCK to support more transport than vmci.
>>>>>>>
>>>>>>>Speaking of leftovers, I have trouble understanding where 
>>>>>>>does vsock set
>>>>>>>sk_err on listener sockets anyway. If it doesn't, why vsock_accept()
>>>>>>>checks for it?
>>>>>>
>>>>>>I can't also see where it can be set TBH. Should we remove it ?
>>>>>
>>>>>I couldn't find it for listener side too.
>>>>
>>>>Removing sk_err handling from vsock_accept() solves the problem, right?
>>>>
>>>>thanks,
>>>>Michal
>>>
>>>Yes, confirmed, removing sk_err checks from vsock_accept() does 
>>>solve the problem.
>>
>>Okay, so maybe better on going on this direction. WDYT?
>>
>>Stefano
>>
>
>I'm still a bit concerned about how connect() and poll() interact 
>here, even with the sk_err checks removed from vsock_accept().
>
>For example:
>vsock_accept() now lets us reuse a socket whose connect() failed (call 
>it r0) as syzbot reproducer does. After listen(), r0 becomes a 
>listener (sk_state == TCP_LISTEN) and works correctly -- it accepts 
>connections.
>
>But poll() on r0 still marks POLLERR, even though there is no error on 
>that socket at that point.
>
>As I understand it, sk_err holds an error that has not yet been 
>reported to userspace. In the blocking vsock_connect() case we have 
>already read that error and returned it to the caller, so it is no 
>longer pending
>Shouldn't sk_err be consumed/cleared when vsock_connect() returns it 
>to userspace?

Yeah, makes sense to me, I'll ack the v2.
@Michal WDYT?

As cleanup (separate patch), should we remove the `sk_err` check in 
vsock_accept() ?

Thanks,
Stefano


  reply	other threads:[~2026-07-29 13:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-19 21:57 [PATCH] vsock: use sock_error() to consume sk_err after connect timeout Nguyen Dinh Phi
2026-07-20  8:17 ` Stefano Garzarella
2026-07-20 17:34   ` Phi Nguyen
2026-07-22  7:55     ` Stefano Garzarella
2026-07-23  4:14       ` Nguyen Dinh Phi [SG]
2026-07-23  6:00         ` Michal Luczaj
2026-07-23  8:24           ` Stefano Garzarella
2026-07-23 10:26             ` Nguyen Dinh Phi [SG]
2026-07-23 21:43               ` Michal Luczaj
2026-07-24  7:34                 ` Nguyen Dinh Phi [SG]
2026-07-28  8:21                   ` Stefano Garzarella
2026-07-29  9:46                     ` Nguyen Dinh Phi [SG]
2026-07-29 13:03                       ` Stefano Garzarella [this message]
2026-07-29 13:20                         ` Michal Luczaj
2026-07-29 13:29                           ` Stefano Garzarella
2026-07-29 15:49                             ` Michal Luczaj
2026-07-29 16:51                               ` Phi Nguyen

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=amn5vWcyY0f5ErEM@sgarzare-redhat \
    --to=sgarzare@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhal@rbox.co \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phind.uet@gmail.com \
    --cc=syzbot+1b2c9c4a0f8708082678@syzkaller.appspotmail.com \
    --cc=virtualization@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.