All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com,
	simon.horman@corigine.com
Subject: Re: [PATCH net-next v4 3/5] net/sched: act_pedit: check static offsets a priori
Date: Fri, 21 Apr 2023 08:15:36 -0700	[thread overview]
Message-ID: <20230421081536.656febc3@kernel.org> (raw)
In-Reply-To: <6297e31c-2f0b-a364-ca5c-d5d02b640466@mojatatu.com>

On Fri, 21 Apr 2023 12:12:54 -0300 Pedro Tammela wrote:
> On 20/04/2023 23:41, Jakub Kicinski wrote:
> > 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.  
> 
> The code uses 'tkey->offmask' as a check for static offsets vs packet 
> derived offsets, which have different handling.
> By checking the static offsets at init we can move the datapath
> 'offset % 4' check for the packet derived offsets only.
> 
> Note that this change only affects the offsets defined in 'tkey->off', 
> the 'at' offset logic stays the same.
> My intention was to keep the code semantically the same.
> Did I miss anything?

You are now erroring out if the static offset is not divisible by 4,
and technically it was possible to construct a case where that'd work
previously - if static offset was 2 and we load another 2 from the
packet, no?

If so it needs to be mentioned in the commit msg.

  reply	other threads:[~2023-04-21 15:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 23:43 [PATCH net-next v4 0/5] net/sched: act_pedit: minor improvements Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 1/5] net/sched: act_pedit: simplify 'ex' key parsing error propagation Pedro Tammela
2023-04-19  9:37   ` Simon Horman
2023-04-21  2:33   ` Jakub Kicinski
2023-04-18 23:43 ` [PATCH net-next v4 2/5] net/sched: act_pedit: use extack in 'ex' parsing errors Pedro Tammela
2023-04-19  9:39   ` Simon Horman
2023-04-21  2:36   ` Jakub Kicinski
2023-04-18 23:43 ` [PATCH net-next v4 3/5] net/sched: act_pedit: check static offsets a priori Pedro Tammela
2023-04-21  2:41   ` Jakub Kicinski
2023-04-21 15:12     ` Pedro Tammela
2023-04-21 15:15       ` Jakub Kicinski [this message]
2023-04-21 16:10         ` Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 4/5] net/sched: act_pedit: remove extra check for key type Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 5/5] net/sched: act_pedit: rate limit datapath messages Pedro Tammela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230421081536.656febc3@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@mojatatu.com \
    --cc=simon.horman@corigine.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.