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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 26 May 2023 10:22:52 +0100
From: Max Tottenham <mtottenh@...mai.com>
To: kernel test robot <lkp@...el.com>
CC: <netdev@...r.kernel.org>, <oe-kbuild-all@...ts.linux.dev>,
        Jamal Hadi
 Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>, Jiri Pirko
	<jiri@...nulli.us>,
        Amir Vadai <amir@...ai.me>, Josh Hunt <johunt@...mai.com>
Subject: Re: [PATCH] net/sched: act_pedit: Parse L3 Header for L4 offset

On 05/26, kernel test robot wrote:
> Hi Max,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on net/main]
> [also build test ERROR on net-next/main linus/master v6.4-rc3 next-20230525]
> [cannot apply to horms-ipvs/master]
> [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#_base_tree_information ]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Max-Tottenham/net-sched-act_pedit-Parse-L3-Header-for-L4-offset/20230526-020135 
> base:   net/main
> patch link:    https://lore.kernel.org/r/20230525164741.4188115-1-mtottenh%40akamai.com 
> patch subject: [PATCH] net/sched: act_pedit: Parse L3 Header for L4 offset
> config: mips-allyesconfig https://download.01.org/0day-ci/archive/20230526/202305261541.N165u9TZ-lkp@intel.com/config )
> compiler: mips-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
>         mkdir -p ~/bin
>         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/dc60ecbe9b4432221ba2109d4ca1956f47d5c5d6 
>         git remote add linux-review https://github.com/intel-lab-lkp/linux 
>         git fetch --no-tags linux-review Max-Tottenham/net-sched-act_pedit-Parse-L3-Header-for-L4-offset/20230526-020135
>         git checkout dc60ecbe9b4432221ba2109d4ca1956f47d5c5d6
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 ~/bin/make.cross W=1 O=build_dir ARCH=mips olddefconfig
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 ~/bin/make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@...el.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202305261541.N165u9TZ-lkp@intel.com/ 
> 
> All errors (new ones prefixed by >>):
> 
>    net/sched/act_pedit.c: In function 'tcf_pedit_act':
> >> net/sched/act_pedit.c:428:17: error: 'rc' undeclared (first use in this function); did you mean 'rq'?
>      428 |                 rc = pedit_skb_hdr_offset(skb, htype, &hoffset);
>          |                 ^~
>          |                 rq
>    net/sched/act_pedit.c:428:17: note: each undeclared identifier is reported only once for each function it appears in
> 
> 
> vim +428 net/sched/act_pedit.c
> 
>    386	
>    387	TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb,
>    388					    const struct tc_action *a,
>    389					    struct tcf_result *res)
>    390	{
>    391		enum pedit_header_type htype = TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
>    392		enum pedit_cmd cmd = TCA_PEDIT_KEY_EX_CMD_SET;
>    393		struct tcf_pedit *p = to_pedit(a);
>    394		struct tcf_pedit_key_ex *tkey_ex;
>    395		struct tcf_pedit_parms *parms;
>    396		struct tc_pedit_key *tkey;
>    397		u32 max_offset;
>    398		int i;
>    399	
>    400		parms = rcu_dereference_bh(p->parms);
>    401	
>    402		max_offset = (skb_transport_header_was_set(skb) ?
>    403			      skb_transport_offset(skb) :
>    404			      skb_network_offset(skb)) +
>    405			     parms->tcfp_off_max_hint;
>    406		if (skb_ensure_writable(skb, min(skb->len, max_offset)))
>    407			goto done;
>    408	
>    409		tcf_lastuse_update(&p->tcf_tm);
>    410		tcf_action_update_bstats(&p->common, skb);
>    411	
>    412		tkey = parms->tcfp_keys;
>    413		tkey_ex = parms->tcfp_keys_ex;
>    414	
>    415		for (i = parms->tcfp_nkeys; i > 0; i--, tkey++) {
>    416			int offset = tkey->off;
>    417			int hoffset = 0;
>    418			u32 *ptr, hdata;
>    419			u32 val;
>    420	
>    421			if (tkey_ex) {
>    422				htype = tkey_ex->htype;
>    423				cmd = tkey_ex->cmd;
>    424	
>    425				tkey_ex++;
>    426			}
>    427	
>  > 428			rc = pedit_skb_hdr_offset(skb, htype, &hoffset);

Ah yep looks like I made an omission while bringing back the rate limited
error message. Will respin a V2 with the fix.

>    429			if (rc) {
>    430				pr_info_ratelimited("tc action pedit unable to extract header offset for header type (0x%x)\n", htype);
>    431				goto bad;
>    432			}
>    433	
>    434			if (tkey->offmask) {
>    435				u8 *d, _d;
>    436	
>    437				if (!offset_valid(skb, hoffset + tkey->at)) {
>    438					pr_info_ratelimited("tc action pedit 'at' offset %d out of bounds\n",
>    439							    hoffset + tkey->at);
>    440					goto bad;
>    441				}
>    442				d = skb_header_pointer(skb, hoffset + tkey->at,
>    443						       sizeof(_d), &_d);
>    444				if (!d)
>    445					goto bad;
>    446	
>    447				offset += (*d & tkey->offmask) >> tkey->shift;
>    448				if (offset % 4) {
>    449					pr_info_ratelimited("tc action pedit offset must be on 32 bit boundaries\n");
>    450					goto bad;
>    451				}
>    452			}
>    453	
>    454			if (!offset_valid(skb, hoffset + offset)) {
>    455				pr_info_ratelimited("tc action pedit offset %d out of bounds\n", hoffset + offset);
>    456				goto bad;
>    457			}
>    458	
>    459			ptr = skb_header_pointer(skb, hoffset + offset,
>    460						 sizeof(hdata), &hdata);
>    461			if (!ptr)
>    462				goto bad;
>    463			/* just do it, baby */
>    464			switch (cmd) {
>    465			case TCA_PEDIT_KEY_EX_CMD_SET:
>    466				val = tkey->val;
>    467				break;
>    468			case TCA_PEDIT_KEY_EX_CMD_ADD:
>    469				val = (*ptr + tkey->val) & ~tkey->mask;
>    470				break;
>    471			default:
>    472				pr_info_ratelimited("tc action pedit bad command (%d)\n", cmd);
>    473				goto bad;
>    474			}
>    475	
>    476			*ptr = ((*ptr & tkey->mask) ^ val);
>    477			if (ptr == &hdata)
>    478				skb_store_bits(skb, hoffset + offset, ptr, 4);
>    479		}
>    480	
>    481		goto done;
>    482	
>    483	bad:
>    484		tcf_action_inc_overlimit_qstats(&p->common);
>    485	done:
>    486		return p->tcf_action;
>    487	}
>    488	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki 

-- 
Max Tottenham | Senior Software Engineer
/(* Akamai Technologies

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ