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] [day] [month] [year] [list]
Date:   Mon, 1 Jun 2020 10:08:44 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Rohit Maheshwari <rohitm@...lsio.com>, netdev@...r.kernel.org,
        davem@...emloft.net
Cc:     kbuild-all@...ts.01.org, kuba@...nel.org, secdev@...lsio.com,
        Rohit Maheshwari <rohitm@...lsio.com>
Subject: Re: [PATCH net v3] cxgb4/chcr: Enable ktls settings at run time

Hi Rohit,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20200529]
[cannot apply to net/master cryptodev/master crypto/master linus/master ipvs/master v5.7-rc7 v5.7-rc6 v5.7-rc5 v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Rohit-Maheshwari/cxgb4-chcr-Enable-ktls-settings-at-run-time/20200601-045155
base:    e7b08814b16b80a0bf76eeca16317f8c2ed23b8c
config: mips-allyesconfig (attached as .config)
compiler: mips-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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 

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

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/crypto/chelsio/chcr_ktls.c:376:6: warning: no previous prototype for 'chcr_ktls_dev_del' [-Wmissing-prototypes]
376 | void chcr_ktls_dev_del(struct net_device *netdev,
|      ^~~~~~~~~~~~~~~~~
>> drivers/crypto/chelsio/chcr_ktls.c:427:5: warning: no previous prototype for 'chcr_ktls_dev_add' [-Wmissing-prototypes]
427 | int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk,
|     ^~~~~~~~~~~~~~~~~

vim +/chcr_ktls_dev_del +376 drivers/crypto/chelsio/chcr_ktls.c

   367	
   368	/*
   369	 * chcr_ktls_dev_del:  call back for tls_dev_del.
   370	 * Remove the tid and l2t entry and close the connection.
   371	 * it per connection basis.
   372	 * @netdev - net device.
   373	 * @tls_cts - tls context.
   374	 * @direction - TX/RX crypto direction
   375	 */
 > 376	void chcr_ktls_dev_del(struct net_device *netdev,
   377			       struct tls_context *tls_ctx,
   378			       enum tls_offload_ctx_dir direction)
   379	{
   380		struct chcr_ktls_ofld_ctx_tx *tx_ctx =
   381					chcr_get_ktls_tx_context(tls_ctx);
   382		struct chcr_ktls_info *tx_info = tx_ctx->chcr_info;
   383		struct sock *sk;
   384	
   385		if (!tx_info)
   386			return;
   387		sk = tx_info->sk;
   388	
   389		spin_lock(&tx_info->lock);
   390		tx_info->connection_state = KTLS_CONN_CLOSED;
   391		spin_unlock(&tx_info->lock);
   392	
   393		/* clear l2t entry */
   394		if (tx_info->l2te)
   395			cxgb4_l2t_release(tx_info->l2te);
   396	
   397		/* clear clip entry */
   398		if (tx_info->ip_family == AF_INET6)
   399			cxgb4_clip_release(netdev,
   400					   (const u32 *)&sk->sk_v6_daddr.in6_u.u6_addr8,
   401					   1);
   402	
   403		/* clear tid */
   404		if (tx_info->tid != -1) {
   405			/* clear tcb state and then release tid */
   406			chcr_ktls_mark_tcb_close(tx_info);
   407			cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan,
   408					 tx_info->tid, tx_info->ip_family);
   409		}
   410	
   411		atomic64_inc(&tx_info->adap->chcr_stats.ktls_tx_connection_close);
   412		kvfree(tx_info);
   413		tx_ctx->chcr_info = NULL;
   414		/* release module refcount */
   415		module_put(THIS_MODULE);
   416	}
   417	
   418	/*
   419	 * chcr_ktls_dev_add:  call back for tls_dev_add.
   420	 * Create a tcb entry for TP. Also add l2t entry for the connection. And
   421	 * generate keys & save those keys locally.
   422	 * @netdev - net device.
   423	 * @tls_cts - tls context.
   424	 * @direction - TX/RX crypto direction
   425	 * return: SUCCESS/FAILURE.
   426	 */
 > 427	int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk,
   428			      enum tls_offload_ctx_dir direction,
   429			      struct tls_crypto_info *crypto_info,
   430			      u32 start_offload_tcp_sn)
   431	{
   432		struct tls_context *tls_ctx = tls_get_ctx(sk);
   433		struct chcr_ktls_ofld_ctx_tx *tx_ctx;
   434		struct chcr_ktls_info *tx_info;
   435		struct dst_entry *dst;
   436		struct adapter *adap;
   437		struct port_info *pi;
   438		struct neighbour *n;
   439		u8 daaddr[16];
   440		int ret = -1;
   441	
   442		tx_ctx = chcr_get_ktls_tx_context(tls_ctx);
   443	
   444		pi = netdev_priv(netdev);
   445		adap = pi->adapter;
   446		if (direction == TLS_OFFLOAD_CTX_DIR_RX) {
   447			pr_err("not expecting for RX direction\n");
   448			ret = -EINVAL;
   449			goto out;
   450		}
   451		if (tx_ctx->chcr_info) {
   452			ret = -EINVAL;
   453			goto out;
   454		}
   455	
   456		tx_info = kvzalloc(sizeof(*tx_info), GFP_KERNEL);
   457		if (!tx_info) {
   458			ret = -ENOMEM;
   459			goto out;
   460		}
   461	
   462		spin_lock_init(&tx_info->lock);
   463	
   464		/* clear connection state */
   465		spin_lock(&tx_info->lock);
   466		tx_info->connection_state = KTLS_CONN_CLOSED;
   467		spin_unlock(&tx_info->lock);
   468	
   469		tx_info->sk = sk;
   470		/* initialize tid and atid to -1, 0 is a also a valid id. */
   471		tx_info->tid = -1;
   472		tx_info->atid = -1;
   473	
   474		tx_info->adap = adap;
   475		tx_info->netdev = netdev;
   476		tx_info->first_qset = pi->first_qset;
   477		tx_info->tx_chan = pi->tx_chan;
   478		tx_info->smt_idx = pi->smt_idx;
   479		tx_info->port_id = pi->port_id;
   480	
   481		tx_info->rx_qid = chcr_get_first_rx_qid(adap);
   482		if (unlikely(tx_info->rx_qid < 0))
   483			goto out2;
   484	
   485		tx_info->prev_seq = start_offload_tcp_sn;
   486		tx_info->tcp_start_seq_number = start_offload_tcp_sn;
   487	
   488		/* save crypto keys */
   489		ret = chcr_ktls_save_keys(tx_info, crypto_info, direction);
   490		if (ret < 0)
   491			goto out2;
   492	
   493		/* get peer ip */
   494		if (sk->sk_family == AF_INET ||
   495		    (sk->sk_family == AF_INET6 && !sk->sk_ipv6only &&
   496		     ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED)) {
   497			memcpy(daaddr, &sk->sk_daddr, 4);
   498		} else {
   499			memcpy(daaddr, sk->sk_v6_daddr.in6_u.u6_addr8, 16);
   500		}
   501	
   502		/* get the l2t index */
   503		dst = sk_dst_get(sk);
   504		if (!dst) {
   505			pr_err("DST entry not found\n");
   506			goto out2;
   507		}
   508		n = dst_neigh_lookup(dst, daaddr);
   509		if (!n || !n->dev) {
   510			pr_err("neighbour not found\n");
   511			dst_release(dst);
   512			goto out2;
   513		}
   514		tx_info->l2te  = cxgb4_l2t_get(adap->l2t, n, n->dev, 0);
   515	
   516		neigh_release(n);
   517		dst_release(dst);
   518	
   519		if (!tx_info->l2te) {
   520			pr_err("l2t entry not found\n");
   521			goto out2;
   522		}
   523	
   524		tx_ctx->chcr_info = tx_info;
   525	
   526		/* create a filter and call cxgb4_l2t_send to send the packet out, which
   527		 * will take care of updating l2t entry in hw if not already done.
   528		 */
   529		ret = chcr_setup_connection(sk, tx_info);
   530		if (ret)
   531			goto out2;
   532	
   533		/* Driver shouldn't be removed until any single connection exists */
   534		if (!try_module_get(THIS_MODULE)) {
   535			ret = -EINVAL;
   536			goto out2;
   537		}
   538	
   539		atomic64_inc(&adap->chcr_stats.ktls_tx_connection_open);
   540		return 0;
   541	out2:
   542		kvfree(tx_info);
   543	out:
   544		atomic64_inc(&adap->chcr_stats.ktls_tx_connection_fail);
   545		return ret;
   546	}
   547	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ