From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org
Subject: [PATCH net 6/8] netfilter: ipvs: make global sysctl readonly in non-init netns
Date: Thu, 21 Oct 2021 12:08:19 +0200 [thread overview]
Message-ID: <20211021100821.964677-7-pablo@netfilter.org> (raw)
In-Reply-To: <20211021100821.964677-1-pablo@netfilter.org>
From: Antoine Tenart <atenart@kernel.org>
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 <atenart@kernel.org>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
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 c25097092a06..29ec3ef63edc 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -4090,6 +4090,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.30.2
next prev parent reply other threads:[~2021-10-21 10:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 10:08 [PATCH net 0/8] Netfilter/IPVS fixes for net Pablo Neira Ayuso
2021-10-21 10:08 ` [PATCH net 1/8] netfilter: xt_IDLETIMER: fix panic that occurs when timer_type has garbage value Pablo Neira Ayuso
2021-10-21 11:40 ` patchwork-bot+netdevbpf
2021-10-21 10:08 ` [PATCH net 2/8] netfilter: Kconfig: use 'default y' instead of 'm' for bool config option Pablo Neira Ayuso
2021-10-21 10:08 ` [PATCH net 3/8] netfilter: nf_tables: skip netdev events generated on netns removal Pablo Neira Ayuso
2021-10-21 10:08 ` [PATCH net 4/8] selftests: nft_nat: add udp hole punch test case Pablo Neira Ayuso
2021-10-21 10:08 ` [PATCH net 5/8] netfilter: ip6t_rt: fix rt0_hdr parsing in rt_mt6 Pablo Neira Ayuso
2021-10-21 10:08 ` Pablo Neira Ayuso [this message]
2021-10-21 10:08 ` [PATCH net 7/8] selftests: netfilter: remove stray bash debug line Pablo Neira Ayuso
2021-10-21 10:08 ` [PATCH net 8/8] netfilter: ebtables: allocate chainstack on CPU local nodes Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211021100821.964677-7-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox