netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 09/21] clusterip: exit_net cleanup check added
       [not found] <bafb347d-e36e-8b2b-7646-afc458a7a32a@virtuozzo.com>
@ 2017-11-05 16:50 ` Vasily Averin
  2017-11-07  2:42   ` kbuild test robot
  2017-11-05 16:50 ` [PATCH v2 13/21] nf_tables: " Vasily Averin
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 8+ 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] 8+ messages in thread

* [PATCH v2 13/21] nf_tables: exit_net cleanup check added
       [not found] <bafb347d-e36e-8b2b-7646-afc458a7a32a@virtuozzo.com>
  2017-11-05 16:50 ` [PATCH v2 09/21] clusterip: 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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ 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] 8+ messages in thread

* [PATCH v2 14/21] nfnetlink_log: exit_net cleanup check added
       [not found] <bafb347d-e36e-8b2b-7646-afc458a7a32a@virtuozzo.com>
  2017-11-05 16:50 ` [PATCH v2 09/21] clusterip: 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 ` Vasily Averin
  2017-11-05 16:51 ` [PATCH v2 15/21] nfnetlink_gueue: " Vasily Averin
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ 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] 8+ messages in thread

* [PATCH v2 15/21] nfnetlink_gueue: exit_net cleanup check added
       [not found] <bafb347d-e36e-8b2b-7646-afc458a7a32a@virtuozzo.com>
                   ` (2 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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ 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] 8+ messages in thread

* [PATCH v2 16/21] x_tables: exit_net cleanup check added
       [not found] <bafb347d-e36e-8b2b-7646-afc458a7a32a@virtuozzo.com>
                   ` (3 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
  2017-11-05 16:51 ` [PATCH v2 18/21] recent: " Vasily Averin
  6 siblings, 0 replies; 8+ 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] 8+ messages in thread

* [PATCH v2 17/21] hashlimit: exit_net cleanup check added
       [not found] <bafb347d-e36e-8b2b-7646-afc458a7a32a@virtuozzo.com>
                   ` (4 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
  6 siblings, 0 replies; 8+ 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] 8+ messages in thread

* [PATCH v2 18/21] recent: exit_net cleanup check added
       [not found] <bafb347d-e36e-8b2b-7646-afc458a7a32a@virtuozzo.com>
                   ` (5 preceding siblings ...)
  2017-11-05 16:51 ` [PATCH v2 17/21] hashlimit: " Vasily Averin
@ 2017-11-05 16:51 ` Vasily Averin
  6 siblings, 0 replies; 8+ 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] 8+ messages in thread

* Re: [PATCH v2 09/21] clusterip: exit_net cleanup check added
  2017-11-05 16:50 ` [PATCH v2 09/21] clusterip: exit_net cleanup check added Vasily Averin
@ 2017-11-07  2:42   ` kbuild test robot
  0 siblings, 0 replies; 8+ 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] 8+ messages in thread

end of thread, other threads:[~2017-11-07  2:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <bafb347d-e36e-8b2b-7646-afc458a7a32a@virtuozzo.com>
2017-11-05 16:50 ` [PATCH v2 09/21] clusterip: exit_net cleanup check added Vasily Averin
2017-11-07  2:42   ` kbuild test robot
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).