From: Julian Braha <julianbraha@gmail.com>
To: nathan@kernel.org, nsc@kernel.org
Cc: jani.nikula@linux.intel.com, akpm@linux-foundation.org,
gary@garyguo.net, ljs@kernel.org, arnd@arndb.de,
gregkh@linuxfoundation.org, masahiroy@kernel.org,
ojeda@kernel.org, corbet@lwn.net, qingfang.deng@linux.dev,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org,
Julian Braha <julianbraha@gmail.com>
Subject: [RFC PATCH v2 2/2] Documentation: dev-tools: add kconfirm
Date: Sat, 9 May 2026 21:38:08 +0100 [thread overview]
Message-ID: <20260509203808.1142311-3-julianbraha@gmail.com> (raw)
In-Reply-To: <20260509203808.1142311-1-julianbraha@gmail.com>
Add usage documentation and a brief description for kconfirm to
Documentation/dev-tools/
Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
Documentation/dev-tools/index.rst | 1 +
Documentation/dev-tools/kconfirm.rst | 196 +++++++++++++++++++++++++++
2 files changed, 197 insertions(+)
create mode 100644 Documentation/dev-tools/kconfirm.rst
diff --git a/Documentation/dev-tools/index.rst b/Documentation/dev-tools/index.rst
index 59cbb77b33ff..130ebc0d7282 100644
--- a/Documentation/dev-tools/index.rst
+++ b/Documentation/dev-tools/index.rst
@@ -40,3 +40,4 @@ Documentation/process/debugging/index.rst
autofdo
propeller
container
+ kconfirm
diff --git a/Documentation/dev-tools/kconfirm.rst b/Documentation/dev-tools/kconfirm.rst
new file mode 100644
index 000000000000..f57bd40508d4
--- /dev/null
+++ b/Documentation/dev-tools/kconfirm.rst
@@ -0,0 +1,196 @@
+.. SPDX-License-Identifier: GPL-2.0-only
+.. Copyright (C) 2026 Julian Braha <julianbraha@gmail.com>
+
+========
+kconfirm
+========
+
+kconfirm is a static analysis tool for the kernel's Kconfig system. It
+checks the entire tree-wide Kconfig, and reports misusage like
+dead code. In the case of dead default statements, these can be a code
+smell.
+
+kconfirm has some additional, optional checks. The first is for dead links
+in the Kconfig help texts. Since this has a high potential for false
+positives (due to websites blocking bots) and slows down runtime
+significantly, it is disabled by default.
+
+Another optional check is for config options that select visible config
+options. Examples of how to enable the optional checks are included
+below.
+
+kconfirm is written in Rust and lives in ``scripts/kconfirm``. Other
+than the dead link checks, kconfirm aims for zero false positives.
+
+Alarms are deduplicated across all affected architectures; kconfirm
+displays a tag with the corresponding Kconfig architecture config option
+names. For example, ``[RISCV]`` indicates that an alarm is specific to
+RISC-V, while ``[ARM, X86]`` indicates that an alarm affects both arm and
+x86.
+
+**NOTE**: kconfirm does not modify or compile the source tree; it is
+strictly a static checker.
+
+
+Getting Started
+===============
+
+
+kconfirm's Minimum Supported Rust Version (MSRV) is v1.85.0, because
+it uses Rust edition 2024, and this is the earliest supported version.
+
+kconfirm also requires the Cargo package manager and an internet
+connection for compilation of its dependencies.
+
+If Cargo is available, kconfirm can be built and run from the top of the
+kernel source tree::
+
+ make kconfirm
+
+The compiled ``kconfirm-linux`` binary will be available in
+``scripts/kconfirm/target/release/``.
+
+The default checks currently cover dead code analysis, as well as invalid
+(reverse) ranges and constant conditions. ``select_visible`` and
+``dead_links`` must be turned on explicitly with ``--enable``; conversely,
+any default check can be turned off with ``--disable``. Both options
+accept either a comma-separated list or repeated flags, so the following
+two invocations are equivalent::
+
+ kconfirm-linux --linux-path . --enable select_visible,dead_link
+ kconfirm-linux --linux-path . --enable select_visible --enable dead_link
+
+
+
+Options
+=======
+
+**NOTE**: kconfirm's arguments must be provided in the ``KCONFIRM_ARGS``
+environment variable if running with ``make``. See `Examples`_.
+
+Available options:
+
+``--linux-path PATH``
+ The path to the linux source tree to analyze. ``make`` uses this
+ option to pass the current linux tree, but this option can be used
+ when running the tool directly with another source tree.
+ See `Examples`_.
+
+``--enable CHECK[,CHECK...]``
+
+ Enable one or more checks in addition to the default set. May be
+ given multiple times, or as a single comma-separated list. See
+ `Available checks`_ below for valid names.
+
+``--disable CHECK[,CHECK...]``
+
+ Disable one or more checks from the default set. May be given
+ multiple times, or as a single comma-separated list.
+
+``-h, --help``
+
+ Show the help message and exit.
+
+``-V, --version``
+
+ Show version information and exit.
+
+
+Available checks
+================
+
+Each check has a string name that is accepted by ``--enable`` and
+``--disable``. Checks marked *(default)* are enabled unless turned off
+explicitly.
+
+``duplicate_dependency`` *(default)*
+
+ Reports duplicated ``depends on`` entries on a single Kconfig symbol.
+
+``duplicate_range`` *(default)*
+
+ Reports duplicated ``range`` entries on a single Kconfig symbol.
+
+``dead_range`` *(default)*
+
+ Reports ``range`` entries that will never be evaluated, due to an
+ unconditional range entry.
+
+``duplicate_select`` *(default)*
+
+ Reports duplicated ``select`` entries on a single Kconfig symbol.
+
+``dead_select`` *(default)*
+
+ Reports dead ``select`` entries that will never be evaluated, due to an
+ unconditional select entry of the same config option.
+
+``duplicate_imply`` *(default)*
+
+ Reports duplicated ``imply`` entries on a single Kconfig symbol.
+
+``dead_imply`` *(default)*
+
+ Reports dead ``imply`` entries that will never be evaluated, due to an
+ unconditional imply entry for the same config option.
+
+``duplicate_default`` *(default)*
+
+ Reports duplicated ``default`` entries on a single Kconfig symbol.
+
+``dead_default`` *(default)*
+
+ Reports ``default`` entries that can never be selected, for example
+ because their condition is unsatisfiable.
+
+``constant_condition`` *(default)*
+
+ Reports conditions for any entries that always evaluate to ``true``.
+
+``failed_parse`` *(default)*
+
+ Reports a parsing failure of the Kconfig.
+
+``select_visible``
+
+ Reports configuration options that ``select`` a config option that is
+ visible to users.
+
+``dead_link``
+
+ Reports broken URLs found in Kconfig help text. Because this
+ performs network requests it can be quite slow, and is disabled by
+ default. May also have false positives.
+
+``UngroupedAttribute``
+
+ Reports ungrouped entries, like ``select`` and ``depends on``.
+ This is a style check, and is disabled by default.
+
+``DuplicateDefaultValue``
+
+ Reports duplicate default values that have different conditions.
+ Suggests combining the conditions using a logical-or ``||``.
+ This is a style check, and is disabled by default.
+
+
+Examples
+========
+
+Compile (as needed) and run on the current tree::
+
+ make kconfirm
+
+To additionally enable the dead link and select-visible checks::
+
+ make kconfirm KCONFIRM_ARGS="--enable=dead_link,select_visible"
+
+To disable a check (here, ``duplicate_dependency``) while keeping the
+rest of the default set::
+
+ make kconfirm KCONFIRM_ARGS="--disable duplicate_dependency"
+
+To run the default checks against a kernel tree separate from the
+current directory, such as ``~/repos/linux``::
+
+ scripts/kconfirm/target/release/kconfirm-linux --linux-path ~/repos/linux
--
2.53.0
next prev parent reply other threads:[~2026-05-09 20:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 20:38 [RFC v2 0/2] add kconfirm Julian Braha
2026-05-09 20:38 ` [RFC PATCH v2 1/2] scripts: " Julian Braha
2026-05-11 9:57 ` Jani Nikula
2026-05-11 13:18 ` Julian Braha
2026-05-09 20:38 ` Julian Braha [this message]
2026-05-10 5:06 ` [RFC v2 0/2] " Jan Engelhardt
2026-05-10 9:49 ` Miguel Ojeda
2026-05-10 23:06 ` Julian Braha
2026-05-10 23:28 ` Jan Engelhardt
2026-05-11 4:24 ` Demi Marie Obenour
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=20260509203808.1142311-3-julianbraha@gmail.com \
--to=julianbraha@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=qingfang.deng@linux.dev \
--cc=rust-for-linux@vger.kernel.org \
/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