Re: [PATCH v6 07/21] net/tcp: Add tcp_parse_auth_options()

From: kernel test robot
Date: Fri May 12 2023 - 19:03:12 EST


Hi Dmitry,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 47a2ee5d4a0bda05decdda7be0a77e792cdb09a3]

url: https://github.com/intel-lab-lkp/linux/commits/Dmitry-Safonov/net-tcp-Prepare-tcp_md5sig_pool-for-TCP-AO/20230513-042734
base: 47a2ee5d4a0bda05decdda7be0a77e792cdb09a3
patch link: https://lore.kernel.org/r/20230512202311.2845526-8-dima%40arista.com
patch subject: [PATCH v6 07/21] net/tcp: Add tcp_parse_auth_options()
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230513/202305130600.uZymcUzw-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/16d692b101c65ae6a5a60530a3461c512f3bc312
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Dmitry-Safonov/net-tcp-Prepare-tcp_md5sig_pool-for-TCP-AO/20230513-042734
git checkout 16d692b101c65ae6a5a60530a3461c512f3bc312
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash net/ipv4/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305130600.uZymcUzw-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

net/ipv4/tcp.c: In function 'tcp_inbound_md5_hash':
>> net/ipv4/tcp.c:4506:24: warning: implicit conversion from 'enum <anonymous>' to 'enum skb_drop_reason' [-Wenum-conversion]
4506 | return true;
| ^~~~


vim +4506 net/ipv4/tcp.c

4477
4478 /* Called with rcu_read_lock() */
4479 enum skb_drop_reason
4480 tcp_inbound_md5_hash(const struct sock *sk, const struct sk_buff *skb,
4481 const void *saddr, const void *daddr,
4482 int family, int dif, int sdif)
4483 {
4484 /*
4485 * This gets called for each TCP segment that arrives
4486 * so we want to be efficient.
4487 * We have 3 drop cases:
4488 * o No MD5 hash and one expected.
4489 * o MD5 hash and we're not expecting one.
4490 * o MD5 hash and its wrong.
4491 */
4492 const __u8 *hash_location = NULL;
4493 struct tcp_md5sig_key *hash_expected;
4494 const struct tcphdr *th = tcp_hdr(skb);
4495 const struct tcp_sock *tp = tcp_sk(sk);
4496 int genhash, l3index;
4497 u8 newhash[16];
4498
4499 /* sdif set, means packet ingressed via a device
4500 * in an L3 domain and dif is set to the l3mdev
4501 */
4502 l3index = sdif ? dif : 0;
4503
4504 hash_expected = tcp_md5_do_lookup(sk, l3index, saddr, family);
4505 if (tcp_parse_auth_options(th, &hash_location, NULL))
> 4506 return true;
4507
4508 /* We've parsed the options - do we have a hash? */
4509 if (!hash_expected && !hash_location)
4510 return SKB_NOT_DROPPED_YET;
4511
4512 if (hash_expected && !hash_location) {
4513 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
4514 return SKB_DROP_REASON_TCP_MD5NOTFOUND;
4515 }
4516
4517 if (!hash_expected && hash_location) {
4518 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
4519 return SKB_DROP_REASON_TCP_MD5UNEXPECTED;
4520 }
4521
4522 /* Check the signature.
4523 * To support dual stack listeners, we need to handle
4524 * IPv4-mapped case.
4525 */
4526 if (family == AF_INET)
4527 genhash = tcp_v4_md5_hash_skb(newhash,
4528 hash_expected,
4529 NULL, skb);
4530 else
4531 genhash = tp->af_specific->calc_md5_hash(newhash,
4532 hash_expected,
4533 NULL, skb);
4534
4535 if (genhash || memcmp(hash_location, newhash, 16) != 0) {
4536 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5FAILURE);
4537 if (family == AF_INET) {
4538 net_info_ratelimited("MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s L3 index %d\n",
4539 saddr, ntohs(th->source),
4540 daddr, ntohs(th->dest),
4541 genhash ? " tcp_v4_calc_md5_hash failed"
4542 : "", l3index);
4543 } else {
4544 net_info_ratelimited("MD5 Hash %s for [%pI6c]:%u->[%pI6c]:%u L3 index %d\n",
4545 genhash ? "failed" : "mismatch",
4546 saddr, ntohs(th->source),
4547 daddr, ntohs(th->dest), l3index);
4548 }
4549 return SKB_DROP_REASON_TCP_MD5FAILURE;
4550 }
4551 return SKB_NOT_DROPPED_YET;
4552 }
4553 EXPORT_SYMBOL(tcp_inbound_md5_hash);
4554

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests