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:   Sun, 19 Jul 2020 17:14:19 +0800
From:   kernel test robot <lkp@...el.com>
To:     wenxu@...oud.cn, fw@...len.de, xiyou.wangcong@...il.com
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        netdev@...r.kernel.org
Subject: Re: [PATCH net v2] net/sched: act_ct: fix restore the qdisc_skb_cb
 after defrag

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]

url:    https://github.com/0day-ci/linux/commits/wenxu-ucloud-cn/net-sched-act_ct-fix-restore-the-qdisc_skb_cb-after-defrag/20200719-093537
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 2ccb0161a0e9eb06f538557d38987e436fc39b8d
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ed6b578040a85977026c93bf4188f996148f3218)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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/sched/act_ct.c:939:6: warning: variable 'defrag' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (clear) {
               ^~~~~
   net/sched/act_ct.c:1026:6: note: uninitialized use occurs here
           if (defrag)
               ^~~~~~
   net/sched/act_ct.c:939:2: note: remove the 'if' if its condition is always false
           if (clear) {
           ^~~~~~~~~~~~
   net/sched/act_ct.c:926:13: note: initialize the variable 'defrag' to silence this warning
           bool defrag;
                      ^
                       = 0
   1 warning generated.

vim +939 net/sched/act_ct.c

b57dc7c13ea90e Paul Blakey 2019-07-09   912  
b57dc7c13ea90e Paul Blakey 2019-07-09   913  static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a,
b57dc7c13ea90e Paul Blakey 2019-07-09   914  		      struct tcf_result *res)
b57dc7c13ea90e Paul Blakey 2019-07-09   915  {
b57dc7c13ea90e Paul Blakey 2019-07-09   916  	struct net *net = dev_net(skb->dev);
b57dc7c13ea90e Paul Blakey 2019-07-09   917  	bool cached, commit, clear, force;
b57dc7c13ea90e Paul Blakey 2019-07-09   918  	enum ip_conntrack_info ctinfo;
b57dc7c13ea90e Paul Blakey 2019-07-09   919  	struct tcf_ct *c = to_ct(a);
b57dc7c13ea90e Paul Blakey 2019-07-09   920  	struct nf_conn *tmpl = NULL;
b57dc7c13ea90e Paul Blakey 2019-07-09   921  	struct nf_hook_state state;
b57dc7c13ea90e Paul Blakey 2019-07-09   922  	int nh_ofs, err, retval;
b57dc7c13ea90e Paul Blakey 2019-07-09   923  	struct tcf_ct_params *p;
46475bb20f4ba0 Paul Blakey 2020-03-03   924  	bool skip_add = false;
b57dc7c13ea90e Paul Blakey 2019-07-09   925  	struct nf_conn *ct;
7e9055f6e78f92 wenxu       2020-07-19   926  	bool defrag;
b57dc7c13ea90e Paul Blakey 2019-07-09   927  	u8 family;
b57dc7c13ea90e Paul Blakey 2019-07-09   928  
b57dc7c13ea90e Paul Blakey 2019-07-09   929  	p = rcu_dereference_bh(c->params);
b57dc7c13ea90e Paul Blakey 2019-07-09   930  
b57dc7c13ea90e Paul Blakey 2019-07-09   931  	retval = READ_ONCE(c->tcf_action);
b57dc7c13ea90e Paul Blakey 2019-07-09   932  	commit = p->ct_action & TCA_CT_ACT_COMMIT;
b57dc7c13ea90e Paul Blakey 2019-07-09   933  	clear = p->ct_action & TCA_CT_ACT_CLEAR;
b57dc7c13ea90e Paul Blakey 2019-07-09   934  	force = p->ct_action & TCA_CT_ACT_FORCE;
b57dc7c13ea90e Paul Blakey 2019-07-09   935  	tmpl = p->tmpl;
b57dc7c13ea90e Paul Blakey 2019-07-09   936  
8367b3ab6e9a26 wenxu       2020-07-04   937  	tcf_lastuse_update(&c->tcf_tm);
8367b3ab6e9a26 wenxu       2020-07-04   938  
b57dc7c13ea90e Paul Blakey 2019-07-09  @939  	if (clear) {
b57dc7c13ea90e Paul Blakey 2019-07-09   940  		ct = nf_ct_get(skb, &ctinfo);
b57dc7c13ea90e Paul Blakey 2019-07-09   941  		if (ct) {
b57dc7c13ea90e Paul Blakey 2019-07-09   942  			nf_conntrack_put(&ct->ct_general);
b57dc7c13ea90e Paul Blakey 2019-07-09   943  			nf_ct_set(skb, NULL, IP_CT_UNTRACKED);
b57dc7c13ea90e Paul Blakey 2019-07-09   944  		}
b57dc7c13ea90e Paul Blakey 2019-07-09   945  
b57dc7c13ea90e Paul Blakey 2019-07-09   946  		goto out;
b57dc7c13ea90e Paul Blakey 2019-07-09   947  	}
b57dc7c13ea90e Paul Blakey 2019-07-09   948  
b57dc7c13ea90e Paul Blakey 2019-07-09   949  	family = tcf_ct_skb_nf_family(skb);
b57dc7c13ea90e Paul Blakey 2019-07-09   950  	if (family == NFPROTO_UNSPEC)
b57dc7c13ea90e Paul Blakey 2019-07-09   951  		goto drop;
b57dc7c13ea90e Paul Blakey 2019-07-09   952  
b57dc7c13ea90e Paul Blakey 2019-07-09   953  	/* The conntrack module expects to be working at L3.
b57dc7c13ea90e Paul Blakey 2019-07-09   954  	 * We also try to pull the IPv4/6 header to linear area
b57dc7c13ea90e Paul Blakey 2019-07-09   955  	 */
b57dc7c13ea90e Paul Blakey 2019-07-09   956  	nh_ofs = skb_network_offset(skb);
b57dc7c13ea90e Paul Blakey 2019-07-09   957  	skb_pull_rcsum(skb, nh_ofs);
7e9055f6e78f92 wenxu       2020-07-19   958  	err = tcf_ct_handle_fragments(net, skb, family, p->zone, &defrag);
b57dc7c13ea90e Paul Blakey 2019-07-09   959  	if (err == -EINPROGRESS) {
b57dc7c13ea90e Paul Blakey 2019-07-09   960  		retval = TC_ACT_STOLEN;
b57dc7c13ea90e Paul Blakey 2019-07-09   961  		goto out;
b57dc7c13ea90e Paul Blakey 2019-07-09   962  	}
b57dc7c13ea90e Paul Blakey 2019-07-09   963  	if (err)
b57dc7c13ea90e Paul Blakey 2019-07-09   964  		goto drop;
b57dc7c13ea90e Paul Blakey 2019-07-09   965  
b57dc7c13ea90e Paul Blakey 2019-07-09   966  	err = tcf_ct_skb_network_trim(skb, family);
b57dc7c13ea90e Paul Blakey 2019-07-09   967  	if (err)
b57dc7c13ea90e Paul Blakey 2019-07-09   968  		goto drop;
b57dc7c13ea90e Paul Blakey 2019-07-09   969  
b57dc7c13ea90e Paul Blakey 2019-07-09   970  	/* If we are recirculating packets to match on ct fields and
b57dc7c13ea90e Paul Blakey 2019-07-09   971  	 * committing with a separate ct action, then we don't need to
b57dc7c13ea90e Paul Blakey 2019-07-09   972  	 * actually run the packet through conntrack twice unless it's for a
b57dc7c13ea90e Paul Blakey 2019-07-09   973  	 * different zone.
b57dc7c13ea90e Paul Blakey 2019-07-09   974  	 */
b57dc7c13ea90e Paul Blakey 2019-07-09   975  	cached = tcf_ct_skb_nfct_cached(net, skb, p->zone, force);
b57dc7c13ea90e Paul Blakey 2019-07-09   976  	if (!cached) {
46475bb20f4ba0 Paul Blakey 2020-03-03   977  		if (!commit && tcf_ct_flow_table_lookup(p, skb, family)) {
46475bb20f4ba0 Paul Blakey 2020-03-03   978  			skip_add = true;
46475bb20f4ba0 Paul Blakey 2020-03-03   979  			goto do_nat;
46475bb20f4ba0 Paul Blakey 2020-03-03   980  		}
46475bb20f4ba0 Paul Blakey 2020-03-03   981  
b57dc7c13ea90e Paul Blakey 2019-07-09   982  		/* Associate skb with specified zone. */
b57dc7c13ea90e Paul Blakey 2019-07-09   983  		if (tmpl) {
b57dc7c13ea90e Paul Blakey 2019-07-09   984  			ct = nf_ct_get(skb, &ctinfo);
b57dc7c13ea90e Paul Blakey 2019-07-09   985  			if (skb_nfct(skb))
b57dc7c13ea90e Paul Blakey 2019-07-09   986  				nf_conntrack_put(skb_nfct(skb));
b57dc7c13ea90e Paul Blakey 2019-07-09   987  			nf_conntrack_get(&tmpl->ct_general);
b57dc7c13ea90e Paul Blakey 2019-07-09   988  			nf_ct_set(skb, tmpl, IP_CT_NEW);
b57dc7c13ea90e Paul Blakey 2019-07-09   989  		}
b57dc7c13ea90e Paul Blakey 2019-07-09   990  
b57dc7c13ea90e Paul Blakey 2019-07-09   991  		state.hook = NF_INET_PRE_ROUTING;
b57dc7c13ea90e Paul Blakey 2019-07-09   992  		state.net = net;
b57dc7c13ea90e Paul Blakey 2019-07-09   993  		state.pf = family;
b57dc7c13ea90e Paul Blakey 2019-07-09   994  		err = nf_conntrack_in(skb, &state);
b57dc7c13ea90e Paul Blakey 2019-07-09   995  		if (err != NF_ACCEPT)
b57dc7c13ea90e Paul Blakey 2019-07-09   996  			goto out_push;
b57dc7c13ea90e Paul Blakey 2019-07-09   997  	}
b57dc7c13ea90e Paul Blakey 2019-07-09   998  
46475bb20f4ba0 Paul Blakey 2020-03-03   999  do_nat:
b57dc7c13ea90e Paul Blakey 2019-07-09  1000  	ct = nf_ct_get(skb, &ctinfo);
b57dc7c13ea90e Paul Blakey 2019-07-09  1001  	if (!ct)
b57dc7c13ea90e Paul Blakey 2019-07-09  1002  		goto out_push;
b57dc7c13ea90e Paul Blakey 2019-07-09  1003  	nf_ct_deliver_cached_events(ct);
b57dc7c13ea90e Paul Blakey 2019-07-09  1004  
b57dc7c13ea90e Paul Blakey 2019-07-09  1005  	err = tcf_ct_act_nat(skb, ct, ctinfo, p->ct_action, &p->range, commit);
b57dc7c13ea90e Paul Blakey 2019-07-09  1006  	if (err != NF_ACCEPT)
b57dc7c13ea90e Paul Blakey 2019-07-09  1007  		goto drop;
b57dc7c13ea90e Paul Blakey 2019-07-09  1008  
b57dc7c13ea90e Paul Blakey 2019-07-09  1009  	if (commit) {
b57dc7c13ea90e Paul Blakey 2019-07-09  1010  		tcf_ct_act_set_mark(ct, p->mark, p->mark_mask);
b57dc7c13ea90e Paul Blakey 2019-07-09  1011  		tcf_ct_act_set_labels(ct, p->labels, p->labels_mask);
b57dc7c13ea90e Paul Blakey 2019-07-09  1012  
b57dc7c13ea90e Paul Blakey 2019-07-09  1013  		/* This will take care of sending queued events
b57dc7c13ea90e Paul Blakey 2019-07-09  1014  		 * even if the connection is already confirmed.
b57dc7c13ea90e Paul Blakey 2019-07-09  1015  		 */
b57dc7c13ea90e Paul Blakey 2019-07-09  1016  		nf_conntrack_confirm(skb);
46475bb20f4ba0 Paul Blakey 2020-03-03  1017  	} else if (!skip_add) {
64ff70b80fd403 Paul Blakey 2020-03-03  1018  		tcf_ct_flow_table_process_conn(p->ct_ft, ct, ctinfo);
46475bb20f4ba0 Paul Blakey 2020-03-03  1019  	}
64ff70b80fd403 Paul Blakey 2020-03-03  1020  
b57dc7c13ea90e Paul Blakey 2019-07-09  1021  out_push:
b57dc7c13ea90e Paul Blakey 2019-07-09  1022  	skb_push_rcsum(skb, nh_ofs);
b57dc7c13ea90e Paul Blakey 2019-07-09  1023  
b57dc7c13ea90e Paul Blakey 2019-07-09  1024  out:
5e1ad95b630e65 Vlad Buslov 2019-10-30  1025  	tcf_action_update_bstats(&c->common, skb);
7e9055f6e78f92 wenxu       2020-07-19  1026  	if (defrag)
7e9055f6e78f92 wenxu       2020-07-19  1027  		qdisc_skb_cb(skb)->pkt_len = skb->len;
b57dc7c13ea90e Paul Blakey 2019-07-09  1028  	return retval;
b57dc7c13ea90e Paul Blakey 2019-07-09  1029  
b57dc7c13ea90e Paul Blakey 2019-07-09  1030  drop:
26b537a88ca5b7 Vlad Buslov 2019-10-30  1031  	tcf_action_inc_drop_qstats(&c->common);
b57dc7c13ea90e Paul Blakey 2019-07-09  1032  	return TC_ACT_SHOT;
b57dc7c13ea90e Paul Blakey 2019-07-09  1033  }
b57dc7c13ea90e Paul Blakey 2019-07-09  1034  

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ