* [PATCH 00/21] exit_net checks for objects initialized in net_init hook
@ 2017-11-05 9:58 Vasily Averin
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (20 more replies)
0 siblings, 21 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 9:58 UTC (permalink / raw)
To: netdev
This patch set checks that lists initialized in net_init hooks were
return to initial state at end of net_exit hooks.
Vasily Averin (21):
exit_net cleanup: geneve sock_list check
ppp: exit_net cleanup checks added
vxlan: exit_net cleanup checks added
netdev: exit_net cleanup check added
nfs4blocklayout: exit_net cleanup check added
nfs client: exit_net cleanup check added
fib_notifier: exit_net cleanup check added
fib_rules: exit_net cleanup check added
clusterip: exit_net cleanup check added
xfrm6_tunnel: exit_net cleanup check added
af_key: replace BUG_ON on WARN_ON in net_exit hook
l2tp: exit_net cleanup check added
nf_tables: exit_net cleanup check added
nfnetlink_log: exit_net cleanup check added
nfnetlink_gueue: exit_net cleanup check added
x_tables: exit_net cleanup check added
hashlimit: exit_net cleanup check added
recent: exit_net cleanup check added
packet: exit_net cleanup check added
phonet: exit_net cleanup check added
sunrpc: exit_net cleanup check added
drivers/net/geneve.c | 2 ++
drivers/net/ppp/ppp_generic.c | 4 ++++
drivers/net/vxlan.c | 6 ++++++
fs/nfs/blocklayout/rpc_pipefs.c | 2 ++
fs/nfs/client.c | 4 ++++
net/core/dev.c | 3 +++
net/core/fib_notifier.c | 7 +++++++
net/core/fib_rules.c | 7 +++++++
net/ipv4/netfilter/ipt_CLUSTERIP.c | 2 ++
net/ipv6/xfrm6_tunnel.c | 12 ++++++++++++
net/key/af_key.c | 2 +-
net/l2tp/l2tp_core.c | 6 ++++++
net/netfilter/nf_tables_api.c | 9 +++++++++
net/netfilter/nfnetlink_log.c | 7 +++++++
net/netfilter/nfnetlink_queue.c | 8 ++++++++
net/netfilter/x_tables.c | 10 ++++++++++
net/netfilter/xt_hashlimit.c | 4 ++++
net/netfilter/xt_recent.c | 4 ++++
net/packet/af_packet.c | 2 ++
net/phonet/pn_dev.c | 2 ++
net/sunrpc/sunrpc_syms.c | 4 ++++
21 files changed, 106 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v2 00/21] exit_net checks for objects initialized in net_init hook
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
@ 2017-11-05 16:49 ` Vasily Averin
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (20 more replies)
2017-11-05 16:49 ` [PATCH v2 01/21] exit_net cleanup: geneve sock_list check Vasily Averin
` (19 subsequent siblings)
20 siblings, 21 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:49 UTC (permalink / raw)
To: netdev
This patch set checks that lists initialized in net_init hooks were
return to initial state at end of net_exit hooks.
I hope such checks allows to detect leaked per-netns objects.
Also I hope that all new pernet_operations will inherit such checks too.
I assume that elements added into per-net lists should not live longer than net namespace,
and should be deleted from the list. I think exit_net hook is good place for such check.
Recently I've found lost list_entry and enabled timer on stop of net namespace.
Then I've reviewed all existing pernet_operations and found that many drivers
have such checks already. So I decided to complete this task and add such checks
into all affected subsystems.
v2:
- net pointer removed from output
- fixed compilation for phonet driver
Vasily Averin (21):
exit_net cleanup: geneve sock_list check
ppp: exit_net cleanup checks added
vxlan: exit_net cleanup checks added
netdev: exit_net cleanup check added
nfs4blocklayout: exit_net cleanup check added
nfs client: exit_net cleanup check added
fib_notifier: exit_net cleanup check added
fib_rules: exit_net cleanup check added
clusterip: exit_net cleanup check added
xfrm6_tunnel: exit_net cleanup check added
af_key: replace BUG_ON on WARN_ON in net_exit hook
l2tp: exit_net cleanup check added
nf_tables: exit_net cleanup check added
nfnetlink_log: exit_net cleanup check added
nfnetlink_gueue: exit_net cleanup check added
x_tables: exit_net cleanup check added
hashlimit: exit_net cleanup check added
recent: exit_net cleanup check added
packet: exit_net cleanup check added
phonet: exit_net cleanup check added
sunrpc: exit_net cleanup check added
drivers/net/geneve.c | 2 ++
drivers/net/ppp/ppp_generic.c | 4 ++++
drivers/net/vxlan.c | 6 ++++++
fs/nfs/blocklayout/rpc_pipefs.c | 2 ++
fs/nfs/client.c | 4 ++++
net/core/dev.c | 3 +++
net/core/fib_notifier.c | 7 +++++++
net/core/fib_rules.c | 7 +++++++
net/ipv4/netfilter/ipt_CLUSTERIP.c | 2 ++
net/ipv6/xfrm6_tunnel.c | 12 ++++++++++++
net/key/af_key.c | 2 +-
net/l2tp/l2tp_core.c | 6 ++++++
net/netfilter/nf_tables_api.c | 9 +++++++++
net/netfilter/nfnetlink_log.c | 6 ++++++
net/netfilter/nfnetlink_queue.c | 7 +++++++
net/netfilter/x_tables.c | 10 ++++++++++
net/netfilter/xt_hashlimit.c | 4 ++++
net/netfilter/xt_recent.c | 4 ++++
net/packet/af_packet.c | 2 ++
net/phonet/pn_dev.c | 4 ++++
net/sunrpc/sunrpc_syms.c | 4 ++++
21 files changed, 106 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v2 01/21] exit_net cleanup: geneve sock_list check
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
@ 2017-11-05 16:49 ` Vasily Averin
2017-11-07 2:37 ` kbuild test robot
2017-11-05 16:49 ` Vasily Averin
` (18 subsequent siblings)
20 siblings, 1 reply; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:49 UTC (permalink / raw)
To: netdev
Be sure that sock_list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/geneve.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index f640407..dece711 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1673,6 +1673,8 @@ static void __net_exit geneve_exit_net(struct net *net)
/* unregister the devices gathered above */
unregister_netdevice_many(&list);
rtnl_unlock();
+ WARN(!list_empty(&gn->sock_list),
+ "&s: sock_list is not empty\n", __func__);
}
static struct pernet_operations geneve_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 02/21] ppp: exit_net cleanup checks added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
@ 2017-11-05 16:49 ` Vasily Averin
2017-11-05 16:49 ` [PATCH v2 01/21] exit_net cleanup: geneve sock_list check Vasily Averin
` (19 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:49 UTC (permalink / raw)
To: netdev; +Cc: linux-ppp, Paul Mackerras
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/ppp/ppp_generic.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e365866..10cee62 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -960,6 +960,10 @@ static __net_exit void ppp_exit_net(struct net *net)
rtnl_unlock();
idr_destroy(&pn->units_idr);
+ WARN(!list_empty(&pn->all_channels),
+ "%s: all_channels list is not empty\n", __func__);
+ WARN(!list_empty(&pn->new_channels),
+ "%s: new_channels list is not empty\n", __func__);
}
static struct pernet_operations ppp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 02/21] ppp: exit_net cleanup checks added
@ 2017-11-05 16:49 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:49 UTC (permalink / raw)
To: netdev; +Cc: linux-ppp, Paul Mackerras
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/ppp/ppp_generic.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e365866..10cee62 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -960,6 +960,10 @@ static __net_exit void ppp_exit_net(struct net *net)
rtnl_unlock();
idr_destroy(&pn->units_idr);
+ WARN(!list_empty(&pn->all_channels),
+ "%s: all_channels list is not empty\n", __func__);
+ WARN(!list_empty(&pn->new_channels),
+ "%s: new_channels list is not empty\n", __func__);
}
static struct pernet_operations ppp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 03/21] vxlan: exit_net cleanup checks added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (2 preceding siblings ...)
2017-11-05 16:49 ` Vasily Averin
@ 2017-11-05 16:49 ` Vasily Averin
2017-11-05 16:49 ` [PATCH v2 04/21] netdev: exit_net cleanup check added Vasily Averin
` (16 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:49 UTC (permalink / raw)
To: netdev
Be sure that sock_list array initialized in net_init hook was return
to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/vxlan.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf..f72c1de 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3704,6 +3704,7 @@ static void __net_exit vxlan_exit_net(struct net *net)
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
struct vxlan_dev *vxlan, *next;
struct net_device *dev, *aux;
+ unsigned int h;
LIST_HEAD(list);
rtnl_lock();
@@ -3723,6 +3724,11 @@ static void __net_exit vxlan_exit_net(struct net *net)
unregister_netdevice_many(&list);
rtnl_unlock();
+
+ for (h = 0; h < PORT_HASH_SIZE; ++h)
+ if (WARN(!hlist_empty(&vn->sock_list[h]),
+ "%s: sock_list is not empty\n", __func__))
+ break;
}
static struct pernet_operations vxlan_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 04/21] netdev: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (3 preceding siblings ...)
2017-11-05 16:49 ` [PATCH v2 03/21] vxlan: " Vasily Averin
@ 2017-11-05 16:49 ` Vasily Averin
2017-11-05 16:49 ` [PATCH v2 05/21] nfs4blocklayout: " Vasily Averin
` (15 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:49 UTC (permalink / raw)
To: netdev
Be sure that dev_base_head list initialized in net_init hook was return
to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/dev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 588b473..198f137 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8562,6 +8562,9 @@ static void __net_exit netdev_exit(struct net *net)
{
kfree(net->dev_name_head);
kfree(net->dev_index_head);
+ if (net != &init_net)
+ WARN(!list_empty(&net->dev_base_head),
+ "%s: dev_base_head is not empty\n", __func__);
}
static struct pernet_operations __net_initdata netdev_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 05/21] nfs4blocklayout: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (4 preceding siblings ...)
2017-11-05 16:49 ` [PATCH v2 04/21] netdev: exit_net cleanup check added Vasily Averin
@ 2017-11-05 16:49 ` Vasily Averin
2017-11-05 16:50 ` [PATCH v2 07/21] fib_notifier: " Vasily Averin
` (14 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:49 UTC (permalink / raw)
To: netdev; +Cc: linux-nfs
Be sure that bl_wq wait queue initialized in net_init hook
is not used anymore.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/nfs/blocklayout/rpc_pipefs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/nfs/blocklayout/rpc_pipefs.c b/fs/nfs/blocklayout/rpc_pipefs.c
index 9fb067a6..faae48f 100644
--- a/fs/nfs/blocklayout/rpc_pipefs.c
+++ b/fs/nfs/blocklayout/rpc_pipefs.c
@@ -256,6 +256,8 @@ static void nfs4blocklayout_net_exit(struct net *net)
nfs4blocklayout_unregister_net(net, nn->bl_device_pipe);
rpc_destroy_pipe_data(nn->bl_device_pipe);
nn->bl_device_pipe = NULL;
+ WARN(!list_empty(&nn->bl_wq.head),
+ "%s: bl_wq head is not empty\n", __func__);
}
static struct pernet_operations nfs4blocklayout_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 06/21] nfs client: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
@ 2017-11-05 16:50 ` Vasily Averin
2017-11-05 16:49 ` [PATCH v2 01/21] exit_net cleanup: geneve sock_list check Vasily Averin
` (19 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, Anna Schumaker, Trond Myklebust
Be sure that nfs_client_list and nfs_volume_list lists initialized
in net_init hook were return to initial state in net_exit hook.
Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
---
fs/nfs/client.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 22880ef..e099a01 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net)
struct nfs_net *nn = net_generic(net, nfs_net_id);
idr_destroy(&nn->cb_ident_idr);
+ WARN(!list_empty(&nn->nfs_client_list),
+ "nfs net_exit: nfs_client_list is not empty\n");
+ WARN(!list_empty(&nn->nfs_volume_list),
+ "nfs net_exit: nfs_volume_list is not empty\n");
}
/* nfs_client_lock held */
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 06/21] nfs client: exit_net cleanup check added
@ 2017-11-05 16:50 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev; +Cc: linux-nfs, Anna Schumaker, Trond Myklebust
Be sure that nfs_client_list and nfs_volume_list lists initialized
in net_init hook were return to initial state in net_exit hook.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/nfs/client.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 22880ef..e099a01 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net)
struct nfs_net *nn = net_generic(net, nfs_net_id);
idr_destroy(&nn->cb_ident_idr);
+ WARN(!list_empty(&nn->nfs_client_list),
+ "nfs net_exit: nfs_client_list is not empty\n");
+ WARN(!list_empty(&nn->nfs_volume_list),
+ "nfs net_exit: nfs_volume_list is not empty\n");
}
/* nfs_client_lock held */
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 07/21] fib_notifier: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (5 preceding siblings ...)
2017-11-05 16:49 ` [PATCH v2 05/21] nfs4blocklayout: " Vasily Averin
@ 2017-11-05 16:50 ` Vasily Averin
2017-11-05 16:50 ` [PATCH v2 08/21] fib_rules: " Vasily Averin
` (13 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev
Be sure that fib_notifier_ops list initilized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/fib_notifier.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/core/fib_notifier.c b/net/core/fib_notifier.c
index 4fc202d..1f57ec0 100644
--- a/net/core/fib_notifier.c
+++ b/net/core/fib_notifier.c
@@ -161,8 +161,15 @@ static int __net_init fib_notifier_net_init(struct net *net)
return 0;
}
+static void __net_exit fib_notifier_net_exit(struct net *net)
+{
+ WARN(!list_empty(&net->fib_notifier_ops),
+ "%s: fib_notifier_ops list is not empty\n", __func__);
+}
+
static struct pernet_operations fib_notifier_net_ops = {
.init = fib_notifier_net_init,
+ .exit = fib_notifier_net_exit,
};
static int __init fib_notifier_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 08/21] fib_rules: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (6 preceding siblings ...)
2017-11-05 16:50 ` [PATCH v2 07/21] fib_notifier: " Vasily Averin
@ 2017-11-05 16:50 ` Vasily Averin
2017-11-05 16:50 ` [PATCH v2 09/21] clusterip: " Vasily Averin
` (12 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev
Be sure that rules_ops list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/fib_rules.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 9a6d97c..5ab4fac 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -1019,8 +1019,15 @@ static int __net_init fib_rules_net_init(struct net *net)
return 0;
}
+static void __net_exit fib_rules_net_exit(struct net *net)
+{
+ WARN(!list_empty(&net->rules_ops),
+ "%s: rules_ops list is not empty\n", __func__);
+}
+
static struct pernet_operations fib_rules_net_ops = {
.init = fib_rules_net_init,
+ .exit = fib_rules_net_exit,
};
static int __init fib_rules_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 09/21] clusterip: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (7 preceding siblings ...)
2017-11-05 16:50 ` [PATCH v2 08/21] fib_rules: " Vasily Averin
@ 2017-11-05 16:50 ` Vasily Averin
2017-11-07 2:42 ` kbuild test robot
2017-11-05 16:50 ` [PATCH v2 10/21] xfrm6_tunnel: " Vasily Averin
` (11 subsequent siblings)
20 siblings, 1 reply; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev
Cc: coreteam, netfilter-devel, Florian Westphal, Jozsef Kadlecsik,
Pablo Neira Ayuso, Hideaki YOSHIFUJI
Be sure that configs list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/ipv4/netfilter/ipt_CLUSTERIP.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 17b4ca5..038f0a9 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -819,6 +819,8 @@ static void clusterip_net_exit(struct net *net)
cn->procdir = NULL;
#endif
nf_unregister_net_hook(net, &cip_arp_ops);
+ WARN(!list_empty(&cn->configs),
+ "%s: configs list is not empty\n"i, __func__);
}
static struct pernet_operations clusterip_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 10/21] xfrm6_tunnel: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (8 preceding siblings ...)
2017-11-05 16:50 ` [PATCH v2 09/21] clusterip: " Vasily Averin
@ 2017-11-05 16:50 ` Vasily Averin
2017-11-05 16:50 ` [PATCH v2 11/21] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
` (10 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev; +Cc: Hideaki YOSHIFUJI, Herbert Xu, Steffen Klassert
Be sure that spi_byaddr and spi_byspi arrays initialized in net_init hook
were return to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/ipv6/xfrm6_tunnel.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 4e438bc..8280152 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -338,6 +338,18 @@ static int __net_init xfrm6_tunnel_net_init(struct net *net)
static void __net_exit xfrm6_tunnel_net_exit(struct net *net)
{
+ struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
+ unsigned int i;
+
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
+ if (WARN(!hlist_empty(&xfrm6_tn->spi_byaddr[i]),
+ "%s: spi_byaddr is not empty\n", __func__))
+ break;
+
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYSPI_HSIZE; i++)
+ if (WARN(!hlist_empty(&xfrm6_tn->spi_byspi[i]),
+ "%s: spi_byspi is not empty\n", __func__))
+ break;
}
static struct pernet_operations xfrm6_tunnel_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 11/21] af_key: replace BUG_ON on WARN_ON in net_exit hook
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (9 preceding siblings ...)
2017-11-05 16:50 ` [PATCH v2 10/21] xfrm6_tunnel: " Vasily Averin
@ 2017-11-05 16:50 ` Vasily Averin
2017-11-05 16:50 ` [PATCH v2 12/21] l2tp: exit_net cleanup check added Vasily Averin
` (9 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev; +Cc: Herbert Xu, Steffen Klassert
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/key/af_key.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index a00d607..3dffb89 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3845,7 +3845,7 @@ static void __net_exit pfkey_net_exit(struct net *net)
struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id);
pfkey_exit_proc(net);
- BUG_ON(!hlist_empty(&net_pfkey->table));
+ WARN_ON(!hlist_empty(&net_pfkey->table));
}
static struct pernet_operations pfkey_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 12/21] l2tp: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (10 preceding siblings ...)
2017-11-05 16:50 ` [PATCH v2 11/21] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
@ 2017-11-05 16:50 ` Vasily Averin
2017-11-05 16:50 ` [PATCH v2 13/21] nf_tables: " Vasily Averin
` (8 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev
Be sure that l2tp_session_hlist array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/l2tp/l2tp_core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 02d6110..1136341 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1888,6 +1888,7 @@ static __net_exit void l2tp_exit_net(struct net *net)
{
struct l2tp_net *pn = l2tp_pernet(net);
struct l2tp_tunnel *tunnel = NULL;
+ int hash;
rcu_read_lock_bh();
list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
@@ -1897,6 +1898,11 @@ static __net_exit void l2tp_exit_net(struct net *net)
flush_workqueue(l2tp_wq);
rcu_barrier();
+
+ for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
+ if (WARN(!hlist_empty(&pn->l2tp_session_hlist[hash]),
+ "%s: session_hlist is not empty\n", __func__))
+ break;
}
static struct pernet_operations l2tp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 13/21] nf_tables: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (11 preceding siblings ...)
2017-11-05 16:50 ` [PATCH v2 12/21] l2tp: exit_net cleanup check added Vasily Averin
@ 2017-11-05 16:50 ` Vasily Averin
2017-11-05 16:51 ` [PATCH v2 14/21] nfnetlink_log: " Vasily Averin
` (7 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:50 UTC (permalink / raw)
To: netdev
Cc: coreteam, netfilter-devel, Florian Westphal, Jozsef Kadlecsik,
Pablo Neira Ayuso
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nf_tables_api.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 64e1ee0..8219b2f 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -5778,6 +5778,14 @@ static int __net_init nf_tables_init_net(struct net *net)
return 0;
}
+static void __net_exit nf_tables_exit_net(struct net *net)
+{
+ WARN(!list_empty(&net->nft.af_info),
+ "%s: af_info list is not empty\n", __func__);
+ WARN(!list_empty(&net->nft.commit_list),
+ "%s: commit_list is not empty\n", __func__);
+}
+
int __nft_release_basechain(struct nft_ctx *ctx)
{
struct nft_rule *rule, *nr;
@@ -5848,6 +5856,7 @@ static void __nft_release_afinfo(struct net *net, struct nft_af_info *afi)
static struct pernet_operations nf_tables_net_ops = {
.init = nf_tables_init_net,
+ .exit = nf_tables_exit_net,
};
static int __init nf_tables_module_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 14/21] nfnetlink_log: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (12 preceding siblings ...)
2017-11-05 16:50 ` [PATCH v2 13/21] nf_tables: " Vasily Averin
@ 2017-11-05 16:51 ` Vasily Averin
2017-11-05 16:51 ` [PATCH v2 15/21] nfnetlink_gueue: " Vasily Averin
` (6 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:51 UTC (permalink / raw)
To: netdev, coreteam
Cc: netfilter-devel, Florian Westphal, Jozsef Kadlecsik, Pablo Neira Ayuso
Be sure that instance_table array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nfnetlink_log.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index cad6498..c99f427 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -1093,10 +1093,16 @@ static int __net_init nfnl_log_net_init(struct net *net)
static void __net_exit nfnl_log_net_exit(struct net *net)
{
+ unsigned int i;
+ struct nfnl_log_net *log = nfnl_log_pernet(net);
#ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_log", net->nf.proc_netfilter);
#endif
nf_log_unset(net, &nfulnl_logger);
+ for (i = 0; i < INSTANCE_BUCKETS; i++)
+ if (WARN(!hlist_empty(&log->instance_table[i]),
+ "%s: instance_table is not empty\n", __func__))
+ break;
}
static struct pernet_operations nfnl_log_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 15/21] nfnetlink_gueue: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (13 preceding siblings ...)
2017-11-05 16:51 ` [PATCH v2 14/21] nfnetlink_log: " Vasily Averin
@ 2017-11-05 16:51 ` Vasily Averin
2017-11-05 16:51 ` [PATCH v2 16/21] x_tables: " Vasily Averin
` (5 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:51 UTC (permalink / raw)
To: netdev
Cc: coreteam, netfilter-devel, Florian Westphal, Jozsef Kadlecsik,
Pablo Neira Ayuso
Be sure that instance_table array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nfnetlink_queue.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index c979662..0fa56d9 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1512,10 +1512,17 @@ static int __net_init nfnl_queue_net_init(struct net *net)
static void __net_exit nfnl_queue_net_exit(struct net *net)
{
+ unsigned int i;
+ struct nfnl_queue_net *q = nfnl_queue_pernet(net);
+
nf_unregister_queue_handler(net);
#ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter);
#endif
+ for (i = 0; i < INSTANCE_BUCKETS; i++)
+ if (WARN(!hlist_empty(&q->instance_table[i]),
+ "%s: instance_table isn't empty\n", __func__))
+ break;
}
static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 16/21] x_tables: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (14 preceding siblings ...)
2017-11-05 16:51 ` [PATCH v2 15/21] nfnetlink_gueue: " Vasily Averin
@ 2017-11-05 16:51 ` Vasily Averin
2017-11-05 16:51 ` [PATCH v2 17/21] hashlimit: " Vasily Averin
` (4 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:51 UTC (permalink / raw)
To: netdev
Cc: coreteam, netfilter-devel, Florian Westphal, Jozsef Kadlecsik,
Pablo Neira Ayuso
Be sure that xt.tables array initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/x_tables.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index d8571f4..8125363 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1714,8 +1714,18 @@ static int __net_init xt_net_init(struct net *net)
return 0;
}
+static void __net_exit xt_net_exit(struct net *net)
+{
+ int i;
+
+ for (i = 0; i < NFPROTO_NUMPROTO; i++)
+ WARN(!list_empty(&net->xt.tables[i]),
+ "%s: tables list is not empty\n", __func__);
+}
+
static struct pernet_operations xt_net_ops = {
.init = xt_net_init,
+ .exit = xt_net_exit,
};
static int __init xt_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 17/21] hashlimit: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (15 preceding siblings ...)
2017-11-05 16:51 ` [PATCH v2 16/21] x_tables: " Vasily Averin
@ 2017-11-05 16:51 ` Vasily Averin
2017-11-05 16:51 ` [PATCH v2 18/21] recent: " Vasily Averin
` (3 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:51 UTC (permalink / raw)
To: netdev
Cc: coreteam, netfilter-devel, Florian Westphal, Jozsef Kadlecsik,
Pablo Neira Ayuso
Be sure that htables array initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/xt_hashlimit.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 5da8746..abef6b4 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -1338,7 +1338,11 @@ static int __net_init hashlimit_net_init(struct net *net)
static void __net_exit hashlimit_net_exit(struct net *net)
{
+ struct hashlimit_net *hashlimit_net = hashlimit_pernet(net);
+
hashlimit_proc_net_exit(net);
+ WARN(!hlist_empty(&hashlimit_net->htables),
+ "%s: htables hlist is not empty\n", __func__);
}
static struct pernet_operations hashlimit_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 18/21] recent: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (16 preceding siblings ...)
2017-11-05 16:51 ` [PATCH v2 17/21] hashlimit: " Vasily Averin
@ 2017-11-05 16:51 ` Vasily Averin
2017-11-05 16:51 ` [PATCH v2 19/21] packet: " Vasily Averin
` (2 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:51 UTC (permalink / raw)
To: netdev
Cc: coreteam, netfilter-devel, Florian Westphal, Jozsef Kadlecsik,
Pablo Neira Ayuso
Be sure that tables list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/xt_recent.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 245fa35..230d00f 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -681,7 +681,11 @@ static int __net_init recent_net_init(struct net *net)
static void __net_exit recent_net_exit(struct net *net)
{
+ struct recent_net *recent_net = recent_pernet(net);
+
recent_proc_net_exit(net);
+ WARN(!list_empty(&recent_net->tables),
+ "%s: tables list is not empty\n", __func__);
}
static struct pernet_operations recent_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 19/21] packet: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (17 preceding siblings ...)
2017-11-05 16:51 ` [PATCH v2 18/21] recent: " Vasily Averin
@ 2017-11-05 16:51 ` Vasily Averin
2017-11-05 16:51 ` [PATCH v2 20/21] phonet: " Vasily Averin
[not found] ` <bafb347d-e36e-8b2b-7646-afc458a7a32a-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:51 UTC (permalink / raw)
To: netdev
Be sure that packet.sklist initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/packet/af_packet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index bec01a3..7ceb97c 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4562,6 +4562,8 @@ static int __net_init packet_net_init(struct net *net)
static void __net_exit packet_net_exit(struct net *net)
{
remove_proc_entry("packet", net->proc_net);
+ WARN(!hlist_empty(&net->packet.sklist),
+ "%s: sklist is not empty\n", __func__);
}
static struct pernet_operations packet_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 20/21] phonet: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
` (18 preceding siblings ...)
2017-11-05 16:51 ` [PATCH v2 19/21] packet: " Vasily Averin
@ 2017-11-05 16:51 ` Vasily Averin
[not found] ` <bafb347d-e36e-8b2b-7646-afc458a7a32a-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:51 UTC (permalink / raw)
To: netdev; +Cc: Remi Denis-Courmont
Be sure that pndevs.list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/phonet/pn_dev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 2cb4c5d..81b4eb0 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -331,7 +331,11 @@ static int __net_init phonet_init_net(struct net *net)
static void __net_exit phonet_exit_net(struct net *net)
{
+ struct phonet_net *pnn = phonet_pernet(net);
+
remove_proc_entry("phonet", net->proc_net);
+ WARN(!list_empty(&pnn->pndevs.list),
+ "%s: pndevs.list is not empty\n", __func__);
}
static struct pernet_operations phonet_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 21/21] sunrpc: exit_net cleanup check added
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
@ 2017-11-05 16:52 ` Vasily Averin
2017-11-05 16:49 ` [PATCH v2 01/21] exit_net cleanup: geneve sock_list check Vasily Averin
` (19 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:52 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust,
Anna Schumaker, Jeff Layton, J. Bruce Fields
Be sure that all_clients list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
---
net/sunrpc/sunrpc_syms.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index c73de18..4a25658 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -65,10 +65,14 @@ static __net_init int sunrpc_init_net(struct net *net)
static __net_exit void sunrpc_exit_net(struct net *net)
{
+ struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
rpc_pipefs_exit_net(net);
unix_gid_cache_destroy(net);
ip_map_cache_destroy(net);
rpc_proc_exit(net);
+ WARN(!list_empty(&sn->all_clients),
+ "%s: all_clients list is not empty\n", __func__);
}
static struct pernet_operations sunrpc_net_ops = {
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v2 21/21] sunrpc: exit_net cleanup check added
@ 2017-11-05 16:52 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-05 16:52 UTC (permalink / raw)
To: netdev
Cc: linux-nfs, Trond Myklebust, Anna Schumaker, Jeff Layton, J. Bruce Fields
Be sure that all_clients list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/sunrpc/sunrpc_syms.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index c73de18..4a25658 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -65,10 +65,14 @@ static __net_init int sunrpc_init_net(struct net *net)
static __net_exit void sunrpc_exit_net(struct net *net)
{
+ struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
rpc_pipefs_exit_net(net);
unix_gid_cache_destroy(net);
ip_map_cache_destroy(net);
rpc_proc_exit(net);
+ WARN(!list_empty(&sn->all_clients),
+ "%s: all_clients list is not empty\n", __func__);
}
static struct pernet_operations sunrpc_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 00/21] exit_net checks for objects initialized in net_init hook
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
@ 2017-11-06 13:22 ` Vasily Averin
2017-11-12 8:39 ` Vasily Averin
` (17 more replies)
[not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
` (19 subsequent siblings)
20 siblings, 18 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:22 UTC (permalink / raw)
To: netdev
This patch set checks that lists initialized in net_init hooks were
return to initial state at end of net_exit hooks.
I hope such checks allows to detect leaked per-netns objects.
Also I hope that all new pernet_operations will inherit such checks too.
I assume that elements added into per-net lists should not live longer than net namespace,
and should be deleted from the list. I think exit_net hook is good place for such check.
Recently I've found lost list_entry and enabled timer on stop of net namespace.
Then I've reviewed all existing pernet_operations and found that many drivers
have such checks already. So I decided to complete this task and add such checks
into all affected subsystems.
v3:
- use net->ns.inum as net Id
- removed patches for hashlimit and recent,
they handle tables list in exit_net hook.
- added patches for grace and lockd
v2:
- net pointer removed from output
- fixed compilation for phonet driver
Vasily Averin (21):
grace: replace BUG_ON by WARN_ONCE in exit_net hook
lockd: added cleanup checks in exit_net hook
exit_net cleanup: geneve sock_list check
ppp: exit_net cleanup checks added
vxlan: exit_net cleanup checks added
netdev: exit_net cleanup check added
nfs4blocklayout: exit_net cleanup check added
nfs client: exit_net cleanup check added
fib_notifier: exit_net cleanup check added
fib_rules: exit_net cleanup check added
clusterip: exit_net cleanup check added
xfrm6_tunnel: exit_net cleanup check added
af_key: replace BUG_ON on WARN_ONCE in net_exit hook
l2tp: exit_net cleanup check added
nf_tables: exit_net cleanup check added
nfnetlink_log: exit_net cleanup check added
nfnetlink_gueue: exit_net cleanup check added
x_tables: exit_net cleanup check added
packet: exit_net cleanup check added
phonet: exit_net cleanup check added
sunrpc: exit_net cleanup check added
drivers/net/geneve.c | 3 +++
drivers/net/ppp/ppp_generic.c | 6 ++++++
drivers/net/vxlan.c | 7 +++++++
fs/lockd/svc.c | 11 +++++++++++
fs/nfs/blocklayout/rpc_pipefs.c | 3 +++
fs/nfs/client.c | 4 ++++
fs/nfs_common/grace.c | 4 +++-
net/core/dev.c | 4 ++++
net/core/fib_notifier.c | 8 ++++++++
net/core/fib_rules.c | 8 ++++++++
net/ipv4/netfilter/ipt_CLUSTERIP.c | 3 +++
net/ipv6/xfrm6_tunnel.c | 14 ++++++++++++++
net/key/af_key.c | 4 +++-
net/l2tp/l2tp_core.c | 7 +++++++
net/netfilter/nf_tables_api.c | 11 +++++++++++
net/netfilter/nfnetlink_log.c | 7 +++++++
net/netfilter/nfnetlink_queue.c | 8 ++++++++
net/netfilter/x_tables.c | 12 ++++++++++++
net/packet/af_packet.c | 2 ++
net/phonet/pn_dev.c | 5 +++++
net/sunrpc/sunrpc_syms.c | 5 +++++
21 files changed, 134 insertions(+), 2 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
@ 2017-11-06 13:22 ` Vasily Averin
[not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
` (19 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:22 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: J. Bruce Fields, Jeff Layton, linux-nfs-u79uwXL29TY76Z2rM5mHXA
Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
---
fs/nfs_common/grace.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
index 420d3a0..1bd6599 100644
--- a/fs/nfs_common/grace.c
+++ b/fs/nfs_common/grace.c
@@ -104,7 +104,9 @@ grace_exit_net(struct net *net)
{
struct list_head *grace_list = net_generic(net, grace_net_id);
- BUG_ON(!list_empty(grace_list));
+ WARN_ONCE(!list_empty(grace_list),
+ "net %x %s: grace_list is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations grace_net_ops = {
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook
@ 2017-11-06 13:22 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:22 UTC (permalink / raw)
To: netdev; +Cc: J. Bruce Fields, Jeff Layton, linux-nfs
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/nfs_common/grace.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
index 420d3a0..1bd6599 100644
--- a/fs/nfs_common/grace.c
+++ b/fs/nfs_common/grace.c
@@ -104,7 +104,9 @@ grace_exit_net(struct net *net)
{
struct list_head *grace_list = net_generic(net, grace_net_id);
- BUG_ON(!list_empty(grace_list));
+ WARN_ONCE(!list_empty(grace_list),
+ "net %x %s: grace_list is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations grace_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 02/21] lockd: added cleanup checks in exit_net hook
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
[not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
@ 2017-11-06 13:23 ` Vasily Averin
2017-11-09 15:06 ` J. Bruce Fields
2017-11-06 13:23 ` [PATCH v3 03/21] exit_net cleanup: geneve sock_list check Vasily Averin
` (17 subsequent siblings)
20 siblings, 1 reply; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:23 UTC (permalink / raw)
To: netdev; +Cc: J. Bruce Fields, Jeff Layton, linux-nfs
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/lockd/svc.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 809cbcc..2a48558 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -690,6 +690,17 @@ static int lockd_init_net(struct net *net)
static void lockd_exit_net(struct net *net)
{
+ struct lockd_net *ln = net_generic(net, lockd_net_id);
+
+ WARN_ONCE(!list_empty(&ln->lockd_manager.list),
+ "net %x %s: lockd_manager.list is not empty\n",
+ net->ns.inum, __func__);
+ WARN_ONCE(!list_empty(&ln->nsm_handles),
+ "net %x %s: nsm_handles list is not empty\n",
+ net->ns.inum, __func__);
+ WARN_ONCE(delayed_work_pending(&ln->grace_period_end),
+ "net %x %s: grace_period_end was not cancelled\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations lockd_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 03/21] exit_net cleanup: geneve sock_list check
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (2 preceding siblings ...)
2017-11-06 13:23 ` [PATCH v3 02/21] lockd: added cleanup checks in exit_net hook Vasily Averin
@ 2017-11-06 13:23 ` Vasily Averin
2017-11-06 13:23 ` Vasily Averin
` (16 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:23 UTC (permalink / raw)
To: netdev
Be sure that sock_list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/geneve.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index f640407..4e3a344 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1673,6 +1673,9 @@ static void __net_exit geneve_exit_net(struct net *net)
/* unregister the devices gathered above */
unregister_netdevice_many(&list);
rtnl_unlock();
+ WARN_ONCE(!list_empty(&gn->sock_list),
+ "net %x &s: sock_list is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations geneve_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 04/21] ppp: exit_net cleanup checks added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
@ 2017-11-06 13:23 ` Vasily Averin
[not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
` (19 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:23 UTC (permalink / raw)
To: Linux Kernel Network Developers; +Cc: linux-ppp, Paul Mackerras
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/ppp/ppp_generic.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e365866..c0861d1 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -960,6 +960,12 @@ static __net_exit void ppp_exit_net(struct net *net)
rtnl_unlock();
idr_destroy(&pn->units_idr);
+ WARN_ONCE(!list_empty(&pn->all_channels),
+ "net %x %s: all_channels list is not empty\n",
+ net->ns.inum, __func__);
+ WARN_ONCE(!list_empty(&pn->new_channels),
+ "net %x %s: new_channels list is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations ppp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 04/21] ppp: exit_net cleanup checks added
@ 2017-11-06 13:23 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:23 UTC (permalink / raw)
To: Linux Kernel Network Developers; +Cc: linux-ppp, Paul Mackerras
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/ppp/ppp_generic.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e365866..c0861d1 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -960,6 +960,12 @@ static __net_exit void ppp_exit_net(struct net *net)
rtnl_unlock();
idr_destroy(&pn->units_idr);
+ WARN_ONCE(!list_empty(&pn->all_channels),
+ "net %x %s: all_channels list is not empty\n",
+ net->ns.inum, __func__);
+ WARN_ONCE(!list_empty(&pn->new_channels),
+ "net %x %s: new_channels list is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations ppp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 05/21] vxlan: exit_net cleanup checks added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (4 preceding siblings ...)
2017-11-06 13:23 ` Vasily Averin
@ 2017-11-06 13:23 ` Vasily Averin
2017-11-06 13:24 ` [PATCH v3 06/21] netdev: exit_net cleanup check added Vasily Averin
` (14 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:23 UTC (permalink / raw)
To: netdev
Be sure that sock_list array initialized in net_init hook was return
to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/vxlan.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf..acf5763 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3704,6 +3704,7 @@ static void __net_exit vxlan_exit_net(struct net *net)
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
struct vxlan_dev *vxlan, *next;
struct net_device *dev, *aux;
+ unsigned int h;
LIST_HEAD(list);
rtnl_lock();
@@ -3723,6 +3724,12 @@ static void __net_exit vxlan_exit_net(struct net *net)
unregister_netdevice_many(&list);
rtnl_unlock();
+
+ for (h = 0; h < PORT_HASH_SIZE; ++h)
+ if (WARN_ONCE(!hlist_empty(&vn->sock_list[h]),
+ "net %x %s: sock_list is not empty\n",
+ net->ns.inum, __func__))
+ break;
}
static struct pernet_operations vxlan_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 06/21] netdev: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (5 preceding siblings ...)
2017-11-06 13:23 ` [PATCH v3 05/21] vxlan: " Vasily Averin
@ 2017-11-06 13:24 ` Vasily Averin
2017-11-06 13:24 ` [PATCH v3 08/21] nfs client: " Vasily Averin
` (13 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:24 UTC (permalink / raw)
To: netdev
Be sure that dev_base_head list initialized in net_init hook was return
to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/dev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 588b473..34f88fc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8562,6 +8562,10 @@ static void __net_exit netdev_exit(struct net *net)
{
kfree(net->dev_name_head);
kfree(net->dev_index_head);
+ if (net != &init_net)
+ WARN_ONCE(!list_empty(&net->dev_base_head),
+ "net %x %s: dev_base_head is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations __net_initdata netdev_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 07/21] nfs4blocklayout: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
@ 2017-11-06 13:24 ` Vasily Averin
[not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
` (19 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:24 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: J. Bruce Fields, Jeff Layton, linux-nfs-u79uwXL29TY76Z2rM5mHXA,
Trond Myklebust, Anna Schumaker
Be sure that bl_wq wait queue initialized in net_init hook
is not used anymore.
Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
---
fs/nfs/blocklayout/rpc_pipefs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/nfs/blocklayout/rpc_pipefs.c b/fs/nfs/blocklayout/rpc_pipefs.c
index 9fb067a6..8c3941b 100644
--- a/fs/nfs/blocklayout/rpc_pipefs.c
+++ b/fs/nfs/blocklayout/rpc_pipefs.c
@@ -256,6 +256,9 @@ static void nfs4blocklayout_net_exit(struct net *net)
nfs4blocklayout_unregister_net(net, nn->bl_device_pipe);
rpc_destroy_pipe_data(nn->bl_device_pipe);
nn->bl_device_pipe = NULL;
+ WARN_ONCE(!list_empty(&nn->bl_wq.head),
+ "net %x %s: bl_wq head is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations nfs4blocklayout_net_ops = {
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 07/21] nfs4blocklayout: exit_net cleanup check added
@ 2017-11-06 13:24 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:24 UTC (permalink / raw)
To: netdev
Cc: J. Bruce Fields, Jeff Layton, linux-nfs, Trond Myklebust, Anna Schumaker
Be sure that bl_wq wait queue initialized in net_init hook
is not used anymore.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/nfs/blocklayout/rpc_pipefs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/nfs/blocklayout/rpc_pipefs.c b/fs/nfs/blocklayout/rpc_pipefs.c
index 9fb067a6..8c3941b 100644
--- a/fs/nfs/blocklayout/rpc_pipefs.c
+++ b/fs/nfs/blocklayout/rpc_pipefs.c
@@ -256,6 +256,9 @@ static void nfs4blocklayout_net_exit(struct net *net)
nfs4blocklayout_unregister_net(net, nn->bl_device_pipe);
rpc_destroy_pipe_data(nn->bl_device_pipe);
nn->bl_device_pipe = NULL;
+ WARN_ONCE(!list_empty(&nn->bl_wq.head),
+ "net %x %s: bl_wq head is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations nfs4blocklayout_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 08/21] nfs client: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (6 preceding siblings ...)
2017-11-06 13:24 ` [PATCH v3 06/21] netdev: exit_net cleanup check added Vasily Averin
@ 2017-11-06 13:24 ` Vasily Averin
2017-11-06 13:24 ` [PATCH v3 09/21] fib_notifier: " Vasily Averin
` (12 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:24 UTC (permalink / raw)
To: netdev; +Cc: linux-nfs, Trond Myklebust, Anna Schumaker
Be sure that nfs_client_list and nfs_volume_list lists initialized
in net_init hook were return to initial state in net_exit hook.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/nfs/client.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 22880ef..3966c98 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net)
struct nfs_net *nn = net_generic(net, nfs_net_id);
idr_destroy(&nn->cb_ident_idr);
+ WARN_ONCE(!list_empty(&nn->nfs_client_list),
+ "net %x exit: nfs_client_list is not empty\n", net->ns.inum);
+ WARN_ONCE(!list_empty(&nn->nfs_volume_list),
+ "net %x exit: nfs_volume_list is not empty\n", net->ns.inum);
}
/* nfs_client_lock held */
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 09/21] fib_notifier: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (7 preceding siblings ...)
2017-11-06 13:24 ` [PATCH v3 08/21] nfs client: " Vasily Averin
@ 2017-11-06 13:24 ` Vasily Averin
2017-11-06 13:24 ` [PATCH v3 10/21] fib_rules: " Vasily Averin
` (11 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:24 UTC (permalink / raw)
To: netdev
Be sure that fib_notifier_ops list initilized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/fib_notifier.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/fib_notifier.c b/net/core/fib_notifier.c
index 4fc202d..57aec96 100644
--- a/net/core/fib_notifier.c
+++ b/net/core/fib_notifier.c
@@ -161,8 +161,16 @@ static int __net_init fib_notifier_net_init(struct net *net)
return 0;
}
+static void __net_exit fib_notifier_net_exit(struct net *net)
+{
+ WARN_ONCE(!list_empty(&net->fib_notifier_ops),
+ "net %x %s: fib_notifier_ops list is not empty\n",
+ net->ns.inum, __func__);
+}
+
static struct pernet_operations fib_notifier_net_ops = {
.init = fib_notifier_net_init,
+ .exit = fib_notifier_net_exit,
};
static int __init fib_notifier_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 10/21] fib_rules: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (8 preceding siblings ...)
2017-11-06 13:24 ` [PATCH v3 09/21] fib_notifier: " Vasily Averin
@ 2017-11-06 13:24 ` Vasily Averin
2017-11-06 13:24 ` [PATCH v3 11/21] clusterip: " Vasily Averin
` (10 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:24 UTC (permalink / raw)
To: netdev
Be sure that rules_ops list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/fib_rules.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 9a6d97c..0049272 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -1019,8 +1019,16 @@ static int __net_init fib_rules_net_init(struct net *net)
return 0;
}
+static void __net_exit fib_rules_net_exit(struct net *net)
+{
+ WARN_ONCE(!list_empty(&net->rules_ops),
+ "net %x %s: rules_ops list is not empty\n",
+ net->ns.inum, __func__);
+}
+
static struct pernet_operations fib_rules_net_ops = {
.init = fib_rules_net_init,
+ .exit = fib_rules_net_exit,
};
static int __init fib_rules_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 11/21] clusterip: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (9 preceding siblings ...)
2017-11-06 13:24 ` [PATCH v3 10/21] fib_rules: " Vasily Averin
@ 2017-11-06 13:24 ` Vasily Averin
2017-11-06 13:40 ` Jozsef Kadlecsik
2017-11-06 13:24 ` [PATCH v3 12/21] xfrm6_tunnel: " Vasily Averin
` (9 subsequent siblings)
20 siblings, 1 reply; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:24 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
Hideaki YOSHIFUJI, netfilter-devel, coreteam
Be sure that configs list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/ipv4/netfilter/ipt_CLUSTERIP.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 17b4ca5..4364a88 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -819,6 +819,9 @@ static void clusterip_net_exit(struct net *net)
cn->procdir = NULL;
#endif
nf_unregister_net_hook(net, &cip_arp_ops);
+ WARN_ONCE(!list_empty(&cn->configs),
+ "net %x %s: configs list is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations clusterip_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 12/21] xfrm6_tunnel: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (10 preceding siblings ...)
2017-11-06 13:24 ` [PATCH v3 11/21] clusterip: " Vasily Averin
@ 2017-11-06 13:24 ` Vasily Averin
2017-11-06 13:25 ` [PATCH v3 13/21] af_key: replace BUG_ON on WARN_ONCE in net_exit hook Vasily Averin
` (8 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:24 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert, Herbert Xu, Hideaki YOSHIFUJI
Be sure that spi_byaddr and spi_byspi arrays initialized in net_init hook
were return to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/ipv6/xfrm6_tunnel.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 4e438bc..5ac3c90 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -338,6 +338,20 @@ static int __net_init xfrm6_tunnel_net_init(struct net *net)
static void __net_exit xfrm6_tunnel_net_exit(struct net *net)
{
+ struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
+ unsigned int i;
+
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
+ if (WARN_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i]),
+ "net %x %s: spi_byaddr is not empty\n",
+ net->ns.inum, __func__))
+ break;
+
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYSPI_HSIZE; i++)
+ if (WARN_ONCE(!hlist_empty(&xfrm6_tn->spi_byspi[i]),
+ "net %x %s: spi_byspi is not empty\n",
+ net->ns.inum, __func__))
+ break;
}
static struct pernet_operations xfrm6_tunnel_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 13/21] af_key: replace BUG_ON on WARN_ONCE in net_exit hook
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (11 preceding siblings ...)
2017-11-06 13:24 ` [PATCH v3 12/21] xfrm6_tunnel: " Vasily Averin
@ 2017-11-06 13:25 ` Vasily Averin
2017-11-06 13:25 ` [PATCH v3 14/21] l2tp: exit_net cleanup check added Vasily Averin
` (7 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:25 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert, Herbert Xu
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/key/af_key.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index a00d607..61d1b58 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3845,7 +3845,9 @@ static void __net_exit pfkey_net_exit(struct net *net)
struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id);
pfkey_exit_proc(net);
- BUG_ON(!hlist_empty(&net_pfkey->table));
+ WARN_ONCE(!hlist_empty(&net_pfkey->table),
+ "net %x %s table hlist is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations pfkey_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 14/21] l2tp: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (12 preceding siblings ...)
2017-11-06 13:25 ` [PATCH v3 13/21] af_key: replace BUG_ON on WARN_ONCE in net_exit hook Vasily Averin
@ 2017-11-06 13:25 ` Vasily Averin
2017-11-06 13:25 ` [PATCH v3 15/21] nf_tables: " Vasily Averin
` (6 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:25 UTC (permalink / raw)
To: netdev
Be sure that l2tp_session_hlist array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/l2tp/l2tp_core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 02d6110..249a2ed 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1888,6 +1888,7 @@ static __net_exit void l2tp_exit_net(struct net *net)
{
struct l2tp_net *pn = l2tp_pernet(net);
struct l2tp_tunnel *tunnel = NULL;
+ int hash;
rcu_read_lock_bh();
list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
@@ -1897,6 +1898,12 @@ static __net_exit void l2tp_exit_net(struct net *net)
flush_workqueue(l2tp_wq);
rcu_barrier();
+
+ for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
+ if (WARN_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash]),
+ "net %x %s: session_hlist is not empty\n",
+ net->ns.inum, __func__))
+ break;
}
static struct pernet_operations l2tp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 15/21] nf_tables: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (13 preceding siblings ...)
2017-11-06 13:25 ` [PATCH v3 14/21] l2tp: exit_net cleanup check added Vasily Averin
@ 2017-11-06 13:25 ` Vasily Averin
2017-11-06 13:25 ` [PATCH v3 16/21] nfnetlink_log: " Vasily Averin
` (5 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:25 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nf_tables_api.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 64e1ee0..3b7f518 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -5778,6 +5778,16 @@ static int __net_init nf_tables_init_net(struct net *net)
return 0;
}
+static void __net_exit nf_tables_exit_net(struct net *net)
+{
+ WARN_ONCE(!list_empty(&net->nft.af_info),
+ "net %x %s: af_info list is not empty\n",
+ net->ns.inum, __func__);
+ WARN_ONCE(!list_empty(&net->nft.commit_list),
+ "net %x %s: commit_list is not empty\n",
+ net->ns.inum, __func__);
+}
+
int __nft_release_basechain(struct nft_ctx *ctx)
{
struct nft_rule *rule, *nr;
@@ -5848,6 +5858,7 @@ static void __nft_release_afinfo(struct net *net, struct nft_af_info *afi)
static struct pernet_operations nf_tables_net_ops = {
.init = nf_tables_init_net,
+ .exit = nf_tables_exit_net,
};
static int __init nf_tables_module_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 16/21] nfnetlink_log: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (14 preceding siblings ...)
2017-11-06 13:25 ` [PATCH v3 15/21] nf_tables: " Vasily Averin
@ 2017-11-06 13:25 ` Vasily Averin
2017-11-06 13:25 ` [PATCH v3 17/21] nfnetlink_gueue: " Vasily Averin
` (4 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:25 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Be sure that instance_table array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nfnetlink_log.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index cad6498..85bc47a 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -1093,10 +1093,17 @@ static int __net_init nfnl_log_net_init(struct net *net)
static void __net_exit nfnl_log_net_exit(struct net *net)
{
+ unsigned int i;
+ struct nfnl_log_net *log = nfnl_log_pernet(net);
#ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_log", net->nf.proc_netfilter);
#endif
nf_log_unset(net, &nfulnl_logger);
+ for (i = 0; i < INSTANCE_BUCKETS; i++)
+ if (WARN_ONCE(!hlist_empty(&log->instance_table[i]),
+ "net %x %s: instance_table is not empty\n",
+ net->ns.inum, __func__))
+ break;
}
static struct pernet_operations nfnl_log_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 17/21] nfnetlink_gueue: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (15 preceding siblings ...)
2017-11-06 13:25 ` [PATCH v3 16/21] nfnetlink_log: " Vasily Averin
@ 2017-11-06 13:25 ` Vasily Averin
2017-11-06 13:25 ` [PATCH v3 18/21] x_tables: " Vasily Averin
` (3 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:25 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Be sure that instance_table array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nfnetlink_queue.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index c979662..139d2b5 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1512,10 +1512,18 @@ static int __net_init nfnl_queue_net_init(struct net *net)
static void __net_exit nfnl_queue_net_exit(struct net *net)
{
+ unsigned int i;
+ struct nfnl_queue_net *q = nfnl_queue_pernet(net);
+
nf_unregister_queue_handler(net);
#ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter);
#endif
+ for (i = 0; i < INSTANCE_BUCKETS; i++)
+ if (WARN_ONCE(!hlist_empty(&q->instance_table[i]),
+ "net %x %s: instance_table isn't empty\n",
+ net->ns.inum, __func__))
+ break;
}
static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 18/21] x_tables: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (16 preceding siblings ...)
2017-11-06 13:25 ` [PATCH v3 17/21] nfnetlink_gueue: " Vasily Averin
@ 2017-11-06 13:25 ` Vasily Averin
2017-11-06 13:25 ` [PATCH v3 19/21] packet: " Vasily Averin
` (2 subsequent siblings)
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:25 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Be sure that xt.tables array initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/x_tables.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index d8571f4..dcdaf96 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1714,8 +1714,20 @@ static int __net_init xt_net_init(struct net *net)
return 0;
}
+static void __net_exit xt_net_exit(struct net *net)
+{
+ int i;
+
+ for (i = 0; i < NFPROTO_NUMPROTO; i++)
+ if (WARN_ONCE(!list_empty(&net->xt.tables[i]),
+ "net %x %s: tables list is not empty\n",
+ net->ns.inum. __func__)
+ break;
+}
+
static struct pernet_operations xt_net_ops = {
.init = xt_net_init,
+ .exit = xt_net_exit,
};
static int __init xt_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 19/21] packet: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (17 preceding siblings ...)
2017-11-06 13:25 ` [PATCH v3 18/21] x_tables: " Vasily Averin
@ 2017-11-06 13:25 ` Vasily Averin
2017-11-06 13:25 ` [PATCH v3 20/21] phonet: " Vasily Averin
2017-11-06 13:26 ` [PATCH v3 21/21] sunrpc: " Vasily Averin
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:25 UTC (permalink / raw)
To: netdev
Be sure that packet.sklist initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/packet/af_packet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index bec01a3..cdd4ce6 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4562,6 +4562,8 @@ static int __net_init packet_net_init(struct net *net)
static void __net_exit packet_net_exit(struct net *net)
{
remove_proc_entry("packet", net->proc_net);
+ WARN_ONCE(!hlist_empty(&net->packet.sklist),
+ "net %x %s: sklist is not empty\n", net->ns.inum, __func__);
}
static struct pernet_operations packet_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 20/21] phonet: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (18 preceding siblings ...)
2017-11-06 13:25 ` [PATCH v3 19/21] packet: " Vasily Averin
@ 2017-11-06 13:25 ` Vasily Averin
2017-11-06 19:37 ` Rémi Denis-Courmont
2017-11-06 13:26 ` [PATCH v3 21/21] sunrpc: " Vasily Averin
20 siblings, 1 reply; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:25 UTC (permalink / raw)
To: netdev; +Cc: Remi Denis-Courmont
Be sure that pndevs.list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/phonet/pn_dev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 2cb4c5d..f0ab85d 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -331,7 +331,12 @@ static int __net_init phonet_init_net(struct net *net)
static void __net_exit phonet_exit_net(struct net *net)
{
+ struct phonet_net *pnn = phonet_pernet(net);
+
remove_proc_entry("phonet", net->proc_net);
+ WARN_ONCE(!list_empty(&pnn->pndevs.list),
+ "net %x %s: pndevs.list is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations phonet_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v3 21/21] sunrpc: exit_net cleanup check added
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
` (19 preceding siblings ...)
2017-11-06 13:25 ` [PATCH v3 20/21] phonet: " Vasily Averin
@ 2017-11-06 13:26 ` Vasily Averin
20 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:26 UTC (permalink / raw)
To: netdev
Cc: J. Bruce Fields, Jeff Layton, linux-nfs, Trond Myklebust, Anna Schumaker
Be sure that all_clients list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/sunrpc/sunrpc_syms.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index c73de18..3ee6d8e 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -65,10 +65,15 @@ static __net_init int sunrpc_init_net(struct net *net)
static __net_exit void sunrpc_exit_net(struct net *net)
{
+ struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
rpc_pipefs_exit_net(net);
unix_gid_cache_destroy(net);
ip_map_cache_destroy(net);
rpc_proc_exit(net);
+ WARN_ONCE(!list_empty(&sn->all_clients),
+ "net %x %s: all_clients list is not empty\n",
+ net->ns.inum, __func__);
}
static struct pernet_operations sunrpc_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH v3 04/21] ppp: exit_net cleanup checks added
2017-11-06 13:23 ` Vasily Averin
@ 2017-11-06 13:34 ` walter harms
-1 siblings, 0 replies; 122+ messages in thread
From: walter harms @ 2017-11-06 13:34 UTC (permalink / raw)
To: Vasily Averin; +Cc: Linux Kernel Network Developers, linux-ppp, Paul Mackerras
Hello Vasily Averin,
just a general hint:
when you send new versions of a patch please document also
what you have changed. Here an example from an other ML:
The problematic code looks like this:
res_seq = res_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK;
res_seq >>= TB_XDOMAIN_SN_SHIFT;
TB_XDOMAIN_SN_SHIFT is 27, and right shifting a u8 27 bits is always
going to result in zero. The fix is to declare these variables as u32.
Fixes: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I accidentally sent this through the wrong list, so I'm resending to
netdev. Also Mika asked me to split it up because the Fixes tags
are different for these patches.
please notice the V2. that tell the reader what has changes against
the V1.
re,
wh
Am 06.11.2017 14:23, schrieb Vasily Averin:
> Be sure that lists initialized in net_init hook were return
> to initial state.
>
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> drivers/net/ppp/ppp_generic.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
> index e365866..c0861d1 100644
> --- a/drivers/net/ppp/ppp_generic.c
> +++ b/drivers/net/ppp/ppp_generic.c
> @@ -960,6 +960,12 @@ static __net_exit void ppp_exit_net(struct net *net)
> rtnl_unlock();
>
> idr_destroy(&pn->units_idr);
> + WARN_ONCE(!list_empty(&pn->all_channels),
> + "net %x %s: all_channels list is not empty\n",
> + net->ns.inum, __func__);
> + WARN_ONCE(!list_empty(&pn->new_channels),
> + "net %x %s: new_channels list is not empty\n",
> + net->ns.inum, __func__);
> }
>
> static struct pernet_operations ppp_net_ops = {
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 04/21] ppp: exit_net cleanup checks added
@ 2017-11-06 13:34 ` walter harms
0 siblings, 0 replies; 122+ messages in thread
From: walter harms @ 2017-11-06 13:34 UTC (permalink / raw)
To: Vasily Averin; +Cc: Linux Kernel Network Developers, linux-ppp, Paul Mackerras
Hello Vasily Averin,
just a general hint:
when you send new versions of a patch please document also
what you have changed. Here an example from an other ML:
The problematic code looks like this:
res_seq = res_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK;
res_seq >>= TB_XDOMAIN_SN_SHIFT;
TB_XDOMAIN_SN_SHIFT is 27, and right shifting a u8 27 bits is always
going to result in zero. The fix is to declare these variables as u32.
Fixes: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I accidentally sent this through the wrong list, so I'm resending to
netdev. Also Mika asked me to split it up because the Fixes tags
are different for these patches.
please notice the V2. that tell the reader what has changes against
the V1.
re,
wh
Am 06.11.2017 14:23, schrieb Vasily Averin:
> Be sure that lists initialized in net_init hook were return
> to initial state.
>
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> drivers/net/ppp/ppp_generic.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
> index e365866..c0861d1 100644
> --- a/drivers/net/ppp/ppp_generic.c
> +++ b/drivers/net/ppp/ppp_generic.c
> @@ -960,6 +960,12 @@ static __net_exit void ppp_exit_net(struct net *net)
> rtnl_unlock();
>
> idr_destroy(&pn->units_idr);
> + WARN_ONCE(!list_empty(&pn->all_channels),
> + "net %x %s: all_channels list is not empty\n",
> + net->ns.inum, __func__);
> + WARN_ONCE(!list_empty(&pn->new_channels),
> + "net %x %s: new_channels list is not empty\n",
> + net->ns.inum, __func__);
> }
>
> static struct pernet_operations ppp_net_ops = {
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 11/21] clusterip: exit_net cleanup check added
2017-11-06 13:24 ` [PATCH v3 11/21] clusterip: " Vasily Averin
@ 2017-11-06 13:40 ` Jozsef Kadlecsik
2017-11-06 13:55 ` Vasily Averin
0 siblings, 1 reply; 122+ messages in thread
From: Jozsef Kadlecsik @ 2017-11-06 13:40 UTC (permalink / raw)
To: Vasily Averin
Cc: netdev, Pablo Neira Ayuso, Florian Westphal, Hideaki YOSHIFUJI,
netfilter-devel, coreteam
Hello Vasily,
On Mon, 6 Nov 2017, Vasily Averin wrote:
> Be sure that configs list initialized in net_init hook was return
> to initial state.
What is the goal of the patch series you sent in the third version in a
row?
- If the deinitializations are missing from the files, the patches
do not fix them, just emit warnings.
- If the deinitializations are not missing, the patches are totally
unnecessary.
It looks like debugging... but not expressed that way, neither in the
subject lines nor in the patch descriptions.
Best regards,
Jozsef
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> net/ipv4/netfilter/ipt_CLUSTERIP.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
> index 17b4ca5..4364a88 100644
> --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
> +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
> @@ -819,6 +819,9 @@ static void clusterip_net_exit(struct net *net)
> cn->procdir = NULL;
> #endif
> nf_unregister_net_hook(net, &cip_arp_ops);
> + WARN_ONCE(!list_empty(&cn->configs),
> + "net %x %s: configs list is not empty\n",
> + net->ns.inum, __func__);
> }
>
> static struct pernet_operations clusterip_net_ops = {
> --
> 2.7.4
>
>
-
E-mail : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
H-1525 Budapest 114, POB. 49, Hungary
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 04/21] ppp: exit_net cleanup checks added
2017-11-06 13:23 ` Vasily Averin
(?)
(?)
@ 2017-11-06 13:50 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:50 UTC (permalink / raw)
To: linux-ppp
Dear Walter,
thank you for feedback, I'll do it next time.
Changes was listed in cover letter, that was not not submitted into linux-ppp@ list
"This patch set checks that lists initialized in net_init hooks were
return to initial state at end of net_exit hooks.
I hope such checks allows to detect leaked per-netns objects.
Also I hope that all new pernet_operations will inherit such checks too.
I assume that elements added into per-net lists should not live longer than net namespace,
and should be deleted from the list. I think exit_net hook is good place for such check.
Recently I've found lost list_entry and enabled timer on stop of net namespace.
Then I've reviewed all existing pernet_operations and found that many drivers
have such checks already. So I decided to complete this task and add such checks
into all affected subsystems.
v3:
- use net->ns.inum as net Id
- removed patches for hashlimit and recent,
they handle tables list in exit_net hook.
- added patches for grace and lockd
v2:
- net pointer removed from output
- fixed compilation for phonet driver
"
On 2017-11-06 16:34, walter harms wrote:
> Hello Vasily Averin,
> just a general hint:
> when you send new versions of a patch please document also
> what you have changed. Here an example from an other ML:
>
> The problematic code looks like this:
>
> res_seq = res_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK;
> res_seq >>= TB_XDOMAIN_SN_SHIFT;
>
> TB_XDOMAIN_SN_SHIFT is 27, and right shifting a u8 27 bits is always
> going to result in zero. The fix is to declare these variables as u32.
>
> Fixes: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: I accidentally sent this through the wrong list, so I'm resending to
> netdev. Also Mika asked me to split it up because the Fixes tags
> are different for these patches.
>
>
> please notice the V2. that tell the reader what has changes against
> the V1.
>
> re,
> wh
>
> Am 06.11.2017 14:23, schrieb Vasily Averin:
>> Be sure that lists initialized in net_init hook were return
>> to initial state.
>>
>> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
>> ---
>> drivers/net/ppp/ppp_generic.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
>> index e365866..c0861d1 100644
>> --- a/drivers/net/ppp/ppp_generic.c
>> +++ b/drivers/net/ppp/ppp_generic.c
>> @@ -960,6 +960,12 @@ static __net_exit void ppp_exit_net(struct net *net)
>> rtnl_unlock();
>>
>> idr_destroy(&pn->units_idr);
>> + WARN_ONCE(!list_empty(&pn->all_channels),
>> + "net %x %s: all_channels list is not empty\n",
>> + net->ns.inum, __func__);
>> + WARN_ONCE(!list_empty(&pn->new_channels),
>> + "net %x %s: new_channels list is not empty\n",
>> + net->ns.inum, __func__);
>> }
>>
>> static struct pernet_operations ppp_net_ops = {
>
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 11/21] clusterip: exit_net cleanup check added
2017-11-06 13:40 ` Jozsef Kadlecsik
@ 2017-11-06 13:55 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-06 13:55 UTC (permalink / raw)
To: Jozsef Kadlecsik
Cc: Pablo Neira Ayuso, Florian Westphal, Hideaki YOSHIFUJI,
netfilter-devel, coreteam
Dear Jozsef,
thank you for your feedback,
I've added description into cover letter,
however it was not sent into netfilters mailing lists:
"This patch set checks that lists initialized in net_init hooks were
return to initial state at end of net_exit hooks.
I hope such checks allows to detect leaked per-netns objects.
Also I hope that all new pernet_operations will inherit such checks too.
I assume that elements added into per-net lists should not live longer than net namespace,
and should be deleted from the list. I think exit_net hook is good place for such check.
Recently I've found lost list_entry and enabled timer on stop of net namespace.
Then I've reviewed all existing pernet_operations and found that many drivers
have such checks already. So I decided to complete this task and add such checks
into all affected subsystems.
v3:
- use net->ns.inum as net Id
- removed patches for hashlimit and recent,
they handle tables list in exit_net hook.
- added patches for grace and lockd
v2:
- net pointer removed from output
- fixed compilation for phonet driver
"
On 2017-11-06 16:40, Jozsef Kadlecsik wrote:
> Hello Vasily,
>
> On Mon, 6 Nov 2017, Vasily Averin wrote:
>
>> Be sure that configs list initialized in net_init hook was return
>> to initial state.
>
> What is the goal of the patch series you sent in the third version in a
> row?
>
> - If the deinitializations are missing from the files, the patches
> do not fix them, just emit warnings.
> - If the deinitializations are not missing, the patches are totally
> unnecessary.
>
> It looks like debugging... but not expressed that way, neither in the
> subject lines nor in the patch descriptions.
>
> Best regards,
> Jozsef
>
>> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
>> ---
>> net/ipv4/netfilter/ipt_CLUSTERIP.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
>> index 17b4ca5..4364a88 100644
>> --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
>> +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
>> @@ -819,6 +819,9 @@ static void clusterip_net_exit(struct net *net)
>> cn->procdir = NULL;
>> #endif
>> nf_unregister_net_hook(net, &cip_arp_ops);
>> + WARN_ONCE(!list_empty(&cn->configs),
>> + "net %x %s: configs list is not empty\n",
>> + net->ns.inum, __func__);
>> }
>>
>> static struct pernet_operations clusterip_net_ops = {
>> --
>> 2.7.4
>>
>>
>
> -
> E-mail : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
> PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
> Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
> H-1525 Budapest 114, POB. 49, Hungary
>
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 20/21] phonet: exit_net cleanup check added
2017-11-06 13:25 ` [PATCH v3 20/21] phonet: " Vasily Averin
@ 2017-11-06 19:37 ` Rémi Denis-Courmont
2017-11-12 9:24 ` Vasily Averin
0 siblings, 1 reply; 122+ messages in thread
From: Rémi Denis-Courmont @ 2017-11-06 19:37 UTC (permalink / raw)
To: Vasily Averin; +Cc: netdev
Le maanantaina 6. marraskuuta 2017, 16.25.54 EET Vasily Averin a écrit :
> Be sure that pndevs.list initialized in net_init hook was return
> to initial state.
>
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> net/phonet/pn_dev.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
> index 2cb4c5d..f0ab85d 100644
> --- a/net/phonet/pn_dev.c
> +++ b/net/phonet/pn_dev.c
> @@ -331,7 +331,12 @@ static int __net_init phonet_init_net(struct net *net)
>
> static void __net_exit phonet_exit_net(struct net *net)
> {
> + struct phonet_net *pnn = phonet_pernet(net);
> +
> remove_proc_entry("phonet", net->proc_net);
> + WARN_ONCE(!list_empty(&pnn->pndevs.list),
> + "net %x %s: pndevs.list is not empty\n",
> + net->ns.inum, __func__);
> }
>
> static struct pernet_operations phonet_net_ops = {
In my opinon, tis is still utterly pointless. Really, what bug did this
specific patch help to fix?
If you want to debug network namespaces, I have a feeling that the network
namespace code is a better place to do so than individual protocol stacks.
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook
2017-11-06 13:22 ` Vasily Averin
(?)
@ 2017-11-06 20:02 ` J. Bruce Fields
-1 siblings, 0 replies; 122+ messages in thread
From: J. Bruce Fields @ 2017-11-06 20:02 UTC (permalink / raw)
To: Vasily Averin; +Cc: netdev, Jeff Layton, linux-nfs
I'm assuming you want me to apply this (and the following lockd patch),
but I'm not clear why this is part of a bigger series going to netdev.
--b.
On Mon, Nov 06, 2017 at 04:22:48PM +0300, Vasily Averin wrote:
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> fs/nfs_common/grace.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
> index 420d3a0..1bd6599 100644
> --- a/fs/nfs_common/grace.c
> +++ b/fs/nfs_common/grace.c
> @@ -104,7 +104,9 @@ grace_exit_net(struct net *net)
> {
> struct list_head *grace_list = net_generic(net, grace_net_id);
>
> - BUG_ON(!list_empty(grace_list));
> + WARN_ONCE(!list_empty(grace_list),
> + "net %x %s: grace_list is not empty\n",
> + net->ns.inum, __func__);
> }
>
> static struct pernet_operations grace_net_ops = {
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v2 01/21] exit_net cleanup: geneve sock_list check
2017-11-05 16:49 ` [PATCH v2 01/21] exit_net cleanup: geneve sock_list check Vasily Averin
@ 2017-11-07 2:37 ` kbuild test robot
0 siblings, 0 replies; 122+ messages in thread
From: kbuild test robot @ 2017-11-07 2:37 UTC (permalink / raw)
To: Vasily Averin; +Cc: kbuild-all, netdev
[-- Attachment #1: Type: text/plain, Size: 3131 bytes --]
Hi Vasily,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net/master]
[also build test WARNING on v4.14-rc8 next-20171106]
[cannot apply to net-next/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Vasily-Averin/exit_net-checks-for-objects-initialized-in-net_init-hook/20171107-094512
config: i386-randconfig-x001-201745 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from arch/x86/include/asm/bug.h:82:0,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:10,
from drivers/net/geneve.c:14:
drivers/net/geneve.c: In function 'geneve_exit_net':
>> drivers/net/geneve.c:1671:7: warning: too many arguments for format [-Wformat-extra-args]
"&s: sock_list is not empty\n", __func__);
^
include/asm-generic/bug.h:94:43: note: in definition of macro '__WARN_printf'
#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
^~~
>> drivers/net/geneve.c:1670:2: note: in expansion of macro 'WARN'
WARN(!list_empty(&gn->sock_list),
^~~~
vim +1671 drivers/net/geneve.c
1643
1644 static void __net_exit geneve_exit_net(struct net *net)
1645 {
1646 struct geneve_net *gn = net_generic(net, geneve_net_id);
1647 struct geneve_dev *geneve, *next;
1648 struct net_device *dev, *aux;
1649 LIST_HEAD(list);
1650
1651 rtnl_lock();
1652
1653 /* gather any geneve devices that were moved into this ns */
1654 for_each_netdev_safe(net, dev, aux)
1655 if (dev->rtnl_link_ops == &geneve_link_ops)
1656 unregister_netdevice_queue(dev, &list);
1657
1658 /* now gather any other geneve devices that were created in this ns */
1659 list_for_each_entry_safe(geneve, next, &gn->geneve_list, next) {
1660 /* If geneve->dev is in the same netns, it was already added
1661 * to the list by the previous loop.
1662 */
1663 if (!net_eq(dev_net(geneve->dev), net))
1664 unregister_netdevice_queue(geneve->dev, &list);
1665 }
1666
1667 /* unregister the devices gathered above */
1668 unregister_netdevice_many(&list);
1669 rtnl_unlock();
> 1670 WARN(!list_empty(&gn->sock_list),
> 1671 "&s: sock_list is not empty\n", __func__);
1672 }
1673
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33858 bytes --]
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v2 09/21] clusterip: exit_net cleanup check added
2017-11-05 16:50 ` [PATCH v2 09/21] clusterip: " Vasily Averin
@ 2017-11-07 2:42 ` kbuild test robot
0 siblings, 0 replies; 122+ messages in thread
From: kbuild test robot @ 2017-11-07 2:42 UTC (permalink / raw)
To: Vasily Averin
Cc: kbuild-all, netdev, coreteam, netfilter-devel, Florian Westphal,
Jozsef Kadlecsik, Pablo Neira Ayuso, Hideaki YOSHIFUJI
[-- Attachment #1: Type: text/plain, Size: 3295 bytes --]
Hi Vasily,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on v4.14-rc8 next-20171106]
[cannot apply to net-next/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Vasily-Averin/exit_net-checks-for-objects-initialized-in-net_init-hook/20171107-094512
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All error/warnings (new ones prefixed by >>):
In file included from ./arch/xtensa/include/generated/asm/bug.h:1:0,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/xtensa/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:10,
from net/ipv4//netfilter/ipt_CLUSTERIP.c:13:
net/ipv4//netfilter/ipt_CLUSTERIP.c: In function 'clusterip_net_exit':
>> net/ipv4//netfilter/ipt_CLUSTERIP.c:823:40: error: expected ')' before 'i'
"%s: configs list is not empty\n"i, __func__);
^
include/asm-generic/bug.h:89:69: note: in definition of macro '__WARN_printf'
#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
^
>> net/ipv4//netfilter/ipt_CLUSTERIP.c:822:2: note: in expansion of macro 'WARN'
WARN(!list_empty(&cn->configs),
^
>> net/ipv4//netfilter/ipt_CLUSTERIP.c:823:40: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
"%s: configs list is not empty\n"i, __func__);
^
include/asm-generic/bug.h:89:69: note: in definition of macro '__WARN_printf'
#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
^
>> net/ipv4//netfilter/ipt_CLUSTERIP.c:822:2: note: in expansion of macro 'WARN'
WARN(!list_empty(&cn->configs),
^
vim +823 net/ipv4//netfilter/ipt_CLUSTERIP.c
813
814 static void clusterip_net_exit(struct net *net)
815 {
816 #ifdef CONFIG_PROC_FS
817 struct clusterip_net *cn = net_generic(net, clusterip_net_id);
818 proc_remove(cn->procdir);
819 cn->procdir = NULL;
820 #endif
821 nf_unregister_net_hook(net, &cip_arp_ops);
> 822 WARN(!list_empty(&cn->configs),
> 823 "%s: configs list is not empty\n"i, __func__);
824 }
825
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 51597 bytes --]
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook
2017-11-06 13:22 ` Vasily Averin
@ 2017-11-09 15:06 ` J. Bruce Fields
-1 siblings, 0 replies; 122+ messages in thread
From: J. Bruce Fields @ 2017-11-09 15:06 UTC (permalink / raw)
To: Vasily Averin
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Jeff Layton,
linux-nfs-u79uwXL29TY76Z2rM5mHXA
Applied for 4.15, thanks.--b.
On Mon, Nov 06, 2017 at 04:22:48PM +0300, Vasily Averin wrote:
> Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
> ---
> fs/nfs_common/grace.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
> index 420d3a0..1bd6599 100644
> --- a/fs/nfs_common/grace.c
> +++ b/fs/nfs_common/grace.c
> @@ -104,7 +104,9 @@ grace_exit_net(struct net *net)
> {
> struct list_head *grace_list = net_generic(net, grace_net_id);
>
> - BUG_ON(!list_empty(grace_list));
> + WARN_ONCE(!list_empty(grace_list),
> + "net %x %s: grace_list is not empty\n",
> + net->ns.inum, __func__);
> }
>
> static struct pernet_operations grace_net_ops = {
> --
> 2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook
@ 2017-11-09 15:06 ` J. Bruce Fields
0 siblings, 0 replies; 122+ messages in thread
From: J. Bruce Fields @ 2017-11-09 15:06 UTC (permalink / raw)
To: Vasily Averin; +Cc: netdev, Jeff Layton, linux-nfs
Applied for 4.15, thanks.--b.
On Mon, Nov 06, 2017 at 04:22:48PM +0300, Vasily Averin wrote:
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> fs/nfs_common/grace.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
> index 420d3a0..1bd6599 100644
> --- a/fs/nfs_common/grace.c
> +++ b/fs/nfs_common/grace.c
> @@ -104,7 +104,9 @@ grace_exit_net(struct net *net)
> {
> struct list_head *grace_list = net_generic(net, grace_net_id);
>
> - BUG_ON(!list_empty(grace_list));
> + WARN_ONCE(!list_empty(grace_list),
> + "net %x %s: grace_list is not empty\n",
> + net->ns.inum, __func__);
> }
>
> static struct pernet_operations grace_net_ops = {
> --
> 2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 02/21] lockd: added cleanup checks in exit_net hook
2017-11-06 13:23 ` [PATCH v3 02/21] lockd: added cleanup checks in exit_net hook Vasily Averin
@ 2017-11-09 15:06 ` J. Bruce Fields
0 siblings, 0 replies; 122+ messages in thread
From: J. Bruce Fields @ 2017-11-09 15:06 UTC (permalink / raw)
To: Vasily Averin; +Cc: netdev, Jeff Layton, linux-nfs
Applied.--b.
On Mon, Nov 06, 2017 at 04:23:24PM +0300, Vasily Averin wrote:
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> fs/lockd/svc.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
> index 809cbcc..2a48558 100644
> --- a/fs/lockd/svc.c
> +++ b/fs/lockd/svc.c
> @@ -690,6 +690,17 @@ static int lockd_init_net(struct net *net)
>
> static void lockd_exit_net(struct net *net)
> {
> + struct lockd_net *ln = net_generic(net, lockd_net_id);
> +
> + WARN_ONCE(!list_empty(&ln->lockd_manager.list),
> + "net %x %s: lockd_manager.list is not empty\n",
> + net->ns.inum, __func__);
> + WARN_ONCE(!list_empty(&ln->nsm_handles),
> + "net %x %s: nsm_handles list is not empty\n",
> + net->ns.inum, __func__);
> + WARN_ONCE(delayed_work_pending(&ln->grace_period_end),
> + "net %x %s: grace_period_end was not cancelled\n",
> + net->ns.inum, __func__);
> }
>
> static struct pernet_operations lockd_net_ops = {
> --
> 2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v4 00/18] exit_net checks for objects initialized in net_init hook
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
@ 2017-11-12 8:39 ` Vasily Averin
2017-11-12 8:39 ` [PATCH v4 01/18] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
` (16 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:39 UTC (permalink / raw)
To: netdev
Cc: Steffen Klassert, Herbert Xu, Hideaki YOSHIFUJI,
Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
Trond Myklebust, Anna Schumaker, Remi Denis-Courmont,
Paul Mackerras, linux-ppp, netfilter-devel, coreteam, linux-nfs
OpenVz kernel team have a long history of fighting against namespace-related bugs,
some of them could be excluded by using simple checks described below.
One of typical errors is related to live cycle of namespaces:
usually objects created for some namespace should not live longer than namespace itself.
Such kind of issues can be invisible on usual systems where additional namespaces
are not used, because initial namespaces usually lives forever and never destroyed.
However in systems with namespaces it can lead to memory leaks or to use-after-free.
Both of them are critical for systems with running containers.
As you knows it's quite hard to find the reason of such issues,
especially in rarely-triggered scenarios on production nodes on default kernels
without specially enabled debug settings. Any additional hints can be useful here.
This patch set should help to detect some of these issues.
It is based on assumption that objects initialized in init hook of pernet_operations
should return to initial state until end of exit hook.
Many drivers and subsystems already have such checks, however I've found number
of places where list_empty check would be useful at least as smoke test.
These checks are useful for long-term stable kernels,
they allows to detect problems related to incomplete or incorrectly
backported patches.
Also this patch set replaces BUG_ON in existing checks:
memory leaks and possible memory corruptions are bad of course,
however in many cases they are not fatal
and should not crash production hosts unconditionally.
Changes:
v4:
- excluded grace and lockd patches taken by Bruce Fields
- let's use WARN_ON_ONCE without any extra messages
adobriyan@ is right, output of net Id gives nothing to host admin,
and developers in any case will extract information from core dump
- updated description in cover letter
- dropped nfs4blocklayout patch: waitqueue check does not look useful
- patches was reordered to be per-subsystem grouped
- cover letter should be sent to all people included into cc: of any patches
- minor cosmetic changes in some patches
v3:
- use net->ns.inum as net Id
- removed patches for hashlimit and recent,
they handle tables list in exit_net hook.
- added patches for grace and lockd
v2:
- net pointer removed from output
- fixed compilation for phonet driver
Vasily Averin (18):
af_key: replace BUG_ON on WARN_ON in net_exit hook
geneve: exit_net cleanup check added
packet: exit_net cleanup check added
vxlan: exit_net cleanup checks added
netdev: exit_net cleanup check added
fib_notifier: exit_net cleanup check added
fib_rules: exit_net cleanup check added
l2tp: exit_net cleanup check added
clusterip: exit_net cleanup check added
nf_tables: exit_net cleanup check added
nfnetlink_log: exit_net cleanup check added
nfnetlink_gueue: exit_net cleanup check added
x_tables: exit_net cleanup check added
nfs client: exit_net cleanup check added
sunrpc: exit_net cleanup check added
phonet: exit_net cleanup check added
ppp: exit_net cleanup checks added
xfrm6_tunnel: exit_net cleanup check added
drivers/net/geneve.c | 1 +
drivers/net/ppp/ppp_generic.c | 2 ++
drivers/net/vxlan.c | 5 +++++
fs/nfs/inode.c | 4 ++++
net/core/dev.c | 2 ++
net/core/fib_notifier.c | 6 ++++++
net/core/fib_rules.c | 6 ++++++
net/ipv4/netfilter/ipt_CLUSTERIP.c | 1 +
net/ipv6/xfrm6_tunnel.c | 10 ++++++++++
net/key/af_key.c | 2 +-
net/l2tp/l2tp_core.c | 5 +++++
net/netfilter/nf_tables_api.c | 7 +++++++
net/netfilter/nfnetlink_log.c | 5 +++++
net/netfilter/nfnetlink_queue.c | 6 ++++++
net/netfilter/x_tables.c | 10 ++++++++++
net/packet/af_packet.c | 1 +
net/phonet/pn_dev.c | 3 +++
net/sunrpc/sunrpc_syms.c | 3 +++
18 files changed, 78 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v4 00/18] exit_net checks for objects initialized in net_init hook
@ 2017-11-12 8:39 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:39 UTC (permalink / raw)
To: netdev
Cc: Steffen Klassert, Herbert Xu, Hideaki YOSHIFUJI,
Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
Trond Myklebust, Anna Schumaker, Remi Denis-Courmont,
Paul Mackerras, linux-ppp, netfilter-devel, coreteam, linux-nfs
OpenVz kernel team have a long history of fighting against namespace-related bugs,
some of them could be excluded by using simple checks described below.
One of typical errors is related to live cycle of namespaces:
usually objects created for some namespace should not live longer than namespace itself.
Such kind of issues can be invisible on usual systems where additional namespaces
are not used, because initial namespaces usually lives forever and never destroyed.
However in systems with namespaces it can lead to memory leaks or to use-after-free.
Both of them are critical for systems with running containers.
As you knows it's quite hard to find the reason of such issues,
especially in rarely-triggered scenarios on production nodes on default kernels
without specially enabled debug settings. Any additional hints can be useful here.
This patch set should help to detect some of these issues.
It is based on assumption that objects initialized in init hook of pernet_operations
should return to initial state until end of exit hook.
Many drivers and subsystems already have such checks, however I've found number
of places where list_empty check would be useful at least as smoke test.
These checks are useful for long-term stable kernels,
they allows to detect problems related to incomplete or incorrectly
backported patches.
Also this patch set replaces BUG_ON in existing checks:
memory leaks and possible memory corruptions are bad of course,
however in many cases they are not fatal
and should not crash production hosts unconditionally.
Changes:
v4:
- excluded grace and lockd patches taken by Bruce Fields
- let's use WARN_ON_ONCE without any extra messages
adobriyan@ is right, output of net Id gives nothing to host admin,
and developers in any case will extract information from core dump
- updated description in cover letter
- dropped nfs4blocklayout patch: waitqueue check does not look useful
- patches was reordered to be per-subsystem grouped
- cover letter should be sent to all people included into cc: of any patches
- minor cosmetic changes in some patches
v3:
- use net->ns.inum as net Id
- removed patches for hashlimit and recent,
they handle tables list in exit_net hook.
- added patches for grace and lockd
v2:
- net pointer removed from output
- fixed compilation for phonet driver
Vasily Averin (18):
af_key: replace BUG_ON on WARN_ON in net_exit hook
geneve: exit_net cleanup check added
packet: exit_net cleanup check added
vxlan: exit_net cleanup checks added
netdev: exit_net cleanup check added
fib_notifier: exit_net cleanup check added
fib_rules: exit_net cleanup check added
l2tp: exit_net cleanup check added
clusterip: exit_net cleanup check added
nf_tables: exit_net cleanup check added
nfnetlink_log: exit_net cleanup check added
nfnetlink_gueue: exit_net cleanup check added
x_tables: exit_net cleanup check added
nfs client: exit_net cleanup check added
sunrpc: exit_net cleanup check added
phonet: exit_net cleanup check added
ppp: exit_net cleanup checks added
xfrm6_tunnel: exit_net cleanup check added
drivers/net/geneve.c | 1 +
drivers/net/ppp/ppp_generic.c | 2 ++
drivers/net/vxlan.c | 5 +++++
fs/nfs/inode.c | 4 ++++
net/core/dev.c | 2 ++
net/core/fib_notifier.c | 6 ++++++
net/core/fib_rules.c | 6 ++++++
net/ipv4/netfilter/ipt_CLUSTERIP.c | 1 +
net/ipv6/xfrm6_tunnel.c | 10 ++++++++++
net/key/af_key.c | 2 +-
net/l2tp/l2tp_core.c | 5 +++++
net/netfilter/nf_tables_api.c | 7 +++++++
net/netfilter/nfnetlink_log.c | 5 +++++
net/netfilter/nfnetlink_queue.c | 6 ++++++
net/netfilter/x_tables.c | 10 ++++++++++
net/packet/af_packet.c | 1 +
net/phonet/pn_dev.c | 3 +++
net/sunrpc/sunrpc_syms.c | 3 +++
18 files changed, 78 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v4 01/18] af_key: replace BUG_ON on WARN_ON in net_exit hook
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
2017-11-12 8:39 ` Vasily Averin
@ 2017-11-12 8:39 ` Vasily Averin
2017-11-12 8:40 ` [PATCH v4 02/18] geneve: exit_net cleanup check added Vasily Averin
` (15 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:39 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert, Herbert Xu
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/key/af_key.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index a00d607..3dffb89 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3845,7 +3845,7 @@ static void __net_exit pfkey_net_exit(struct net *net)
struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id);
pfkey_exit_proc(net);
- BUG_ON(!hlist_empty(&net_pfkey->table));
+ WARN_ON(!hlist_empty(&net_pfkey->table));
}
static struct pernet_operations pfkey_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 02/18] geneve: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
2017-11-12 8:39 ` Vasily Averin
2017-11-12 8:39 ` [PATCH v4 01/18] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
@ 2017-11-12 8:40 ` Vasily Averin
2017-11-12 8:41 ` [PATCH v4 03/18] packet: " Vasily Averin
` (14 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:40 UTC (permalink / raw)
To: netdev
Be sure that sock_list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/geneve.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index f640407..6bc5721 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1673,6 +1673,7 @@ static void __net_exit geneve_exit_net(struct net *net)
/* unregister the devices gathered above */
unregister_netdevice_many(&list);
rtnl_unlock();
+ WARN_ON_ONCE(!list_empty(&gn->sock_list));
}
static struct pernet_operations geneve_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 03/18] packet: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (2 preceding siblings ...)
2017-11-12 8:40 ` [PATCH v4 02/18] geneve: exit_net cleanup check added Vasily Averin
@ 2017-11-12 8:41 ` Vasily Averin
2017-11-12 8:42 ` [PATCH v4 04/18] vxlan: exit_net cleanup checks added Vasily Averin
` (13 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:41 UTC (permalink / raw)
To: netdev
Be sure that packet.sklist initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/packet/af_packet.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index bec01a3..4b58c4a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4562,6 +4562,7 @@ static int __net_init packet_net_init(struct net *net)
static void __net_exit packet_net_exit(struct net *net)
{
remove_proc_entry("packet", net->proc_net);
+ WARN_ON_ONCE(!hlist_empty(&net->packet.sklist));
}
static struct pernet_operations packet_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 04/18] vxlan: exit_net cleanup checks added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (3 preceding siblings ...)
2017-11-12 8:41 ` [PATCH v4 03/18] packet: " Vasily Averin
@ 2017-11-12 8:42 ` Vasily Averin
2017-11-12 8:42 ` [PATCH v4 05/18] netdev: exit_net cleanup check added Vasily Averin
` (12 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:42 UTC (permalink / raw)
To: netdev
Be sure that sock_list array initialized in net_init hook was return
to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/vxlan.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf..766a41b 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3704,6 +3704,7 @@ static void __net_exit vxlan_exit_net(struct net *net)
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
struct vxlan_dev *vxlan, *next;
struct net_device *dev, *aux;
+ unsigned int h;
LIST_HEAD(list);
rtnl_lock();
@@ -3723,6 +3724,10 @@ static void __net_exit vxlan_exit_net(struct net *net)
unregister_netdevice_many(&list);
rtnl_unlock();
+
+ for (h = 0; h < PORT_HASH_SIZE; ++h)
+ if (WARN_ON_ONCE(!hlist_empty(&vn->sock_list[h])))
+ break;
}
static struct pernet_operations vxlan_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 05/18] netdev: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (4 preceding siblings ...)
2017-11-12 8:42 ` [PATCH v4 04/18] vxlan: exit_net cleanup checks added Vasily Averin
@ 2017-11-12 8:42 ` Vasily Averin
2017-11-12 8:42 ` [PATCH v4 06/18] fib_notifier: " Vasily Averin
` (11 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:42 UTC (permalink / raw)
To: netdev
Be sure that dev_base_head list initialized in net_init hook was return
to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/dev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 588b473..56fece7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8562,6 +8562,8 @@ static void __net_exit netdev_exit(struct net *net)
{
kfree(net->dev_name_head);
kfree(net->dev_index_head);
+ if (net != &init_net)
+ WARN_ON_ONCE(!list_empty(&net->dev_base_head));
}
static struct pernet_operations __net_initdata netdev_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 06/18] fib_notifier: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (5 preceding siblings ...)
2017-11-12 8:42 ` [PATCH v4 05/18] netdev: exit_net cleanup check added Vasily Averin
@ 2017-11-12 8:42 ` Vasily Averin
2017-11-12 8:43 ` [PATCH v4 07/18] fib_rules: " Vasily Averin
` (10 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:42 UTC (permalink / raw)
To: netdev
Be sure that fib_notifier_ops list initilized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/fib_notifier.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/fib_notifier.c b/net/core/fib_notifier.c
index 4fc202d..6b8cd49 100644
--- a/net/core/fib_notifier.c
+++ b/net/core/fib_notifier.c
@@ -161,8 +161,14 @@ static int __net_init fib_notifier_net_init(struct net *net)
return 0;
}
+static void __net_exit fib_notifier_net_exit(struct net *net)
+{
+ WARN_ON_ONCE(!list_empty(&net->fib_notifier_ops));
+}
+
static struct pernet_operations fib_notifier_net_ops = {
.init = fib_notifier_net_init,
+ .exit = fib_notifier_net_exit,
};
static int __init fib_notifier_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 07/18] fib_rules: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (6 preceding siblings ...)
2017-11-12 8:42 ` [PATCH v4 06/18] fib_notifier: " Vasily Averin
@ 2017-11-12 8:43 ` Vasily Averin
2017-11-12 8:44 ` [PATCH v4 08/18] l2tp: " Vasily Averin
` (9 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:43 UTC (permalink / raw)
To: netdev
Be sure that rules_ops list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/fib_rules.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 9a6d97c..c029192 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -1019,8 +1019,14 @@ static int __net_init fib_rules_net_init(struct net *net)
return 0;
}
+static void __net_exit fib_rules_net_exit(struct net *net)
+{
+ WARN_ON_ONCE(!list_empty(&net->rules_ops));
+}
+
static struct pernet_operations fib_rules_net_ops = {
.init = fib_rules_net_init,
+ .exit = fib_rules_net_exit,
};
static int __init fib_rules_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 08/18] l2tp: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (7 preceding siblings ...)
2017-11-12 8:43 ` [PATCH v4 07/18] fib_rules: " Vasily Averin
@ 2017-11-12 8:44 ` Vasily Averin
2017-11-12 8:44 ` [PATCH v4 09/18] clusterip: " Vasily Averin
` (8 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:44 UTC (permalink / raw)
To: netdev
Be sure that l2tp_session_hlist array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/l2tp/l2tp_core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 02d6110..eed1e21 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1888,6 +1888,7 @@ static __net_exit void l2tp_exit_net(struct net *net)
{
struct l2tp_net *pn = l2tp_pernet(net);
struct l2tp_tunnel *tunnel = NULL;
+ int hash;
rcu_read_lock_bh();
list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
@@ -1897,6 +1898,10 @@ static __net_exit void l2tp_exit_net(struct net *net)
flush_workqueue(l2tp_wq);
rcu_barrier();
+
+ for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
+ if (WARN_ON_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash])))
+ break;
}
static struct pernet_operations l2tp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 09/18] clusterip: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (8 preceding siblings ...)
2017-11-12 8:44 ` [PATCH v4 08/18] l2tp: " Vasily Averin
@ 2017-11-12 8:44 ` Vasily Averin
2017-11-12 8:45 ` [PATCH v4 10/18] nf_tables: " Vasily Averin
` (7 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:44 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
Hideaki YOSHIFUJI, netfilter-devel, coreteam
Be sure that configs list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/ipv4/netfilter/ipt_CLUSTERIP.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 17b4ca5..e35b8d0 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -819,6 +819,7 @@ static void clusterip_net_exit(struct net *net)
cn->procdir = NULL;
#endif
nf_unregister_net_hook(net, &cip_arp_ops);
+ WARN_ON_ONCE(!list_empty(&cn->configs));
}
static struct pernet_operations clusterip_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 10/18] nf_tables: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (9 preceding siblings ...)
2017-11-12 8:44 ` [PATCH v4 09/18] clusterip: " Vasily Averin
@ 2017-11-12 8:45 ` Vasily Averin
2017-11-12 8:46 ` [PATCH v4 11/18] nfnetlink_log: " Vasily Averin
` (6 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:45 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nf_tables_api.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 64e1ee0..f432b53 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -5778,6 +5778,12 @@ static int __net_init nf_tables_init_net(struct net *net)
return 0;
}
+static void __net_exit nf_tables_exit_net(struct net *net)
+{
+ WARN_ON_ONCE(!list_empty(&net->nft.af_info));
+ WARN_ON_ONCE(!list_empty(&net->nft.commit_list));
+}
+
int __nft_release_basechain(struct nft_ctx *ctx)
{
struct nft_rule *rule, *nr;
@@ -5848,6 +5854,7 @@ static void __nft_release_afinfo(struct net *net, struct nft_af_info *afi)
static struct pernet_operations nf_tables_net_ops = {
.init = nf_tables_init_net,
+ .exit = nf_tables_exit_net,
};
static int __init nf_tables_module_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 11/18] nfnetlink_log: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (10 preceding siblings ...)
2017-11-12 8:45 ` [PATCH v4 10/18] nf_tables: " Vasily Averin
@ 2017-11-12 8:46 ` Vasily Averin
2017-11-12 8:53 ` Florian Westphal
2017-11-12 11:28 ` Sergei Shtylyov
2017-11-12 8:47 ` [PATCH v4 12/18] nfnetlink_gueue: " Vasily Averin
` (5 subsequent siblings)
17 siblings, 2 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:46 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Be sure that instance_table array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nfnetlink_log.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index cad6498..80236a2 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -1093,10 +1093,15 @@ static int __net_init nfnl_log_net_init(struct net *net)
static void __net_exit nfnl_log_net_exit(struct net *net)
{
+ unsigned int i;
+ struct nfnl_log_net *log = nfnl_log_pernet(net);
#ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_log", net->nf.proc_netfilter);
#endif
nf_log_unset(net, &nfulnl_logger);
+ for (i = 0; i < INSTANCE_BUCKETS; i++)
+ if (WARN_ON_ONCE(!hlist_empty(&log->instance_table[i])))
+ break;
}
static struct pernet_operations nfnl_log_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 12/18] nfnetlink_gueue: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (11 preceding siblings ...)
2017-11-12 8:46 ` [PATCH v4 11/18] nfnetlink_log: " Vasily Averin
@ 2017-11-12 8:47 ` Vasily Averin
2017-11-12 8:52 ` Florian Westphal
2017-11-12 8:47 ` [PATCH v4 13/18] x_tables: " Vasily Averin
` (4 subsequent siblings)
17 siblings, 1 reply; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:47 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Be sure that instance_table array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nfnetlink_queue.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index c979662..fd41077 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1512,10 +1512,16 @@ static int __net_init nfnl_queue_net_init(struct net *net)
static void __net_exit nfnl_queue_net_exit(struct net *net)
{
+ unsigned int i;
+ struct nfnl_queue_net *q = nfnl_queue_pernet(net);
+
nf_unregister_queue_handler(net);
#ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter);
#endif
+ for (i = 0; i < INSTANCE_BUCKETS; i++)
+ if (WARN_ON_ONCE(!hlist_empty(&q->instance_table[i])))
+ break;
}
static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 13/18] x_tables: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (12 preceding siblings ...)
2017-11-12 8:47 ` [PATCH v4 12/18] nfnetlink_gueue: " Vasily Averin
@ 2017-11-12 8:47 ` Vasily Averin
[not found] ` <9dfa013e-9098-e155-9c47-a73753338288-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
` (3 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:47 UTC (permalink / raw)
To: netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Be sure that xt.tables array initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/x_tables.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index d8571f4..119b670 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1714,8 +1714,18 @@ static int __net_init xt_net_init(struct net *net)
return 0;
}
+static void __net_exit xt_net_exit(struct net *net)
+{
+ int i;
+
+ for (i = 0; i < NFPROTO_NUMPROTO; i++)
+ if (WARN_ON_ONCE(!list_empty(&net->xt.tables[i])))
+ break;
+}
+
static struct pernet_operations xt_net_ops = {
.init = xt_net_init,
+ .exit = xt_net_exit,
};
static int __init xt_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 14/18] nfs client: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
@ 2017-11-12 8:48 ` Vasily Averin
2017-11-12 8:39 ` [PATCH v4 01/18] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
` (16 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:48 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust, Anna Schumaker
Be sure that nfs_client_list and nfs_volume_list lists initialized
in net_init hook were return to initial state in net_exit hook.
Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
---
fs/nfs/inode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 134d9f5..4ef515f 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -2084,8 +2084,12 @@ static int nfs_net_init(struct net *net)
static void nfs_net_exit(struct net *net)
{
+ struct nfs_net *nn = net_generic(net, nfs_net_id);
+
nfs_fs_proc_net_exit(net);
nfs_cleanup_cb_ident_idr(net);
+ WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
+ WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
}
static struct pernet_operations nfs_net_ops = {
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 14/18] nfs client: exit_net cleanup check added
@ 2017-11-12 8:48 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:48 UTC (permalink / raw)
To: netdev; +Cc: linux-nfs, Trond Myklebust, Anna Schumaker
Be sure that nfs_client_list and nfs_volume_list lists initialized
in net_init hook were return to initial state in net_exit hook.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/nfs/inode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 134d9f5..4ef515f 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -2084,8 +2084,12 @@ static int nfs_net_init(struct net *net)
static void nfs_net_exit(struct net *net)
{
+ struct nfs_net *nn = net_generic(net, nfs_net_id);
+
nfs_fs_proc_net_exit(net);
nfs_cleanup_cb_ident_idr(net);
+ WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
+ WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
}
static struct pernet_operations nfs_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 15/18] sunrpc: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
@ 2017-11-12 8:48 ` Vasily Averin
2017-11-12 8:39 ` [PATCH v4 01/18] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
` (16 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:48 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust, Anna Schumaker
Be sure that all_clients list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
---
net/sunrpc/sunrpc_syms.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index c73de18..56f9eff 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -65,10 +65,13 @@ static __net_init int sunrpc_init_net(struct net *net)
static __net_exit void sunrpc_exit_net(struct net *net)
{
+ struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
rpc_pipefs_exit_net(net);
unix_gid_cache_destroy(net);
ip_map_cache_destroy(net);
rpc_proc_exit(net);
+ WARN_ON_ONCE(!list_empty(&sn->all_clients));
}
static struct pernet_operations sunrpc_net_ops = {
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 15/18] sunrpc: exit_net cleanup check added
@ 2017-11-12 8:48 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:48 UTC (permalink / raw)
To: netdev; +Cc: linux-nfs, Trond Myklebust, Anna Schumaker
Be sure that all_clients list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/sunrpc/sunrpc_syms.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index c73de18..56f9eff 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -65,10 +65,13 @@ static __net_init int sunrpc_init_net(struct net *net)
static __net_exit void sunrpc_exit_net(struct net *net)
{
+ struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
rpc_pipefs_exit_net(net);
unix_gid_cache_destroy(net);
ip_map_cache_destroy(net);
rpc_proc_exit(net);
+ WARN_ON_ONCE(!list_empty(&sn->all_clients));
}
static struct pernet_operations sunrpc_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 16/18] phonet: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (14 preceding siblings ...)
[not found] ` <9dfa013e-9098-e155-9c47-a73753338288-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
@ 2017-11-12 8:49 ` Vasily Averin
2017-11-12 8:50 ` Vasily Averin
2017-11-12 8:51 ` [PATCH v4 18/18] xfrm6_tunnel: exit_net cleanup check added Vasily Averin
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:49 UTC (permalink / raw)
To: netdev; +Cc: Remi Denis-Courmont
Be sure that pndevs.list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/phonet/pn_dev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 2cb4c5d..7778751 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -331,7 +331,10 @@ static int __net_init phonet_init_net(struct net *net)
static void __net_exit phonet_exit_net(struct net *net)
{
+ struct phonet_net *pnn = phonet_pernet(net);
+
remove_proc_entry("phonet", net->proc_net);
+ WARN_ON_ONCE(!list_empty(&pnn->pndevs.list));
}
static struct pernet_operations phonet_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 17/18] ppp: exit_net cleanup checks added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
@ 2017-11-12 8:50 ` Vasily Averin
2017-11-12 8:39 ` [PATCH v4 01/18] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
` (16 subsequent siblings)
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:50 UTC (permalink / raw)
To: netdev; +Cc: linux-ppp, Paul Mackerras
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/ppp/ppp_generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e365866..30744ce 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -960,6 +960,8 @@ static __net_exit void ppp_exit_net(struct net *net)
rtnl_unlock();
idr_destroy(&pn->units_idr);
+ WARN_ON_ONCE(!list_empty(&pn->all_channels));
+ WARN_ON_ONCE(!list_empty(&pn->new_channels));
}
static struct pernet_operations ppp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 17/18] ppp: exit_net cleanup checks added
@ 2017-11-12 8:50 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:50 UTC (permalink / raw)
To: netdev; +Cc: linux-ppp, Paul Mackerras
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/ppp/ppp_generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e365866..30744ce 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -960,6 +960,8 @@ static __net_exit void ppp_exit_net(struct net *net)
rtnl_unlock();
idr_destroy(&pn->units_idr);
+ WARN_ON_ONCE(!list_empty(&pn->all_channels));
+ WARN_ON_ONCE(!list_empty(&pn->new_channels));
}
static struct pernet_operations ppp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v4 18/18] xfrm6_tunnel: exit_net cleanup check added
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
` (16 preceding siblings ...)
2017-11-12 8:50 ` Vasily Averin
@ 2017-11-12 8:51 ` Vasily Averin
17 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 8:51 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert, Herbert Xu, Hideaki YOSHIFUJI
Be sure that spi_byaddr and spi_byspi arrays initialized in net_init hook
were return to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/ipv6/xfrm6_tunnel.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 4e438bc..09ec069 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -338,6 +338,16 @@ static int __net_init xfrm6_tunnel_net_init(struct net *net)
static void __net_exit xfrm6_tunnel_net_exit(struct net *net)
{
+ struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
+ unsigned int i;
+
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
+ if (WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i])))
+ break;
+
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYSPI_HSIZE; i++)
+ if (WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byspi[i])))
+ break;
}
static struct pernet_operations xfrm6_tunnel_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH v4 12/18] nfnetlink_gueue: exit_net cleanup check added
2017-11-12 8:47 ` [PATCH v4 12/18] nfnetlink_gueue: " Vasily Averin
@ 2017-11-12 8:52 ` Florian Westphal
2017-11-12 9:02 ` Vasily Averin
0 siblings, 1 reply; 122+ messages in thread
From: Florian Westphal @ 2017-11-12 8:52 UTC (permalink / raw)
To: Vasily Averin
Cc: netdev, Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Vasily Averin <vvs@virtuozzo.com> wrote:
> Be sure that instance_table array initialized in net_init hook
> was return to initial state.
> + for (i = 0; i < INSTANCE_BUCKETS; i++)
> + if (WARN_ON_ONCE(!hlist_empty(&q->instance_table[i])))
> + break;
This looks strange, why if/break?
Plain WARN_ON_ONCE should be enough, but thats a nit so:
Acked-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v4 11/18] nfnetlink_log: exit_net cleanup check added
2017-11-12 8:46 ` [PATCH v4 11/18] nfnetlink_log: " Vasily Averin
@ 2017-11-12 8:53 ` Florian Westphal
2017-11-12 11:28 ` Sergei Shtylyov
1 sibling, 0 replies; 122+ messages in thread
From: Florian Westphal @ 2017-11-12 8:53 UTC (permalink / raw)
To: Vasily Averin
Cc: netdev, Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Vasily Averin <vvs@virtuozzo.com> wrote:
> Be sure that instance_table array initialized in net_init hook
> was return to initial state.
Acked-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v4 12/18] nfnetlink_gueue: exit_net cleanup check added
2017-11-12 8:52 ` Florian Westphal
@ 2017-11-12 9:02 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 9:02 UTC (permalink / raw)
To: Florian Westphal
Cc: netdev, Pablo Neira Ayuso, Jozsef Kadlecsik, netfilter-devel, coreteam
On 2017-11-12 11:52, Florian Westphal wrote:
> Vasily Averin <vvs@virtuozzo.com> wrote:
>> Be sure that instance_table array initialized in net_init hook
>> was return to initial state.
>
>> + for (i = 0; i < INSTANCE_BUCKETS; i++)
>> + if (WARN_ON_ONCE(!hlist_empty(&q->instance_table[i])))
>> + break;
>
> This looks strange, why if/break?
I did not want to generate huge number of messages on each non-empty hash bucket.
> Plain WARN_ON_ONCE should be enough, but thats a nit so:
Oh, you're right.
In first patch version WARN_ON was used here.
I've missed that only first message will be printed with _ONCE check.
> Acked-by: Florian Westphal <fw@strlen.de>
>
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v3 20/21] phonet: exit_net cleanup check added
2017-11-06 19:37 ` Rémi Denis-Courmont
@ 2017-11-12 9:24 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 9:24 UTC (permalink / raw)
To: Rémi Denis-Courmont; +Cc: netdev
On 2017-11-06 22:37, Rémi Denis-Courmont wrote:
> In my opinon, tis is still utterly pointless. Really, what bug did this
> specific patch help to fix?
I'm maintainer of legacy OpenVz kernels, we release containers-ready kernels 15+ years,
they are widely used by hosting providers, usually they use 30-300 containers per node.
In this scenario if any of container causes the problem it affects many other.
For many years we got lot of strange memory corruptions and found lot of memory leaks
in namespace-fied subsytems.
These bugs are invisible on usual kernls, because init_net lives forever and never destroyed.
However they are quite important for systems running lott of independent namespaces,
that can be restarted many times without host admin assistance.
Each memory leak can be repeated many times and finally it enables OOM-killer
that disables whole node. And nobody understand what's happen.
Such kind of checks allows to be sure that net namespace exit was clear and leaked nothing.
> If you want to debug network namespaces, I have a feeling that the network
> namespace code is a better place to do so than individual protocol stacks.
Common network namespace code knows nothing about specific of each individual driver/subsystem.
I do not understand how it's possible to do it in common netns code.
Thank you,
Vasily Averin
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v4 11/18] nfnetlink_log: exit_net cleanup check added
2017-11-12 8:46 ` [PATCH v4 11/18] nfnetlink_log: " Vasily Averin
2017-11-12 8:53 ` Florian Westphal
@ 2017-11-12 11:28 ` Sergei Shtylyov
1 sibling, 0 replies; 122+ messages in thread
From: Sergei Shtylyov @ 2017-11-12 11:28 UTC (permalink / raw)
To: Vasily Averin, netdev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam
Hello!
On 11/12/2017 11:46 AM, Vasily Averin wrote:
> Be sure that instance_table array initialized in net_init hook
> was return to initial state.
>
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> net/netfilter/nfnetlink_log.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
> index cad6498..80236a2 100644
> --- a/net/netfilter/nfnetlink_log.c
> +++ b/net/netfilter/nfnetlink_log.c
> @@ -1093,10 +1093,15 @@ static int __net_init nfnl_log_net_init(struct net *net)
>
> static void __net_exit nfnl_log_net_exit(struct net *net)
> {
> + unsigned int i;
> + struct nfnl_log_net *log = nfnl_log_pernet(net);
Need empty line after the declarations.
> #ifdef CONFIG_PROC_FS
> remove_proc_entry("nfnetlink_log", net->nf.proc_netfilter);
> #endif
> nf_log_unset(net, &nfulnl_logger);
> + for (i = 0; i < INSTANCE_BUCKETS; i++)
> + if (WARN_ON_ONCE(!hlist_empty(&log->instance_table[i])))
> + break;
> }
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v5 0/5] netfilter: exit_net checks for objects initialized in net_init hook
2017-11-12 8:39 ` Vasily Averin
(?)
@ 2017-11-12 11:32 ` Vasily Averin
2017-11-12 11:44 ` Florian Westphal
2017-11-13 12:55 ` Pablo Neira Ayuso
-1 siblings, 2 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 11:32 UTC (permalink / raw)
To: netfilter-devel
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal, coreteam
OpenVz kernel team have a long history of fighting against namespace-related bugs,
some of them could be excluded by using simple checks described below.
One of typical errors is related to live cycle of namespaces:
usually objects created for some namespace should not live longer than namespace itself.
Such kind of issues can be invisible on usual systems where additional namespaces
are not used, because initial namespaces usually lives forever and never destroyed.
However in systems with namespaces it can lead to memory leaks or to use-after-free.
Both of them are critical for systems with running containers.
As you knows it's quite hard to find the reason of such issues,
especially in rarely-triggered scenarios on production nodes on default kernels
without specially enabled debug settings. Any additional hints can be useful here.
This patch set should help to detect some of these issues.
It is based on assumption that objects initialized in init hook of pernet_operations
should return to initial state until end of exit hook.
Many drivers and subsystems already have such checks, however I've found number
of places where list_empty check would be useful at least as smoke test.
These checks are useful for long-term stable kernels,
they allows to detect problems related to incomplete or incorrectly
backported patches.
Changes:
v5:
- fixed nit pointed by Florian Westphal
- netfilter patches are send separately to netfilter-devel@
v4:
- excluded grace and lockd patches taken by Bruce Fields
- let's use WARN_ON_ONCE without any extra messages
adobriyan@ is right, output of net Id gives nothing to host admin,
and developers in any case will extract information from core dump
- updated description in cover letter
- dropped nfs4blocklayout patch: waitqueue check does not look useful
- patches was reordered to be per-subsystem grouped
- cover letter should be sent to all people included into cc: of any patches
- minor cosmetic changes in some patches
v3:
- use net->ns.inum as net Id
- removed patches for hashlimit and recent,
they handle tables list in exit_net hook.
- added patches for grace and lockd
v2:
- net pointer removed from output
- fixed compilation for phonet driver
Vasily Averin (5):
clusterip: exit_net cleanup check added
nf_tables: exit_net cleanup check added
nfnetlink_log: exit_net cleanup check added
nfnetlink_gueue: exit_net cleanup check added
x_tables: exit_net cleanup check added
net/ipv4/netfilter/ipt_CLUSTERIP.c | 1 +
net/netfilter/nf_tables_api.c | 7 +++++++
net/netfilter/nfnetlink_log.c | 4 ++++
net/netfilter/nfnetlink_queue.c | 5 +++++
net/netfilter/x_tables.c | 9 +++++++++
5 files changed, 26 insertions(+)
--
2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v5 1/5] clusterip: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
(?)
(?)
@ 2017-11-12 11:32 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 11:32 UTC (permalink / raw)
To: netfilter-devel
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
Hideaki YOSHIFUJI, coreteam
Be sure that configs list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/ipv4/netfilter/ipt_CLUSTERIP.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 17b4ca5..e35b8d0 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -819,6 +819,7 @@ static void clusterip_net_exit(struct net *net)
cn->procdir = NULL;
#endif
nf_unregister_net_hook(net, &cip_arp_ops);
+ WARN_ON_ONCE(!list_empty(&cn->configs));
}
static struct pernet_operations clusterip_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 2/5] nf_tables: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (2 preceding siblings ...)
(?)
@ 2017-11-12 11:33 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 11:33 UTC (permalink / raw)
To: netfilter-devel
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal, coreteam
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/nf_tables_api.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 64e1ee0..f432b53 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -5778,6 +5778,12 @@ static int __net_init nf_tables_init_net(struct net *net)
return 0;
}
+static void __net_exit nf_tables_exit_net(struct net *net)
+{
+ WARN_ON_ONCE(!list_empty(&net->nft.af_info));
+ WARN_ON_ONCE(!list_empty(&net->nft.commit_list));
+}
+
int __nft_release_basechain(struct nft_ctx *ctx)
{
struct nft_rule *rule, *nr;
@@ -5848,6 +5854,7 @@ static void __nft_release_afinfo(struct net *net, struct nft_af_info *afi)
static struct pernet_operations nf_tables_net_ops = {
.init = nf_tables_init_net,
+ .exit = nf_tables_exit_net,
};
static int __init nf_tables_module_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 3/5] nfnetlink_log: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (3 preceding siblings ...)
(?)
@ 2017-11-12 11:33 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 11:33 UTC (permalink / raw)
To: netfilter-devel
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal, coreteam
Be sure that instance_table array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Acked-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nfnetlink_log.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index cad6498..23d75b1 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -1093,10 +1093,14 @@ static int __net_init nfnl_log_net_init(struct net *net)
static void __net_exit nfnl_log_net_exit(struct net *net)
{
+ unsigned int i;
+ struct nfnl_log_net *log = nfnl_log_pernet(net);
#ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_log", net->nf.proc_netfilter);
#endif
nf_log_unset(net, &nfulnl_logger);
+ for (i = 0; i < INSTANCE_BUCKETS; i++)
+ WARN_ON_ONCE(!hlist_empty(&log->instance_table[i]));
}
static struct pernet_operations nfnl_log_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 4/5] nfnetlink_gueue: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (4 preceding siblings ...)
(?)
@ 2017-11-12 11:34 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 11:34 UTC (permalink / raw)
To: netfilter-devel
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal, coreteam
Be sure that instance_table array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Acked-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nfnetlink_queue.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index c979662..3cae6d8 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1512,10 +1512,15 @@ static int __net_init nfnl_queue_net_init(struct net *net)
static void __net_exit nfnl_queue_net_exit(struct net *net)
{
+ unsigned int i;
+ struct nfnl_queue_net *q = nfnl_queue_pernet(net);
+
nf_unregister_queue_handler(net);
#ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter);
#endif
+ for (i = 0; i < INSTANCE_BUCKETS; i++)
+ WARN_ON_ONCE(!hlist_empty(&q->instance_table[i]));
}
static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 5/5] x_tables: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (5 preceding siblings ...)
(?)
@ 2017-11-12 11:35 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 11:35 UTC (permalink / raw)
To: netfilter-devel
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal, coreteam
Be sure that xt.tables array initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/netfilter/x_tables.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index d8571f4..02c1abb 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1714,8 +1714,17 @@ static int __net_init xt_net_init(struct net *net)
return 0;
}
+static void __net_exit xt_net_exit(struct net *net)
+{
+ int i;
+
+ for (i = 0; i < NFPROTO_NUMPROTO; i++)
+ WARN_ON_ONCE(!list_empty(&net->xt.tables[i]));
+}
+
static struct pernet_operations xt_net_ops = {
.init = xt_net_init,
+ .exit = xt_net_exit,
};
static int __init xt_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH v5 0/5] netfilter: exit_net checks for objects initialized in net_init hook
2017-11-12 11:32 ` [PATCH v5 0/5] netfilter: " Vasily Averin
@ 2017-11-12 11:44 ` Florian Westphal
2017-11-13 12:55 ` Pablo Neira Ayuso
1 sibling, 0 replies; 122+ messages in thread
From: Florian Westphal @ 2017-11-12 11:44 UTC (permalink / raw)
To: Vasily Averin
Cc: netfilter-devel, Pablo Neira Ayuso, Jozsef Kadlecsik,
Florian Westphal, coreteam
Vasily Averin <vvs@virtuozzo.com> wrote:
> OpenVz kernel team have a long history of fighting against namespace-related bugs,
> some of them could be excluded by using simple checks described below.
>
> One of typical errors is related to live cycle of namespaces:
> usually objects created for some namespace should not live longer than namespace itself.
These changes look good to me, thank you.
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v4 00/18] exit_net checks for objects initialized in net_init hook
2017-11-12 8:39 ` Vasily Averin
` (6 preceding siblings ...)
(?)
@ 2017-11-12 15:06 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 15:06 UTC (permalink / raw)
To: Linux Kernel Network Developers
On 2017-11-12 11:39, Vasily Averin wrote:
> clusterip: exit_net cleanup check added
> nf_tables: exit_net cleanup check added
> nfnetlink_log: exit_net cleanup check added
> nfnetlink_gueue: exit_net cleanup check added
> x_tables: exit_net cleanup check added
netfilter-related patches was sent separately to netfilter-devel@ mailing list
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v5 00/13] exit_net checks for objects initialized in net_init hook
2017-11-12 8:39 ` Vasily Averin
@ 2017-11-12 19:26 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:26 UTC (permalink / raw)
To: netdev
Cc: Steffen Klassert, linux-nfs, Trond Myklebust, Anna Schumaker,
Remi Denis-Courmont, linux-ppp, Paul Mackerras, Herbert Xu,
Hideaki YOSHIFUJI
OpenVz kernel team have a long history of fighting against namespace-related bugs,
some of them could be prevented by using simple checks described below.
One of typical errors is related to live cycle of namespaces:
usually objects created for some namespace should not live longer than namespace itself.
Such kind of issues can be invisible on usual systems where additional namespaces
are not used, because initial namespaces usually lives forever and never destroyed.
However in systems with namespaces it can lead to memory leaks or to use-after-free.
Both of them are critical for systems with running containers.
As you knows it's quite hard to find the reason of such issues,
especially in rarely-triggered scenarios on production nodes on default kernels
without specially enabled debug settings. Any additional hints can be useful here.
This patch set should help to detect some of these issues.
It is based on assumption that objects initialized in init hook of pernet_operations
should return to initial state until end of exit hook.
Many drivers and subsystems already have such checks, however I've found number
of places where list_empty check would be useful at least as smoke test.
These checks are useful for long-term stable kernels,
they allows to detect problems related to incomplete or incorrectly
backported patches.
Changes:
v5:
- fixed nit pointed by Florian Westphal
- netfilter patches are send separately to netfilter-devel@
v4:
- excluded grace and lockd patches taken by Bruce Fields
- let's use WARN_ON_ONCE without any extra messages
adobriyan@ is right, output of net Id gives nothing to host admin,
and developers in any case will extract information from core dump
- updated description in cover letter
- dropped nfs4blocklayout patch: waitqueue check does not look useful
- patches was reordered to be per-subsystem grouped
- cover letter should be sent to all people included into cc: of any patches
- minor cosmetic changes in some patches
v3:
- use net->ns.inum as net Id
- removed patches for hashlimit and recent,
they handle tables list in exit_net hook.
- added patches for grace and lockd
v2:
- net pointer removed from output
- fixed compilation for phonet driver
Vasily Averin (13):
af_key: replace BUG_ON on WARN_ON in net_exit hook
geneve: exit_net cleanup check added
packet: exit_net cleanup check added
vxlan: exit_net cleanup checks added
netdev: exit_net cleanup check added
fib_notifier: exit_net cleanup check added
fib_rules: exit_net cleanup check added
l2tp: exit_net cleanup check added
nfs client: exit_net cleanup check added
sunrpc: exit_net cleanup check added
phonet: exit_net cleanup check added
ppp: exit_net cleanup checks added
xfrm6_tunnel: exit_net cleanup check added
drivers/net/geneve.c | 1 +
drivers/net/ppp/ppp_generic.c | 2 ++
drivers/net/vxlan.c | 4 ++++
fs/nfs/inode.c | 4 ++++
net/core/dev.c | 2 ++
net/core/fib_notifier.c | 6 ++++++
net/core/fib_rules.c | 6 ++++++
net/ipv6/xfrm6_tunnel.c | 8 ++++++++
net/key/af_key.c | 2 +-
net/l2tp/l2tp_core.c | 4 ++++
net/packet/af_packet.c | 1 +
net/phonet/pn_dev.c | 3 +++
net/sunrpc/sunrpc_syms.c | 3 +++
13 files changed, 45 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v5 00/13] exit_net checks for objects initialized in net_init hook
@ 2017-11-12 19:26 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:26 UTC (permalink / raw)
To: netdev
Cc: Steffen Klassert, linux-nfs, Trond Myklebust, Anna Schumaker,
Remi Denis-Courmont, linux-ppp, Paul Mackerras, Herbert Xu,
Hideaki YOSHIFUJI
OpenVz kernel team have a long history of fighting against namespace-related bugs,
some of them could be prevented by using simple checks described below.
One of typical errors is related to live cycle of namespaces:
usually objects created for some namespace should not live longer than namespace itself.
Such kind of issues can be invisible on usual systems where additional namespaces
are not used, because initial namespaces usually lives forever and never destroyed.
However in systems with namespaces it can lead to memory leaks or to use-after-free.
Both of them are critical for systems with running containers.
As you knows it's quite hard to find the reason of such issues,
especially in rarely-triggered scenarios on production nodes on default kernels
without specially enabled debug settings. Any additional hints can be useful here.
This patch set should help to detect some of these issues.
It is based on assumption that objects initialized in init hook of pernet_operations
should return to initial state until end of exit hook.
Many drivers and subsystems already have such checks, however I've found number
of places where list_empty check would be useful at least as smoke test.
These checks are useful for long-term stable kernels,
they allows to detect problems related to incomplete or incorrectly
backported patches.
Changes:
v5:
- fixed nit pointed by Florian Westphal
- netfilter patches are send separately to netfilter-devel@
v4:
- excluded grace and lockd patches taken by Bruce Fields
- let's use WARN_ON_ONCE without any extra messages
adobriyan@ is right, output of net Id gives nothing to host admin,
and developers in any case will extract information from core dump
- updated description in cover letter
- dropped nfs4blocklayout patch: waitqueue check does not look useful
- patches was reordered to be per-subsystem grouped
- cover letter should be sent to all people included into cc: of any patches
- minor cosmetic changes in some patches
v3:
- use net->ns.inum as net Id
- removed patches for hashlimit and recent,
they handle tables list in exit_net hook.
- added patches for grace and lockd
v2:
- net pointer removed from output
- fixed compilation for phonet driver
Vasily Averin (13):
af_key: replace BUG_ON on WARN_ON in net_exit hook
geneve: exit_net cleanup check added
packet: exit_net cleanup check added
vxlan: exit_net cleanup checks added
netdev: exit_net cleanup check added
fib_notifier: exit_net cleanup check added
fib_rules: exit_net cleanup check added
l2tp: exit_net cleanup check added
nfs client: exit_net cleanup check added
sunrpc: exit_net cleanup check added
phonet: exit_net cleanup check added
ppp: exit_net cleanup checks added
xfrm6_tunnel: exit_net cleanup check added
drivers/net/geneve.c | 1 +
drivers/net/ppp/ppp_generic.c | 2 ++
drivers/net/vxlan.c | 4 ++++
fs/nfs/inode.c | 4 ++++
net/core/dev.c | 2 ++
net/core/fib_notifier.c | 6 ++++++
net/core/fib_rules.c | 6 ++++++
net/ipv6/xfrm6_tunnel.c | 8 ++++++++
net/key/af_key.c | 2 +-
net/l2tp/l2tp_core.c | 4 ++++
net/packet/af_packet.c | 1 +
net/phonet/pn_dev.c | 3 +++
net/sunrpc/sunrpc_syms.c | 3 +++
13 files changed, 45 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH v5 01/13] af_key: replace BUG_ON on WARN_ON in net_exit hook
2017-11-12 8:39 ` Vasily Averin
` (8 preceding siblings ...)
(?)
@ 2017-11-12 19:26 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:26 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert, Herbert Xu
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/key/af_key.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index a00d607..3dffb89 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3845,7 +3845,7 @@ static void __net_exit pfkey_net_exit(struct net *net)
struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id);
pfkey_exit_proc(net);
- BUG_ON(!hlist_empty(&net_pfkey->table));
+ WARN_ON(!hlist_empty(&net_pfkey->table));
}
static struct pernet_operations pfkey_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 02/13] geneve: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (9 preceding siblings ...)
(?)
@ 2017-11-12 19:27 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:27 UTC (permalink / raw)
To: netdev
Be sure that sock_list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/geneve.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index f640407..6bc5721 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1673,6 +1673,7 @@ static void __net_exit geneve_exit_net(struct net *net)
/* unregister the devices gathered above */
unregister_netdevice_many(&list);
rtnl_unlock();
+ WARN_ON_ONCE(!list_empty(&gn->sock_list));
}
static struct pernet_operations geneve_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 03/13] packet: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (10 preceding siblings ...)
(?)
@ 2017-11-12 19:27 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:27 UTC (permalink / raw)
To: netdev
Be sure that packet.sklist initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/packet/af_packet.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index bec01a3..4b58c4a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4562,6 +4562,7 @@ static int __net_init packet_net_init(struct net *net)
static void __net_exit packet_net_exit(struct net *net)
{
remove_proc_entry("packet", net->proc_net);
+ WARN_ON_ONCE(!hlist_empty(&net->packet.sklist));
}
static struct pernet_operations packet_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 04/13] vxlan: exit_net cleanup checks added
2017-11-12 8:39 ` Vasily Averin
` (11 preceding siblings ...)
(?)
@ 2017-11-12 19:28 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:28 UTC (permalink / raw)
To: netdev
Be sure that sock_list array initialized in net_init hook was return
to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/vxlan.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf..c02d856 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3704,6 +3704,7 @@ static void __net_exit vxlan_exit_net(struct net *net)
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
struct vxlan_dev *vxlan, *next;
struct net_device *dev, *aux;
+ unsigned int h;
LIST_HEAD(list);
rtnl_lock();
@@ -3723,6 +3724,9 @@ static void __net_exit vxlan_exit_net(struct net *net)
unregister_netdevice_many(&list);
rtnl_unlock();
+
+ for (h = 0; h < PORT_HASH_SIZE; ++h)
+ WARN_ON_ONCE(!hlist_empty(&vn->sock_list[h]));
}
static struct pernet_operations vxlan_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 05/13] netdev: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (12 preceding siblings ...)
(?)
@ 2017-11-12 19:28 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:28 UTC (permalink / raw)
To: netdev
Be sure that dev_base_head list initialized in net_init hook was return
to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/dev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 588b473..56fece7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8562,6 +8562,8 @@ static void __net_exit netdev_exit(struct net *net)
{
kfree(net->dev_name_head);
kfree(net->dev_index_head);
+ if (net != &init_net)
+ WARN_ON_ONCE(!list_empty(&net->dev_base_head));
}
static struct pernet_operations __net_initdata netdev_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 06/13] fib_notifier: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (13 preceding siblings ...)
(?)
@ 2017-11-12 19:29 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:29 UTC (permalink / raw)
To: netdev
Be sure that fib_notifier_ops list initilized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/fib_notifier.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/fib_notifier.c b/net/core/fib_notifier.c
index 4fc202d..6b8cd49 100644
--- a/net/core/fib_notifier.c
+++ b/net/core/fib_notifier.c
@@ -161,8 +161,14 @@ static int __net_init fib_notifier_net_init(struct net *net)
return 0;
}
+static void __net_exit fib_notifier_net_exit(struct net *net)
+{
+ WARN_ON_ONCE(!list_empty(&net->fib_notifier_ops));
+}
+
static struct pernet_operations fib_notifier_net_ops = {
.init = fib_notifier_net_init,
+ .exit = fib_notifier_net_exit,
};
static int __init fib_notifier_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 07/13] fib_rules: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (14 preceding siblings ...)
(?)
@ 2017-11-12 19:30 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:30 UTC (permalink / raw)
To: netdev
Be sure that rules_ops list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/core/fib_rules.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 9a6d97c..c029192 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -1019,8 +1019,14 @@ static int __net_init fib_rules_net_init(struct net *net)
return 0;
}
+static void __net_exit fib_rules_net_exit(struct net *net)
+{
+ WARN_ON_ONCE(!list_empty(&net->rules_ops));
+}
+
static struct pernet_operations fib_rules_net_ops = {
.init = fib_rules_net_init,
+ .exit = fib_rules_net_exit,
};
static int __init fib_rules_init(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 08/13] l2tp: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (15 preceding siblings ...)
(?)
@ 2017-11-12 19:30 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:30 UTC (permalink / raw)
To: netdev
Be sure that l2tp_session_hlist array initialized in net_init hook
was return to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/l2tp/l2tp_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 02d6110..fabc404 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1888,6 +1888,7 @@ static __net_exit void l2tp_exit_net(struct net *net)
{
struct l2tp_net *pn = l2tp_pernet(net);
struct l2tp_tunnel *tunnel = NULL;
+ int hash;
rcu_read_lock_bh();
list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
@@ -1897,6 +1898,9 @@ static __net_exit void l2tp_exit_net(struct net *net)
flush_workqueue(l2tp_wq);
rcu_barrier();
+
+ for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
+ WARN_ON_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash]));
}
static struct pernet_operations l2tp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 09/13] nfs client: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
@ 2017-11-12 19:31 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:31 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust, Anna Schumaker
Be sure that nfs_client_list and nfs_volume_list lists initialized
in net_init hook were return to initial state in net_exit hook.
Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
---
fs/nfs/inode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 134d9f5..4ef515f 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -2084,8 +2084,12 @@ static int nfs_net_init(struct net *net)
static void nfs_net_exit(struct net *net)
{
+ struct nfs_net *nn = net_generic(net, nfs_net_id);
+
nfs_fs_proc_net_exit(net);
nfs_cleanup_cb_ident_idr(net);
+ WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
+ WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
}
static struct pernet_operations nfs_net_ops = {
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 09/13] nfs client: exit_net cleanup check added
@ 2017-11-12 19:31 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:31 UTC (permalink / raw)
To: netdev; +Cc: linux-nfs, Trond Myklebust, Anna Schumaker
Be sure that nfs_client_list and nfs_volume_list lists initialized
in net_init hook were return to initial state in net_exit hook.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/nfs/inode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 134d9f5..4ef515f 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -2084,8 +2084,12 @@ static int nfs_net_init(struct net *net)
static void nfs_net_exit(struct net *net)
{
+ struct nfs_net *nn = net_generic(net, nfs_net_id);
+
nfs_fs_proc_net_exit(net);
nfs_cleanup_cb_ident_idr(net);
+ WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
+ WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
}
static struct pernet_operations nfs_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 10/13] sunrpc: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
@ 2017-11-12 19:32 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:32 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust, Anna Schumaker
Be sure that all_clients list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
---
net/sunrpc/sunrpc_syms.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index c73de18..56f9eff 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -65,10 +65,13 @@ static __net_init int sunrpc_init_net(struct net *net)
static __net_exit void sunrpc_exit_net(struct net *net)
{
+ struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
rpc_pipefs_exit_net(net);
unix_gid_cache_destroy(net);
ip_map_cache_destroy(net);
rpc_proc_exit(net);
+ WARN_ON_ONCE(!list_empty(&sn->all_clients));
}
static struct pernet_operations sunrpc_net_ops = {
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 10/13] sunrpc: exit_net cleanup check added
@ 2017-11-12 19:32 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:32 UTC (permalink / raw)
To: netdev; +Cc: linux-nfs, Trond Myklebust, Anna Schumaker
Be sure that all_clients list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/sunrpc/sunrpc_syms.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index c73de18..56f9eff 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -65,10 +65,13 @@ static __net_init int sunrpc_init_net(struct net *net)
static __net_exit void sunrpc_exit_net(struct net *net)
{
+ struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
rpc_pipefs_exit_net(net);
unix_gid_cache_destroy(net);
ip_map_cache_destroy(net);
rpc_proc_exit(net);
+ WARN_ON_ONCE(!list_empty(&sn->all_clients));
}
static struct pernet_operations sunrpc_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 11/13] phonet: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (17 preceding siblings ...)
(?)
@ 2017-11-12 19:32 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:32 UTC (permalink / raw)
To: netdev; +Cc: Remi Denis-Courmont
Be sure that pndevs.list initialized in net_init hook was return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/phonet/pn_dev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 2cb4c5d..7778751 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -331,7 +331,10 @@ static int __net_init phonet_init_net(struct net *net)
static void __net_exit phonet_exit_net(struct net *net)
{
+ struct phonet_net *pnn = phonet_pernet(net);
+
remove_proc_entry("phonet", net->proc_net);
+ WARN_ON_ONCE(!list_empty(&pnn->pndevs.list));
}
static struct pernet_operations phonet_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 12/13] ppp: exit_net cleanup checks added
2017-11-12 8:39 ` Vasily Averin
@ 2017-11-12 19:33 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:33 UTC (permalink / raw)
To: netdev; +Cc: linux-ppp, Paul Mackerras
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/ppp/ppp_generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e365866..30744ce 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -960,6 +960,8 @@ static __net_exit void ppp_exit_net(struct net *net)
rtnl_unlock();
idr_destroy(&pn->units_idr);
+ WARN_ON_ONCE(!list_empty(&pn->all_channels));
+ WARN_ON_ONCE(!list_empty(&pn->new_channels));
}
static struct pernet_operations ppp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 12/13] ppp: exit_net cleanup checks added
@ 2017-11-12 19:33 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:33 UTC (permalink / raw)
To: netdev; +Cc: linux-ppp, Paul Mackerras
Be sure that lists initialized in net_init hook were return
to initial state.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
drivers/net/ppp/ppp_generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e365866..30744ce 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -960,6 +960,8 @@ static __net_exit void ppp_exit_net(struct net *net)
rtnl_unlock();
idr_destroy(&pn->units_idr);
+ WARN_ON_ONCE(!list_empty(&pn->all_channels));
+ WARN_ON_ONCE(!list_empty(&pn->new_channels));
}
static struct pernet_operations ppp_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH v5 13/13] xfrm6_tunnel: exit_net cleanup check added
2017-11-12 8:39 ` Vasily Averin
` (19 preceding siblings ...)
(?)
@ 2017-11-12 19:34 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-12 19:34 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert, Herbert Xu, Hideaki YOSHIFUJI
Be sure that spi_byaddr and spi_byspi arrays initialized in net_init hook
were return to initial state
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
net/ipv6/xfrm6_tunnel.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 4e438bc..f85f0d7 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -338,6 +338,14 @@ static int __net_init xfrm6_tunnel_net_init(struct net *net)
static void __net_exit xfrm6_tunnel_net_exit(struct net *net)
{
+ struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
+ unsigned int i;
+
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
+ WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i]));
+
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYSPI_HSIZE; i++)
+ WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byspi[i]));
}
static struct pernet_operations xfrm6_tunnel_net_ops = {
--
2.7.4
^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH v5 0/5] netfilter: exit_net checks for objects initialized in net_init hook
2017-11-12 11:32 ` [PATCH v5 0/5] netfilter: " Vasily Averin
2017-11-12 11:44 ` Florian Westphal
@ 2017-11-13 12:55 ` Pablo Neira Ayuso
1 sibling, 0 replies; 122+ messages in thread
From: Pablo Neira Ayuso @ 2017-11-13 12:55 UTC (permalink / raw)
To: Vasily Averin
Cc: netfilter-devel, Jozsef Kadlecsik, Florian Westphal, coreteam
Hi Vasily,
On Sun, Nov 12, 2017 at 02:32:14PM +0300, Vasily Averin wrote:
> OpenVz kernel team have a long history of fighting against namespace-related bugs,
> some of them could be excluded by using simple checks described below.
I'm folding this series into one single patch, description looks like
this:
netfilter: exit_net cleanup check added
Be sure that lists initialized in net_init hook was return to initial
state.
I understand your goal is to make it easier for review, but given this
is all part of the same logic change, I just hope you don't mind I
have squashed them into one single patch like I did.
Thanks.
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v5 00/13] exit_net checks for objects initialized in net_init hook
2017-11-12 19:26 ` Vasily Averin
@ 2017-11-14 6:47 ` David Miller
-1 siblings, 0 replies; 122+ messages in thread
From: David Miller @ 2017-11-14 6:47 UTC (permalink / raw)
To: vvs
Cc: netdev, steffen.klassert, linux-nfs, trond.myklebust,
anna.schumaker, courmisch, linux-ppp, paulus, herbert, yoshfuji
From: Vasily Averin <vvs@virtuozzo.com>
Date: Sun, 12 Nov 2017 22:26:44 +0300
> OpenVz kernel team have a long history of fighting against namespace-related bugs,
> some of them could be prevented by using simple checks described below.
>
> One of typical errors is related to live cycle of namespaces:
> usually objects created for some namespace should not live longer than namespace itself.
>
> Such kind of issues can be invisible on usual systems where additional namespaces
> are not used, because initial namespaces usually lives forever and never destroyed.
>
> However in systems with namespaces it can lead to memory leaks or to use-after-free.
> Both of them are critical for systems with running containers.
> As you knows it's quite hard to find the reason of such issues,
> especially in rarely-triggered scenarios on production nodes on default kernels
> without specially enabled debug settings. Any additional hints can be useful here.
>
> This patch set should help to detect some of these issues.
> It is based on assumption that objects initialized in init hook of pernet_operations
> should return to initial state until end of exit hook.
>
> Many drivers and subsystems already have such checks, however I've found number
> of places where list_empty check would be useful at least as smoke test.
>
> These checks are useful for long-term stable kernels,
> they allows to detect problems related to incomplete or incorrectly
> backported patches.
All applied to net-next except patch #9 and #10 which need to go via the
NFS maintainer.
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v5 00/13] exit_net checks for objects initialized in net_init hook
@ 2017-11-14 6:47 ` David Miller
0 siblings, 0 replies; 122+ messages in thread
From: David Miller @ 2017-11-14 6:47 UTC (permalink / raw)
To: vvs
Cc: netdev, steffen.klassert, linux-nfs, trond.myklebust,
anna.schumaker, courmisch, linux-ppp, paulus, herbert, yoshfuji
From: Vasily Averin <vvs@virtuozzo.com>
Date: Sun, 12 Nov 2017 22:26:44 +0300
> OpenVz kernel team have a long history of fighting against namespace-related bugs,
> some of them could be prevented by using simple checks described below.
>
> One of typical errors is related to live cycle of namespaces:
> usually objects created for some namespace should not live longer than namespace itself.
>
> Such kind of issues can be invisible on usual systems where additional namespaces
> are not used, because initial namespaces usually lives forever and never destroyed.
>
> However in systems with namespaces it can lead to memory leaks or to use-after-free.
> Both of them are critical for systems with running containers.
> As you knows it's quite hard to find the reason of such issues,
> especially in rarely-triggered scenarios on production nodes on default kernels
> without specially enabled debug settings. Any additional hints can be useful here.
>
> This patch set should help to detect some of these issues.
> It is based on assumption that objects initialized in init hook of pernet_operations
> should return to initial state until end of exit hook.
>
> Many drivers and subsystems already have such checks, however I've found number
> of places where list_empty check would be useful at least as smoke test.
>
> These checks are useful for long-term stable kernels,
> they allows to detect problems related to incomplete or incorrectly
> backported patches.
All applied to net-next except patch #9 and #10 which need to go via the
NFS maintainer.
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v5 00/13] exit_net checks for objects initialized in net_init hook
2017-11-14 6:47 ` David Miller
@ 2017-11-14 14:41 ` Vasily Averin
-1 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-14 14:41 UTC (permalink / raw)
To: David Miller, anna.schumaker-HgOvQuBEEgTQT0dZR+AlfA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
steffen.klassert-opNxpl+3fjRBDgjK7y7TUQ,
linux-nfs-u79uwXL29TY76Z2rM5mHXA,
trond.myklebust-7I+n7zu2hftEKMMhf/gKZA
On 2017-11-14 09:47, David Miller wrote:
> From: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
> Date: Sun, 12 Nov 2017 22:26:44 +0300
>
>> OpenVz kernel team have a long history of fighting against namespace-related bugs,
>> some of them could be prevented by using simple checks described below.
>>
>> One of typical errors is related to live cycle of namespaces:
>> usually objects created for some namespace should not live longer than namespace itself.
>
> All applied to net-next except patch #9 and #10 which need to go via the
> NFS maintainer.
As far as I see Anna included them into Anna's linux-nfs work git.
Thank you!
Vasily Averin
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH v5 00/13] exit_net checks for objects initialized in net_init hook
@ 2017-11-14 14:41 ` Vasily Averin
0 siblings, 0 replies; 122+ messages in thread
From: Vasily Averin @ 2017-11-14 14:41 UTC (permalink / raw)
To: David Miller, anna.schumaker
Cc: netdev, steffen.klassert, linux-nfs, trond.myklebust
On 2017-11-14 09:47, David Miller wrote:
> From: Vasily Averin <vvs@virtuozzo.com>
> Date: Sun, 12 Nov 2017 22:26:44 +0300
>
>> OpenVz kernel team have a long history of fighting against namespace-related bugs,
>> some of them could be prevented by using simple checks described below.
>>
>> One of typical errors is related to live cycle of namespaces:
>> usually objects created for some namespace should not live longer than namespace itself.
>
> All applied to net-next except patch #9 and #10 which need to go via the
> NFS maintainer.
As far as I see Anna included them into Anna's linux-nfs work git.
Thank you!
Vasily Averin
^ permalink raw reply [flat|nested] 122+ messages in thread
end of thread, other threads:[~2017-11-14 14:41 UTC | newest]
Thread overview: 122+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-05 9:58 [PATCH 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
2017-11-05 16:49 ` [PATCH v2 " Vasily Averin
2017-11-06 13:22 ` [PATCH v3 " Vasily Averin
2017-11-12 8:39 ` [PATCH v4 00/18] " Vasily Averin
2017-11-12 8:39 ` Vasily Averin
2017-11-12 11:32 ` [PATCH v5 0/5] netfilter: " Vasily Averin
2017-11-12 11:44 ` Florian Westphal
2017-11-13 12:55 ` Pablo Neira Ayuso
2017-11-12 11:32 ` [PATCH v5 1/5] clusterip: exit_net cleanup check added Vasily Averin
2017-11-12 11:33 ` [PATCH v5 2/5] nf_tables: " Vasily Averin
2017-11-12 11:33 ` [PATCH v5 3/5] nfnetlink_log: " Vasily Averin
2017-11-12 11:34 ` [PATCH v5 4/5] nfnetlink_gueue: " Vasily Averin
2017-11-12 11:35 ` [PATCH v5 5/5] x_tables: " Vasily Averin
2017-11-12 15:06 ` [PATCH v4 00/18] exit_net checks for objects initialized in net_init hook Vasily Averin
2017-11-12 19:26 ` [PATCH v5 00/13] " Vasily Averin
2017-11-12 19:26 ` Vasily Averin
2017-11-14 6:47 ` David Miller
2017-11-14 6:47 ` David Miller
[not found] ` <20171114.154720.1071922306148362515.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2017-11-14 14:41 ` Vasily Averin
2017-11-14 14:41 ` Vasily Averin
2017-11-12 19:26 ` [PATCH v5 01/13] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
2017-11-12 19:27 ` [PATCH v5 02/13] geneve: exit_net cleanup check added Vasily Averin
2017-11-12 19:27 ` [PATCH v5 03/13] packet: " Vasily Averin
2017-11-12 19:28 ` [PATCH v5 04/13] vxlan: exit_net cleanup checks added Vasily Averin
2017-11-12 19:28 ` [PATCH v5 05/13] netdev: exit_net cleanup check added Vasily Averin
2017-11-12 19:29 ` [PATCH v5 06/13] fib_notifier: " Vasily Averin
2017-11-12 19:30 ` [PATCH v5 07/13] fib_rules: " Vasily Averin
2017-11-12 19:30 ` [PATCH v5 08/13] l2tp: " Vasily Averin
[not found] ` <cb06dace-88a8-fecf-92ad-02920920a0d3-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-11-12 19:31 ` [PATCH v5 09/13] nfs client: " Vasily Averin
2017-11-12 19:31 ` Vasily Averin
2017-11-12 19:32 ` [PATCH v5 10/13] sunrpc: " Vasily Averin
2017-11-12 19:32 ` Vasily Averin
2017-11-12 19:32 ` [PATCH v5 11/13] phonet: " Vasily Averin
2017-11-12 19:33 ` [PATCH v5 12/13] ppp: exit_net cleanup checks added Vasily Averin
2017-11-12 19:33 ` Vasily Averin
2017-11-12 19:34 ` [PATCH v5 13/13] xfrm6_tunnel: exit_net cleanup check added Vasily Averin
2017-11-12 8:39 ` [PATCH v4 01/18] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
2017-11-12 8:40 ` [PATCH v4 02/18] geneve: exit_net cleanup check added Vasily Averin
2017-11-12 8:41 ` [PATCH v4 03/18] packet: " Vasily Averin
2017-11-12 8:42 ` [PATCH v4 04/18] vxlan: exit_net cleanup checks added Vasily Averin
2017-11-12 8:42 ` [PATCH v4 05/18] netdev: exit_net cleanup check added Vasily Averin
2017-11-12 8:42 ` [PATCH v4 06/18] fib_notifier: " Vasily Averin
2017-11-12 8:43 ` [PATCH v4 07/18] fib_rules: " Vasily Averin
2017-11-12 8:44 ` [PATCH v4 08/18] l2tp: " Vasily Averin
2017-11-12 8:44 ` [PATCH v4 09/18] clusterip: " Vasily Averin
2017-11-12 8:45 ` [PATCH v4 10/18] nf_tables: " Vasily Averin
2017-11-12 8:46 ` [PATCH v4 11/18] nfnetlink_log: " Vasily Averin
2017-11-12 8:53 ` Florian Westphal
2017-11-12 11:28 ` Sergei Shtylyov
2017-11-12 8:47 ` [PATCH v4 12/18] nfnetlink_gueue: " Vasily Averin
2017-11-12 8:52 ` Florian Westphal
2017-11-12 9:02 ` Vasily Averin
2017-11-12 8:47 ` [PATCH v4 13/18] x_tables: " Vasily Averin
[not found] ` <9dfa013e-9098-e155-9c47-a73753338288-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-11-12 8:48 ` [PATCH v4 14/18] nfs client: " Vasily Averin
2017-11-12 8:48 ` Vasily Averin
2017-11-12 8:48 ` [PATCH v4 15/18] sunrpc: " Vasily Averin
2017-11-12 8:48 ` Vasily Averin
2017-11-12 8:49 ` [PATCH v4 16/18] phonet: " Vasily Averin
2017-11-12 8:50 ` [PATCH v4 17/18] ppp: exit_net cleanup checks added Vasily Averin
2017-11-12 8:50 ` Vasily Averin
2017-11-12 8:51 ` [PATCH v4 18/18] xfrm6_tunnel: exit_net cleanup check added Vasily Averin
[not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-11-06 13:22 ` [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook Vasily Averin
2017-11-06 13:22 ` Vasily Averin
2017-11-06 20:02 ` J. Bruce Fields
[not found] ` <a059abdd-e727-adcb-7b43-976be1d0a08e-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-11-09 15:06 ` J. Bruce Fields
2017-11-09 15:06 ` J. Bruce Fields
2017-11-06 13:24 ` [PATCH v3 07/21] nfs4blocklayout: exit_net cleanup check added Vasily Averin
2017-11-06 13:24 ` Vasily Averin
2017-11-06 13:23 ` [PATCH v3 02/21] lockd: added cleanup checks in exit_net hook Vasily Averin
2017-11-09 15:06 ` J. Bruce Fields
2017-11-06 13:23 ` [PATCH v3 03/21] exit_net cleanup: geneve sock_list check Vasily Averin
2017-11-06 13:23 ` [PATCH v3 04/21] ppp: exit_net cleanup checks added Vasily Averin
2017-11-06 13:23 ` Vasily Averin
2017-11-06 13:34 ` walter harms
2017-11-06 13:34 ` walter harms
2017-11-06 13:50 ` Vasily Averin
2017-11-06 13:23 ` [PATCH v3 05/21] vxlan: " Vasily Averin
2017-11-06 13:24 ` [PATCH v3 06/21] netdev: exit_net cleanup check added Vasily Averin
2017-11-06 13:24 ` [PATCH v3 08/21] nfs client: " Vasily Averin
2017-11-06 13:24 ` [PATCH v3 09/21] fib_notifier: " Vasily Averin
2017-11-06 13:24 ` [PATCH v3 10/21] fib_rules: " Vasily Averin
2017-11-06 13:24 ` [PATCH v3 11/21] clusterip: " Vasily Averin
2017-11-06 13:40 ` Jozsef Kadlecsik
2017-11-06 13:55 ` Vasily Averin
2017-11-06 13:24 ` [PATCH v3 12/21] xfrm6_tunnel: " Vasily Averin
2017-11-06 13:25 ` [PATCH v3 13/21] af_key: replace BUG_ON on WARN_ONCE in net_exit hook Vasily Averin
2017-11-06 13:25 ` [PATCH v3 14/21] l2tp: exit_net cleanup check added Vasily Averin
2017-11-06 13:25 ` [PATCH v3 15/21] nf_tables: " Vasily Averin
2017-11-06 13:25 ` [PATCH v3 16/21] nfnetlink_log: " Vasily Averin
2017-11-06 13:25 ` [PATCH v3 17/21] nfnetlink_gueue: " Vasily Averin
2017-11-06 13:25 ` [PATCH v3 18/21] x_tables: " Vasily Averin
2017-11-06 13:25 ` [PATCH v3 19/21] packet: " Vasily Averin
2017-11-06 13:25 ` [PATCH v3 20/21] phonet: " Vasily Averin
2017-11-06 19:37 ` Rémi Denis-Courmont
2017-11-12 9:24 ` Vasily Averin
2017-11-06 13:26 ` [PATCH v3 21/21] sunrpc: " Vasily Averin
2017-11-05 16:49 ` [PATCH v2 01/21] exit_net cleanup: geneve sock_list check Vasily Averin
2017-11-07 2:37 ` kbuild test robot
2017-11-05 16:49 ` [PATCH v2 02/21] ppp: exit_net cleanup checks added Vasily Averin
2017-11-05 16:49 ` Vasily Averin
2017-11-05 16:49 ` [PATCH v2 03/21] vxlan: " Vasily Averin
2017-11-05 16:49 ` [PATCH v2 04/21] netdev: exit_net cleanup check added Vasily Averin
2017-11-05 16:49 ` [PATCH v2 05/21] nfs4blocklayout: " Vasily Averin
2017-11-05 16:50 ` [PATCH v2 07/21] fib_notifier: " Vasily Averin
2017-11-05 16:50 ` [PATCH v2 08/21] fib_rules: " Vasily Averin
2017-11-05 16:50 ` [PATCH v2 09/21] clusterip: " Vasily Averin
2017-11-07 2:42 ` kbuild test robot
2017-11-05 16:50 ` [PATCH v2 10/21] xfrm6_tunnel: " Vasily Averin
2017-11-05 16:50 ` [PATCH v2 11/21] af_key: replace BUG_ON on WARN_ON in net_exit hook Vasily Averin
2017-11-05 16:50 ` [PATCH v2 12/21] l2tp: exit_net cleanup check added Vasily Averin
2017-11-05 16:50 ` [PATCH v2 13/21] nf_tables: " Vasily Averin
2017-11-05 16:51 ` [PATCH v2 14/21] nfnetlink_log: " Vasily Averin
2017-11-05 16:51 ` [PATCH v2 15/21] nfnetlink_gueue: " Vasily Averin
2017-11-05 16:51 ` [PATCH v2 16/21] x_tables: " Vasily Averin
2017-11-05 16:51 ` [PATCH v2 17/21] hashlimit: " Vasily Averin
2017-11-05 16:51 ` [PATCH v2 18/21] recent: " Vasily Averin
2017-11-05 16:51 ` [PATCH v2 19/21] packet: " Vasily Averin
2017-11-05 16:51 ` [PATCH v2 20/21] phonet: " Vasily Averin
[not found] ` <bafb347d-e36e-8b2b-7646-afc458a7a32a-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-11-05 16:50 ` [PATCH v2 06/21] nfs client: " Vasily Averin
2017-11-05 16:50 ` Vasily Averin
2017-11-05 16:52 ` [PATCH v2 21/21] sunrpc: " Vasily Averin
2017-11-05 16:52 ` Vasily Averin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.