Re: [PATCH nf] netfilter: x_tables: Switch synchronization to RCU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Subash,

I love your patch! Perhaps something to improve:

[auto build test WARNING on nf/master]

url:    https://github.com/0day-ci/linux/commits/Subash-Abhinov-Kasiviswanathan/netfilter-x_tables-Switch-synchronization-to-RCU/20201123-032122
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git master
config: i386-randconfig-s001-20201122 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-134-gb59dbdaf-dirty
        # https://github.com/0day-ci/linux/commit/2d87a7da9e77a1c31af435d23238e60d0067aac0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Subash-Abhinov-Kasiviswanathan/netfilter-x_tables-Switch-synchronization-to-RCU/20201123-032122
        git checkout 2d87a7da9e77a1c31af435d23238e60d0067aac0
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


"sparse warnings: (new ones prefixed by >>)"
>> net/ipv6/netfilter/ip6_tables.c:983:56: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected struct xt_table_info const *private @@     got struct xt_table_info [noderef] __rcu *private @@
>> net/ipv6/netfilter/ip6_tables.c:983:56: sparse:     expected struct xt_table_info const *private
>> net/ipv6/netfilter/ip6_tables.c:983:56: sparse:     got struct xt_table_info [noderef] __rcu *private
>> net/ipv6/netfilter/ip6_tables.c:1038:50: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected struct xt_table_info *private @@     got struct xt_table_info [noderef] __rcu *private @@
>> net/ipv6/netfilter/ip6_tables.c:1038:50: sparse:     expected struct xt_table_info *private
   net/ipv6/netfilter/ip6_tables.c:1038:50: sparse:     got struct xt_table_info [noderef] __rcu *private
>> net/ipv6/netfilter/ip6_tables.c:1192:17: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct xt_table_info const *private @@     got struct xt_table_info [noderef] __rcu *private @@
   net/ipv6/netfilter/ip6_tables.c:1192:17: sparse:     expected struct xt_table_info const *private
   net/ipv6/netfilter/ip6_tables.c:1192:17: sparse:     got struct xt_table_info [noderef] __rcu *private
   net/ipv6/netfilter/ip6_tables.c:42:16: sparse: sparse: Initializer entry defined twice
   net/ipv6/netfilter/ip6_tables.c:42:16: sparse:   also defined here
   net/ipv6/netfilter/ip6_tables.c:42:16: sparse: sparse: Initializer entry defined twice
   net/ipv6/netfilter/ip6_tables.c:42:16: sparse:   also defined here

vim +983 net/ipv6/netfilter/ip6_tables.c

3bc3fe5eed5e866 Patrick McHardy   2007-12-17   962  
f415e76fd723594 Christoph Hellwig 2020-07-17   963  static int get_info(struct net *net, void __user *user, const int *len)
433665c9d110d78 Patrick McHardy   2007-12-17   964  {
12b00c2c025b8af Jan Engelhardt    2010-10-13   965  	char name[XT_TABLE_MAXNAMELEN];
433665c9d110d78 Patrick McHardy   2007-12-17   966  	struct xt_table *t;
433665c9d110d78 Patrick McHardy   2007-12-17   967  	int ret;
433665c9d110d78 Patrick McHardy   2007-12-17   968  
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03   969  	if (*len != sizeof(struct ip6t_getinfo))
433665c9d110d78 Patrick McHardy   2007-12-17   970  		return -EINVAL;
433665c9d110d78 Patrick McHardy   2007-12-17   971  
433665c9d110d78 Patrick McHardy   2007-12-17   972  	if (copy_from_user(name, user, sizeof(name)) != 0)
433665c9d110d78 Patrick McHardy   2007-12-17   973  		return -EFAULT;
433665c9d110d78 Patrick McHardy   2007-12-17   974  
12b00c2c025b8af Jan Engelhardt    2010-10-13   975  	name[XT_TABLE_MAXNAMELEN-1] = '\0';
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   976  #ifdef CONFIG_COMPAT
f415e76fd723594 Christoph Hellwig 2020-07-17   977  	if (in_compat_syscall())
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   978  		xt_compat_lock(AF_INET6);
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   979  #endif
03d13b6868a261f Florian Westphal  2017-12-08   980  	t = xt_request_find_table_lock(net, AF_INET6, name);
03d13b6868a261f Florian Westphal  2017-12-08   981  	if (!IS_ERR(t)) {
433665c9d110d78 Patrick McHardy   2007-12-17   982  		struct ip6t_getinfo info;
5452e425adfdfc4 Jan Engelhardt    2008-04-14  @983  		const struct xt_table_info *private = t->private;
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   984  #ifdef CONFIG_COMPAT
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   985  		struct xt_table_info tmp;
14c7dbe043d01a8 Alexey Dobriyan   2010-02-08   986  
f415e76fd723594 Christoph Hellwig 2020-07-17   987  		if (in_compat_syscall()) {
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   988  			ret = compat_table_info(private, &tmp);
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   989  			xt_compat_flush_offsets(AF_INET6);
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   990  			private = &tmp;
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   991  		}
3bc3fe5eed5e866 Patrick McHardy   2007-12-17   992  #endif
cccbe5ef8528462 Jan Engelhardt    2010-11-03   993  		memset(&info, 0, sizeof(info));
433665c9d110d78 Patrick McHardy   2007-12-17   994  		info.valid_hooks = t->valid_hooks;
433665c9d110d78 Patrick McHardy   2007-12-17   995  		memcpy(info.hook_entry, private->hook_entry,
433665c9d110d78 Patrick McHardy   2007-12-17   996  		       sizeof(info.hook_entry));
433665c9d110d78 Patrick McHardy   2007-12-17   997  		memcpy(info.underflow, private->underflow,
433665c9d110d78 Patrick McHardy   2007-12-17   998  		       sizeof(info.underflow));
433665c9d110d78 Patrick McHardy   2007-12-17   999  		info.num_entries = private->number;
433665c9d110d78 Patrick McHardy   2007-12-17  1000  		info.size = private->size;
b5dd674b2a1de59 Patrick McHardy   2007-12-17  1001  		strcpy(info.name, name);
433665c9d110d78 Patrick McHardy   2007-12-17  1002  
433665c9d110d78 Patrick McHardy   2007-12-17  1003  		if (copy_to_user(user, &info, *len) != 0)
433665c9d110d78 Patrick McHardy   2007-12-17  1004  			ret = -EFAULT;
433665c9d110d78 Patrick McHardy   2007-12-17  1005  		else
433665c9d110d78 Patrick McHardy   2007-12-17  1006  			ret = 0;
433665c9d110d78 Patrick McHardy   2007-12-17  1007  
433665c9d110d78 Patrick McHardy   2007-12-17  1008  		xt_table_unlock(t);
433665c9d110d78 Patrick McHardy   2007-12-17  1009  		module_put(t->me);
433665c9d110d78 Patrick McHardy   2007-12-17  1010  	} else
03d13b6868a261f Florian Westphal  2017-12-08  1011  		ret = PTR_ERR(t);
3bc3fe5eed5e866 Patrick McHardy   2007-12-17  1012  #ifdef CONFIG_COMPAT
f415e76fd723594 Christoph Hellwig 2020-07-17  1013  	if (in_compat_syscall())
3bc3fe5eed5e866 Patrick McHardy   2007-12-17  1014  		xt_compat_unlock(AF_INET6);
3bc3fe5eed5e866 Patrick McHardy   2007-12-17  1015  #endif
433665c9d110d78 Patrick McHardy   2007-12-17  1016  	return ret;
433665c9d110d78 Patrick McHardy   2007-12-17  1017  }
433665c9d110d78 Patrick McHardy   2007-12-17  1018  
^1da177e4c3f415 Linus Torvalds    2005-04-16  1019  static int
d5d1baa15f5b05e Jan Engelhardt    2009-06-26  1020  get_entries(struct net *net, struct ip6t_get_entries __user *uptr,
d5d1baa15f5b05e Jan Engelhardt    2009-06-26  1021  	    const int *len)
^1da177e4c3f415 Linus Torvalds    2005-04-16  1022  {
^1da177e4c3f415 Linus Torvalds    2005-04-16  1023  	int ret;
d924357c50d83e7 Patrick McHardy   2007-12-17  1024  	struct ip6t_get_entries get;
2e4e6a17af35be3 Harald Welte      2006-01-12  1025  	struct xt_table *t;
^1da177e4c3f415 Linus Torvalds    2005-04-16  1026  
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03  1027  	if (*len < sizeof(get))
d924357c50d83e7 Patrick McHardy   2007-12-17  1028  		return -EINVAL;
d924357c50d83e7 Patrick McHardy   2007-12-17  1029  	if (copy_from_user(&get, uptr, sizeof(get)) != 0)
d924357c50d83e7 Patrick McHardy   2007-12-17  1030  		return -EFAULT;
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03  1031  	if (*len != sizeof(struct ip6t_get_entries) + get.size)
d924357c50d83e7 Patrick McHardy   2007-12-17  1032  		return -EINVAL;
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03  1033  
b301f2538759933 Pablo Neira Ayuso 2016-03-24  1034  	get.name[sizeof(get.name) - 1] = '\0';
d924357c50d83e7 Patrick McHardy   2007-12-17  1035  
336b517fdc0f92f Alexey Dobriyan   2008-01-31  1036  	t = xt_find_table_lock(net, AF_INET6, get.name);
03d13b6868a261f Florian Westphal  2017-12-08  1037  	if (!IS_ERR(t)) {
2e4e6a17af35be3 Harald Welte      2006-01-12 @1038  		struct xt_table_info *private = t->private;
d924357c50d83e7 Patrick McHardy   2007-12-17  1039  		if (get.size == private->size)
2e4e6a17af35be3 Harald Welte      2006-01-12  1040  			ret = copy_entries_to_user(private->size,
^1da177e4c3f415 Linus Torvalds    2005-04-16  1041  						   t, uptr->entrytable);
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03  1042  		else
544473c1664f3a6 Patrick McHardy   2008-04-14  1043  			ret = -EAGAIN;
d7cdf81657776ca Pablo Neira Ayuso 2016-05-03  1044  
6b7d31fcdda5938 Harald Welte      2005-10-26  1045  		module_put(t->me);
2e4e6a17af35be3 Harald Welte      2006-01-12  1046  		xt_table_unlock(t);
^1da177e4c3f415 Linus Torvalds    2005-04-16  1047  	} else
03d13b6868a261f Florian Westphal  2017-12-08  1048  		ret = PTR_ERR(t);
^1da177e4c3f415 Linus Torvalds    2005-04-16  1049  
^1da177e4c3f415 Linus Torvalds    2005-04-16  1050  	return ret;
^1da177e4c3f415 Linus Torvalds    2005-04-16  1051  }
^1da177e4c3f415 Linus Torvalds    2005-04-16  1052  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux