| b3b7b332 | 21-Jan-2026 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add tests for namespace deletion
Add tests that validate vsock sockets are resilient to deleting namespaces. The vsock sockets should still function normally.
The function check_ns
selftests/vsock: add tests for namespace deletion
Add tests that validate vsock sockets are resilient to deleting namespaces. The vsock sockets should still function normally.
The function check_ns_delete_doesnt_break_connection() is added to re-use the step-by-step logic of 1) setup connections, 2) delete ns, 3) check that the connections are still ok.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-12-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| 0424ee7c | 21-Jan-2026 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add tests for host <-> vm connectivity with namespaces
Add tests to validate namespace correctness using vsock_test and socat. The vsock_test tool is used to validate expected succe
selftests/vsock: add tests for host <-> vm connectivity with namespaces
Add tests to validate namespace correctness using vsock_test and socat. The vsock_test tool is used to validate expected success tests, but socat is used for expected failure tests. socat is used to ensure that connections are rejected outright instead of failing due to some other socket behavior (as tested in vsock_test). Additionally, socat is already required for tunneling TCP traffic from vsock_test. Using only one of the vsock_test tests like 'test_stream_client_close_client' would have yielded a similar result, but doing so wouldn't remove the socat dependency.
Additionally, check for the dependency socat. socat needs special handling beyond just checking if it is on the path because it must be compiled with support for both vsock and unix. The function check_socat() checks that this support exists.
Add more padding to test name printf strings because the tests added in this patch would otherwise overflow.
Add vm_dmesg_* helpers to encapsulate checking dmesg for oops and warnings.
Add ability to pass extra args to host-side vsock_test so that tests that cause false positives may be skipped with arg --skip.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-11-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| 605caec5 | 21-Jan-2026 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add namespace tests for CID collisions
Add tests to verify CID collision rules across different vsock namespace modes.
1. Two VMs with the same CID cannot start in different global
selftests/vsock: add namespace tests for CID collisions
Add tests to verify CID collision rules across different vsock namespace modes.
1. Two VMs with the same CID cannot start in different global namespaces (ns_global_same_cid_fails) 2. Two VMs with the same CID can start in different local namespaces (ns_local_same_cid_ok) 3. VMs with the same CID can coexist when one is in a global namespace and another is in a local namespace (ns_global_local_same_cid_ok and ns_local_global_same_cid_ok)
The tests ns_global_local_same_cid_ok and ns_local_global_same_cid_ok make sure that ordering does not matter.
The tests use a shared helper function namespaces_can_boot_same_cid() that attempts to start two VMs with identical CIDs in the specified namespaces and verifies whether VM initialization failed or succeeded.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-10-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| 06cf7895 | 21-Jan-2026 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add tests for proc sys vsock ns_mode
Add tests for the /proc/sys/net/vsock/{ns_mode,child_ns_mode} interfaces. Namely, that they accept/report "global" and "local" strings and enfor
selftests/vsock: add tests for proc sys vsock ns_mode
Add tests for the /proc/sys/net/vsock/{ns_mode,child_ns_mode} interfaces. Namely, that they accept/report "global" and "local" strings and enforce their access policies.
Start a convention of commenting the test name over the test description. Add test name comments over test descriptions that existed before this convention.
Add a check_netns() function that checks if the test requires namespaces and if the current kernel supports namespaces. Skip tests that require namespaces if the system does not have namespace support.
This patch is the first to add tests that do *not* re-use the same shared VM. For that reason, it adds a run_ns_tests() function to run these tests and filter out the shared VM tests.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-9-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| 7418f3bb | 21-Jan-2026 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: use ss to wait for listeners instead of /proc/net
Replace /proc/net parsing with ss(8) for detecting listening sockets in wait_for_listener() functions and add support for TCP, VSOC
selftests/vsock: use ss to wait for listeners instead of /proc/net
Replace /proc/net parsing with ss(8) for detecting listening sockets in wait_for_listener() functions and add support for TCP, VSOCK, and Unix socket protocols.
The previous implementation parsed /proc/net/tcp using awk to detect listening sockets, but this approach could not support vsock because vsock does not export socket information to /proc/net/.
Instead, use ss so that we can detect listeners on tcp, vsock, and unix.
The protocol parameter is now required for all wait_for_listener family functions (wait_for_listener, vm_wait_for_listener, host_wait_for_listener) to explicitly specify which socket type to wait for.
ss is added to the dependency check in check_deps().
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-8-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| 4e870ac8 | 21-Jan-2026 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add vm_dmesg_{warn,oops}_count() helpers
These functions are reused by the VM tests to collect and compare dmesg warnings and oops counts. The future VM-specific tests use them heav
selftests/vsock: add vm_dmesg_{warn,oops}_count() helpers
These functions are reused by the VM tests to collect and compare dmesg warnings and oops counts. The future VM-specific tests use them heavily. This patches relies on vm_ssh() already supporting namespaces.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-7-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| fd1b4172 | 21-Jan-2026 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: prepare vm management helpers for namespaces
Add namespace support to vm management, ssh helpers, and vsock_test wrapper functions. This enables running VMs and test helpers in spec
selftests/vsock: prepare vm management helpers for namespaces
Add namespace support to vm management, ssh helpers, and vsock_test wrapper functions. This enables running VMs and test helpers in specific namespaces, which is required for upcoming namespace isolation tests.
The functions still work correctly within the init ns, though the caller must now pass "init_ns" explicitly.
No functional changes for existing tests. All have been updated to pass "init_ns" explicitly.
Affected functions (such as vm_start() and vm_ssh()) now wrap their commands with 'ip netns exec' when executing commands in non-init namespaces.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-6-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| 423ec638 | 21-Jan-2026 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add namespace helpers to vmtest.sh
Add functions for initializing namespaces with the different vsock NS modes. Callers can use add_namespaces() and del_namespaces() to create names
selftests/vsock: add namespace helpers to vmtest.sh
Add functions for initializing namespaces with the different vsock NS modes. Callers can use add_namespaces() and del_namespaces() to create namespaces global0, global1, local0, and local1.
The add_namespaces() function initializes global0, local0, etc... with their respective vsock NS mode by toggling child_ns_mode before creating the namespace.
Remove namespaces upon exiting the program in cleanup(). This is unlikely to be needed for a healthy run, but it is useful for tests that are manually killed mid-test.
This patch is in preparation for later namespace tests.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-5-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| 99f932c9 | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: disable shellcheck SC2317 and SC2119
Disable shellcheck rules SC2317 and SC2119. These rules are being triggered due to false positives. For SC2317, many `return "${KSFT_PASS}"` lin
selftests/vsock: disable shellcheck SC2317 and SC2119
Disable shellcheck rules SC2317 and SC2119. These rules are being triggered due to false positives. For SC2317, many `return "${KSFT_PASS}"` lines are reported as unreachable, even though they are executed during normal runs. For SC2119, the fact that log_guest/log_host accept either stdin or arguments triggers SC2119, despite being valid.
Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-12-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 338c5ddf | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add vsock_loopback module loading
Add vsock_loopback module loading to the loopback test so that vmtest.sh can be used for kernels built with loopback as a module.
This is not tech
selftests/vsock: add vsock_loopback module loading
Add vsock_loopback module loading to the loopback test so that vmtest.sh can be used for kernels built with loopback as a module.
This is not technically a fix as kselftest expects loopback to be built-in already (defined in selftests/vsock/config). This is useful only for using vmtest.sh outside of kselftest.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-11-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 67422ef3 | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add 1.37 to tested virtme-ng versions
Testing with 1.37 shows all tests passing but emits the warning:
warning: vng version 'virtme-ng 1.37' has not been tested and may not functio
selftests/vsock: add 1.37 to tested virtme-ng versions
Testing with 1.37 shows all tests passing but emits the warning:
warning: vng version 'virtme-ng 1.37' has not been tested and may not function properly. The following versions have been tested: 1.33 1.36
This patch adds 1.37 to the virtme-ng versions to get rid of the above warning.
Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-10-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 592e3d14 | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add BUILD=0 definition
Add the definition for BUILD and initialize it to zero. This avoids 'bash -u vmtest.sh` from throwing 'unbound variable' when BUILD is not set to 1 and is lat
selftests/vsock: add BUILD=0 definition
Add the definition for BUILD and initialize it to zero. This avoids 'bash -u vmtest.sh` from throwing 'unbound variable' when BUILD is not set to 1 and is later checked for its value.
Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-9-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| d13fb04a | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: identify and execute tests that can re-use VM
In preparation for future patches that introduce tests that cannot re-use the same VM, add functions to identify those that *can* re-us
selftests/vsock: identify and execute tests that can re-use VM
In preparation for future patches that introduce tests that cannot re-use the same VM, add functions to identify those that *can* re-use a VM.
By continuing to re-use the same VM for these tests we can save time by avoiding the delay of booting a VM for every test.
Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-8-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 7fea50df | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: add check_result() for pass/fail counting
Add check_result() function to reuse logic for incrementing the pass/fail counters. This function will get used by different callers as we
selftests/vsock: add check_result() for pass/fail counting
Add check_result() function to reuse logic for incrementing the pass/fail counters. This function will get used by different callers as we add different types of tests in future patches (namely, namespace and non-namespace tests will be called at different places, and re-use this function).
Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-7-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 9e2ad0bc | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: speed up tests by reducing the QEMU pidfile timeout
Reduce the time waiting for the QEMU pidfile from three minutes to five seconds. The three minute time window was chosen to make
selftests/vsock: speed up tests by reducing the QEMU pidfile timeout
Reduce the time waiting for the QEMU pidfile from three minutes to five seconds. The three minute time window was chosen to make sure QEMU had enough time to fully boot up. This, however, is an unreasonably long delay for QEMU to write the pidfile, which happens earlier when the QEMU process starts (not after VM boot). The three minute delay becomes noticeably wasteful in future tests that expect QEMU to fail and wait a full three minutes for a pidfile that will never exist.
Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-6-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| c7df4adc | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: do not unconditionally die if qemu fails
If QEMU fails to boot, then set the returncode (via timeout) instead of unconditionally dying. This is in preparation for tests that expect
selftests/vsock: do not unconditionally die if qemu fails
If QEMU fails to boot, then set the returncode (via timeout) instead of unconditionally dying. This is in preparation for tests that expect QEMU to fail to boot. In that case, we just want to know if the boot failed or not so we can test the pass/fail criteria, and continue executing the next test.
Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-5-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| ac8997e9 | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: avoid multi-VM pidfile collisions with QEMU
Change QEMU to use generated pidfile names instead of just a single globally-defined pidfile. This allows multiple QEMU instances to co-e
selftests/vsock: avoid multi-VM pidfile collisions with QEMU
Change QEMU to use generated pidfile names instead of just a single globally-defined pidfile. This allows multiple QEMU instances to co-exist with different pidfiles. This is required for future tests that use multiple VMs to check for CID collissions.
Additionally, this also places the burden of killing the QEMU process and cleaning up the pidfile on the caller of vm_start(). To help with this, a function terminate_pidfiles() is introduced that callers use to perform the cleanup. The terminate_pidfiles() function supports multiple pidfile removals because future patches will need to process two pidfiles at a time.
Change QEMU_OPTS to be initialized inside the vm_start(). This allows the generated pidfile to be passed to the string assignment, and prepares for future vm-specific options as well (e.g., cid).
Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-4-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 4f76ff14 | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: reuse logic for vsock_test through wrapper functions
Add wrapper functions vm_vsock_test() and host_vsock_test() to invoke the vsock_test binary. This encapsulates several items of
selftests/vsock: reuse logic for vsock_test through wrapper functions
Add wrapper functions vm_vsock_test() and host_vsock_test() to invoke the vsock_test binary. This encapsulates several items of repeat logic, such as waiting for the server to reach listening state and enabling/disabling the bash option pipefail to avoid pipe-style logging from hiding failures.
Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-3-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 2ed3ce7e | 08-Nov-2025 |
Bobby Eshleman <bobbyeshleman@meta.com> |
selftests/vsock: make wait_for_listener() work even if pipefail is on
Rewrite wait_for_listener()'s pattern matching to avoid tripping the if-condition when pipefail is on.
awk doesn't gracefully h
selftests/vsock: make wait_for_listener() work even if pipefail is on
Rewrite wait_for_listener()'s pattern matching to avoid tripping the if-condition when pipefail is on.
awk doesn't gracefully handle SIGPIPE with a non-zero exit code, so grep exiting upon finding a match causes false-positives when the pipefail option is used (grep exits, SIGPIPE emits, and awk complains with a non-zero exit code). Instead, move all of the pattern matching into awk so that SIGPIPE cannot happen and the correct exit code is returned.
Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20251108-vsock-selftests-fixes-and-improvements-v4-2-d5e8d6c87289@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|