From: netdev-bot+sashiko@kernel.org
To: i.maximets@ovn.org
Cc: netdev@vger.kernel.org, pablo@netfilter.org, fw@strlen.de,
phil@nwl.cc, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
aconole@redhat.com, echaudro@redhat.com, jhs@mojatatu.com,
jiri@resnulli.us, lucien.xin@gmail.com,
marcelo.leitner@gmail.com, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org, linux-kernel@vger.kernel.org,
dev@openvswitch.org, stable@vger.kernel.org
Subject: Re: [PATCH net 3/6] net: openvswitch: conntrack: fix helper UAF due to extensions realloc
Date: Tue, 22 Sep 2026 14:58:39 +0000 [thread overview]
Message-ID: <179008911935.2160803.14933035266780079917@kernel.org> (raw)
In-Reply-To: <20260921145655.3167436-4-i.maximets@ovn.org>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] Inaccurate newly added comment in __ovs_ct_lookup()
(net/openvswitch/conntrack.c:820-826).
Pre-existing issues:
- [Low] Concern (INVALIDATED by later patch in the same series): the
identical helper/expectation use-after-free was claimed to remain…
--
net: openvswitch: conntrack: fix helper UAF due to extensions realloc
This moves the nf_ct_helper() call for unconfirmed connections out of
__ovs_ct_lookup() and into ovs_ct_commit(), after the mark, labels and
act_ct extensions have been added, so that a later extension realloc
cannot invalidate the expectation list pointer wired up by the helper.
No Link: tags are present in the commit header.
> diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
> index c20f096eef40e..d3326edcabf76 100644
> --- a/net/openvswitch/conntrack.c
> +++ b/net/openvswitch/conntrack.c
> @@ -817,11 +817,14 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
> }
> }
>
> - /* Call the helper only if:
> - * - nf_conntrack_in() was executed above ("!cached"), or
> - * - When committing an unconfirmed connection.
> + /* Call the helper only if nf_conntrack_in() was executed
> + * above ("!cached").
> + *
> + * For unconfirmed connections it will be called later during
> + * commit as we need to have all the other extensions allocated
> + * before the call.
> */
> - if ((nf_ct_is_confirmed(ct) ? !cached : info->commit)) {
> + if (nf_ct_is_confirmed(ct) && !cached) {
[Severity: Low]
Could this comment be made to match the condition below it? The text says
the helper is called only if nf_conntrack_in() ran above ("!cached"), but
the guard is:
if (nf_ct_is_confirmed(ct) && !cached) {
The nf_ct_is_confirmed() term isn't mentioned, which can read as if the
confirmed check were redundant.
The second half of the comment also promises that for unconfirmed
connections the helper "will be called later during commit". Isn't that
only true for the committing path? __ovs_ct_lookup() is also reached from
ovs_ct_lookup(), where info->commit is 0 and there is no nf_ct_helper()
call anywhere in that action:
net/openvswitch/conntrack.c:ovs_ct_lookup() {
...
err = __ovs_ct_lookup(net, key, info, skb);
...
}
So for an unconfirmed entry created by nf_conntrack_in() during a plain
ct() lookup action, the helper is simply never run and there is no later
commit to run it. Behaviour here is the same as before the patch (the old
nf_ct_is_confirmed(ct) ? !cached : info->commit guard skipped it too), so
this is only about the wording of the new comment.
> int err = nf_ct_helper(skb, ct, ctinfo, info->family);
>
> err = verdict_to_errno(err);
> @@ -1025,6 +1028,14 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key,
> return err;
>
> nf_conn_act_ct_ext_add(skb, ct, ctinfo);
> +
> + /* Call the helpers now. We couldn't do this before as
> + * all the extensions must be allocated before the call.
> + */
> + err = nf_ct_helper(skb, ct, ctinfo, info->family);
> + err = verdict_to_errno(err);
> + if (err)
> + return err;
[Severity: Low]
This isn't a bug introduced by this patch, but the same ordering problem
exists in the other in-tree caller of nf_ct_helper(), tcf_ct_act() in
net/sched/act_ct.c, which at this commit runs the helper before the
extension add for unconfirmed entries:
net/sched/act_ct.c:tcf_ct_act() {
...
if (nf_ct_is_confirmed(ct) ? (!cached && !skip_add) : commit) {
err = nf_ct_helper(skb, ct, ctinfo, family);
...
if (commit) {
tcf_ct_act_set_mark(...);
tcf_ct_act_set_labels(...);
if (!nf_ct_is_confirmed(ct))
nf_conn_act_ct_ext_add(skb, ct, ctinfo);
...
}
nf_conn_act_ct_ext_add() -> nf_ct_ext_add() -> krealloc() can move ct->ext,
leaving exp->lnode.pprev (which points into nf_conn_help inside the old
ext blob, stored by nf_ct_expect_insert() via
hlist_add_head_rcu(&exp->lnode, &master_help->expectations)) dangling.
Note this is already handled by the later patch in the same series,
"net/sched: act_ct: fix helper UAF due to extensions realloc", which moves
the tcf_ct_act() helper call below the nf_conn_act_ct_ext_add() block, so
no extension-adding call remains after the helper in either caller by the
end of the series. Mentioned here only for completeness.
> } else if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) &&
> labels_nonzero(&info->labels.mask)) {
> err = ovs_ct_set_labels(ct, key, &info->labels.value,
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260921145655.3167436-1-i.maximets%40ovn.org
next prev parent reply other threads:[~2026-09-22 14:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 14:55 [PATCH net 0/6] ovs, net/sched: fixes for UAF after conntrack extension realloc Ilya Maximets
2026-09-21 14:55 ` [PATCH net 1/6] net: openvswitch: conntrack: avoid modifying shared unconfirmed ct entry Ilya Maximets
2026-09-22 14:58 ` netdev-bot+sashiko
2026-09-22 15:27 ` Ilya Maximets
2026-09-22 15:26 ` Aaron Conole
2026-09-21 14:55 ` [PATCH net 2/6] net: openvswitch: conntrack: remove 'add_helper' dead code Ilya Maximets
2026-09-22 14:58 ` netdev-bot+sashiko
2026-09-22 15:29 ` Ilya Maximets
2026-09-22 15:26 ` Aaron Conole
2026-09-21 14:55 ` [PATCH net 3/6] net: openvswitch: conntrack: fix helper UAF due to extensions realloc Ilya Maximets
2026-09-22 14:58 ` netdev-bot+sashiko [this message]
2026-09-22 15:43 ` Ilya Maximets
2026-09-22 15:26 ` Aaron Conole
2026-09-21 14:55 ` [PATCH net 4/6] net/sched: act_ct: avoid modifying shared unconfirmed ct entry Ilya Maximets
2026-09-22 14:58 ` netdev-bot+sashiko
2026-09-22 15:52 ` Ilya Maximets
2026-09-22 15:27 ` Aaron Conole
2026-09-22 20:42 ` Xin Long
2026-09-22 21:34 ` Jamal Hadi Salim
2026-09-21 14:55 ` [PATCH net 5/6] net/sched: act_ct: remove 'add_helper' dead code Ilya Maximets
2026-09-22 15:27 ` Aaron Conole
2026-09-22 20:43 ` Xin Long
2026-09-22 21:35 ` Jamal Hadi Salim
2026-09-21 14:55 ` [PATCH net 6/6] net/sched: act_ct: fix helper UAF due to extensions realloc Ilya Maximets
2026-09-22 14:58 ` netdev-bot+sashiko
2026-09-22 15:54 ` Ilya Maximets
2026-09-22 20:43 ` Xin Long
2026-09-22 21:36 ` Jamal Hadi Salim
2026-09-23 12:35 ` Aaron Conole
2026-09-24 1:21 ` [PATCH net 0/6] ovs, net/sched: fixes for UAF after conntrack extension realloc Jakub Kicinski
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=179008911935.2160803.14933035266780079917@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aconole@redhat.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=echaudro@redhat.com \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=i.maximets@ovn.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®