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:   Fri, 12 Mar 2021 10:14:30 +0800
From:   kernel test robot <lkp@...el.com>
To:     ishaangandhi <ishaangandhi@...il.com>, davem@...emloft.net
Cc:     kbuild-all@...ts.01.org, ishaangandhi@...il.com,
        netdev@...r.kernel.org, willemb@...gle.com
Subject: Re: [PATCH] icmp: support rfc 5837

Hi ishaangandhi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]
[also build test WARNING on net/master linus/master v5.12-rc2 next-20210311]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/ishaangandhi/icmp-support-rfc-5837/20210312-084955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 1520929e26d54bc3c9e024ee91eee5a19c56b95b
config: arc-randconfig-p002-20210312 (attached as .config)
compiler: arc-elf-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/42e5e7501eafeda575f91db23d34172d720316ab
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review ishaangandhi/icmp-support-rfc-5837/20210312-084955
        git checkout 42e5e7501eafeda575f91db23d34172d720316ab
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

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

All warnings (new ones prefixed by >>):

>> net/ipv4/icmp.c:589:6: warning: no previous prototype for 'icmp_identify_arrival_interface' [-Wmissing-prototypes]
     589 | void icmp_identify_arrival_interface(struct sk_buff *skb, struct net *net, int room,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


"cppcheck warnings: (new ones prefixed by >>)"
>> net/ipv4/icmp.c:704:6: warning: Uninitialized variable: mtu [uninitvar]
    if (mtu) {
        ^
>> net/ipv4/icmp.c:692:6: warning: Uninitialized variable: name [uninitvar]
    if (name) {
        ^

vim +/icmp_identify_arrival_interface +589 net/ipv4/icmp.c

   579	
   580	/*  Appends interface identification object to ICMP packet to identify
   581	 *  the interface on which the original datagram arrived, per RFC 5837.
   582	 *
   583	 *  Should only be called on the following messages
   584	 *  - ICMPv4 Time Exceeded
   585	 *  - ICMPv4 Destination Unreachable
   586	 *  - ICMPv4 Parameter Problem
   587	 */
   588	
 > 589	void icmp_identify_arrival_interface(struct sk_buff *skb, struct net *net, int room,
   590					     struct icmphdr *icmph)
   591	{
   592		unsigned int ext_len, if_index, orig_len, offset, extra_space_needed,
   593			     word_aligned_orig_len, mtu, name_len, name_subobj_len;
   594		struct interface_ipv4_addr_sub_obj ip_addr;
   595		struct icmp_extobj_hdr *iio_hdr;
   596		struct icmp_ext_hdr *ext_hdr;
   597		struct net_device *dev;
   598		void *subobj_offset;
   599		char *name, ctype;
   600	
   601		skb_linearize(skb);
   602		if_index = inet_iif(skb);
   603		orig_len = skb->len - skb_network_offset(skb);
   604		word_aligned_orig_len = (orig_len + 3) & ~0x03;
   605	
   606		// Original datagram length is measured in 32-bit words
   607		icmph->un.reserved[1] = word_aligned_orig_len / 4;
   608		ctype = ICMP_5837_ARRIVAL_ROLE_CTYPE;
   609	
   610		ext_len = sizeof(struct icmp_ext_hdr) + sizeof(struct icmp_extobj_hdr);
   611	
   612		// Always add if_index to the IIO
   613		ext_len += 4;
   614		ctype |= ICMP_5837_IF_INDEX_CTYPE;
   615	
   616		dev = dev_get_by_index(net, if_index);
   617		// Try to append IP address, name, and MTU
   618		if (dev) {
   619			ip_addr.addr = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
   620			if (ip_addr.addr) {
   621				ip_addr.afi = htons(1);
   622				ip_addr.reserved = 0;
   623				ctype |= ICMP_5837_IP_ADDR_CTYPE;
   624				ext_len += 8;
   625			}
   626	
   627			name = dev->name;
   628			if (name) {
   629				name_len = strlen(name);
   630				name_subobj_len = min_t(unsigned int, name_len, ICMP_5837_MAX_NAME_LEN) + 1;
   631				name_subobj_len = (name_subobj_len + 3) & ~0x03;
   632				ctype |= ICMP_5837_NAME_CTYPE;
   633				ext_len += name_subobj_len;
   634			}
   635	
   636			mtu = dev->mtu;
   637			if (mtu) {
   638				ctype |= ICMP_5837_MTU_CTYPE;
   639				ext_len += 4;
   640			}
   641		}
   642	
   643		if (word_aligned_orig_len + ext_len > room) {
   644			offset = room - ext_len;
   645			extra_space_needed = room - orig_len;
   646		} else if (orig_len < ICMP_5837_MIN_ORIG_LEN) {
   647			// Original packet must be zero padded to 128 bytes
   648			offset = ICMP_5837_MIN_ORIG_LEN;
   649			extra_space_needed = offset + ext_len - orig_len;
   650		} else {
   651			// There is enough room to just add to the end of the packet
   652			offset = word_aligned_orig_len;
   653			extra_space_needed = ext_len;
   654		}
   655	
   656		if (skb_tailroom(skb) < extra_space_needed) {
   657			if (pskb_expand_head(skb, 0, extra_space_needed - skb_tailroom(skb), GFP_ATOMIC))
   658				return;
   659		}
   660	
   661		// Zero-pad from the end of the original message to the beginning of the header
   662		if (orig_len < ICMP_5837_MIN_ORIG_LEN) {
   663			// Original packet must be zero padded to 128 bytes
   664			memset(skb_network_header(skb) + orig_len, 0, ICMP_5837_MIN_ORIG_LEN - orig_len);
   665		} else {
   666			// Just zero-pad so the original packet is aligned on a 4 byte boundary
   667			memset(skb_network_header(skb) + orig_len, 0, word_aligned_orig_len - orig_len);
   668		}
   669	
   670		skb_put(skb, extra_space_needed);
   671		ext_hdr = (struct icmp_ext_hdr *)(skb_network_header(skb) + offset);
   672		iio_hdr = (struct icmp_extobj_hdr *)(ext_hdr + 1);
   673		subobj_offset = (void *)(iio_hdr + 1);
   674	
   675		ext_hdr->reserved1 = 0;
   676		ext_hdr->reserved2 = 0;
   677		ext_hdr->version = 2;
   678		ext_hdr->checksum = 0;
   679	
   680		iio_hdr->length = htons(ext_len - 4);
   681		iio_hdr->class_num = 2;
   682		iio_hdr->class_type = ctype;
   683	
   684		*(__be32 *)subobj_offset = htonl(if_index);
   685		subobj_offset += sizeof(__be32);
   686	
   687		if (ip_addr.addr) {
   688			*(struct interface_ipv4_addr_sub_obj *)subobj_offset = ip_addr;
   689			subobj_offset += sizeof(ip_addr);
   690		}
   691	
 > 692		if (name) {
   693			*(__u8 *)subobj_offset = name_subobj_len;
   694			subobj_offset += sizeof(__u8);
   695			if (name_len >= ICMP_5837_MAX_NAME_LEN) {
   696				memcpy(subobj_offset, name, ICMP_5837_MAX_NAME_LEN);
   697			} else {
   698				memcpy(subobj_offset, name, name_len);
   699				memset(subobj_offset + name_len, 0, name_subobj_len - name_len - 1);
   700			}
   701			subobj_offset += name_subobj_len - sizeof(__u8);
   702		}
   703	
 > 704		if (mtu) {
   705			*(__be32 *)subobj_offset = htonl(mtu);
   706			subobj_offset += sizeof(__be32);
   707		}
   708	
   709		ext_hdr->checksum =
   710			csum_fold(skb_checksum(skb, skb_network_offset(skb) + offset, ext_len, 0));
   711	}
   712	

---
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" (26040 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ