From: netdev-bot+sashiko@kernel.org
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg
Subject: Re: [PATCH net-next 07/15] netfilter: nft_ct: validate timeout object protocol
Date: Tue, 24 Nov 2026 14:39:37 +0000 [thread overview]
Message-ID: <179553117713.3135.14906437423367847166@kernel.org> (raw)
In-Reply-To: <20261123135726.3940688-8-pablo@netfilter.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Moving nft_ct_helper_obj_eval() onto nft_ct_get_safe() adds a
new `l4proto != pkt->tprot` rejection to the conntrack helper object…
- [Low] The changelog credits the original author under a different name
from the Signed-off-by: the body says "Based on original patch from…
--
netfilter: nft_ct: validate timeout object protocol
This adds nft_ct_get_safe(). It returns the conntrack entry only if the
entry is unconfirmed, is not a template, and both pkt->tprot and the
conntrack tuple protocol match the expected L4 protocol.
nft_ct_timeout_obj_eval() and nft_ct_helper_obj_eval() now use it. A
timeout object therefore can no longer be attached to an entry of a
different protocol.
> Based on original patch from Kyle Zheng, who also authored this commit
> message.
>
> LLM review complains about _ext_add() races with cloned unconfirmed skbs.
> conntrack never supported this; fixing it is hard and out of scope for this
> change.
>
> Fixes: 0434ccdcf883 ("netfilter: nf_tables: rework ct timeout set support")
> Signed-off-by: Kyle Zeng <kylebot@openai.com>
[Severity: Low]
This isn't a bug, but the body credits "Kyle Zheng" and the Signed-off-by:
tag says "Kyle Zeng". Should these match?
The LLM review paragraph mentions a known, unfixed race in
nf_ct_timeout_ext_add() on unconfirmed conntracks reached through cloned
skbs. It doesn't say what the impact is. Could it describe the
consequence, so stable backporters have something to act on?
> diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
> index 58846bc405b7e..a19a839a0fc0b 100644
> --- a/net/netfilter/nft_ct.c
> +++ b/net/netfilter/nft_ct.c
> @@ -839,6 +839,34 @@ static struct nft_expr_type nft_notrack_type __read_mostly = {
> .owner = THIS_MODULE,
> };
>
[ ... ]
> +static struct nf_conn *nft_ct_get_safe(const struct nft_pktinfo *pkt, u8 l4proto)
> +{
> + enum ip_conntrack_info ctinfo;
> + struct nf_conn *ct;
> +
> + ct = nf_ct_get(pkt->skb, &ctinfo);
> + if (!ct || l4proto != pkt->tprot)
> + return NULL;
> +
> + if (l4proto != nf_ct_protonum(ct))
> + return NULL;
[ ... ]
> @@ -1115,14 +1141,12 @@ static void nft_ct_helper_obj_eval(struct nft_object *obj,
> const struct nft_pktinfo *pkt)
> {
> const struct nft_ct_helper_obj *priv = nft_obj_data(obj);
> - struct nf_conn *ct = (struct nf_conn *)skb_nfct(pkt->skb);
> struct nf_conntrack_helper *to_assign = NULL;
> struct nf_conn_help *help;
> + struct nf_conn *ct;
>
> - if (!ct ||
> - nf_ct_is_confirmed(ct) ||
> - nf_ct_is_template(ct) ||
> - priv->l4proto != nf_ct_protonum(ct))
> + ct = nft_ct_get_safe(pkt, priv->l4proto);
> + if (!ct)
> return;
[Severity: Medium]
Does this make the helper object path stricter than before?
The old check in nft_ct_helper_obj_eval() only compared priv->l4proto with
nf_ct_protonum(ct). It never looked at packet metadata. Through
nft_ct_get_safe() it now also requires:
if (!ct || l4proto != pkt->tprot)
return NULL;
pkt->tprot and the conntrack tuple protocol are not always the same. For
IPv6, nft_set_pktinfo_ipv6() calls ipv6_find_hdr() with IP6_FH_F_AUTH:
unsigned int flags = IP6_FH_F_AUTH;
...
protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags);
...
pkt->tprot = protohdr;
This stops at the AH header and reports IPPROTO_AH. Conntrack's
ipv6_get_l4proto() uses ipv6_skip_exthdr() instead, which skips AH and
records the inner transport protocol:
protoff = ipv6_skip_exthdr(skb, extoff, &nexthdr, &frag_off);
For an IPv6 TCP flow protected by AH, nf_ct_protonum(ct) is IPPROTO_TCP
and pkt->tprot is IPPROTO_AH. No priv->l4proto value passes both checks.
Would "ct helper set" with an ftp or sip helper object then silently stop
attaching the helper for such flows?
The two values can also differ in two other cases. One is when the nft
pktinfo parse fails and nft_set_pktinfo_unspec() leaves tprot at 0. The
other is after a header rewrite.
The commit message says:
This mirrors validation by named timeout policies and
nftables conntrack helper objects.
It doesn't mention that the helper object path itself gains the pkt->tprot
check.
The nf_ct_protonum() check alone is enough to prevent the out-of-bounds
read, and the helper path never had that problem. Could the pkt->tprot
comparison stay in nft_ct_timeout_obj_eval() only? The helper object path
would then keep its previous behaviour.
>
> switch (nf_ct_l3num(ct)) {
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123135726.3940688-2-pablo%40netfilter.org
next prev parent reply other threads:[~2026-11-24 14:39 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 13:57 [PATCH net-next,v2 00/15] Netfilter updates for net-next Pablo Neira Ayuso
2026-11-23 13:57 ` [PATCH net-next 01/15] netfilter: conntrack: prevent nf_conntrack_buckets race condition Pablo Neira Ayuso
2026-11-23 14:02 ` netdev-bot+sinfo
2026-11-23 14:17 ` Pablo Neira Ayuso
2026-11-23 13:57 ` [PATCH net-next 02/15] netfilter: conntrack: validate skb->_nfct and packet headers Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 03/15] netfilter: conntrack: refactor helper call logic in nf_confirm() Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 04/15] netfilter: conntrack: verify L4 protocol before calling helper Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 05/15] netfilter: conntrack: replace open-coded helper invocation Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 06/15] netfilter: conntrack: harden helper invocation with tuple revalidation Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 07/15] netfilter: nft_ct: validate timeout object protocol Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko [this message]
2026-11-23 13:57 ` [PATCH net-next 08/15] netfilter: nft_synproxy: only handle pure SYN and ACK packets Pablo Neira Ayuso
2026-11-23 13:57 ` [PATCH net-next 09/15] netfilter: nft_ct: validate hook and priority for ct zone set Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 10/15] rhashtable: Add rhashtable_flush_and_free helper Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 11/15] netfilter: ipset: add rhashtable boilerplate stubs Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 12/15] netfilter: ipset: replace internal hash table with rhashtable Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 13/15] netfilter: ipset: also report mem size for cidr storage to userspace Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 14/15] netfilter: ipset: re-add IP_SET_HASH_WITH_MULTI support Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-23 13:57 ` [PATCH net-next 15/15] netfilter: ipset: re-add forceadd support Pablo Neira Ayuso
2026-11-24 14:39 ` netdev-bot+sashiko
2026-11-24 12:27 ` [PATCH net-next,v2 00/15] Netfilter updates for net-next Paolo Abeni
2026-11-24 12:36 ` Florian Westphal
2026-11-24 13:47 ` Paolo Abeni
2026-11-24 13:33 ` Pablo Neira Ayuso
2026-11-24 13:43 ` Paolo Abeni
-- strict thread matches above, loose matches on Subject: below --
2026-11-23 13:54 [PATCH net-next " Pablo Neira Ayuso
2026-11-23 13:54 ` [PATCH net-next 07/15] netfilter: nft_ct: validate timeout object protocol Pablo Neira Ayuso
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=179553117713.3135.14906437423367847166@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.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