From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f50.google.com (mail-yx1-f50.google.com [74.125.224.50]) (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 365E51DA0E1 for ; Tue, 24 Feb 2026 00:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771892652; cv=none; b=kYHTMDGN13cVbqOcSROAsxYOCprIEL07KYo2bfqiJZoYUwd+oIXHDtfuzedUstAOLhL9IPDZF+JEm4VjSjh3lC9YZv6na53ITFckMbDdpa28rCJe9yUsjoMYHEjyS6INX/hxMX8JyT69jBPE0lqw5j/9ExJG594u7qxVAOqDs3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771892652; 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=AELyE3R25UET3xLveCEFaZausIZQ2wNjsRXPty+gm9DIcUOet5n/a2j1oP1KYxHvlDCx8TNHF07biMZZpdUWqFCM/dDl8mZ3kRqE3onm8VV5/6UzZQ4w+VBdJUBZ9aw0Y8OFVaw3LxzbkUMPpyVsUKvbuoQPxatVyW6aHlM4VE4= 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.50 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-f50.google.com with SMTP id 956f58d0204a3-64ad8435f46so4429171d50.1 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=BMtBPl3Q9/7Ikf/2be9xmyJQcMK9lVAAyyhBqSy+NHwm9F44mq3+h6LP7Ww2JqaoCd 3jwct2+vm29kGCF8GMhmnYBb0cmhomCu9E/HvgdaAduJdqzx7HGFzKPNjnCHi3pnewbf j870UfTz6wUF5gtwf7JjpCYr/pqgb81svqPToFwkZGqn0gMKL6bIpGHNSnLlx/YncEB4 2rYiOC8chhB6fgQ391FKxhdScZGyhPaz2CMDGjXZ3WTUS3M/D2a0nyUm/FvuuBXwztjq 3WbkkL5FK1puXfv1Ee02Ixl5b+gG/lw+oJPH/Bma1YHpg3u5WPGI6/g2cLT9rrbtNoZN lbxg== X-Forwarded-Encrypted: i=1; AJvYcCVyIKOHqXq+hP4eJ+YsECsSQ61TL2MX2ssA5G+kWZyH+Dnz0rnUeW5EkVQuJhjGdb2BrVjPmKg=@vger.kernel.org X-Gm-Message-State: AOJu0YzSPpDruZpbC5Xzo+wa5OS7o6k0l5GvZB69lYn6i4YcH4y0JXvy M0Muu+gMCaVsdAtlPOR2+Jp7X1WteOyb2ggom5//he2inIXJ5X1iPY1V X-Gm-Gg: ATEYQzwZ0lDdWQTgFnbnUp+JiYKvFe1Mdr8WR7O+iOsKlje9bc4+wDe7648GeFwI9E7 jOFZOOlVoE7OZ/0A8qmtCvc9y7oJhULYnZPg2VsqygGz9E9HJmJgUNtehgipSP1fCla9gEmrRPx Q9RqS5dyQogqSE1Xw6Jj+GLEVvH0RBvH6b1FiyO5pOlCZj1ylK5OziiVmM4D7R4POjfvZ2mBXle bFkfCpKcSjn7IV55611JlVvi67gGbkc5cTD8zdgO/QsMnItDzC9MVshPaWRYoKm6YSMNStzXfSo Pvh2LtSyQ7/y3qtWDvWvoisdb3+lcKdhbSM+JaRPFjaC7iHhjkq3FLdzuMkGT95UfNpUMUHOMok Er4bscGlYzw+UaAhKMkB7Zk12qbr2nL1iGEuIdkJ1w1UAnfCIcW3VCHNUUDennXWfW8HXdFZS4r Fq2ZlvuwzGnqMxJX9u4I0BToiJLHAhPdLIEIWpGamptr5N9UY= 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: netdev@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