From: sashiko-bot@kernel.org
To: "Bobby Eshleman" <bobbyeshleman@gmail.com>
Cc: kvm@vger.kernel.org, virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH net-next v2 5/6] selftests/vsock: test the guest vsock device network namespace
Date: Wed, 23 Sep 2026 01:18:43 +0000 [thread overview]
Message-ID: <20260923011843.694B61F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260921-vsock-guest-ns-v2-5-693bd78fde9e@meta.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] kselftest/vsock: missing TEST_FILES breaks make install
- [Medium] netlink: vsock dev-netns-set violates uAPI by not replying
- [Medium] kselftest/vsock: subshell termination leaks ssh and socat processes
--
commit 3122f274adb12a4633dc3d5fee699cdb3ce877cf
Author: Bobby Eshleman <bobbyeshleman@meta.com>
selftests/vsock: test the guest vsock device network namespace
Add tests for guest vsock device namespace assignment, including ns
destruction and the device moving between namespaces.
> diff --git a/tools/testing/selftests/vsock/vmtest.sh b/tools/testing/selftests/vsock/vmtest.sh
> index 310dfc2a39ad5..e94cc2fd90ccd 100755
> --- a/tools/testing/selftests/vsock/vmtest.sh
> +++ b/tools/testing/selftests/vsock/vmtest.sh
> @@ -17,6 +17,8 @@ readonly KERNEL_CHECKOUT=$(realpath "${SCRIPT_DIR}"/../../../../)
> source "${SCRIPT_DIR}"/../kselftest/ktap_helpers.sh
>
> readonly VSOCK_TEST="${SCRIPT_DIR}"/vsock_test
> +readonly YNL_CLI="${KERNEL_CHECKOUT}"/tools/net/ynl/pyynl/cli.py
> +readonly VSOCK_SPEC="${KERNEL_CHECKOUT}"/Documentation/netlink/specs/vsock.yaml
> readonly TEST_GUEST_PORT=51000
> readonly TEST_HOST_PORT=50000
[Severity: Medium]
Does this break running the tests from an installed location (via make
install)? Since cli.py and vsock.yaml are not added to TEST_FILES in the
selftests Makefile, they won't be copied during installation.
When check_deps() runs in the installed environment, it will fail to find
these files at the hardcoded ${KERNEL_CHECKOUT} paths and unconditionally
skip the test suite.
[ ... ]
> +vm_ns_assign_g2h() {
> + local ns=$1
> + local nspid=$2
> +
> + vm_ns_exec "${ns}" "${nspid}" "python3 /root/ynl/cli.py --no-schema \
> + --spec /root/ynl/vsock.yaml --do dev-netns-set"
> +}
[Severity: Medium]
Does dev-netns-set in vsock.yaml violate the Netlink subsystem guidelines?
The operation in vsock.yaml is defined as "do: {}" with no reply, but the
guidelines require that all new operations must reply with a full message
(such as the assigned netns ID) rather than just an ACK to ensure future
extensibility.
[ ... ]
> +host_send_to_guest() {
> + local ns=$1
> + local nspid=$2
> + local port=$3
> + local outfile=$4
> + local cmd="socat -u VSOCK-LISTEN:${port} STDOUT"
> + local dst="VSOCK-CONNECT:${VSOCK_CID}:${port}"
> + local pid
> +
> + vm_ns_exec "${ns}" "${nspid}" "${cmd}" > "${outfile}" 2>/dev/null &
> + pid=$!
[Severity: Medium]
Does this leak the ssh client and remote socat processes? vm_ns_exec is a
bash function, so backgrounding it means $! captures the local subshell's
PID rather than the ssh client's PID.
When terminate_pids sends SIGTERM to the subshell, the subshell exits, but
bash does not forward the signal to its children (the ssh client).
The orphaned ssh process keeps the connection open. Because no PTY is
allocated, the remote sshd does not send SIGHUP, leaving the remote socat
process running and holding the port open, which could cause EADDRINUSE
failures in subsequent shared VM tests.
[ ... ]
> +test_ns_guest_assign_g2h_netns_old_conn_send_fails() {
> + local gap=$(( WAIT_PERIOD * 3 ))
> + local port=12346
> + local outfile
> + local result
> + local sender
> + local nspid
> + local pid
> +
> + nspid=$(vm_ns_start "init_ns")
> + if [[ -z "${nspid}" ]]; then
> + log_host "failed to create a namespace inside the guest"
> + return "${KSFT_FAIL}"
> + fi
> +
> + outfile=$(mktemp)
> + socat -u VSOCK-LISTEN:"${port}" STDOUT > "${outfile}" 2>/dev/null &
> + pid=$!
> + host_wait_for_listener "init_ns" "${port}" "vsock"
> +
> + # Send a message, wait, then send another. While waiting, assign the
> + # device to a namespace. Confirm the second message does not arrive.
> + vm_ssh "init_ns" -- \
> + "(echo FIRST; sleep ${gap}; echo SECOND) |" \
> + "socat -u STDIN VSOCK-CONNECT:2:${port}" &>/dev/null &
> + sender=$!
[Severity: Medium]
Similarly here, does backgrounding the vm_ssh bash function cause it to
orphan the ssh and socat processes when sender is killed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260921-vsock-guest-ns-v2-0-693bd78fde9e@meta.com?part=5
next prev parent reply other threads:[~2026-09-23 1:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 1:18 [PATCH net-next v2 0/6] vsock: assign the guest vsock device to a network namespace Bobby Eshleman
2026-09-22 1:18 ` [PATCH net-next v2 1/6] vsock: constify the transport in vsock_for_each_connected_socket() Bobby Eshleman
2026-09-23 1:18 ` sashiko-bot
2026-09-22 1:18 ` [PATCH net-next v2 2/6] vsock: rename the vsock pernet operations Bobby Eshleman
2026-09-23 1:18 ` sashiko-bot
2026-09-22 1:18 ` [PATCH net-next v2 3/6] vsock: add a netlink command to assign the g2h device to a netns Bobby Eshleman
2026-09-23 1:18 ` sashiko-bot
2026-09-23 19:21 ` netdev-bot+sashiko
2026-09-24 22:40 ` Bobby Eshleman
2026-09-22 1:18 ` [PATCH net-next v2 4/6] vsock/virtio: support guest device network namespace Bobby Eshleman
2026-09-23 1:18 ` sashiko-bot
2026-09-23 19:21 ` netdev-bot+sashiko
2026-09-24 1:16 ` Bobby Eshleman
2026-09-22 1:18 ` [PATCH net-next v2 5/6] selftests/vsock: test the guest vsock " Bobby Eshleman
2026-09-23 1:18 ` sashiko-bot [this message]
2026-09-23 19:21 ` netdev-bot+sashiko
2026-09-24 0:42 ` Bobby Eshleman
2026-09-22 1:18 ` [PATCH net-next v2 6/6] selftests/vsock: test the netns assign privilege checks Bobby Eshleman
2026-09-23 1:18 ` sashiko-bot
2026-09-23 19:21 ` netdev-bot+sashiko
2026-09-24 0:24 ` Bobby Eshleman
2026-09-24 0:55 ` Bobby Eshleman
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=20260923011843.694B61F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bobbyeshleman@gmail.com \
--cc=eperezma@redhat.com \
--cc=kvm@vger.kernel.org \
--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