From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (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 B02D51386DA for ; Fri, 13 Feb 2026 01:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770945254; cv=none; b=u0UpJWMu1A3Ki+Jpy2HyD8JO9vp8dOszwMUA71iD8lDtpmIxUeIcyDS1l+80ux5Q9pCXxD9eFSyPTiure7iiM+XVICS69mqTznRShvtpvUcyZYEeVX4gUdhZtFG6E3UEadZfjPwfqCmzOiQE9Ay0yPuom/1gzstaHryFeBldWww= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770945254; c=relaxed/simple; bh=md7cp6wH2+N6MD3mWQSj0qSboD+7rUfa+MjyvhsGzmQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jmhOwQhPl6SvziL2wh+jvzok+s1k/h0VQ6v9TgSElImz9iLXUXSACxtH/yfvoC5TpijrSlEUuv4GRwlxgHOVZ/QtXAn3amECw+9fokFFWMEf0MDWkTWcTonEdVB0O5vCP/AMsb5z21ENQszEEZfMYmuaCq68iX007rSxNiU+8Yc= 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=UhA9kspQ; arc=none smtp.client-ip=209.85.128.179 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="UhA9kspQ" Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-793fdbb8d3aso5222657b3.3 for ; Thu, 12 Feb 2026 17:14:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770945252; x=1771550052; 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=pVvyXAJYhGKiBzDbhgb+tCE1hBe6OOdBiT7l2EEI8Wc=; b=UhA9kspQdso2Pr8ovtMGQ9KtJrpoiklHkLgdGl+QYBAAJm/+cR+VYFr2GmQEsDRkvd QRaUsUQxQ5rv6lNQi0PC30NhS9bXvCfJEAPJPUOeO3jvNoUwqGdjqB9WHJjYcQ2avyEF DqLylhi64EvBLwtO6dE+L/iS/LXaynjqxLptJsU56Hv1AXh5FtmyhHhrMQI6RJT662ap oFUTcWZuvNkOZRp0l5Ho6z3tM74bKybLUsNzZ41Xyn/en8g0p59jw7oywoimXYo7SU7x evH8hvyxLtiHiFZA2FbxeUXBkCQHAL6/ZcqxWoHaMWRa0B4v6t6umoUOG5fv9LAqM2TJ jx0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770945252; x=1771550052; 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=pVvyXAJYhGKiBzDbhgb+tCE1hBe6OOdBiT7l2EEI8Wc=; b=EyQijXRs0YnKdBmtL8rM8gD5Q1R9AysFgMgBecwE1xE4IbVBGxZWL2iidPVurRSqa2 iYVFNPxqJuMCMLCepvD70fwOXf+zCtNrxy1JPnv+LA9/NzPInPb1KIiCWSrm0250oVzY 8gd0fKnRXc0y1veDiWeyg1Q+y3NIrSWcXd2JcFjd4IJCAiGTJVqYr5kiO/2w9K5PUlYq 1ykBewdIznQ6kPbbuzMwzUnxUN5IQZxl6fce9eFy5YSrvRdK4qnd+V21wkUwsiwoYPXJ lmwau5cL0LYxMCPJET3S+0vLgyTSMxY0Og6DwRRkKhGReyqQhpuVg0UKWE23RQxeMbkI /XxQ== X-Forwarded-Encrypted: i=1; AJvYcCXojmliG9wE4OoKgdCfFZ73rp3ZJlAdD/FMdka9BnprNX17Tx3r67r0sc72tJ4K/VygRMM4+zz3FI7vHJA=@vger.kernel.org X-Gm-Message-State: AOJu0YyPMArGbQO7NQy7zKC9gkbjGSJ6pJAqgkNQMZDUcSRCW7xJjv/O w34Uqg5e1y6U9vRJ4SAbczbVoeKReHw+gZ29wOZBYCWv+RZhpTCbj6++ X-Gm-Gg: AZuq6aLxF+VxwFURejAbmL4VxRIxTjcqaXZHlcVPMW6PRuvHvtCj426muAJ0n/3rG83 yGjZjO7J3u/rg8aoctyaQigZmAFXtDxcOMX0TFvEJKWP1WCwvA3mRnyDG1aYKs0f6LwIaRyOHcs Zq/0i+c2fLI/mZXzqvYZAU8jvjYnXhzfW6Ghh3eErUJB1yLKFGVJfIFK6T9gpg+sFLJo412z/3d GFS0pfCqsLthl4+gZRzC8k1HfrQeWwQ2gU+x75GVWenk/pnrUBZ0zdqbV3f4M1RFc8fR0uzjVEt PmIP+a+SJJk53PR+WspviLRux9CgK9ImEiWXr2VSGRnkr4l5f7mdbmbTHJO6L73NQCk1YnVEFFQ O4JuzDhFhpeKDycP2hD95exaY+01XMXDQghFFsrHn9BQDlShb6KcK+xEdTJbgqa5Fptv7J3g7+O uNcUAWUTr2KKrMGhKU1HUu93zwdfvQpSJOCBjCqf+DXsZC38K8gZtRiwGL6w== X-Received: by 2002:a05:690c:e3eb:b0:796:2fde:5dee with SMTP id 00721157ae682-7979e899542mr7425397b3.34.1770945252544; Thu, 12 Feb 2026 17:14:12 -0800 (PST) Received: from devvm11784.nha0.facebook.com ([2a03:2880:25ff:4a::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7966c18b3desm56788687b3.14.2026.02.12.17.14.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Feb 2026 17:14:12 -0800 (PST) Date: Thu, 12 Feb 2026 17:14:10 -0800 From: Bobby Eshleman To: Stefano Garzarella Cc: netdev@vger.kernel.org, Eric Dumazet , linux-kernel@vger.kernel.org, Bobby Eshleman , Jakub Kicinski , virtualization@lists.linux.dev, Paolo Abeni , "Michael S. Tsirkin" , Simon Horman , "David S. Miller" Subject: Re: [PATCH net 1/2] vsock: fix child netns mode initialization Message-ID: References: <20260212205916.97533-1-sgarzare@redhat.com> <20260212205916.97533-2-sgarzare@redhat.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: <20260212205916.97533-2-sgarzare@redhat.com> On Thu, Feb 12, 2026 at 09:59:15PM +0100, Stefano Garzarella wrote: > From: Stefano Garzarella > > When a new network namespace is created, vsock_net_init() correctly > initializes the namespace's mode by reading the parent's `child_ns_mode` > via vsock_net_child_mode(). However, the `child_ns_mode` of the new > namespace was always hardcoded to VSOCK_NET_MODE_GLOBAL, regardless of > its own mode. > > This means that if a parent namespace has `child_ns_mode` set to "local", > the child namespace correctly gets mode "local", but its `child_ns_mode` > is reset to "global". As a result, further nested namespaces will > incorrectly get mode "global" instead of inheriting "local", breaking > the expected propagation of the mode through nested namespaces. > > Fix this by initializing `child_ns_mode` to the namespace's own mode, > so the setting propagates correctly through all levels of nesting. > > Fixes: eafb64f40ca4 ("vsock: add netns to vsock core") > Cc: bobbyeshleman@meta.com > Signed-off-by: Stefano Garzarella > --- > net/vmw_vsock/af_vsock.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c > index 20ad2b2dc17b..3b629b4a0359 100644 > --- a/net/vmw_vsock/af_vsock.c > +++ b/net/vmw_vsock/af_vsock.c > @@ -91,7 +91,8 @@ > * - /proc/sys/net/vsock/ns_mode (read-only) reports the current namespace's > * mode, which is set at namespace creation and immutable thereafter. > * - /proc/sys/net/vsock/child_ns_mode (writable) controls what mode future > - * child namespaces will inherit when created. The default is "global". > + * child namespaces will inherit when created. The initial value matches > + * the namespace's own ns_mode. > * > * Changing child_ns_mode only affects newly created namespaces, not the > * current namespace or existing children. At namespace creation, ns_mode > @@ -2912,7 +2913,7 @@ static void vsock_net_init(struct net *net) > else > net->vsock.mode = vsock_net_child_mode(current->nsproxy->net_ns); > > - net->vsock.child_ns_mode = VSOCK_NET_MODE_GLOBAL; > + net->vsock.child_ns_mode = net->vsock.mode; > } > > static __net_init int vsock_sysctl_init_net(struct net *net) > -- > 2.53.0 > LGTM. Reviewed-by: Bobby Eshleman