lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210270104.Ekxswk8J-lkp@intel.com>
Date:   Thu, 27 Oct 2022 01:29:43 +0800
From:   kernel test robot <lkp@...el.com>
To:     Ziyang Xuan <william.xuanziyang@...wei.com>, davem@...emloft.net,
        yoshfuji@...ux-ipv6.org, dsahern@...nel.org, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Robert.Olsson@...a.slu.se, ja@....bg
Subject: Re: [PATCH net] ipv4: fix source address and gateway mismatch under
 multiple default gateways

Hi Ziyang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Ziyang-Xuan/ipv4-fix-source-address-and-gateway-mismatch-under-multiple-default-gateways/20221026-112135
patch link:    https://lore.kernel.org/r/20221026032017.3675060-1-william.xuanziyang%40huawei.com
patch subject: [PATCH net] ipv4: fix source address and gateway mismatch under multiple default gateways
config: x86_64-randconfig-s023
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/10ba8a9a3b91638837103326eb6a23b814b5ee2b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ziyang-Xuan/ipv4-fix-source-address-and-gateway-mismatch-under-multiple-default-gateways/20221026-112135
        git checkout 10ba8a9a3b91638837103326eb6a23b814b5ee2b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash net/ipv4/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

sparse warnings: (new ones prefixed by >>)
   net/ipv4/fib_semantics.c:2082:26: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned long word @@     got restricted __be32 @@
   net/ipv4/fib_semantics.c:2082:26: sparse:     expected unsigned long word
   net/ipv4/fib_semantics.c:2082:26: sparse:     got restricted __be32
>> net/ipv4/fib_semantics.c:2082:26: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected long @@     got restricted __be32 @@
   net/ipv4/fib_semantics.c:2082:26: sparse:     expected long
   net/ipv4/fib_semantics.c:2082:26: sparse:     got restricted __be32

vim +2082 net/ipv4/fib_semantics.c

  2038	
  2039	/* Must be invoked inside of an RCU protected region.  */
  2040	static void fib_select_default(const struct flowi4 *flp, struct fib_result *res)
  2041	{
  2042		struct fib_info *fi = NULL, *last_resort = NULL;
  2043		struct hlist_head *fa_head = res->fa_head;
  2044		struct fib_table *tb = res->table;
  2045		u8 slen = 32 - res->prefixlen;
  2046		int order = -1, last_idx = -1;
  2047		struct fib_alias *fa, *fa1 = NULL;
  2048		u32 last_prio = res->fi->fib_priority;
  2049		u8 prefix, max_prefix = 0;
  2050		dscp_t last_dscp = 0;
  2051	
  2052		hlist_for_each_entry_rcu(fa, fa_head, fa_list) {
  2053			struct fib_info *next_fi = fa->fa_info;
  2054			struct fib_nh_common *nhc;
  2055	
  2056			if (fa->fa_slen != slen)
  2057				continue;
  2058			if (fa->fa_dscp &&
  2059			    fa->fa_dscp != inet_dsfield_to_dscp(flp->flowi4_tos))
  2060				continue;
  2061			if (fa->tb_id != tb->tb_id)
  2062				continue;
  2063			if (next_fi->fib_priority > last_prio &&
  2064			    fa->fa_dscp == last_dscp) {
  2065				if (last_dscp)
  2066					continue;
  2067				break;
  2068			}
  2069			if (next_fi->fib_flags & RTNH_F_DEAD)
  2070				continue;
  2071			last_dscp = fa->fa_dscp;
  2072			last_prio = next_fi->fib_priority;
  2073	
  2074			if (next_fi->fib_scope != res->scope ||
  2075			    fa->fa_type != RTN_UNICAST)
  2076				continue;
  2077	
  2078			nhc = fib_info_nhc(next_fi, 0);
  2079			if (!nhc->nhc_gw_family || nhc->nhc_scope != RT_SCOPE_LINK)
  2080				continue;
  2081	
> 2082			prefix = __ffs(flp->saddr ^ nhc->nhc_gw.ipv4);
  2083			if (prefix < max_prefix)
  2084				continue;
  2085			max_prefix = max_t(u8, prefix, max_prefix);
  2086	
  2087			fib_alias_accessed(fa);
  2088	
  2089			if (!fi) {
  2090				if (next_fi != res->fi)
  2091					break;
  2092				fa1 = fa;
  2093			} else if (!fib_detect_death(fi, order, &last_resort,
  2094						     &last_idx, fa1->fa_default)) {
  2095				fib_result_assign(res, fi);
  2096				fa1->fa_default = order;
  2097				goto out;
  2098			}
  2099			fi = next_fi;
  2100			order++;
  2101		}
  2102	
  2103		if (order <= 0 || !fi) {
  2104			if (fa1)
  2105				fa1->fa_default = -1;
  2106			goto out;
  2107		}
  2108	
  2109		if (!fib_detect_death(fi, order, &last_resort, &last_idx,
  2110				      fa1->fa_default)) {
  2111			fib_result_assign(res, fi);
  2112			fa1->fa_default = order;
  2113			goto out;
  2114		}
  2115	
  2116		if (last_idx >= 0)
  2117			fib_result_assign(res, last_resort);
  2118		fa1->fa_default = last_idx;
  2119	out:
  2120		return;
  2121	}
  2122	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (122790 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ