Re: net-next: warnings from sysctl_net_exit
From: Lucian Adrian Grijincu <hidden>
Date: 2011-02-28 00:49:43
Subsystem:
networking [general], networking [ipv4/ipv6], the rest · Maintainers:
"David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds
On Mon, Feb 28, 2011 at 1:34 AM, David Miller [off-list ref] wrote:
From: Lucian Adrian Grijincu <redacted>quoted
David: it looks like someone registered a /proc/sys table with register_net_sysctl_table but forgot to remove it (or someone wrote something in the 'struct net*' and buffer overflowed into &net->sysctls.list).Hmmm, we might therefore want to inspect this commit carefully: commit bf36076a67db6d7423d09d861a072337866f0dd9 Author: Eric W. Biederman [off-list ref] Date: Mon Jan 31 20:54:17 2011 -0800 net: Fix ipv6 neighbour unregister_sysctl_table warning
I'm not sure why we need that empty entry in the sysctl table anyway. I just ran a net-next with the next patch and register_net_sysctl_table managed to add /proc/sys/net/ipv6/neigh/ because we add 'default' and 'all' entries, followed by 'lo' for every netns.
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 7cb65ef..8e8b107 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c@@ -37,12 +37,6 @@ static ctl_table ipv6_table_template[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { - .procname = "neigh", - .maxlen = 0, - .mode = 0555, - .child = empty, - }, { } };
What are the benefits of this empty entry? Is there an assumption that we add this empty '/proc/sys/net/ipv6/neigh/' entry *before* adding entries for "/proc/sys/net/ipv6/neigh/default/" or "/proc/sys/net/ipv6/neigh/all/"? Because we register the empty '/proc/sys/net/ipv6/neigh/' entry *after* registering these two of it's children, and I'm not sure how this will affect the attachment of ctl_table_header corresponding to these ctl_table trees. With the following patch I get this ordering (for both init_net and a new net): CALL addrconf_init_net (create default/all) CALL ipv6_sysctl_net_init (create empty entry).
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3daaf3c..5fe402e 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c@@ -4564,6 +4564,8 @@ static int __net_init addrconf_init_net(struct net *net) int err; struct ipv6_devconf *all, *dflt; + printk(KERN_ALERT "CALL addrconf_init_net\n"); + err = -ENOMEM; all = &ipv6_devconf; dflt = &ipv6_devconf_dflt;
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 7cb65ef..880d64a 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c@@ -71,6 +65,8 @@ static int __net_init ipv6_sysctl_net_init(struct net *net) struct ctl_table *ipv6_icmp_table; int err; + printk(KERN_ALERT "CALL ipv6_sysctl_net_init\n"); + err = -ENOMEM; ipv6_table = kmemdup(ipv6_table_template, sizeof(ipv6_table_template), GFP_KERNEL);
--
.
..: Lucian