From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A20C932B98F for ; Tue, 13 Jan 2026 17:17:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768324629; cv=none; b=K7MugAyzUew4mwomX8D8zaZr0NNMXvtNaKRCYmJXI51b4Brob4YK+SWTjSN9vXrhCgPpZiCVTqWfuo6EBNYfGVT3VpmOH7Ptpouw5is6DAchrkjXueQJaPBMHsGTWlSFWwnvnKG1ujFKrnKwgupnjufeILJAw7LYes592KS2S0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768324629; c=relaxed/simple; bh=BOiAlUio2xt6kMFB7Iqg42Lzr5vEiOhyy/79lkkulkY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=doWS+0ysWjVnsJZs6WHUbuEfg5oQbURvMlnN6/d0C5t4Ti4/ntvm4KTgO3CsCOPicVQETIkzXC3iPhEsRFh/mpHoAJccPDd3L8ZZcbzaFnTo5YxB9qWF96liz8P1dRcPnMDOf9WkpRMoNGEO9m35qUboq6hrm4EhXLdezMDjwvs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NHVkp9rW; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=SvcC94OG; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NHVkp9rW"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="SvcC94OG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768324625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3UUsl99U+a3n2frGXSYzi136UPXsqcjTTgTorfCP1Ac=; b=NHVkp9rWef3cOzZxI5LMGcVajFLYa324YszaVUXnNnW38uvMo6mEjYb11b8CDFgAJTKY8S cpnhnDDkUC06Rctsn1nAAzWX6Gm6WI1Mzgc8cv09je4d2c13r4GByJdk5InkroaW3QSM27 2MjeEjmPB7LYaH6iOlAP4M7vHw5ZYRE= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-CKfCV4nFNsOXpksr8YLI2Q-1; Tue, 13 Jan 2026 12:17:04 -0500 X-MC-Unique: CKfCV4nFNsOXpksr8YLI2Q-1 X-Mimecast-MFC-AGG-ID: CKfCV4nFNsOXpksr8YLI2Q_1768324623 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-47ed980309aso144915e9.0 for ; Tue, 13 Jan 2026 09:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1768324623; x=1768929423; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3UUsl99U+a3n2frGXSYzi136UPXsqcjTTgTorfCP1Ac=; b=SvcC94OGsB4Xo9umWEL7eXkSL+IYl73oOEst/2yYt4/gjx95IV8BbRUNTHACNc8xt8 TbWNdq8s0Bg1OCIllQ/NuYmJPuPGVZGQtrrlZzx5NJRlDA9pPjHyunSzGOR7TElSl+mX 1fSmS/khCurnqtRRhSJs3TUApeP178AJ4Zb7kEX5l3LvSFYLp8r0ojVM4kHYIIp168I2 W7yGwVUo7kiNmQ2ibu1lMREcy/rcZ/UhBHNzU+XXR0lxFJam0VVxlvL5tZhm+upd421g RmKYRJJGmU/i/iZqoz90k0WVa9+MrYoC77clj07L4n171UYpUYddw//TMykMKDOrrBNy C1bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768324623; x=1768929423; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3UUsl99U+a3n2frGXSYzi136UPXsqcjTTgTorfCP1Ac=; b=VtMs9LRLe9RkXaZx5w5VE7EnddE9KH0nbhXjHCFkKs+kDMTbmM6/LUskXlvFnQ7FEC Ka9k9rgqOLbKyvO9goHe6gOJF0GV4FHhy4yGKL48XBUZabFTYahd0X3xmvLO9xJbtl7J MRQUm4gFBfVWjgFYGuxyBTGX47qum7SidtwbVmTVVQXC2EZDsozo5ukPeTq79Rdh57nQ /KiZuwGRHkI5n3wi0rtDl3gAzyauRkvHUzwiKSE1XLfpgidvLIrkXv0lIIJlqC5XR2cC V7t2Pjhx2f8rBXo+zCh4SUFGfESgRHwz3Gj0QUMwVqokhcc9b1AXUztgRW3xlyRWSBO2 uMUA== X-Forwarded-Encrypted: i=1; AJvYcCWYSgSex3ihrph8FcayruN6r5Qn3GQ5vxaUBdm4AMZFmmOcX9ijcCoNBZhM25EVIWpNstYHO3z4RNQmun4=@vger.kernel.org X-Gm-Message-State: AOJu0YwnR4LydMxgu7lCKmfcRmJpS1F+kpSBxUzANgQ1bLGMpqE0gMQ0 B9ozsGYPTAu+o1sXu3hZ1jH0mO3ayKhUiFwzuy7sZxjqc5/ByIUZTuKtztpVYnP4F1sUQwLXjE+ cBTXQzy23kvNsubTKGM6o7oXIRn10jav82uUt9Cntc1Aokl0foclLdIrIuiqWh/9wbA== X-Gm-Gg: AY/fxX7KOjfGFUffpvD0afEdz4JxN2A4f12HgDz4bOKVlaZ4pA5OZEEsm3aswJ/pbj5 /INLoQcQNB977EE7U6wnz5RFPQ2tg6zu7jMZbNJTffEOfbIJ6mMwzOBcQgFV33K4H5ThhLg2+vT 3nPAWalybFvwY74J7UmGt/lhtmmlMWFsbIV3NufcsxH2wYfPzY7v0c6aPS3uOWWVfbwT4Izv3Kx awCfzN9LoZG6/Uov+h70gcI216v6yehTZ+3+xnhwVQgTcS0tg4dg155BiHFKrio14zJlPAx0yLt NnCyYw/a29ow0G+hHThfuvdPGWNWdN9/P7HUPJjH5W4/NqXhAaPmlokLSHaRbgJL1e5YcnCGefr X1Jq1j3O/KVPc7zjsIYXu2kY7u46bq/smgQPEfDwQIcO81hagKXazke6EXn//DA== X-Received: by 2002:a05:600c:450a:b0:471:5c0:94fc with SMTP id 5b1f17b1804b1-47ed7c074f8mr51944445e9.6.1768324622966; Tue, 13 Jan 2026 09:17:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCSYBYlMR5NUmwo3nUrikwa7NopKszIR4niyQXAQsU/DKal6wX+cyMdumSidxaQyfxjCmWhA== X-Received: by 2002:a05:600c:450a:b0:471:5c0:94fc with SMTP id 5b1f17b1804b1-47ed7c074f8mr51943825e9.6.1768324622288; Tue, 13 Jan 2026 09:17:02 -0800 (PST) Received: from sgarzare-redhat (host-87-12-25-233.business.telecomitalia.it. [87.12.25.233]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd0e17aasm45799146f8f.15.2026.01.13.09.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jan 2026 09:17:01 -0800 (PST) Date: Tue, 13 Jan 2026 18:16:41 +0100 From: Stefano Garzarella To: Bobby Eshleman Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , Eugenio =?utf-8?B?UMOpcmV6?= , Xuan Zhuo , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Bryan Tan , Vishnu Dasa , Broadcom internal kernel review list , Shuah Khan , Long Li , linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org, kvm@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kselftest@vger.kernel.org, berrange@redhat.com, Sargun Dhillon , Bobby Eshleman Subject: Re: [PATCH net-next v14 12/12] selftests/vsock: add tests for namespace deletion Message-ID: References: <20260112-vsock-vmtest-v14-0-a5c332db3e2b@meta.com> <20260112-vsock-vmtest-v14-12-a5c332db3e2b@meta.com> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20260112-vsock-vmtest-v14-12-a5c332db3e2b@meta.com> On Mon, Jan 12, 2026 at 07:11:21PM -0800, Bobby Eshleman wrote: >From: Bobby Eshleman > >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. > >Signed-off-by: Bobby Eshleman >--- >Changes in v13: >- remove tests that change the mode after socket creation (this is not > supported behavior now and the immutability property is tested in other > tests) >- remove "change_mode" behavior of > check_ns_changes_dont_break_connection() and rename to > check_ns_delete_doesnt_break_connection() because we only need to test > namespace deletion (other tests confirm that the mode cannot change) > >Changes in v11: >- remove pipefile (Stefano) > >Changes in v9: >- more consistent shell style >- clarify -u usage comment for pipefile >--- > tools/testing/selftests/vsock/vmtest.sh | 84 +++++++++++++++++++++++++++++++++ > 1 file changed, 84 insertions(+) Reviewed-by: Stefano Garzarella > >diff --git a/tools/testing/selftests/vsock/vmtest.sh b/tools/testing/selftests/vsock/vmtest.sh >index a9eaf37bc31b..dc8dbe74a6d0 100755 >--- a/tools/testing/selftests/vsock/vmtest.sh >+++ b/tools/testing/selftests/vsock/vmtest.sh >@@ -68,6 +68,9 @@ readonly TEST_NAMES=( > ns_same_local_loopback_ok > ns_same_local_host_connect_to_local_vm_ok > ns_same_local_vm_connect_to_local_host_ok >+ ns_delete_vm_ok >+ ns_delete_host_ok >+ ns_delete_both_ok > ) > readonly TEST_DESCS=( > # vm_server_host_client >@@ -135,6 +138,15 @@ readonly TEST_DESCS=( > > # ns_same_local_vm_connect_to_local_host_ok > "Run vsock_test client in VM in a local ns with server in same ns." >+ >+ # ns_delete_vm_ok >+ "Check that deleting the VM's namespace does not break the socket connection" >+ >+ # ns_delete_host_ok >+ "Check that deleting the host's namespace does not break the socket connection" >+ >+ # ns_delete_both_ok >+ "Check that deleting the VM and host's namespaces does not break the socket connection" > ) > > readonly USE_SHARED_VM=( >@@ -1287,6 +1299,78 @@ test_vm_loopback() { > return "${KSFT_PASS}" > } > >+check_ns_delete_doesnt_break_connection() { >+ local pipefile pidfile outfile >+ local ns0="global0" >+ local ns1="global1" >+ local port=12345 >+ local pids=() >+ local rc=0 >+ >+ init_namespaces >+ >+ pidfile="$(create_pidfile)" >+ if ! vm_start "${pidfile}" "${ns0}"; then >+ return "${KSFT_FAIL}" >+ fi >+ vm_wait_for_ssh "${ns0}" >+ >+ outfile=$(mktemp) >+ vm_ssh "${ns0}" -- \ >+ socat VSOCK-LISTEN:"${port}",fork STDOUT > "${outfile}" 2>/dev/null & >+ pids+=($!) >+ vm_wait_for_listener "${ns0}" "${port}" "vsock" >+ >+ # We use a pipe here so that we can echo into the pipe instead of using >+ # socat and a unix socket file. We just need a name for the pipe (not a >+ # regular file) so use -u. >+ pipefile=$(mktemp -u /tmp/vmtest_pipe_XXXX) >+ ip netns exec "${ns1}" \ >+ socat PIPE:"${pipefile}" VSOCK-CONNECT:"${VSOCK_CID}":"${port}" & >+ pids+=($!) >+ >+ timeout "${WAIT_PERIOD}" \ >+ bash -c 'while [[ ! -e '"${pipefile}"' ]]; do sleep 1; done; exit 0' >+ >+ if [[ "$1" == "vm" ]]; then >+ ip netns del "${ns0}" >+ elif [[ "$1" == "host" ]]; then >+ ip netns del "${ns1}" >+ elif [[ "$1" == "both" ]]; then >+ ip netns del "${ns0}" >+ ip netns del "${ns1}" >+ fi >+ >+ echo "TEST" > "${pipefile}" >+ >+ timeout "${WAIT_PERIOD}" \ >+ bash -c 'while [[ ! -s '"${outfile}"' ]]; do sleep 1; done; exit 0' >+ >+ if grep -q "TEST" "${outfile}"; then >+ rc="${KSFT_PASS}" >+ else >+ rc="${KSFT_FAIL}" >+ fi >+ >+ terminate_pidfiles "${pidfile}" >+ terminate_pids "${pids[@]}" >+ rm -f "${outfile}" "${pipefile}" >+ >+ return "${rc}" >+} >+ >+test_ns_delete_vm_ok() { >+ check_ns_delete_doesnt_break_connection "vm" >+} >+ >+test_ns_delete_host_ok() { >+ check_ns_delete_doesnt_break_connection "host" >+} >+ >+test_ns_delete_both_ok() { >+ check_ns_delete_doesnt_break_connection "both" >+} >+ > shared_vm_test() { > local tname > > >-- >2.47.3 >