The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ahmed S. Darwish" <darwi@linutronix.de>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nsc@kernel.org>,
	"Julian Braha" <julianbraha@gmail.com>,
	"Emanuele Rocca" <ema@debian.org>,
	"Clark Williams" <clrkwllms@kernel.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ingo Molnar" <mingo@redhat.com>
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
Subject: Re: [PATCH v2 10/11] kconfig: Introduce auditconfig target
Date: Fri, 04 Dec 2026 22:50:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-250781@kernel.org> (raw)
In-Reply-To: <20261203224916.118064-11-darwi@linutronix.de>

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [Low] kconfig: auditconfig pipeline masks audit.py startup and
  dependency failures
- [Low] kconfig: auditconfig validates POLICY with grep -qw instead of
  grep -Fxq --
- [Low] kconfig: relative OVERLAY paths fail under O= builds in
  auditconfig
- [Low] kconfig: auditconfig uses echo -n with newline-separated
  list-policies output
- [Low] kconfig: unresolved maintainer objection to auditconfig Makefile
  target
--

commit 6f54ed0a60b4e5e9fac14ed041af880ff3de56ee
Author: Ahmed S. Darwish <darwi@linutronix.de>

kconfig: Introduce auditconfig target

This commit adds an auditconfig Kbuild target in scripts/kconfig/Makefile
to check the current .config against a selected kconfig-audit policy and
optional overlay, and lists the target in make help.

> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index 5baf1c44ffa25..b216761c534f8 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -125,6 +125,28 @@ testconfig: $(obj)/conf
>  	$(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no)
>  clean-files += tests/.cache
>  
> +auditconfig := $(PYTHON3) -B $(srctree)/tools/kconfig-audit/audit.py
> +auditconfig_overlay = $(if $(OVERLAY),-o "$(OVERLAY)")

[Severity: Low]
Will a relative OVERLAY path work in out-of-tree O= builds?

The top-level Makefile re-invokes make with -C $(abs_output), so audit.py
opens OVERLAY relative to the output directory instead of the source or
invocation directory.  A relative path such as OVERLAY=my-overlay.yml then
fails with No such file or directory unless the file is inside the O= tree.

Canonicalizing OVERLAY before changing directories or falling back to
$(srctree)/$(OVERLAY) would handle this.

> +
> +list_auditconfig_rules =						\
> +	echo -n >&2 "Available POLICY: ";				\
> +	$(auditconfig) list-policies >&2;				\
> +	echo >&2

[Severity: Low]
Will echo -n misalign the policy list once more than one policy exists?

audit.py list-policies prints one policy name per line, so the first
policy appears inline after "Available POLICY: " while every subsequent
policy prints unindented at column 0.  Joining the output onto one line or
dropping -n would keep the formatting consistent.

> +
> +PHONY += auditconfig
> +auditconfig:
> +	$(Q)if [ -z "$(POLICY)" ]; then					\
> +		echo >&2 "Usage: make POLICY=<profile> [OVERLAY=<overlay>] auditconfig"; \
> +		$(list_auditconfig_rules);				\
> +		exit 2;							\
> +	fi
> +	$(Q)if ! $(auditconfig) list-policies | grep -qw "$(POLICY)"; then	\

[Severity: Low]
Should this use grep -Fxq -- "$(POLICY)" instead of grep -qw "$(POLICY)"?

Without -F, -x, and --, regex metacharacters like POLICY=preempt.rt or
leading-hyphen values like POLICY=--help bypass the Makefile check and
fall through to audit.py or produce grep errors, and -w would also match a
partial name if a policy stem contains a hyphen.

> +		echo >&2 "Unknown POLICY profile = $(POLICY)";		\
> +		$(list_auditconfig_rules);				\
> +		exit 2;							\
> +	fi

[Severity: Low]
Does this pipeline mask audit.py startup and dependency failures?

When PyYAML or jsonschema is missing, audit.py exits with os.EX_UNAVAILABLE
and empty stdout, which POSIX sh hides behind grep's exit status.  A valid
POLICY is then misreported as unknown, $(list_auditconfig_rules) runs
audit.py again glued onto "Available POLICY: ", and make exits 2.

Capturing "$(auditconfig) list-policies" before checking POLICY (or
letting audit.py validate POLICY directly) would preserve the failure.

> +	$(Q)$(auditconfig) check -c "$(KCONFIG_CONFIG)" -p "$(POLICY)" $(auditconfig_overlay)

[Severity: Low]
As reported by Nicolas Schier on v1 [1], is a top-level auditconfig make
target needed for a standalone tools/ script that does not use Kbuild?

Nicolas recommended keeping argument validation in the script and skipping
Makefile integration so new CLI options do not need to be mapped here.
audit.py already validates -p/--policy via argparse and adds
-P/--policy-file and list-api-versions, which this wrapper omits.

[1] https://lore.kernel.org/r/avQNfFbeoMImmtre@derry.ads.avm.de

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203224916.118064-1-darwi@linutronix.de?part=10

  reply	other threads:[~2026-12-04 22:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 22:49 [PATCH v2 00/11] tools: Introduce a kernel configuration checker Ahmed S. Darwish
2026-12-03 22:49 ` [PATCH v2 01/11] kconfig-audit: Add schema for policy files Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 02/11] kconfig-audit: Introduce a PREEMPT_RT configuration policy Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 03/11] kconfig-audit: Add the configuration checker code Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 04/11] Documentation: Describe kconfig-audit usage and design Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 05/11] kconfig-audit: Split policy schema for component reuse Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 06/11] kconfig-audit: Introduce policy overlays schema Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 07/11] kconfig-audit: Add support for policy overlays Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 08/11] Documentation: kconfig-audit: Describe " Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 09/11] MAINTAINERS: Add entry for kernel configuration audit Ahmed S. Darwish
2026-12-03 22:49 ` [PATCH v2 10/11] kconfig: Introduce auditconfig target Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot [this message]
2026-12-03 22:49 ` [PATCH v2 11/11] Documentation: Describe auditconfig build target Ahmed S. Darwish
2026-12-04 22:50   ` sashiko-bot

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-250781@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=clrkwllms@kernel.org \
    --cc=daan.j.demeyer@gmail.com \
    --cc=darwi@linutronix.de \
    --cc=debarbos@redhat.com \
    --cc=debian-kernel@lists.debian.org \
    --cc=ema@debian.org \
    --cc=frederic@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=julianbraha@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=luca.boccassi@gmail.com \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zbyszek@amutable.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