Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiri Pirko" <jiri@resnulli.us>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH RFC 01/20] ctlv: Add the schema language and generator
Date: Thu, 15 Oct 2026 14:58:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-173015@kernel.org> (raw)
In-Reply-To: <20261015145053.3664509-2-jiri@resnulli.us>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] ctlvgen: ABI compatibility checker incorrectly flags widening to unlimited as an error
- [Low] ctlvgen: missing validation for --mode uapi --source causes KeyError
--

commit dbbe210aabdf036fa0f92c7b8932bca4fd127ce7
Author: Jiri Pirko <jiri@nvidia.com>

ctlv: Add the schema language and generator

Define the YAML schema and append-only family registry. Add ctlvgen to
validate specifications and emit kernel and UAPI outputs.

> diff --git a/tools/ctlv/ctlvgen/cli.py b/tools/ctlv/ctlvgen/cli.py
> new file mode 100755
> index 0000000000000..c6bfafeb28525
> --- /dev/null
> +++ b/tools/ctlv/ctlvgen/cli.py

[ ... ]

> @@ -0,0 +1,172 @@
[ ... ]
> +    kinds = (args.header, args.source)
> +    if args.mode and not any(kinds):
> +        parser.error('--mode needs --header or --source')
> +    if any(kinds) and not args.mode:
> +        parser.error('--header and --source need --mode')

[Severity: Low]
Should the command-line parsing prevent the combination of --mode uapi
and --source here?

Right now, this combination passes validation, but the GENERATORS dictionary
only maps ('uapi', 'header'). If a user provides --mode uapi --source, it
will cause an unhandled KeyError later in _generate() when looking up the
output renderer.

> +    if args.schema_only and args.mode != 'kernel':
> +        parser.error('--schema-only needs --mode kernel')

[ ... ]

> +    if args.mode == 'kernel':
> +        renderer = (gen_kernel.render_header if args.header
> +                    else gen_kernel.render_source)
> +        text = renderer(family, family_api=not args.schema_only)
> +    else:
> +        text = GENERATORS[(args.mode, kind)](family)

[ ... ]

> diff --git a/tools/ctlv/ctlvgen/lib/compat.py b/tools/ctlv/ctlvgen/lib/compat.py
> new file mode 100644
> index 0000000000000..4cf93af06ea90
> --- /dev/null
> +++ b/tools/ctlv/ctlvgen/lib/compat.py

[ ... ]

> @@ -0,0 +1,821 @@
[ ... ]
> +def _compare_occurrences(problems, where, was, now):
> +    old_max = was['max-occurrences']
> +    new_max = now['max-occurrences']
> +    if old_max == new_max:
> +        return
> +    if old_max == spec.UNLIMITED or new_max < old_max:

[Severity: Medium]
Will this incorrectly flag a compatible widening as an ABI break?

Because spec.UNLIMITED is represented as 0, widening max-occurrences
from a finite value like 10 to unlimited means new_max is 0 and
old_max is 10. The condition new_max < old_max evaluates to true
(0 < 10), misidentifying the widened bound as a narrowed bound.

Does this check need to specifically ignore comparisons where new_max
is spec.UNLIMITED?

> +        problems.append(f'{where}: max-occurrences was narrowed from '
> +                        f'{_occurrences(old_max)} to {_occurrences(new_max)}')
> +
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261015145053.3664509-1-jiri@resnulli.us?part=1

  reply	other threads:[~2026-10-15 14:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 14:50 [PATCH RFC 00/20] attestation: Add a common subsystem and TDX support Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 01/20] ctlv: Add the schema language and generator Jiri Pirko
2026-10-15 14:58   ` sashiko-bot [this message]
2026-10-15 14:50 ` [PATCH RFC 02/20] ctlv: Add the UAPI wire format and family API Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 03/20] ctlv: Add the root family specification and generated files Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 04/20] Documentation: ctlv: Add userspace ABI Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 05/20] ctlv: Prepare message input handling Jiri Pirko
2026-10-15 15:06   ` sashiko-bot
2026-10-15 14:50 ` [PATCH RFC 06/20] ctlv: Prepare blob descriptor validation Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 07/20] ctlv: Prepare schema validation Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 08/20] ctlv: Prepare message output handling Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 09/20] ctlv: Prepare VA blob handling Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 10/20] ctlv: Prepare event queue support Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 11/20] ctlv: Prepare runtime introspection Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 12/20] ctlv: Add device and operation dispatch Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 13/20] Documentation: ctlv: Describe how to write a family Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 14/20] attestation: Add the base family specification and generated files Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 15/20] attestation: Prepare provider and instance core Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 16/20] attestation: Prepare measurement register journal Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 17/20] attestation: Add CTLV operation handling Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 18/20] tdx-guest: Expose the native attestation service API Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 19/20] attestation: Add the TDX family specification and generated files Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 20/20] attestation: Add the TDX family implementation Jiri Pirko

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=sashiko-outbox-173015@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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