All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avinash Duduskar <avinash.duduskar@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Phil Sutter <phil@nwl.cc>, Florian Westphal <fw@strlen.de>,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] datatype: accept a numeric cgroupsv2 id on input
Date: Wed, 29 Jul 2026 01:49:09 +0530	[thread overview]
Message-ID: <20260728201909.1773000-1-avinash.duduskar@gmail.com> (raw)
In-Reply-To: <amkAJuVZmpGy7pvY@chamomile>

On Tue, Jul 28, 2026 at 09:16:54PM +0200, Pablo Neira Ayuso wrote:
> On Tue, Jul 28, 2026 at 06:19:25PM +0200, Phil Sutter wrote:
> > So with nft printing non-existent cgroup names using PRIu64 and parsing
> > code still performs the path lookup first, what is all the fuss about
> > non-decimal number input?
>
> They claim they cannot delete entries via numeric value, it seems.

Correct, the earlier example proves it.

A typo'd id can collide with a live inode and then list as another
cgroup's path. Fine with dropping the checks if you prefer.

> > Is this AI output?

Yes. Point taken on the length.

> > Can't this just be something like (untested):
> > [...]

Yes. v2, keeping the two checks:

	if (stat(cgroupv2_path, &st) == 0) {
		ino = st.st_ino;
	} else if (isdigit((unsigned char)sym->identifier[0])) {
		char *end;

		errno = 0;
		ino = strtoull(sym->identifier, &end, 10);
		if (*end != '\0' || errno == ERANGE)
			return error(&sym->location, "invalid cgroupv2 id");
	} else {
		return error(&sym->location, "cgroupv2 path fails: %s",
			     strerror(errno));
	}

> > out=$($NFT -j list table t)
> > [...]
> > $NFT -j -f - <<< "$out"

Will do.

> > Hmm. Looks like we'll have to update all .json-nft files if we ever bump
> > json_schema_version. Maybe json_pretty should drop that array elem, we
> > merely keep asserting it exists and that could be done by a dedicated
> > shell test.

Can do that as a follow-up if wanted.

Avi

  reply	other threads:[~2026-07-28 20:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27  8:24 [PATCH nft] datatype: accept a numeric cgroupsv2 id on input Avinash Duduskar
2026-07-28 16:19 ` Phil Sutter
2026-07-28 19:16   ` Pablo Neira Ayuso
2026-07-28 20:19     ` Avinash Duduskar [this message]
2026-07-28 20:31       ` Pablo Neira Ayuso
2026-07-28 20:55         ` Avinash Duduskar

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=20260728201909.1773000-1-avinash.duduskar@gmail.com \
    --to=avinash.duduskar@gmail.com \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    /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.