Merge branch 'vsock-add-namespace-support-to-vhost-vsock-and-loopback'
Bobby Eshleman says:
====================
vsock: add namespace support to vhost-vsock and loopback
This series adds namespace support to vhost-vsock and loopback. It does
not add namespaces to any of the other guest transports (virtio-vsock,
hyperv, or vmci).
The current revision supports two modes: local and global. Local
mode is complete isolation of namespaces, while global mode is complete
sharing between namespaces of CIDs (the original behavior).
The mode is set using the parent namespace's
/proc/sys/net/vsock/child_ns_mode and inherited when a new namespace is
created. The mode of the current namespace can be queried by reading
/proc/sys/net/vsock/ns_mode. The mode can not change after the namespace
has been created.
Modes are per-netns. This allows a system to configure namespaces
independently (some may share CIDs, others are completely isolated).
This also supports future possible mixed use cases, where there may be
namespaces in global mode spinning up VMs while there are mixed mode
namespaces that provide services to the VMs, but are not allowed to
allocate from the global CID pool (this mode is not implemented in this
series).
Additionally, added tests for the new namespace features:
tools/testing/selftests/vsock/vmtest.sh
1..25
ok 1 vm_server_host_client
ok 2 vm_client_host_server
ok 3 vm_loopback
ok 4 ns_host_vsock_ns_mode_ok
ok 5 ns_host_vsock_child_ns_mode_ok
ok 6 ns_global_same_cid_fails
ok 7 ns_local_same_cid_ok
ok 8 ns_global_local_same_cid_ok
ok 9 ns_local_global_same_cid_ok
ok 10 ns_diff_global_host_connect_to_global_vm_ok
ok 11 ns_diff_global_host_connect_to_local_vm_fails
ok 12 ns_diff_global_vm_connect_to_global_host_ok
ok 13 ns_diff_global_vm_connect_to_local_host_fails
ok 14 ns_diff_local_host_connect_to_local_vm_fails
ok 15 ns_diff_local_vm_connect_to_local_host_fails
ok 16 ns_diff_global_to_local_loopback_local_fails
ok 17 ns_diff_local_to_global_loopback_fails
ok 18 ns_diff_local_to_local_loopback_fails
ok 19 ns_diff_global_to_global_loopback_ok
ok 20 ns_same_local_loopback_ok
ok 21 ns_same_local_host_connect_to_local_vm_ok
ok 22 ns_same_local_vm_connect_to_local_host_ok
ok 23 ns_delete_vm_ok
ok 24 ns_delete_host_ok
ok 25 ns_delete_both_ok
SUMMARY: PASS=25 SKIP=0 FAIL=0
Thanks again for everyone's help and reviews!
Suggested-by: Sargun Dhillon <sargun@sargun.me>
Signed-off-by: Bobby Eshleman <bobbyeshleman@gmail.com>
v15: https://lore.kernel.org/r/
20260116-vsock-vmtest-v15-0-
bbfd1a668548@meta.com
v14: https://lore.kernel.org/r/
20260112-vsock-vmtest-v14-0-
a5c332db3e2b@meta.com
v13: https://lore.kernel.org/all/
20251223-vsock-vmtest-v13-0-
9d6db8e7c80b@meta.com/
v12: https://lore.kernel.org/r/
20251126-vsock-vmtest-v12-0-
257ee21cd5de@meta.com
v11: https://lore.kernel.org/r/
20251120-vsock-vmtest-v11-0-
55cbc80249a7@meta.com
v10: https://lore.kernel.org/r/
20251117-vsock-vmtest-v10-0-
df08f165bf3e@meta.com
v9: https://lore.kernel.org/all/
20251111-vsock-vmtest-v9-0-
852787a37bed@meta.com
v8: https://lore.kernel.org/r/
20251023-vsock-vmtest-v8-0-
dea984d02bb0@meta.com
v7: https://lore.kernel.org/r/
20251021-vsock-vmtest-v7-0-
0661b7b6f081@meta.com
v6: https://lore.kernel.org/r/
20250916-vsock-vmtest-v6-0-
064d2eb0c89d@meta.com
v5: https://lore.kernel.org/r/
20250827-vsock-vmtest-v5-0-
0ba580bede5b@meta.com
v4: https://lore.kernel.org/r/
20250805-vsock-vmtest-v4-0-
059ec51ab111@meta.com
v2: https://lore.kernel.org/kvm/
20250312-vsock-netns-v2-0-
84bffa1aa97a@gmail.com
v1: https://lore.kernel.org/r/
20200116172428.311437-1-sgarzare@redhat.com
====================
Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-0-2859a7512097@meta.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>