From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 898151D2F42 for ; Thu, 20 Nov 2025 23:36:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681811; cv=none; b=Ozf5bpg8XMqhfsUcn/I0TDYPvS5kl97O1paPSF9DiOZEucAIv/wPXQH3i3x3qKJ9tueY1XcLBobZTStcmacCk4C2R3tqYxGHN+YXEHpTfZ9ZQEodhaf8xHO/QvELEY6G6EUGGsBag/UmAN+5l3kG4lItYt/HNictLWMAXk8uM5c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681811; c=relaxed/simple; bh=xgZokAZNABaDEkJOi6XbkoiCbaV/hMr2HbQKs7w9K+Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NZOP1Me70eIoz8xwK1Q6SZiVFzpU9AwcqgD5KL0QHtoH0NrTeXIqssxxoUsfRudExRo3ePiNRw5TGpIHNsLdqi5OORT1bjVRgiErciHnW4Y7s70bChMYIjM3o768lX14I9VFm87Dpnv3Hi/T6pZBRoQraQ41hnKMpZSNoG/3H2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UgXfHQM+; arc=none smtp.client-ip=209.85.128.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UgXfHQM+" Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-786943affbaso11405407b3.0 for ; Thu, 20 Nov 2025 15:36:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763681806; x=1764286606; 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=7F8K5d92SUopdRevdYJsWlM5dC1gAVlWHDuGfPJviq0=; b=UgXfHQM+VzkoT9pZfTjeVQlBCkbkgN9lOhxDBGbx0kE7YcuvwPUZT0Avoe4dhS9Aqg YCg7oivtWKHNQhRlcbmsCgF9uldDucelEvevo+NCYiL9xGjmR5XmDzkauyVdiZqnmT4V GA2sJQJZhOrvDcF6H6JcxgUfhMj/Ajzp3zwc+ch2yY8P0icYsqJHp8fGajiyWE050y1s UHghG0pqVnXzJZjZl5KCxy/LsGC8CAWsHpWdyDfI1Jd52NpsbkIgWF43Id8wxwmZrDnP YfCB7qi8RKznsBlzAEQ2bUirfrcq/ZRvOpYjuHTr7LwJ/yEqXVUi1/gFM89PAfgM2cvv 7IAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763681806; x=1764286606; 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=7F8K5d92SUopdRevdYJsWlM5dC1gAVlWHDuGfPJviq0=; b=pYZ7cfQPAbdejJdy3xbko61tef/RPhyDmMn5wbdDXCEusjPoeV1pbbJtkZHtCEhdP9 Smbf37OIehnj1N4KEqLgnYr6CExcD1rTCHItJDEvq9XdFa8A40NuBLBlFor6z92TJQ3u pkavOMIpRtMdbVprpl09KGQEgwDkEJDOsOwtNISnDPo6Qqr0L5ulk/8O8QmZxkf7rv04 nSrmppCB3rTq3RBupwdB0x7AxXvk+CjLAjqd2rMXgyyV1dRd3j1V8kvOM2a5cdvXu43K 0wiLgOdkPfl/lJsN9tOVA96kc3TfdXaJle/76vMF/REzxdc4Sa5lUX8o598JxloeShyO ExaQ== X-Forwarded-Encrypted: i=1; AJvYcCWfjxi1/8iN3aLrKmg95/FaJkWwMmplRWBEX6hMmMYA/DTFYOWYI/nKy5tbsE2ZnNRQqitGSPlt0DgOAE4=@vger.kernel.org X-Gm-Message-State: AOJu0YyAInWx8euyy4qI4muoOgkh5oJ6mtFJnhMNCszzFjvySHF2Vjn6 ZMyqg5H65hGgnBI0aacHn1cCoEitzbbKONqLmfqw/EmNEh+N7so6Fhlp X-Gm-Gg: ASbGncvzEhjnD06RA4iczMJe3py0yg5opNMHJmDEq41JI1KW0kl8+qIkl0JPAmu1xyE oZyuTJojJgypJvmoPf/uDa+34iuaGJW2X97dMxwv2PaEBHuk+7tLEYJTiHZZsFmtgBHOuJhKsO/ uoe2NdpJQDVAe1vbUuax/aqZRw8CIEouRK8eK5wwDHPX6pJWZcibFAEqoToLZhX4jpORAIDs7j2 YttruZK1B1xMbXnk5u0kQvWNl7ChKZffUHDvzzzKQM4Ve1T2qmOJvqZZ8vrus7adogPSj+c1cKn GZyrHr31BqjpMuEvZQ99SnVKPEvf2NElhNsiW8ULJAgk1QlS1jm7qGkD58zK676aDojf34BXkM3 g6pexSOtMOJ8lRFSHm/9iEHKocF1NEe8aqb+R7jfeRXu+RZ8Fs37yhXbduhi7g35aju2GP1SFIK zvbldbkpIzbAihO8fE7A1cWjernarDtpahSZBosKzMKvpnH0E= X-Google-Smtp-Source: AGHT+IG936bzBd2t2ZDaxj9CFy9XI4BtCUEGOQ719Q5cTSLOuBM3YS+5i5WksDX1Mm7w5hHfQZBozg== X-Received: by 2002:a05:690c:620e:b0:787:e384:4e7 with SMTP id 00721157ae682-78a8b55db14mr1407957b3.51.1763681806540; Thu, 20 Nov 2025 15:36:46 -0800 (PST) Received: from devvm11784.nha0.facebook.com ([2a03:2880:25ff:11::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-78a798a7f19sm11526177b3.20.2025.11.20.15.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:36:46 -0800 (PST) Date: Thu, 20 Nov 2025 15:36:44 -0800 From: Bobby Eshleman To: Stefano Garzarella Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , Eugenio =?iso-8859-1?Q?P=E9rez?= , Xuan Zhuo , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Bryan Tan , Vishnu Dasa , Broadcom internal kernel review list , Shuah Khan , 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, Sargun Dhillon , berrange@redhat.com, Bobby Eshleman Subject: Re: [PATCH net-next v10 10/11] selftests/vsock: add tests for host <-> vm connectivity with namespaces Message-ID: References: <20251117-vsock-vmtest-v10-0-df08f165bf3e@meta.com> <20251117-vsock-vmtest-v10-10-df08f165bf3e@meta.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Nov 18, 2025 at 07:15:03PM +0100, Stefano Garzarella wrote: > On Mon, Nov 17, 2025 at 06:00:33PM -0800, Bobby Eshleman wrote: > > From: Bobby Eshleman > > > > 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_start() and vm_dmesg_check() to encapsulate checking dmesg > > for oops and warnings. > > > > Signed-off-by: Bobby Eshleman > > --- > > Changes in v10: > > - add vm_dmesg_start() and vm_dmesg_check() > > > > Changes in v9: > > - consistent variable quoting > > --- ... > > > > +test_ns_diff_global_host_connect_to_global_vm_ok() { > > + local oops_before warn_before > > + local pids pid pidfile > > + local ns0 ns1 port > > + declare -a pids > > + local unixfile > > + ns0="global0" > > + ns1="global1" > > + port=1234 > > + local rc > > + > > + init_namespaces > > + > > + pidfile="$(create_pidfile)" > > + > > + if ! vm_start "${pidfile}" "${ns0}"; then > > + return "${KSFT_FAIL}" > > + fi > > + > > + vm_wait_for_ssh "${ns0}" > > + oops_before=$(vm_dmesg_oops_count "${ns0}") > > + warn_before=$(vm_dmesg_warn_count "${ns0}") > > + > > + unixfile=$(mktemp -u /tmp/XXXX.sock) > > Should we remove this file at the end of this test? > Conveniently, socat does both the create and destroy for us. > > +test_ns_diff_global_host_connect_to_local_vm_fails() { > > + local oops_before warn_before > > + local ns0="global0" > > + local ns1="local0" > > + local port=12345 > > + local dmesg_rc > > + local pidfile > > + local result > > + local pid > > + > > + init_namespaces > > + > > + outfile=$(mktemp) > > + > > + pidfile="$(create_pidfile)" > > + if ! vm_start "${pidfile}" "${ns1}"; then > > + log_host "failed to start vm (cid=${VSOCK_CID}, ns=${ns0})" > > + return "${KSFT_FAIL}" > > + fi > > + > > + vm_wait_for_ssh "${ns1}" > > + oops_before=$(vm_dmesg_oops_count "${ns1}") > > + warn_before=$(vm_dmesg_warn_count "${ns1}") > > + > > + vm_ssh "${ns1}" -- socat VSOCK-LISTEN:"${port}" STDOUT > "${outfile}" & > > Should we wait for the listener here, like we do for TCP sockets? > (also in other place where we use VSOCK-LISTEN) Definitely, I didn't know ss could do this. Best, Bobby