Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Taylor Bates <tmbates12@gmail.com>
Cc: Donald Hunter <donald.hunter@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Jiri Pirko <jiri@resnulli.us>,
	Stanislav Fomichev <sdf@fomichev.me>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/4] tools: ynl: reject zero-length attributes instead of looping forever
Date: Thu, 10 Sep 2026 19:25:09 -0700	[thread overview]
Message-ID: <20260910192509.73207bef@kernel.org> (raw)
In-Reply-To: <20260908-ynl-robustness-v1-2-f255214c0f30@gmail.com>

On Tue, 08 Sep 2026 19:45:08 -0400 Taylor Bates wrote:
> The BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS payload the kernel then sends:
> 
>   34 00 02 00   MDBA_ROUTER, len 52
>   30 00 01 00   MDBA_ROUTER_PORT, len 48
>   08 00 00 00   bare ifindex 8, written by nla_put_nohdr()
>   08 00 01 00   MDBA_ROUTER_PATTR_TIMER, len 8
>   00 00 00 00   timer value, 0 for a permanent router

Sounds like the family outputs garbage and should not be supported.

>          while offset < len(msg):
>              attr = NlAttr(msg, offset)
> +            if attr.full_len < 4:
> +                raise YnlException(
> +                    f'Malformed attribute at offset {offset}: '
> +                    f'length {attr.payload_len} is shorter than the header')
>              offset += attr.full_len
>              self.attrs.append(attr)

Not sure i follow you logic. If anything I'd have written:

	if len(msg) - offset < 4:
		raise ...short, not overly verbose msg")

? But again, if the kernel is not outputting valid attrs that's not
YNL's problem. 

  reply	other threads:[~2026-09-11  2:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 23:45 [PATCH net-next 0/4] netlink: fix ynl spec tooling robustness bugs Taylor Bates
2026-09-08 23:45 ` [PATCH net-next 1/4] netlink: specs: fix duplicate if/then keys in netlink-raw schema Taylor Bates
2026-09-08 23:45 ` [PATCH net-next 2/4] tools: ynl: reject zero-length attributes instead of looping forever Taylor Bates
2026-09-11  2:25   ` Jakub Kicinski [this message]
2026-09-08 23:45 ` [PATCH net-next 3/4] tools: ynl: stop find_kernel_root() spinning at the filesystem root Taylor Bates
2026-09-11  2:26   ` Jakub Kicinski
2026-09-08 23:45 ` [PATCH net-next 4/4] tools: ynl: fix uapi generation for anonymous enums with documented entries Taylor Bates
2026-09-11  2:27   ` Jakub Kicinski
2026-09-11  2:23 ` [PATCH net-next 0/4] netlink: fix ynl spec tooling robustness bugs Jakub Kicinski
2026-09-12 17:35   ` tmbates12

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=20260910192509.73207bef@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=tmbates12@gmail.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