All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Nick Garlis <nickgarlis@gmail.com>
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org
Subject: Re: [PATCH v2] netfilter: nft_ct: reject ambiguous conntrack expressions in inet tables
Date: Wed, 3 Sep 2025 12:13:38 +0200	[thread overview]
Message-ID: <aLgUyGSwIBjFPh82@strlen.de> (raw)
In-Reply-To: <CA+jwDR=zv++WiiGXTjp3pMrev2UPxx9KY1Y-bCFxDbOV7uvjbQ@mail.gmail.com>

Nick Garlis <nickgarlis@gmail.com> wrote:
> Florian Westphal <fw@strlen.de> wrote:
> > Thats a userspace bug; userspace that makes use of NFT_CT_SRC/DST must
> > provide the dependency.
> 
> Yes I guess that makes sense, garbage in, garbage out. I was just used
> to seeing some kind of errno being returned from any other invalid input
> and I assumed that it might have been a bug in the validation.
> 
> > But why?  As far as I can see nothing is broken.
> 
> Honestly, I am not really sure whether it is an issue or not and this
> was mostly driven by the assumption that the kernel shouldn't trust the
> userspace to properly validate its input.

Its simply not possible to validate it in kernel.

Consider e.g. 'tcp dort 80'.  nftables will insert the 'its tcp' check.

But userspace can also do
'meta l4proto { 6, 17, 132} th dport { 22, 23, 80}'.

The 'read 2 bytes from start of transport header' is the same.
So kernel cannot 'force' anything.

It will make sure that 2 bytes could be read from the given
offset.  But it can't make sure that those bytes have a particular
meaning (port for instance).

> There is probably no strong enough reason to. Was the decision to not
> force dependencies intentional or something that was left as a TODO?

Its fully intentional, see above example.

> Thanks for taking the time to explain. Let me know if you'd like any
> more info about this or another patch involving nft_ctx instead.
> Otherwise, I’m fine leaving this here.

You could submit a patch for nftables userspace to no longer
emit NFT_CT_SRC/DST, I think there is no need to support kernels < 4.17
anymore.

  reply	other threads:[~2025-09-03 10:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  6:50 [PATCH] netfilter: nft_ct: reject ambiguous conntrack expressions in inet tables Nikolaos Gkarlis
2025-08-29 15:08 ` Florian Westphal
2025-08-29 21:59   ` Nick Garlis
2025-09-02 21:54     ` [PATCH v2] " Nikolaos Gkarlis
2025-09-02 22:21       ` Florian Westphal
2025-09-03  9:12         ` Nick Garlis
2025-09-03 10:13           ` Florian Westphal [this message]
2025-09-03 10:34             ` Pablo Neira Ayuso
2025-09-03 11:51               ` Nikolaos Gkarlis
2025-09-03 10:31       ` Pablo Neira Ayuso
2025-09-03 13:18       ` kernel test robot
2025-09-03 17:47       ` [syzbot ci] " syzbot ci
2025-09-03 17:56       ` [PATCH v2] " kernel test robot

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=aLgUyGSwIBjFPh82@strlen.de \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nickgarlis@gmail.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 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.