Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp688685pxb; Mon, 25 Oct 2021 16:41:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkJgXusHLo1RtCMNhPcDLLHkOOTUSqqA+IVLZEfhjyekKyM/gEjiIkglrqEE8th6UDJ2NX X-Received: by 2002:a05:6402:270b:: with SMTP id y11mr31320880edd.387.1635205318040; Mon, 25 Oct 2021 16:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635205318; cv=none; d=google.com; s=arc-20160816; b=Qbk6ABMH2T1v/+NaWmPDhFFXG2bEnmhM5mvpmKfxlAyvogh+n5JvLwEkRy4EJZQOQo pa9o290OjbIaku4evP4Qpw1At4eO+3MoT/z7GeNJoV/vvhSNUTEMCYm8yDZjV7ZS/DhS mJz5c0JZOjnqhL9yc2tguaedM7a2wYqriDZ0QVLjpjEfIh0jUMt/2vxOMFpDev/lo3Aw w7qQdqITch14pDCk5GYWJgBHzC4moP//BlOeyLp/aKlQ487uAoEXKdXnK+7w0e5NRXde 12kP/urWGLpeE5K6+8kVRpoI31tHzDDyxjeF7hZ5U6BIoL/iBhKTyxAoS+xt6EnM5gpE +9DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a03o3nj4n06TV+fU1XaNnI8fSoUBp9EGog+zzpwSW7A=; b=Bl6iWNeSwTNsykOPFpjjQOYr4B2kGs1MOf8LqcYnw0J8ycgowZqnteQX/aVigj/4xy 9qcHssykye4ssHjK1vrlDlg/rmg3SUIZofnIVMuEZYXVfUpsWhKNpzSj/+VVkzVFOSBB r8fR3Xh6RATpDHDDyFeWXz/h7FA5OmjdOr19yPKGk+AlR0ocd7983OH17TLxzHlZX7dQ mOxHiDxMsGy3WbOhkyjhyVrsZN8EssEWQBzvyPbYwiTV/Z0pspjwpikBj5TS+ZaIJrmc Hv5TSWs6ojx2MA0v8gHDWkmh6ITC2ZDVu2avaD8lc+cpq+pXEPKK6sLsEh4uGde8cc3V ek0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sec7sOdl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m20si29710811edc.499.2021.10.25.16.41.24; Mon, 25 Oct 2021 16:41:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sec7sOdl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235883AbhJYT3w (ORCPT + 99 others); Mon, 25 Oct 2021 15:29:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:46716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235010AbhJYT0v (ORCPT ); Mon, 25 Oct 2021 15:26:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 444D7610F8; Mon, 25 Oct 2021 19:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189818; bh=nJZkzGejf4EI9OeSs65hfhWR70BVNtVIsjh595JktZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sec7sOdlfsbXLer0xHbgLnVQha+12cCQjOE8+J6V8ZxX4EiJvxM1joYGEy73E9UJ7 cruqFf61WEwGBVN2JdeoXQFnKP7G2CSN+5OqMI1BggE6X3P8GVfFxqjYpDRvLKTP2P Lrf8V1nd4r84A0ZLnL5xHiyGDOnxuj7pCwBQxvkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antoine Tenart , Julian Anastasov , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 4.19 07/37] netfilter: ipvs: make global sysctl readonly in non-init netns Date: Mon, 25 Oct 2021 21:14:32 +0200 Message-Id: <20211025190929.721115472@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190926.680827862@linuxfoundation.org> References: <20211025190926.680827862@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Antoine Tenart [ Upstream commit 174c376278949c44aad89c514a6b5db6cee8db59 ] Because the data pointer of net/ipv4/vs/debug_level is not updated per netns, it must be marked as read-only in non-init netns. Fixes: c6d2d445d8de ("IPVS: netns, final patch enabling network name space.") Signed-off-by: Antoine Tenart Acked-by: Julian Anastasov Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/ipvs/ip_vs_ctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 6208fa09fe71..3bf8d7f3cdc3 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -3955,6 +3955,11 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) tbl[idx++].data = &ipvs->sysctl_conn_reuse_mode; tbl[idx++].data = &ipvs->sysctl_schedule_icmp; tbl[idx++].data = &ipvs->sysctl_ignore_tunneled; +#ifdef CONFIG_IP_VS_DEBUG + /* Global sysctls must be ro in non-init netns */ + if (!net_eq(net, &init_net)) + tbl[idx++].mode = 0444; +#endif ipvs->sysctl_hdr = register_net_sysctl(net, "net/ipv4/vs", tbl); if (ipvs->sysctl_hdr == NULL) { -- 2.33.0