From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796238440; b=0qBbOxwgN2HP/rwOGhkfPt/hfB0OzWe80gdPhz1Htglio3I3OoPWUGxPAaNRqqxpSp67 odFITM+rB48eNLp5p++uU0r3ft7/V6BLQ59/qejTU70n2xtoYZca3Sc2pJAA4cCZxJZfc DMZNbSy/mR6vh2TcZrSlP0jgh6tCkVBWlCnOib5Td0R67sItA4pqvbbx8t13KuogP5IId BrmtN/yF77XRf6rKw03g5p/HttHYX4oC6u54mePy81Z+yYSspiEnilk42BsDCmlpvyEcn /v4IGnTu77VEaW8O7zHGDNFBRT+eAVFVD2ot/qtjbFnBi3WwYxtZQNYQiqjpTfMJtrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796238440; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=PaREL6DgbE68fR26XwLlPsGLbfZT1vkhDfP1V2sa770=; b=rQ5YqVpJsW1PryYalfM0B12QlaJq05LVVV0ubFo6kKzEnoYzZGiUaam7PG3XrbpIwywj JNY5/bvwKExbIQcd6NBoRGCqr8ReGara55PzjoUrck81ibi/OaCeSe5zaPvlaNmpz8Knp JiPxluT25k9zUr6tW9DxUomgGUeDFco8yB0PCL+qEjuaiEcyo3w/s/khoLvS7tTo+2Grm vDglaF8kIi4hiApQRCBpuJd6MQ4n041htm+iDEXpZcxxyY4QGNvPmw5+yps28o6fJIyoF qzb3LbKxKf19Ay6oYHEv8CVR8l2ERz8Svo5JxHkU4BSEiBLHlQocKpSsCI7dQjoeWOg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bsoLEtd5; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16060606A32C; Wed, 2 Dec 2026 19:07:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bsoLEtd5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06A5E1F00893; Wed, 2 Dec 2026 19:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796238439; bh=PaREL6DgbE68fR26XwLlPsGLbfZT1vkhDfP1V2sa770=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=bsoLEtd5h6yJBDwoDjgjvJJBIHapbYuRFzKy42r6/A/2fsBnGUA5Ctx511Ffb31+0 w362UTn4lzT060lJgy9PzdnMBsswbUCJ501IgV1a+54LwZLydtumO4J+61sVLY9E/N uXkJb/ZU1dluGhsV15Yx4Ms//35AeqN1zdOf3vbhVkv75DO5tvi+2bGoBbVH6ly2ep 6W0wIYZ4fxzFWr/dpIUYCQOZiF3LjEkWVepEGLU6abd3qIrB4OpSL5/NClaa3fHasB lFdcd0hPmUAVMcMCIHfcCsfXCYGyLPbIAPdrZQAVZuHiAb1t4F+ZxjnAyvM2pL7sAE qWGrz3FuoQWuA== Subject: Re: [PATCH net-next v8 6/7] selftests/vsock: test the guest vsock device network namespace From: netdev-bot+sashiko@kernel.org To: bobbyeshleman@meta.com Cc: sgarzare@redhat.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, stefanha@redhat.com, mst@redhat.com, jasowangio@gmail.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, shuah@kernel.org, rdunlap@infradead.org, donald.hunter@gmail.com, edumazet@kernel.org, georgezhang@vmware.com, acking@vmware.com, dtor@vmware.com, willemb@google.com, virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, sargun@sargun.me, jlinbox@meta.com, bobbyeshleman@gmail.com Date: Wed, 02 Dec 2026 19:07:17 +0000 Message-ID: <179623843754.3146.16114719734929000830@kernel.org> In-Reply-To: <20261130-vsock-guest-ns-v8-6-5fff852d325b@meta.com> References: <20261130-vsock-guest-ns-v8-6-5fff852d325b@meta.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] In tools/testing/selftests/vsock/vmtest.sh, test_ns_guest_assign_g2h_netns_pins_ns_ok is described in TEST_DESCS… - [Low] This patch rewrote the --skip=29 comment in test_ns_same_local_host_connect_to_local_vm_ok (vmtest.sh ~1352-1357),… -- selftests/vsock: test the guest vsock device network namespace This adds vmtest.sh tests for assigning the guest vsock device to a network namespace, including namespace destruction and moving the device between namespaces. The tests drive the device through ynl's cli.py, and only these tests are skipped when python3, PyYAML or unshare is missing. > diff --git a/tools/testing/selftests/vsock/vmtest.sh b/tools/testing/selftests/vsock/vmtest.sh > index 310dfc2a39ad5..c771d0cb9268a 100755 > --- a/tools/testing/selftests/vsock/vmtest.sh > +++ b/tools/testing/selftests/vsock/vmtest.sh [ ... ] > @@ -1168,11 +1350,11 @@ test_ns_same_local_host_connect_to_local_vm_ok() { > vm_vsock_test "${ns}" "server" 2 "${TEST_GUEST_PORT}" > > # Skip test 29 (transport release use-after-free): This test attempts > - # binding both G2H and H2G CIDs. Because virtio-vsock (G2H) doesn't > - # support local namespaces the test will fail when > - # transport_g2h->stream_allow() returns false. This edge case only > - # happens for vsock_test in client mode on the host in a local > - # namespace. This is a false positive. > + # binding both G2H and H2G CIDs. The virtio-vsock (G2H) device stays > + # assigned to init_net, which a local namespace cannot reach, so the > + # test will fail when transport_g2h->stream_allow() returns false. This > + # edge case only happens for vsock_test in client mode on the host in a > + # local namespace. This is a false positive. > host_vsock_test "${ns}" "127.0.0.1" "${VSOCK_CID}" "${TEST_HOST_PORT}" --skip=29 [Severity: Low] Is stream_allow() still the check that makes test 29 fail here? In this series, virtio-vsock sets .netns_assign_allow = true. In vsock_connect(), vsock_assign_transport() runs first. It rejects the unreachable G2H device before the stream_allow() check is reached: net/vmw_vsock/af_vsock.c:vsock_assign_transport() { ... if (vsock_g2h_unreachable(new_transport, sock_net(sk))) { ret = -ENETUNREACH; goto err; } ... } test_stream_transport_uaf() in tools/testing/vsock/vsock_test.c only accepts EADDRNOTAVAIL, or ENODEV for CID_HOST. The ENETUNREACH from vsock_assign_transport() is what makes test 29 fail: if (errno != EADDRNOTAVAIL) { perror("Unexpected connect() errno"); exit(EXIT_FAILURE); } The v7 notes say this comment was fixed, but it still points at transport_g2h->stream_allow(). Could it name the vsock_g2h_unreachable() check in vsock_assign_transport() instead? [ ... ] > +test_ns_guest_assign_g2h_netns_pins_ns_ok() { [ ... ] > + vm_ns_stop "init_ns" "${nspid}" > + sleep "${WAIT_PERIOD}" > + > + outfile=$(mktemp) > + guest_send_to_host "init_ns" "" "${port}" "${outfile}" > + result=$(cat "${outfile}") > + if [[ "${result}" == TEST ]]; then > + log_host "device returned to the init ns instead of pinning it" > + rm -f "${outfile}" > + vm_reset_g2h > + return "${KSFT_FAIL}" > + fi > + > + # Assigning it back is what releases the deleted namespace. > + vm_reset_g2h > + > + guest_send_to_host "init_ns" "" "$(( port + 1 ))" "${outfile}" > + result=$(cat "${outfile}") > + rm -f "${outfile}" > + > + if [[ "${result}" != TEST ]]; then > + log_host "device did not come back on reassign: [${result}]" > + return "${KSFT_FAIL}" > + fi [Severity: Low] Does this test check what its description says? The TEST_DESCS entry is "Check the assignment keeps the ns alive when deleted, and that reassigning releases it". The comment above vm_reset_g2h() also says the reassign is what releases the deleted namespace. The test checks only two things: - a send from the guest's init ns fails after the holder exits - a send from init ns works again after vm_reset_g2h() Nothing here checks that the namespace stays alive, or that it is released (put_net / cleanup_net) after the reassign. A netns reference leaked on reassign would still pass. vm_ns_stop() only waits for the holder process to exit, and netns teardown runs asynchronously on netns_wq. Only the fixed sleep "${WAIT_PERIOD}" stands between the two before the first assertion. Suppose a broken implementation moved the device back to init_net from a pernet exit hook, and that cleanup ran after the first guest_send_to_host(). The first check would not fire, vm_reset_g2h() would then reassign explicitly, and the test would still pass. Could the description and the in-body comment be narrowed to what is actually checked? Or could the test check the namespace lifetime directly? The same applies to "including ns destruction" in the commit message. [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-vsock-guest-ns-v8-0-5fff852d325b%40meta.com