Netdev List
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Victor Nogueira <victor@mojatatu.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, jhs@mojatatu.com, jiri@resnulli.us,
	daniel@iogearbox.net, john.fastabend@gmail.com, sdf@fomichev.me,
	martin.lau@linux.dev, ast@kernel.org, andrii@kernel.org,
	eddyz87@gmail.com, memxor@gmail.com, song@kernel.org,
	jolsa@kernel.org, emil@etsalapatis.com, vega@nebusec.ai,
	netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH net v2] net/sched: add get_fill_size callbacks for actions missing them
Date: Wed, 19 Aug 2026 16:57:03 +0100	[thread overview]
Message-ID: <20260819155703.GV265046@horms.kernel.org> (raw)
In-Reply-To: <20260816201327.2435335-1-victor@mojatatu.com>

On Sun, Aug 16, 2026 at 05:13:27PM -0300, Victor Nogueira wrote:
> Several tc actions - act_police, act_bpf, act_pedit, act_ife, act_sample,
> act_ct, act_ctinfo and act_tunnel_key among them - provide no
> get_fill_size() callback, so tcf_action_fill_size() falls back to
> tcf_action_shared_attrs_size() which does not account for the
> action-specific netlink attributes emitted inside TCA_ACT_OPTIONS by
> their dump functions.
> 
> When an RTM_NEWACTION request with NLM_F_ECHO (or an RTNLGRP_TC
> listener) creates several actions, tcf_add_notify_msg() allocates the
> echo skb from this underestimated size. When this happens, the act_api
> code fails to add all of the fields to the netlink message and, thus,
> fails to send it. Issue is that, when that happens, this failure doesn't
> stop the action instances from being added. So any user watching these
> events will be under the false impression that no actions were created at
> all.
> 
> For example, act_pedit overruns with 32 actions of four munge keys each,
> act_police with 32 policers once the optional rate/peakrate/result/avrate
> attributes are present.
> 
> To fix this, add the missing get_fill_size callbacks returning the
> worst-case size of each action's dump attributes, following the pattern
> used by act_gact/act_skbedit/act_vlan. Also widen the TCA_GACT_TM
> accounting in tcf_action_shared_attrs_size() to nla_total_size_64bit(),
> since actions dump their tcf_t with nla_put_64bit(), which may be
> preceded by an NLA_PAD attribute.
> 
> Note: We only provided fixes for the actions we reproduced this bug with
> as of today. We can send a separate hardening patch for the remaining
> actions to net-next later. The other pre-existing issues, pointed out by
> Clashiko [1], will be fixed in upcoming patches.
> 
> [1] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260810164357.1653956-1-victor%40mojatatu.com
> 
> Fixes: 4e76e75d6aba ("net sched actions: calculate add/delete event message size")
> Reported-by: Vega <vega@nebusec.ai>
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Victor Nogueira <victor@mojatatu.com>
> ---
> v1 -> v2:
> - Use tcf_lock when accessing shared bpf action fields
> - Improve commit message clarifying what the bug actually affects - Jakub
> - Make it explicit that the list of actions missing get_fill_size() is
>   not exhaustive

Reviewed-by: Simon Horman <horms@kernel.org>


      reply	other threads:[~2026-08-19 15:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16 20:13 [PATCH net v2] net/sched: add get_fill_size callbacks for actions missing them Victor Nogueira
2026-08-19 15:57 ` Simon Horman [this message]

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=20260819155703.GV265046@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=emil@etsalapatis.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kuba@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=vega@nebusec.ai \
    --cc=victor@mojatatu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox