From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f42.google.com (mail-yx1-f42.google.com [74.125.224.42]) (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 3A6491DA62E for ; Tue, 24 Feb 2026 00:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771892653; cv=none; b=uS98v+PyWke4Lqd7TlE/a1jTrfYJqskwndDikjLhw6M4jDl0OWqC6BfoIpD0pkLp/kFC89xrUawenl81t7IaBvCwoZOZvP2hpi282d6459Au8YYSnCl6mbQwKhdyWpxCJLDDcLPj9XmhrlDXULdCjOAh0PY5vzoQHfggqxF54K8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771892653; c=relaxed/simple; bh=jKHWyDAu0xJvzI3WO6+meQgDEHUikzp88qy14INmcPk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sj3f1MQ0BQFxc83pyinSHOOVEV2AORNvFOACs3J2b52ZKJnBuH5p6WnLhX5QIAEQBlH/nFi2L+RADBXorNgR4UFb1+0vA21e9uGoH7h7ABl/OyTiXa9AMe8xSccd0SK4DDxMhVAY43C4TwKssW98W/tJIQXWmAhywk7DM8xAZtk= 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=GpogB9XA; arc=none smtp.client-ip=74.125.224.42 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="GpogB9XA" Received: by mail-yx1-f42.google.com with SMTP id 956f58d0204a3-64c9a6d7f81so584638d50.3 for ; Mon, 23 Feb 2026 16:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771892650; x=1772497450; 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=u1akxnV01TuuqkqVdn8oJReBwARp0bMrNePNSdt98A4=; b=GpogB9XAYZVLqYAmNIO3FrVFQhmoujs+FpP+4b4mJiQxMSpUhpo8OwTsalI1EAz5ur FDKD6SSIPbopYVEceVSXKj3gzfrTiKdP0+3Ub6uiMB1ddrs1Fu+cK0zFxTWqfA1p8xWC txJfEn33rZ6JzxMxxuA6/QrDQqfcZRaNXpgcgCSmInhIkhcmYhgtfgA8Gid0msMlNcXz JKBczHy9aVSGRKZKrxwgLCBLNbVUrbZHlQHqRTPyxUdV3UJi+dkZe8fwFoAsw3Jk/4Oz UTt8OAJtk/+0IWTu2oGeGp+fgfSqocrq5h519eM/4FaHGro3RfgStDuRzcEsOwR0S3oc hl+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771892650; x=1772497450; 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=u1akxnV01TuuqkqVdn8oJReBwARp0bMrNePNSdt98A4=; b=FO+vHV+eq/FDHbnCjVnhYkid0PXBAt/Ed92YM6CKbrX5p1H8xChlUVts0FqDCHzuuU yy6HFzP4zW1hzAcLujEk2/qg2L4iW6dTnpbibN3FNal1EHobatOM/eboxgbxNaOhjXHM vDl8ncpH9coR+4WYylTouKGrtHzm+u8VldD7spAZFWFn0+pS3g2wYewzp3Yr094ieCsg fOI88VCkPUd2d1l+oFjXi3m8yPDyho/Mzs1pwVdVZTajmBrxPzQ42aWBFqi2TXV4wTbk bf67kHhNrEgfLi9KQgaUqVDbpFwrNiD/pXtXu5IKGj5MyLlIYCCGO8jLpPDOPH6+5hj4 ogmw== X-Forwarded-Encrypted: i=1; AJvYcCWm+MhlFE1z+H+VnL5EaNjJQ9zItyQ6afWV8LTuSiTg6cXLsUaLG3r+NT2KraEXFi7pHiJHTUcTleH+iU8=@vger.kernel.org X-Gm-Message-State: AOJu0YzSHdWmEsxno3DEl8hYVzkAlYiRG8zY0dh6kcvA/dJzF8u3qKa+ tGmnOYQ9Fz5DJI727Vl+iszJl9LJV+OuWB+UzK+38SwQv/ow1g2b5dsL X-Gm-Gg: ATEYQzyXnQDT0a8BWx5slh72E9DzJGft6qtE3lEuCDd87nnoUwBqE/azEItrtu8zrP3 fvYHIvSE5iCEzTESnYkJ/k0god5njiWMnNvJRjy3g3wVKWGEDAnP1JDzthH16Qnv0LsHjZWqeTt xrwCU1GcU5wg63iQXcZziUfMcc8O4GjxtSbAWpQyES1TADrO0cXoPwXwGMSVMLbpVce8dQRmChQ CbSMYK+A4EQLoYGOkpwX25yGySbTjK3I6mPf9Bcx8JmxEIjLcdt5FF9ZPTiSLE8fkDON782Rx4v VIiPSrEeEcMY++ZZhFR7W39IrdEFcamqEqDFGRxB+3YClZfQVB64l1z4vZQjkinGhJ/YFFJl7+v +nfeCvwcdBiYOUTEX0q3w4+9r61kamKowu7B4+y4Yk3m+6y/bKmDyd9zEK4RHh9BSCugP8BB2YU baDBt17V7Uk8ZSl8H/bEmlSIUtBU3S/IswjqeTivVzSR/vvaM= X-Received: by 2002:a05:690e:4149:b0:649:4906:770a with SMTP id 956f58d0204a3-64c788d2821mr7812527d50.8.1771892650119; Mon, 23 Feb 2026 16:24:10 -0800 (PST) Received: from devvm11784.nha0.facebook.com ([2a03:2880:25ff:41::]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64c7a35d839sm3891935d50.13.2026.02.23.16.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 16:24:09 -0800 (PST) Date: Mon, 23 Feb 2026 16:24:07 -0800 From: Bobby Eshleman To: Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Stefan Hajnoczi , Shuah Khan , Bobby Eshleman , "Michael S. Tsirkin" , Jonathan Corbet , Shuah Khan Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, kuniyu@google.com, ncardwell@google.com, Daan De Meyer Subject: Re: [PATCH net v3 2/3] vsock: lock down child_ns_mode as write-once Message-ID: References: <20260223-vsock-ns-write-once-v3-0-c0cde6959923@meta.com> <20260223-vsock-ns-write-once-v3-2-c0cde6959923@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: <20260223-vsock-ns-write-once-v3-2-c0cde6959923@meta.com> On Mon, Feb 23, 2026 at 02:38:33PM -0800, Bobby Eshleman wrote: > From: Bobby Eshleman > > Two administrator processes may race when setting child_ns_mode as one > process sets child_ns_mode to "local" and then creates a namespace, but > another process changes child_ns_mode to "global" between the write and > the namespace creation. The first process ends up with a namespace in > "global" mode instead of "local". While this can be detected after the > fact by reading ns_mode and retrying, it is fragile and error-prone. > > Make child_ns_mode write-once so that a namespace manager can set it > once and be sure it won't change. Writing a different value after the > first write returns -EBUSY. This applies to all namespaces, including > init_net, where an init process can write "local" to lock all future > namespaces into local mode. > > Fixes: eafb64f40ca4 ("vsock: add netns to vsock core") > Suggested-by: Daan De Meyer > Suggested-by: Stefano Garzarella > Co-developed-by: Stefano Garzarella > Signed-off-by: Stefano Garzarella Stefano, I wasn't sure if you wanted the Co-developed-by and S-o-b on this iteration, but I added it just in case. Please let me know, if that wasn't what you intended. Best, Bobby