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]
Date:   Wed, 11 Nov 2020 09:34:24 +0800
From:   kernel test robot <lkp@...el.com>
To:     Dmytro Shytyi <dmytro@...tyi.net>, kuba <kuba@...nel.org>,
        kuznet <kuznet@....inr.ac.ru>,
        yoshfuji <yoshfuji@...ux-ipv6.org>,
        liuhangbin <liuhangbin@...il.com>, davem <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Cc:     kbuild-all@...ts.01.org
Subject: Re: Re: [PATCH net-next] net: Variable SLAAC: SLAAC with prefixes of
 arbitrary length in PIO

Hi Dmytro,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Dmytro-Shytyi/Re-PATCH-net-next-net-Variable-SLAAC-SLAAC-with-prefixes-of-arbitrary-length-in-PIO/20201111-014800
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 8be33ecfc1ffd2da20cc29e957e4cb6eb99310cb
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/0d851d20831574b490bbb131cb68f722dc2419ca
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dmytro-Shytyi/Re-PATCH-net-next-net-Variable-SLAAC-SLAAC-with-prefixes-of-arbitrary-length-in-PIO/20201111-014800
        git checkout 0d851d20831574b490bbb131cb68f722dc2419ca
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

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

All error/warnings (new ones prefixed by >>):

   net/ipv6/addrconf.c: In function 'ipv6_create_tempaddr':
>> net/ipv6/addrconf.c:1329:2: error: expected expression before '__int128'
    1329 |  __int128 host_id;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:1330:2: error: expected expression before '__int128'
    1330 |  __int128 net_prfx;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:1331:2: error: expected expression before '__int128'
    1331 |  __int128 ipv6addr;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:1332:2: error: expected expression before '__int128'
    1332 |  __int128 mask_128;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:1333:2: error: expected expression before '__int128'
    1333 |  __int128 mask_host_id;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:1334:2: error: expected expression before '__int128'
    1334 |  __int128 mask_net_prfx;
         |  ^~~~~~~~
>> net/ipv6/addrconf.c:1335:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    1335 |  int i;
         |  ^~~
>> net/ipv6/addrconf.c:1338:10: error: 'mask_128' undeclared (first use in this function)
    1338 |  memset(&mask_128, 0xFF, 16);
         |          ^~~~~~~~
   net/ipv6/addrconf.c:1338:10: note: each undeclared identifier is reported only once for each function it appears in
>> net/ipv6/addrconf.c:1370:11: error: 'host_id' undeclared (first use in this function)
    1370 |   memcpy(&host_id, temp.s6_addr32, sizeof(host_id));
         |           ^~~~~~~
>> net/ipv6/addrconf.c:1371:11: error: 'net_prfx' undeclared (first use in this function)
    1371 |   memcpy(&net_prfx, addr.s6_addr, sizeof(net_prfx));
         |           ^~~~~~~~
>> net/ipv6/addrconf.c:1373:3: error: 'mask_host_id' undeclared (first use in this function); did you mean 'mask_host_id_arr'?
    1373 |   mask_host_id = ifp->prefix_len != 128 ? (mask_128 << ifp->prefix_len) : 0x0;
         |   ^~~~~~~~~~~~
         |   mask_host_id_arr
>> net/ipv6/addrconf.c:1380:3: error: 'mask_net_prfx' undeclared (first use in this function)
    1380 |   mask_net_prfx = mask_128 ^ mask_host_id;
         |   ^~~~~~~~~~~~~
>> net/ipv6/addrconf.c:1383:3: error: 'ipv6addr' undeclared (first use in this function); did you mean 'ipv6_hdr'?
    1383 |   ipv6addr = net_prfx | host_id;
         |   ^~~~~~~~
         |   ipv6_hdr
   net/ipv6/addrconf.c: In function 'addrconf_prefix_rcv_add_addr':
   net/ipv6/addrconf.c:2626:3: error: expected expression before '__int128'
    2626 |   __int128 mask_128;
         |   ^~~~~~~~
   net/ipv6/addrconf.c:2627:3: error: expected expression before '__int128'
    2627 |   __int128 mask_net_prfx;
         |   ^~~~~~~~
   net/ipv6/addrconf.c:2628:3: error: expected expression before '__int128'
    2628 |   __int128 net_prfx;
         |   ^~~~~~~~
   net/ipv6/addrconf.c:2629:3: error: expected expression before '__int128'
    2629 |   __int128 curr_net_prfx;
         |   ^~~~~~~~
   net/ipv6/addrconf.c:2630:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    2630 |   int hostid_len;
         |   ^~~
   net/ipv6/addrconf.c:2634:11: error: 'mask_128' undeclared (first use in this function)
    2634 |   memset(&mask_128, 0xFF, 16);
         |           ^~~~~~~~
   net/ipv6/addrconf.c:2642:4: error: 'mask_net_prfx' undeclared (first use in this function)
    2642 |    mask_net_prfx = pinfo->prefix_len != 128 ? (mask_128 << pinfo->prefix_len) : 0x0;
         |    ^~~~~~~~~~~~~
   net/ipv6/addrconf.c:2650:12: error: 'net_prfx' undeclared (first use in this function)
    2650 |    memcpy(&net_prfx, pinfo->prefix.s6_addr32, 16);
         |            ^~~~~~~~
>> net/ipv6/addrconf.c:2654:12: error: 'curr_net_prfx' undeclared (first use in this function)
    2654 |    memcpy(&curr_net_prfx, ifp->addr.s6_addr32, 16);
         |            ^~~~~~~~~~~~~
>> net/ipv6/addrconf.c:2630:7: warning: variable 'hostid_len' set but not used [-Wunused-but-set-variable]
    2630 |   int hostid_len;
         |       ^~~~~~~~~~
   net/ipv6/addrconf.c: In function 'ipv6_generate_address_variable_plen':
   net/ipv6/addrconf.c:3424:2: error: expected expression before '__int128'
    3424 |  __int128 host_id;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:3425:2: error: expected expression before '__int128'
    3425 |  __int128 net_prfx;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:3426:2: error: expected expression before '__int128'
    3426 |  __int128 ipv6addr;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:3427:2: error: expected expression before '__int128'
    3427 |  __int128 mask_128;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:3428:2: error: expected expression before '__int128'
    3428 |  __int128 mask_host_id;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:3429:2: error: expected expression before '__int128'
    3429 |  __int128 mask_net_prfx;
         |  ^~~~~~~~
   net/ipv6/addrconf.c:3430:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    3430 |  int i;
         |  ^~~
   net/ipv6/addrconf.c:3433:10: error: 'mask_128' undeclared (first use in this function)
    3433 |  memset(&mask_128, 0xFF, 16);
         |          ^~~~~~~~
   net/ipv6/addrconf.c:3477:10: error: 'host_id' undeclared (first use in this function)
    3477 |  memcpy(&host_id, temp.s6_addr32, 16);
         |          ^~~~~~~
   net/ipv6/addrconf.c:3478:10: error: 'net_prfx' undeclared (first use in this function)
    3478 |  memcpy(&net_prfx, address->s6_addr32, 16);
         |          ^~~~~~~~
   net/ipv6/addrconf.c:3480:2: error: 'mask_host_id' undeclared (first use in this function); did you mean 'mask_host_id_arr'?
    3480 |  mask_host_id = rcvd_prfx_len != 128 ? (mask_128 << rcvd_prfx_len) : 0x0;
         |  ^~~~~~~~~~~~
         |  mask_host_id_arr
   net/ipv6/addrconf.c:3487:2: error: 'mask_net_prfx' undeclared (first use in this function)
    3487 |  mask_net_prfx = mask_128 ^ mask_host_id;
         |  ^~~~~~~~~~~~~
   net/ipv6/addrconf.c:3490:2: error: 'ipv6addr' undeclared (first use in this function); did you mean 'ipv6_hdr'?
    3490 |  ipv6addr = net_prfx | host_id;
         |  ^~~~~~~~
         |  ipv6_hdr

vim +/__int128 +1329 net/ipv6/addrconf.c

  1313	
  1314	static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, bool block)
  1315	{
  1316		struct inet6_dev *idev = ifp->idev;
  1317		unsigned long tmp_tstamp, age;
  1318		unsigned long regen_advance;
  1319		unsigned long now = jiffies;
  1320		s32 cnf_temp_preferred_lft;
  1321		struct inet6_ifaddr *ift;
  1322		struct ifa6_config cfg;
  1323		long max_desync_factor;
  1324	
  1325		struct in6_addr temp, addr;
  1326	
  1327		int ret = 0;
  1328	
> 1329		__int128 host_id;
  1330		__int128 net_prfx;
  1331		__int128 ipv6addr;
  1332		__int128 mask_128;
  1333		__int128 mask_host_id;
  1334		__int128 mask_net_prfx;
> 1335		int i;
  1336		unsigned char mask_host_id_arr[128];
  1337	
> 1338		memset(&mask_128, 0xFF, 16);
  1339		write_lock_bh(&idev->lock);
  1340	
  1341	retry:
  1342		in6_dev_hold(idev);
  1343		if (idev->cnf.use_tempaddr <= 0) {
  1344			write_unlock_bh(&idev->lock);
  1345			pr_info("%s: use_tempaddr is disabled\n", __func__);
  1346			in6_dev_put(idev);
  1347			ret = -1;
  1348			goto out;
  1349		}
  1350		spin_lock_bh(&ifp->lock);
  1351		if (ifp->regen_count++ >= idev->cnf.regen_max_retry) {
  1352			idev->cnf.use_tempaddr = -1;	/*XXX*/
  1353			spin_unlock_bh(&ifp->lock);
  1354			write_unlock_bh(&idev->lock);
  1355			pr_warn("%s: regeneration time exceeded - disabled temporary address support\n",
  1356				__func__);
  1357			in6_dev_put(idev);
  1358			ret = -1;
  1359			goto out;
  1360		}
  1361		in6_ifa_hold(ifp);
  1362	
  1363		if (ifp->prefix_len == 64) {
  1364			memcpy(addr.s6_addr, ifp->addr.s6_addr, 8);
  1365			ipv6_gen_rnd_iid(&addr);
  1366		} else if (ifp->prefix_len > 0 && ifp->prefix_len <= 128) {
  1367			memcpy(addr.s6_addr, ifp->addr.s6_addr, 16);
  1368			get_random_bytes(temp.s6_addr32, 16);
  1369	
> 1370			memcpy(&host_id, temp.s6_addr32, sizeof(host_id));
> 1371			memcpy(&net_prfx, addr.s6_addr, sizeof(net_prfx));
  1372	
> 1373			mask_host_id = ifp->prefix_len != 128 ? (mask_128 << ifp->prefix_len) : 0x0;
  1374			memcpy(mask_host_id_arr, &mask_host_id, 16);
  1375			for (i = 0; i < 128; i++)
  1376				mask_host_id_arr[i] = reverse_bits(mask_host_id_arr[i]);
  1377			memcpy(&mask_host_id, mask_host_id_arr, 16);
  1378			host_id = host_id & mask_host_id;
  1379	
> 1380			mask_net_prfx = mask_128 ^ mask_host_id;
  1381			net_prfx = net_prfx & mask_net_prfx;
  1382	
> 1383			ipv6addr = net_prfx | host_id;
  1384			memcpy(addr.s6_addr, &ipv6addr, 16);
  1385		}
  1386		age = (now - ifp->tstamp) / HZ;
  1387	
  1388		regen_advance = idev->cnf.regen_max_retry *
  1389				idev->cnf.dad_transmits *
  1390				max(NEIGH_VAR(idev->nd_parms, RETRANS_TIME), HZ/100) / HZ;
  1391	
  1392		/* recalculate max_desync_factor each time and update
  1393		 * idev->desync_factor if it's larger
  1394		 */
  1395		cnf_temp_preferred_lft = READ_ONCE(idev->cnf.temp_prefered_lft);
  1396		max_desync_factor = min_t(__u32,
  1397					  idev->cnf.max_desync_factor,
  1398					  cnf_temp_preferred_lft - regen_advance);
  1399	
  1400		if (unlikely(idev->desync_factor > max_desync_factor)) {
  1401			if (max_desync_factor > 0) {
  1402				get_random_bytes(&idev->desync_factor,
  1403						 sizeof(idev->desync_factor));
  1404				idev->desync_factor %= max_desync_factor;
  1405			} else {
  1406				idev->desync_factor = 0;
  1407			}
  1408		}
  1409	
  1410		memset(&cfg, 0, sizeof(cfg));
  1411		cfg.valid_lft = min_t(__u32, ifp->valid_lft,
  1412				      idev->cnf.temp_valid_lft + age);
  1413		cfg.preferred_lft = cnf_temp_preferred_lft + age - idev->desync_factor;
  1414		cfg.preferred_lft = min_t(__u32, ifp->prefered_lft, cfg.preferred_lft);
  1415	
  1416		cfg.plen = ifp->prefix_len;
  1417		tmp_tstamp = ifp->tstamp;
  1418		spin_unlock_bh(&ifp->lock);
  1419	
  1420		write_unlock_bh(&idev->lock);
  1421	
  1422		/* A temporary address is created only if this calculated Preferred
  1423		 * Lifetime is greater than REGEN_ADVANCE time units.  In particular,
  1424		 * an implementation must not create a temporary address with a zero
  1425		 * Preferred Lifetime.
  1426		 * Use age calculation as in addrconf_verify to avoid unnecessary
  1427		 * temporary addresses being generated.
  1428		 */
  1429		age = (now - tmp_tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ;
  1430		if (cfg.preferred_lft <= regen_advance + age) {
  1431			in6_ifa_put(ifp);
  1432			in6_dev_put(idev);
  1433			ret = -1;
  1434			goto out;
  1435		}
  1436	
  1437		cfg.ifa_flags = IFA_F_TEMPORARY;
  1438		/* set in addrconf_prefix_rcv() */
  1439		if (ifp->flags & IFA_F_OPTIMISTIC)
  1440			cfg.ifa_flags |= IFA_F_OPTIMISTIC;
  1441	
  1442		cfg.pfx = &addr;
  1443		cfg.scope = ipv6_addr_scope(cfg.pfx);
  1444	
  1445		ift = ipv6_add_addr(idev, &cfg, block, NULL);
  1446		if (IS_ERR(ift)) {
  1447			in6_ifa_put(ifp);
  1448			in6_dev_put(idev);
  1449			pr_info("%s: retry temporary address regeneration\n", __func__);
  1450			write_lock_bh(&idev->lock);
  1451			goto retry;
  1452		}
  1453	
  1454		spin_lock_bh(&ift->lock);
  1455		ift->ifpub = ifp;
  1456		ift->cstamp = now;
  1457		ift->tstamp = tmp_tstamp;
  1458		spin_unlock_bh(&ift->lock);
  1459	
  1460		addrconf_dad_start(ift);
  1461		in6_ifa_put(ift);
  1462		in6_dev_put(idev);
  1463	out:
  1464		return ret;
  1465	}
  1466	

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

Download attachment ".config.gz" of type "application/gzip" (53504 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ