Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jerome Mohm" <jrmmhm.kernel@eldare.de>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>,
	virtualization@lists.linux.dev, bpf@vger.kernel.org
Subject: Re: [PATCH net] vsock/bpf: release sock lock while waiting for data in recvmsg
Date: Wed, 30 Sep 2026 16:33:14 +0000	[thread overview]
Message-ID: <20260930163315.4EC631F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260929-kbh3-1-022-fix-v1-1-cc97cc95d269@eldare.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] vsock/bpf: blocking recvmsg returns -EAGAIN on EOF/errors
--

commit 8e70f21df314d9898f7fd2e5b9f42b2d7a42d677
Author: Jerome Mohm <jrmmhm.kernel@eldare.de>

vsock/bpf: release sock lock while waiting for data in recvmsg

This commit modifies vsock_msg_wait_data() to drop the socket lock while
sleeping in wait_woken(), and reacquire it upon waking. This prevents the
transport's delivery context from stalling when a blocking recvmsg is in
progress.

> diff --git a/net/vmw_vsock/vsock_bpf.c b/net/vmw_vsock/vsock_bpf.c
> index 9049d26486460..bb7d81a95baa6 100644
> --- a/net/vmw_vsock/vsock_bpf.c
> +++ b/net/vmw_vsock/vsock_bpf.c
> @@ -50,7 +50,9 @@ static bool vsock_msg_wait_data(struct sock *sk, struct sk_psock *psock, long ti
>  	sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
>  	ret = vsock_has_data(sk, psock);
>  	if (!ret) {
> +		release_sock(sk);
>  		wait_woken(&wait, TASK_INTERRUPTIBLE, timeo);
> +		lock_sock(sk);
>  		ret = vsock_has_data(sk, psock);

[Severity: High]
Does this check in vsock_msg_wait_data() miss terminal states when
waking up? If the wakeup is caused by a socket shutdown (EOF), signal,
or socket error, vsock_has_data() will return false since there is no
data.

This would cause vsock_msg_wait_data() to return false, which in turn
makes the caller vsock_bpf_recvmsg() unconditionally translate the
result to -EAGAIN:

net/vmw_vsock/vsock_bpf.c:vsock_bpf_recvmsg() {
...
	if (!vsock_msg_wait_data(sk, psock, timeo)) {
		copied = -EAGAIN;
		break;
	}
...
}

Could this result in blocking recvmsg calls returning -EAGAIN on EOF
or socket errors, violating POSIX semantics and potentially causing
applications to spin in infinite polling loops?

>  	}
>  	sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
>  	remove_wait_queue(sk_sleep(sk), &wait);
>  	return ret;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929-kbh3-1-022-fix-v1-1-cc97cc95d269@eldare.de?part=1

  reply	other threads:[~2026-09-30 16:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 16:33 [PATCH net] vsock/bpf: release sock lock while waiting for data in recvmsg Jerome Mohm via B4 Relay
2026-09-30 16:33 ` sashiko-bot [this message]
2026-10-01  9:01 ` Stefano Garzarella
2026-10-05  7:59   ` Michal Luczaj
2026-10-01 16:35 ` netdev-bot+sashiko

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=20260930163315.4EC631F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=eperezma@redhat.com \
    --cc=jrmmhm.kernel@eldare.de \
    --cc=mst@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox