* [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema
@ 2026-09-15 1:53 Taylor Bates
2026-09-15 3:01 ` Hangbin Liu
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Taylor Bates @ 2026-09-15 1:53 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Jiri Pirko, Stanislav Fomichev
Cc: netdev, linux-kernel, Taylor Bates
Currently netlink-raw.yaml contains two if keys and two then keys in a
single mapping that enforces a "len" for "pad" members and a "len" or
"struct" for binary members.
During validation PyYAML resolves duplicate keys last-wins, so only the
binary rule survives. Pad has not been validated since commit
bf08f32c8ced ("tools/net/ynl: Add support for nested structs") added
the second if/then pair in January 2024.
None of the current specs violate this rule, but this validation should
not be parser dependent and unspecified. Strict YAML validators such as
Red Hat's VS Code YAML extension and Adrien Verge's yamllint will
reject the netlink-raw.yaml schema:
Command:
$ yamllint Documentation/netlink/netlink-raw.yaml
Output:
185:13 error duplication of key "if" in mapping (key-duplicates)
189:13 error duplication of key "then" in mapping (key-duplicates)
The following invalid netlink family spec will pass validation in the
current ynl tooling:
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
---
name: minimal-raw
doc: Minimal netlink-raw family for schema validation testing.
protocol: netlink-raw
protonum: 0
definitions:
-
name: test-struct
type: struct
members:
-
name: reserved
type: pad
# len intentionally omitted
attribute-sets: []
operations:
list: []
Signed-off-by: Taylor Bates <tmbates12@gmail.com>
---
This is a repost of patch 1 from the "netlink: fix ynl spec tooling
robustness bugs" series, reduced to this single fix as requested.
The netlink-raw spec for the Bridge VLAN family that motivated the
original series will be sent separately once this has landed.
---
Changes in v2:
- Drop patches 2/4, 3/4 and 4/4 from the series; this schema fix stands
on its own.
- Drop the Fixes tag. This is developer tooling only and is not a bug
that needs to reach stable. The offending commit is now cited in the
commit message instead.
- Link to v1: https://patch.msgid.link/20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com
To: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
To: "David S. Miller" <davem@davemloft.net>
To: Eric Dumazet <edumazet@google.com>
To: Paolo Abeni <pabeni@redhat.com>
To: Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Documentation/netlink/netlink-raw.yaml | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml
index 4c436b59a34b..18ccfe05048a 100644
--- a/Documentation/netlink/netlink-raw.yaml
+++ b/Documentation/netlink/netlink-raw.yaml
@@ -176,20 +176,23 @@ properties:
struct:
description: Name of the nested struct type.
type: string
- if:
- properties:
- type:
- const: pad
- then:
- required: [ len ]
- if:
- properties:
- type:
- const: binary
- then:
- oneOf:
- - required: [ len ]
- - required: [ struct ]
+ allOf:
+ -
+ if:
+ properties:
+ type:
+ const: pad
+ then:
+ required: [ len ]
+ -
+ if:
+ properties:
+ type:
+ const: binary
+ then:
+ oneOf:
+ - required: [ len ]
+ - required: [ struct ]
# End genetlink-legacy
attribute-sets:
---
base-commit: 043777e948807b5f335f58a0b9f5ed04bba681cf
change-id: 20260907-ynl-robustness-d62d9693cc12
Best regards,
--
Taylor Bates <tmbates12@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema
2026-09-15 1:53 [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema Taylor Bates
@ 2026-09-15 3:01 ` Hangbin Liu
2026-09-17 8:35 ` Donald Hunter
2026-09-17 14:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2026-09-15 3:01 UTC (permalink / raw)
To: Taylor Bates
Cc: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Jiri Pirko, Stanislav Fomichev,
netdev, linux-kernel
On Mon, Sep 14, 2026 at 09:53:15PM -0400, Taylor Bates wrote:
> Currently netlink-raw.yaml contains two if keys and two then keys in a
> single mapping that enforces a "len" for "pad" members and a "len" or
> "struct" for binary members.
>
> During validation PyYAML resolves duplicate keys last-wins, so only the
> binary rule survives. Pad has not been validated since commit
> bf08f32c8ced ("tools/net/ynl: Add support for nested structs") added
> the second if/then pair in January 2024.
>
> None of the current specs violate this rule, but this validation should
> not be parser dependent and unspecified. Strict YAML validators such as
> Red Hat's VS Code YAML extension and Adrien Verge's yamllint will
> reject the netlink-raw.yaml schema:
>
> Command:
> $ yamllint Documentation/netlink/netlink-raw.yaml
>
> Output:
> 185:13 error duplication of key "if" in mapping (key-duplicates)
> 189:13 error duplication of key "then" in mapping (key-duplicates)
>
> The following invalid netlink family spec will pass validation in the
> current ynl tooling:
>
> # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
> ---
> name: minimal-raw
> doc: Minimal netlink-raw family for schema validation testing.
> protocol: netlink-raw
> protonum: 0
>
> definitions:
> -
> name: test-struct
> type: struct
> members:
> -
> name: reserved
> type: pad
> # len intentionally omitted
>
> attribute-sets: []
>
> operations:
> list: []
>
> Signed-off-by: Taylor Bates <tmbates12@gmail.com>
> ---
> This is a repost of patch 1 from the "netlink: fix ynl spec tooling
> robustness bugs" series, reduced to this single fix as requested.
>
> The netlink-raw spec for the Bridge VLAN family that motivated the
> original series will be sent separately once this has landed.
> ---
> Changes in v2:
> - Drop patches 2/4, 3/4 and 4/4 from the series; this schema fix stands
> on its own.
> - Drop the Fixes tag. This is developer tooling only and is not a bug
> that needs to reach stable. The offending commit is now cited in the
> commit message instead.
> - Link to v1: https://patch.msgid.link/20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com
>
> To: Donald Hunter <donald.hunter@gmail.com>
> To: Jakub Kicinski <kuba@kernel.org>
> To: "David S. Miller" <davem@davemloft.net>
> To: Eric Dumazet <edumazet@google.com>
> To: Paolo Abeni <pabeni@redhat.com>
> To: Simon Horman <horms@kernel.org>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> Documentation/netlink/netlink-raw.yaml | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml
> index 4c436b59a34b..18ccfe05048a 100644
> --- a/Documentation/netlink/netlink-raw.yaml
> +++ b/Documentation/netlink/netlink-raw.yaml
> @@ -176,20 +176,23 @@ properties:
> struct:
> description: Name of the nested struct type.
> type: string
> - if:
> - properties:
> - type:
> - const: pad
> - then:
> - required: [ len ]
> - if:
> - properties:
> - type:
> - const: binary
> - then:
> - oneOf:
> - - required: [ len ]
> - - required: [ struct ]
> + allOf:
> + -
> + if:
> + properties:
> + type:
> + const: pad
> + then:
> + required: [ len ]
> + -
> + if:
> + properties:
> + type:
> + const: binary
> + then:
> + oneOf:
> + - required: [ len ]
> + - required: [ struct ]
> # End genetlink-legacy
>
> attribute-sets:
>
> ---
> base-commit: 043777e948807b5f335f58a0b9f5ed04bba681cf
> change-id: 20260907-ynl-robustness-d62d9693cc12
>
> Best regards,
> --
> Taylor Bates <tmbates12@gmail.com>
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema
2026-09-15 1:53 [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema Taylor Bates
2026-09-15 3:01 ` Hangbin Liu
@ 2026-09-17 8:35 ` Donald Hunter
2026-09-17 22:05 ` tmbates12
2026-09-17 14:20 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Donald Hunter @ 2026-09-17 8:35 UTC (permalink / raw)
To: Taylor Bates
Cc: Jakub Kicinski, David S. Miller, Eric Dumazet, Paolo Abeni,
Simon Horman, Jiri Pirko, Stanislav Fomichev, netdev,
linux-kernel
Taylor Bates <tmbates12@gmail.com> writes:
> Currently netlink-raw.yaml contains two if keys and two then keys in a
> single mapping that enforces a "len" for "pad" members and a "len" or
> "struct" for binary members.
>
> During validation PyYAML resolves duplicate keys last-wins, so only the
> binary rule survives. Pad has not been validated since commit
> bf08f32c8ced ("tools/net/ynl: Add support for nested structs") added
> the second if/then pair in January 2024.
>
> None of the current specs violate this rule, but this validation should
> not be parser dependent and unspecified. Strict YAML validators such as
> Red Hat's VS Code YAML extension and Adrien Verge's yamllint will
> reject the netlink-raw.yaml schema:
>
> Command:
> $ yamllint Documentation/netlink/netlink-raw.yaml
>
> Output:
> 185:13 error duplication of key "if" in mapping (key-duplicates)
> 189:13 error duplication of key "then" in mapping (key-duplicates)
>
> The following invalid netlink family spec will pass validation in the
> current ynl tooling:
>
> # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
> ---
> name: minimal-raw
> doc: Minimal netlink-raw family for schema validation testing.
> protocol: netlink-raw
> protonum: 0
>
> definitions:
> -
> name: test-struct
> type: struct
> members:
> -
> name: reserved
> type: pad
> # len intentionally omitted
>
> attribute-sets: []
>
> operations:
> list: []
>
> Signed-off-by: Taylor Bates <tmbates12@gmail.com>
Good catch. We have a lint check on the specs but not the schemas. Maybe
need to add that.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema
2026-09-15 1:53 [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema Taylor Bates
2026-09-15 3:01 ` Hangbin Liu
2026-09-17 8:35 ` Donald Hunter
@ 2026-09-17 14:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-17 14:20 UTC (permalink / raw)
To: Taylor Bates
Cc: donald.hunter, kuba, davem, edumazet, pabeni, horms, jiri, sdf,
netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 14 Sep 2026 21:53:15 -0400 you wrote:
> Currently netlink-raw.yaml contains two if keys and two then keys in a
> single mapping that enforces a "len" for "pad" members and a "len" or
> "struct" for binary members.
>
> During validation PyYAML resolves duplicate keys last-wins, so only the
> binary rule survives. Pad has not been validated since commit
> bf08f32c8ced ("tools/net/ynl: Add support for nested structs") added
> the second if/then pair in January 2024.
>
> [...]
Here is the summary with links:
- [net-next,v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema
https://git.kernel.org/netdev/net-next/c/5ccdfb2c3203
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema
2026-09-17 8:35 ` Donald Hunter
@ 2026-09-17 22:05 ` tmbates12
0 siblings, 0 replies; 5+ messages in thread
From: tmbates12 @ 2026-09-17 22:05 UTC (permalink / raw)
To: Donald Hunter
Cc: Jakub Kicinski, David S. Miller, Eric Dumazet, Paolo Abeni,
Simon Horman, Jiri Pirko, Stanislav Fomichev, netdev,
linux-kernel
On Thu, 17 Sep 2026 09:35:07 +0100, Donald Hunter wrote:
> Good catch. We have a lint check on the specs but not the schemas. Maybe
> need to add that.
Agreed, there definitely is a gap there, as tools/net/ynl/Makefile is
only pulling in yaml from the specs dir:
SPECDIR=../../../Documentation/netlink/specs
lint:
yamllint $(SPECDIR)
The default profile is rather noisy on the schemas, with both errors
and warnings, mostly brackets, line-length and truthy. With this patch
applied:
$ yamllint -f parsable Documentation/netlink/*.yaml | wc -l
460
$ yamllint -f parsable Documentation/netlink/*.yaml | grep -c '\[error\]'
386
So it'd be worth having a .yamllint config scoped just for the schemas
so we're not chasing a bunch of smaller things, while still checking
for any structure breaking ones (such as the one addressed in this
patch). I'd be happy to put this together as a follow-up if that
sounds useful.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-17 22:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 1:53 [PATCH net-next v2] netlink: specs: fix duplicate if/then keys in netlink-raw schema Taylor Bates
2026-09-15 3:01 ` Hangbin Liu
2026-09-17 8:35 ` Donald Hunter
2026-09-17 22:05 ` tmbates12
2026-09-17 14:20 ` patchwork-bot+netdevbpf
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®