Subject: Re: [PATCH net-next v4 3/5] net/sched: act_pedit: check static offsets a priori

From: Jakub Kicinski <[email-masked]>
Date: Thu, 20 Apr 2023 19:41:34 -0700

On Tue, 18 Apr 2023 20:43:52 -0300 Pedro Tammela wrote:
> @@ -414,12 +420,12 @@ TC_INDIRECT_SCOPE int tcf_pedit_act(struct sk_buff *skb,
>  					       sizeof(_d), &_d);
>  			if (!d)
>  				goto bad;
> -			offset += (*d & tkey->offmask) >> tkey->shift;
> -		}
>  
> -		if (offset % 4) {
> -			pr_info("tc action pedit offset must be on 32 bit boundaries\n");
> -			goto bad;
> +			offset += (*d & tkey->offmask) >> tkey->shift;

this line loads part of the offset from packet data, so it's not
exactly equivalent to the init time check. It's unlikely to be used
but I think that rejecting cur % 4 vs data patch check only is
technically a functional change, so needs to be discussed in the commit
msg.

> +			if (offset % 4) {
> +				pr_info("tc action pedit offset must be on 32 bit boundaries\n");
> +				goto bad;
> +			}