From: sashiko-bot@kernel.org
To: "Sergio Lopez" <slp@redhat.com>
Cc: virtualization@lists.linux.dev, kvm@vger.kernel.org,
bpf@vger.kernel.org, linux-hyperv@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH RFC v3 8/8] vsock: add datagram tests to vsock_test
Date: Fri, 13 Nov 2026 17:51:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-213365@kernel.org> (raw)
In-Reply-To: <20261113-vsock-dgram-support-v3-8-1523c8e9b27e@redhat.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] selftests/vsock: unguarded loopback SOCK_SEQPACKET connect in
local netns
- [Low] vsock/test: incomplete DGRAM_VMCI probe in dgram_capabilities()
--
commit 75f8685914783d3ed99f76000f4d13a1f1c04ea3
Author: Sergio Lopez <slp@redhat.com>
vsock: add datagram tests to vsock_test
This commit adds AF_VSOCK datagram tests to vsock_test covering local
semantics, peer transfers, routing, queue accounting, and capability-based
skips, along with a --local mode for running local test cases standalone.
> diff --git a/tools/testing/vsock/vsock_test_dgram.c b/tools/testing/vsock/vsock_test_dgram.c
> new file mode 100644
> index 0000000000000..4b45dcf2a15cc
> --- /dev/null
> +++ b/tools/testing/vsock/vsock_test_dgram.c
> @@ -0,0 +1,1061 @@
[ ... ]
> +static unsigned int dgram_capabilities(const struct test_opts *opts,
> + unsigned int needs)
> +{
> + unsigned int caps = DGRAM_SOCKET;
> + struct sockaddr_vm peer;
> + int fd, local_fd;
> +
> + fd = socket(AF_VSOCK, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
> + if (fd < 0) {
> + if (dgram_unavailable(errno))
> + return 0;
> + check(fd, "probe datagram socket");
> + }
> + /* VMCI may own the socket while a directional transport serves peers.
> + * A nested guest can have both virtio and vhost registered. Probe the
> + * requested direction so vhost registration cannot mask a virtio device
> + * that did not negotiate datagrams.
> + */
> + if (!access("/sys/module/vmw_vsock_vmci_transport", F_OK))
> + caps |= DGRAM_VMCI;
[Severity: Low]
Does checking only for /sys/module/vmw_vsock_vmci_transport leave
test_dgram_vmci_inq() unskipped when VMCI cannot route datagrams to
itself?
When vmw_vsock_vmci_transport is loaded without vsock_loopback, running in
a local-mode vsock network namespace causes vmci_transport_dgram_allow()
to return false and sendto() in test_dgram_vmci_inq() to fail with EINVAL
(or EADDRNOTAVAIL when VMCI has no active context ID), aborting the test
run instead of skipping.
[ ... ]
> + if (needs & DGRAM_LOOPBACK) {
> + /* Binding a stream socket to CID_LOCAL probes registration of
> + * the loopback transport without sending a packet to the host.
> + */
> + local_fd = vsock_bind_try(VMADDR_CID_LOCAL, VMADDR_PORT_ANY, SOCK_STREAM);
> + if (local_fd >= 0) {
> + caps |= DGRAM_LOOPBACK;
> + close(local_fd);
> + } else if (errno != EADDRNOTAVAIL) {
> + check(local_fd, "probe loopback transport");
> + }
> + }
> + return caps;
> +}
[ ... ]
> +void test_dgram_bound_lookup(const struct test_opts *opts)
> +{
> + const int types[] = { SOCK_STREAM, SOCK_SEQPACKET };
> + unsigned int cid = local_cid();
> + size_t i;
> +
> + for (i = 0; i < ARRAY_SIZE(types); i++) {
> + int listener = vsock_bind(VMADDR_CID_ANY, VMADDR_PORT_ANY, types[i]);
> + int stream = vsock_bind(VMADDR_CID_LOCAL, VMADDR_PORT_ANY, types[i]);
> + struct sockaddr_vm listen_addr = local_address(listener);
> + struct sockaddr_vm src = sock_name(stream, false);
> + struct sockaddr_vm dest;
> + int accepted, tx, rx;
> + char byte;
> +
> + check(listen(listener, 1), "listen");
> + if (vsock_connect_fd(stream, listen_addr.svm_cid, listen_addr.svm_port))
> + fail("%s loopback connect: %s",
> + types[i] == SOCK_STREAM ? "stream" : "seqpacket", strerror(errno));
[Severity: Medium]
Will the SOCK_SEQPACKET iteration in test_dgram_bound_lookup() and
test_dgram_port_space() fail with ESOCKTNOSUPPORT when vsock_test runs in
a local-mode vsock network namespace?
dgram_capabilities() probes DGRAM_LOOPBACK with SOCK_STREAM, which is
allowed in both global and local namespace modes, whereas
vsock_loopback_seqpacket_allow() rejects SOCK_SEQPACKET when the socket is
not in global mode:
net/vmw_vsock/vsock_loopback.c:vsock_loopback_seqpacket_allow() {
return vsock_net_mode_global(vsk);
}
As a result, running vsock_test in a local-mode namespace (such as the
local-namespace cases in tools/testing/selftests/vsock/vmtest.sh) will
pass the capability check and then abort in test_dgram_bound_lookup() and
test_dgram_port_space() when connecting the SOCK_SEQPACKET socket to
VMADDR_CID_LOCAL.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113-vsock-dgram-support-v3-0-1523c8e9b27e@redhat.com?part=8
prev parent reply other threads:[~2026-11-13 17:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 17:15 [PATCH RFC v3 0/8] vsock: add datagram support to virtio and vhost Sergio Lopez
2026-11-13 17:15 ` [PATCH RFC v3 1/8] vsock: expose the core port allocator to transports Sergio Lopez
2026-11-13 17:15 ` [PATCH RFC v3 2/8] vsock: report datagram receive and send queue state Sergio Lopez
2026-11-13 17:15 ` [PATCH RFC v3 3/8] vsock/virtio: implement the datagram data path Sergio Lopez
2026-11-13 17:47 ` sashiko-bot
2026-11-13 17:15 ` [PATCH RFC v3 4/8] vsock/virtio: negotiate datagram support on the guest Sergio Lopez
2026-11-13 17:15 ` [PATCH RFC v3 5/8] vhost/vsock: negotiate datagram support with guests Sergio Lopez
2026-11-13 17:15 ` [PATCH RFC v3 6/8] vsock: allow datagrams to use directional transports Sergio Lopez
2026-11-13 17:42 ` sashiko-bot
2026-11-13 17:15 ` [PATCH RFC v3 7/8] vsock: fragment datagrams across receive buffers Sergio Lopez
2026-11-13 17:15 ` [PATCH RFC v3 8/8] vsock: add datagram tests to vsock_test Sergio Lopez
2026-11-13 17:51 ` sashiko-bot [this message]
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=sashiko-outbox-213365@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=eperezma@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=slp@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox