From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=67.231.145.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796263642; b=N2kMqh8bCRCgbRvPdQ9y2yzqjEZDwPtp3kpsFjk42dBQmZ+UCoTHva5BodlNONcCItcZ j6Ekhguz+FC3Sdob3GFw29zpTsIxLyrN2CaNtxoURltSKcjY35KUpIjyDLfV34Z/humgp fErq0JshXaitgAs4gOhGgM5UsKVKczO7jEAyrYE8SR3A40f6uTdVHlg6i6md4wLw0DAks 6Cl4zQlYjUVqLpmqLcAeedbivQsqMPRM3PZcljaG239RqZnVa2xD1n5nhVSJVGDL9J6OH HzXFKzFlYdm3MyscoZo4R7JSvl8HCQPwyW5wStVDcNFnOLIeNsyLouexOegdELrHPgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796263642; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Date:From:To: CC:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:X-Originating-IP:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Authority-Analysis: X-Proofpoint-Virus-Version; bh=Wne3VlxtMwZkz7vTK/F2dcAhFR8ooFECygAhI9FBa7o=; b=MuODJQgSreS7TswSKQ9ey1fHvC+ET0jzO1/NRmeycMY3X4nYarloROpkC5Lyydenq8KT BZQ48UVMV0qFgNgK6k2EBWDHoJOsCtf8DdnDH5ZppyPY8j64j4En0hsDT2ZseNshmXoQC tvCAFxVW2Ro6gKGRwpP7plNDCz/Lly8go2AYrv3Ep+BNG5j7cDG24nVRoz5EEyDhgXfyx ua2fEfDH70LDb8xl3pJBwT+VuC3TddBrFDpncIRF16v/5u+n0caGt1grcrp/U6Ulmd1+3 6The3nxgGnTmehFXh56t2B8L+tCnjo0u1203y7To1AC3Be636H3wcoi13D6URgMFAqw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass header.d=meta.com header.i=@meta.com header.a=rsa-sha256 header.s=pps82601-s2048-2026-q3 header.b=dCizOYU0; arc=none smtp.remote-ip=67.231.145.42 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76EBF606A322; Thu, 3 Dec 2026 02:07:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 76EBF606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.a=rsa-sha256 header.s=pps82601-s2048-2026-q3 header.b=dCizOYU0 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B305jK0457815; Wed, 2 Dec 2026 18:06:55 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=pps82601-s2048-2026-q3; bh=Wne3VlxtMwZ kz7vTK/F2dcAhFR8ooFECygAhI9FBa7o=; b=dCizOYU0/ky1arrV3jPhMCszBCH 6/PSlm7T11mHMvUlPTsMkLvmqrXiXV92RNk6qrbjyBd+ofVaUAOOtSQgSxgKsk0v tY/RHt7ribUzVTO/EgKoSQ2fJ155bt0lZp1w09kL3PoyrUkDeRLzjp24XqJ7vwQE rBmKw7iQLCoD86gEg5aNt8fAsA6RXagk5hdwBNtKESAwmBsGfT2oFbllaRi8Z3qH vjobtAjYYYhxokZTeKYSnxNM0pje51PDk+F7OFNoRyRbDxH9z0ubWqZ9ntqglNq9 0K5NYIAezJ5yMd0r0nAoE73/RLT/wA/qF/t9eirBStcHg2EZkuR98LSBH6A== Received: from mail.thefacebook.com ([163.114.134.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 4jawbv8paq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 02 Dec 2026 18:06:55 -0800 (PST) Received: from localhost (2620:10d:c085:108::4) by mail.thefacebook.com (2620:10d:c08b:78::c78f) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.57; Thu, 3 Dec 2026 02:06:54 +0000 Date: Wed, 2 Dec 2026 18:06:54 -0800 From: Bobby Eshleman To: Stefano Garzarella CC: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , "Jonathan Corbet" , Shuah Khan , "Stefan Hajnoczi" , "Michael S. Tsirkin" , "Jason Wang" , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Shuah Khan , Randy Dunlap , Donald Hunter , Eric Dumazet , George Zhang , Andy King , Dmitry Torokhov , Willem de Bruijn , , , , , , , , Subject: Re: [PATCH net-next v8 0/7] vsock: assign the guest vsock device to a network namespace Message-ID: References: <20261130-vsock-guest-ns-v8-0-5fff852d325b@meta.com> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Proofpoint-GUID: ZqlOkgbuGX5ZzKUWKH7pg_Q1xz5c-gTi X-Proofpoint-ORIG-GUID: ZqlOkgbuGX5ZzKUWKH7pg_Q1xz5c-gTi X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDAwOCBTYWx0ZWRfXywZJfbBDeQwj z2YCJfESWZSXf3wXhr+uK2T/h92kLT9SxfZ82Gjc5Im0Saf3JqKs/7yy21TpgwLrCJTpG2N8W3g /UPXp4DIvJtTGdrj/SCeMJChM+WJhog= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDAwOCBTYWx0ZWRfX2gqIgyUQJGX+ Vgpcd/2Q4XxJDWBmS0JgbMYJu4yjDiN47/OQuLxfZGYrAGL/R/ygdberywrCKSgYUG90pg8F9rG kjAt1pjZqPQSm8K/R7LhFv2/7eU/Uf4bFXgNKMQmDZ+NP2SXHcnkWtgJuk8owDTFiHgCFF/HhHC bqDxttEFS/VzsHLl21+GsZc2BNd+cSu/0q6fFY+qFy6GLavPtSwlCnkXPqV6xfL277Ehl9+pPLY 7uMwQaYyZgbfNhz1neFtpiJy7Tbf8VGNVWftArAkuO0LjcKDJ1GoMrwkE3lolTA05qqRzxF8Jal WlJcqIsccBGkt8Kj+UtdR5xeuVrriXXlaaov3C2NX2NnjtHwW9PZDNIpiqO2faAqnIqQuo4sdBT COF3NbAzBqNpIiwDK9K+hBK8sgVJujmEkDPpxZ09JXL523eggz91V6vt9v10iUzYy/b+wZsqzVT IRHPTrIaax9TEfwz+eg== X-Authority-Analysis: v=2.4 cv=Ao97T+9P c=1 sm=1 tr=0 ts=6b10cebf cx=c_pps a=CB4LiSf2rd0gKozIdrpkBw==:117 a=CB4LiSf2rd0gKozIdrpkBw==:17 a=kj9zAlcOel0A:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=7x6HtfJdh03M6CCDgxCd:22 a=PAz_-FQ8hEVmOPYdF0yf:22 a=VwQbUJbxAAAA:8 a=VabnemYjAAAA:8 a=20KFwNOVAAAA:8 a=FX3rGARlmeLr0HBe6AcA:9 a=CjuIK1q_8ugA:10 a=gKebqoRLp9LExxC7YDUY:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_07,2026-12-02_07,2025-10-01_01 On Wed, Dec 02, 2026 at 07:15:14PM +0100, Stefano Garzarella wrote: > On Mon, Nov 30, 2026 at 05:06:48PM -0800, Bobby Eshleman wrote: > > vsock network namespaces let a host put each VM in a namespace of its > > own. A guest has no equivalent yet. It has a single G2H device that > > cannot be assigned to a network namespace. > > > > This series lets a guest move that device into a network namespace. A > > new generic netlink family, "vsock", supports the command > > VSOCK_CMD_DEV_NETNS_SET which assigns the device to the namespace given > > by fd or PID, or else to the namespace the request was sent from. The > > namespace's existing ns_mode then decides who may use it: a "global" > > namespace shares the device with every other global namespace, and a > > "local" namespace keeps the host connection to itself. The device starts > > out in the initial namespace, so until the command is issued global > > namespaces see no change, and local namespaces still cannot use it. > > There is no explicit unassign as assigning the device back to the > > initial namespace is equivalent. > > > > The command requires CAP_NET_ADMIN in the initial user namespace, so > > that an unprivileged user namespace cannot claim the device. > > > > Connections that can no longer reach the device after a move are reset, > > so that a namespace which has lost access cannot keep using a socket it > > opened while it still had access. They are reset the same way as when > > the device is removed, so to the old namespace a move looks like an > > unplug. The assignment holds a reference on the namespace, so deleting > > that namespace does not move the device; only another assignment does. > > > > Because a move looks like an unplug, swept sockets share two known > > issues with unplug and replug: connect() can fail with ECONNRESET and > > leave the socket SS_CONNECTED, and shutdown() and credit updates can > > still be sent once the device is reachable again. These will be > > addressed in a separate series. > > > > A socket swept while connect() sleeps hits the same connect() vs reset > > race as on unplug, which is fixed separately in net. This series builds > > and applies without it: > > https://lore.kernel.org/all/20261117-vsock-connect-close-v2-1-db5388323770@meta.com/ > > > > Transports opt in through a new netns_assign_allow flag. Only > > virtio-vsock sets it here, because it is the only guest transport > > that I am able to test against. > > > > Based off of Stefano's original series: > > https://lore.kernel.org/all/20200116172428.311437-1-sgarzare@redhat.com/ > > > > Suggested-by: Stefano Garzarella > > Link: https://lore.kernel.org/all/20200427142518.uwssa6dtasrp3bfc@steredhat/ > > Signed-off-by: Bobby Eshleman > > --- > > Changes in v8: > > - When the device moves to a netns that can no longer reach it, model > > the behavior after a device unplug instead of a peer RST. This > > simplifies the code by reusing vsock_for_each_connected_socket() and > > dropping the lock_sock() sweep, vsock_g2h_assign_mutex and the > > SOCK_DONE/peer_shutdown/TCP_CLOSING juggling > > - Drop cancel_pkt() of swept sockets, so purged skbs no longer leave > > vvs->bytes_unsent elevated (Sashiko) > > - Swept sockets now behave as after an unplug: recv() returns -ENOTCONN > > rather than EOF, and SIOCINQ may report bytes that recv() can no longer > > read (fixing that requires recvmsg() to drain regardless of socket > > state) > > - Fix stale comments > > - Rebased to latest net-next, the tap netns fix is now merged > > - Link to v7: https://lore.kernel.org/r/20261117-vsock-guest-ns-v7-0-7e522ea9dd9b@meta.com > > > > Aaaaa, I tried spending time today to review this, but I failed, sorry :-( > > FYI I'll be travelling till Dec 8, so on Dec 9 this will be my priority. > > Sorry about that! > Stefano No worries, safe travels! Best, Bobby