Article View: linux.kernel
Article #31Re: [PATCH v1 03/10] kconfig-checker: Add the configuration checker code
From: Ahmed S. Darwish
Date: Mon, 09 Nov 2026 19:50
Date: Mon, 09 Nov 2026 19:50
104 lines
6234 bytes
6234 bytes
On Sat, 07 Nov 2026, sashiko-bot@kernel.org wrote:
> >
> > + def _find_issue_pattern(self, pattern_rule: PatternRule) -> Optional[PatternIssue]:
> > + """Check the .config against a pattern rule. Return found issues, if any."""
> > + if pattern_rule.expected == ExpectedValue.allowed:
> > + return None
> > +
> > + violation_type = 'unset' if pattern_rule.expected == ExpectedValue.y else 'set'
> > + docs_url = self.rules.get_docs_url_for(pattern_rule)
> > +
> > + violating_symbols = []
> > +
> > + for symbol in self.kconfig.get_matching_symbols(pattern_rule.symbol_regex):
> > + symbol_value = self.kconfig.get_symbol_value(symbol)
> > +
> > + if pattern_rule.expected == ExpectedValue.y and symbol_value == 'n':
> > + # Exclude the config symbol if it's explicitly disabled elsewhere
> > + symbol_rule = self.rules.get_symbol_rule(symbol)
> > + if symbol_rule and symbol_rule.expected == ExpectedValue.n:
> > + continue
> > +
> > + violating_symbols.append(symbol)
> > +
> > + if pattern_rule.expected == ExpectedValue.n and symbol_value in ('y', 'm'):
> > + # Exclude the config symbol if it's explicitly allowed elsewhere
> > + symbol_rule = self.rules.get_symbol_rule(symbol)
> > + if symbol_rule and symbol_rule.expected in (ExpectedValue.y, ExpectedValue.allowed):
> > + continue
> > +
> > + violating_symbols.append(symbol)
>
> [Severity: Low]
> Should _find_issue_pattern() skip any symbol that has an explicit
> SymbolRule, regardless of symbol_rule.expected?
>
> Only checking for opposing expected values causes two issues: when
> pattern_rule.expected is ExpectedValue.y, a symbol with a SymbolRule of
> ExpectedValue.allowed is not exempted and is falsely reported as unset,
I think you misunderstand what 'allowed' means.
'expected: allowed', means that an option is permitted. Quoting the schema:
#
# Expected value for the matching kernel configuration option.
#
# Values:
#
# y option is expected to be enabled (built-in or module).
# n option is expected to be disabled or unset.
# allowed option is permitted and must not be reported as a violation.
# This is to be used either by overlays, or to exempt a specific
# symbol from a broader `name_pattern` rule with `expected: n`.
#
expected:
type: string
enum: [y, n, allowed]
So, for below policy:
- name_pattern: CONFIG_DEBUG_.*
expected: n
- name: CONFIG_DEBUG_ATOMIC_SLEEP
expected: allowed
having a CONFIG_DEBUG_ATOMIC_SLEEP=y should not trigger an audit warning.
But for below policy:
- name_pattern: CONFIG_DEBUG_.*
expected: y
- name: CONFIG_DEBUG_ATOMIC_SLEEP
expected: allowed
having CONFIG_DEBUG_ATOMIC_SLEEP=y should trigger no warning, but having
'CONFIG_DEBUG_ATOMIC_SLEEP is unset' should definitely trigger a warning,
even with the second 'expected: allowed' rule.
TLDR; the pattern expected: y / symbol expected: allowed case is not a bug.
>
> and when a SymbolRule has the same expected value as the PatternRule (for
> example, to give a specific symbol its own severity or rationale), the
> violation is reported twice—once by _find_issue_symbol() and once by
> _find_issue_pattern().
>
Hmm, the tool does not handle below case:
- name_pattern: CONFIG_DEBUG_.*
expected: n
serverity: medium
- name: CONFIG_DEBUG_ATOMIC_SLEEP
expected: n
severity: fatal
rationale: Danger! must disable! Danger!
But on a second look, maybe it should... I'll think about it.
Thanks,
Ahmed
Technical Details
Message-ID:
<NXDxo-aS5U-7@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodReferences:
<NWoK5-aaez-7@gated-at.bofh.it> <NWLdD-amPt-5@gated-at.bofh.it> <NWLdD-amPt-3@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod From: "Ahmed S. Darwish" <darwi@linutronix.de> Newsgroups: linux.debian.kernel,linux.kernel Subject: Re: [PATCH v1 03/10] kconfig-checker: Add the configuration checker code Date: Mon, 09 Nov 2026 20:50:02 +0100 Message-ID: <NXDxo-aS5U-7@gated-at.bofh.it> References: <NWoK5-aaez-7@gated-at.bofh.it> <NWLdD-amPt-5@gated-at.bofh.it> <NWLdD-amPt-3@gated-at.bofh.it> X-Mailbox-Line: From debian-kernel-request@lists.debian.org Mon Nov 9 19:45:10 2026 Old-Return-Path: <darwi@linutronix.de> X-Amavis-Spam-Status: No, score=-4.4 tagged_above=-10000 required=5.3 tests=[BAYES_00=-1.9, 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: -4.6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailing-List: <debian-kernel@lists.debian.org> archive/latest/158174 List-ID: <debian-kernel.lists.debian.org> List-URL: <https://lists.debian.org/debian-kernel/> List-Archive: https://lists.debian.org/msgid-search/avIfEhE83UkF9g_Y@lx-t490 Approved: robomod@news.nic.it Lines: 104 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Cc: Clark Williams <clrkwllms@kernel.org>, Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@redhat.com>, Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nsc@kernel.org>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Frederic Weisbecker <frederic@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jonathan Corbet <corbet@lwn.net>, 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: Mon, 9 Nov 2026 20:29:22 +0100 X-Original-Message-ID: <avIfEhE83UkF9g_Y@lx-t490> X-Original-References: <20261106091922.7560-1-darwi@linutronix.de> <20261106091922.7560-4-darwi@linutronix.de> <sashiko-outbox-202758@kernel.org>