Article View: linux.debian.kernel
Article #966Re: [PATCH v2 07/11] kconfig-audit: Add support for policy overlays
From: sashiko-bot
Date: Fri, 04 Dec 2026 23:10
Date: Fri, 04 Dec 2026 23:10
93 lines
5403 bytes
5403 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] kconfig-audit: PolicyOverlayFile and Overlayer silently drop
pattern_prio
- [Low] kconfig-audit: Overlayer._update_rule() ignores empty rationale
overrides
--
commit 77e7af9fe203f534d6486ee41fb9f2863605bc4c
Author: Ahmed S. Darwish <darwi@linutronix.de>
kconfig-audit: Add support for policy overlays
This commit adds policy overlay support to tools/kconfig-audit/audit.py,
allowing a YAML overlay file to override fields on existing rules, update
docs_url, or add new rules via the -o/--overlay option.
> diff --git a/tools/kconfig-audit/audit.py b/tools/kconfig-audit/audit.py
> index 94ff427715d11..ba6ba86f2791f 100755
> --- a/tools/kconfig-audit/audit.py
> +++ b/tools/kconfig-audit/audit.py
[ ... ]
> @@ -546,6 +551,195 @@ class PolicyFile(VersionedYamlFile):
[ ... ]
> +@dataclass
> +class RuleOverlay:
> + """Typed overlay for a (symbol or regex) .config rule"""
> +
> + target: OverlayTarget
> + expected: Optional[ExpectedValue]
> + severity: Optional[Severity]
> + rationale: Optional[str]
> + docs_hint: Optional[str]
[ ... ]
> + return RuleOverlay(
> + target,
> + expected,
> + severity,
> + rule.get('rationale'),
> + rule.get('docs_hint'),
> + )
[Severity: Medium]
Does this silently drop pattern_prio from overlay rules?
policy-overlay-v1.yml allows pattern_prio on name_pattern rules via rule.yml,
but RuleOverlay has no pattern_prio field, PolicyOverlayFile._parse_rule()
ignores it, and Overlayer._update_rule() and Overlayer._new_rule() never
propagate it to PatternRule (leaving new rules at priority 0).
A new overlay pattern rule with a higher pattern_prio is downgraded to 0 and
can lose to a higher-priority base pattern rule, letting non-compliant configs
pass, or collide with a priority-0 base rule in Checker._map_pattern_rules()
and abort with os.EX_DATAERR. Overrides on existing rules are also ignored.
[ ... ]
> + @staticmethod
> + def _update_rule(overlay: RuleOverlay, rule: Rule) -> None:
> + """Apply an overlay's specified fields to an existing rule"""
> + if overlay.expected:
> + rule.expected = overlay.expected
> +
> + if overlay.severity:
> + rule.severity = overlay.severity
> +
> + if overlay.rationale:
> + rule.rationale = overlay.rationale
> +
> + if overlay.docs_hint:
> + rule.docs_hint = overlay.docs_hint
> + rule._normalize_docs_hint()
[Severity: Low]
Should this check overlay.rationale is not None instead of testing truthiness?
rule.yml defines rationale as a string with no minimum length and rejects
null, so an empty string is the only schema-valid way to clear an inherited
rationale. Because an empty string is falsy, the assignment is skipped and
the base rule's stale rationale remains in the audit report.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203224916.118064-1-darwi@linutronix.de?part=7
Technical Details
Message-ID:
<O6KzE-g1p2-29@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodReferences:
<O6o65-fPfD-3@gated-at.bofh.it> <O6o65-fPfD-21@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod From: sashiko-bot@kernel.org Newsgroups: linux.debian.kernel,linux.kernel Subject: Re: [PATCH v2 07/11] kconfig-audit: Add support for policy overlays Date: Sat, 05 Dec 2026 00:10:02 +0100 Message-ID: <O6KzE-g1p2-29@gated-at.bofh.it> References: <O6o65-fPfD-3@gated-at.bofh.it> <O6o65-fPfD-21@gated-at.bofh.it> X-Mailbox-Line: From debian-kernel-request@lists.debian.org Fri Dec 4 23:07:04 2026 Old-Return-Path: <sashiko-bot@kernel.org> X-Amavis-Spam-Status: No, score=-4.401 tagged_above=-10000 required=5.3 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham autolearn_force=no X-Policyd-Weight: using cached result; rate: -5.5 Reply-To: sashiko-reviews@lists.linux.dev Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailing-List: <debian-kernel@lists.debian.org> archive/latest/158754 List-ID: <debian-kernel.lists.debian.org> List-URL: <https://lists.debian.org/debian-kernel/> List-Archive: https://lists.debian.org/msgid-search/sashiko-outbox-250779@kernel.org Approved: robomod@news.nic.it Lines: 93 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Cc: "Sebastian Andrzej Siewior" <bigeasy@linutronix.de>, "Frederic Weisbecker" <frederic@kernel.org>, "John Ogness" <john.ogness@linutronix.de>, "Derek Barbosa" <debarbos@redhat.com>, Zbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>, "Daan De Meyer" <daan.j.demeyer@gmail.com>, "Luca Boccassi" <luca.boccassi@gmail.com>, linux-rt-devel@lists.linux.dev, debian-kernel@lists.debian.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org X-Original-Date: Fri, 04 Dec 2026 22:50:15 +0000 X-Original-Message-ID: <sashiko-outbox-250779@kernel.org> X-Original-References: <20261203224916.118064-1-darwi@linutronix.de> <20261203224916.118064-8-darwi@linutronix.de>