Article View: linux.kernel
Article #53[PATCH v2 08/11] Documentation: kconfig-audit: Describe policy overlays
From: Ahmed S. Darwish
Date: Thu, 03 Dec 2026 23:10
Date: Thu, 03 Dec 2026 23:10
197 lines
7977 bytes
7977 bytes
Document kconfig-audit's policy overlays structure and usage.
Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
---
Documentation/tools/kconfig-audit.rst | 128 ++++++++++++++++++++++++--
1 file changed, 118 insertions(+), 10 deletions(-)
diff --git a/Documentation/tools/kconfig-audit.rst b/Documentation/tools/kconfig-audit.rst
index 5b8e2fa842b1..e83eb56e43ed 100644
--- a/Documentation/tools/kconfig-audit.rst
+++ b/Documentation/tools/kconfig-audit.rst
@@ -26,6 +26,10 @@ Check a ``.config`` against a policy known to the checker::
audit.py check -c path/to/.config -p preempt_rt
+An optional overlay may be supplied with ``-o``::
+
+ audit.py check -c path/to/.config -p preempt_rt -o path/to/overlay.yml
+
Example invocation from within the kernel tree:
.. code-block:: shell
@@ -121,6 +125,24 @@ The supplied PREEMPT_RT policy resides in the kernel source tree at::
For field-by-field descriptions of the policy's top-level and rule fields,
see :ref:`Policy file reference <policy-file-reference>`.
+Policy overlays format
+======================
+
+Policy overlay files are YAML documents applied on top of the requested
+configuration policy. A policy overlay typically looks like:
+
+.. code-block:: yaml
+
+ api_version: kconfig-audit.kernel.org/v1
+ kind: PolicyOverlay
+
+ rules:
+ - name: CONFIG_DRM
+ severity: high
+
+where in the above case, the base policy's ``CONFIG_DRM`` rule severity is
+overriden to high.
+
Rule matching
=============
@@ -285,10 +307,86 @@ Duplicate exact symbol rules are rejected. The policy below:
is considered malformed.
+Writing overlay files
+=====================
+
+Overlays are intended for local policy, distribution kernel packaging, CI
+environments, and board support packages. Use an overlay to adjust the
+behaviour of a mainline kernel configuration policy.
+
+Overriding an existing rule
+---------------------------
+
+An overlay identifies an existing rule by its exact ``name`` or exact
+``name_pattern`` string. It changes only the fields it supplies. Omitted
+fields keep their values from the base policy.
+
+For example, if the mainline PREEMPT_RT policy contains below rules:
+
+.. code-block:: yaml
+
+ rules:
+ - name: CONFIG_DRM
+ expected: disabled
+ severity: info
+
+ - name: CONFIG_EFI_DISABLE_RUNTIME
+ expected: enabled
+ severity: medium
+
+A board support package may override such rules with an overlay like:
+
+.. code-block:: yaml
+
+ api_version: kconfig-audit.kernel.org/v1
+ kind: PolicyOverlay
+
+ rules:
+ - name: CONFIG_DRM
+ expected: neutral
+ rationale:
+ This product requires a display controller and accepts the latency
+ cost.
+
+ - name: CONFIG_EFI_DISABLE_RUNTIME
+ expected: disabled
+ rationale:
+ The efi_runtime workqueue is pinned to housekeeping CPU#0.
+
+Note that an overlay ``name_pattern`` does not select every base rule whose
+regex matches the same symbols. It selects only a base rule with the
+*identical* regular expression pattern text. If no base rule has that
+target, the overlay creates a new rule.
+
+Adding a new rule
+-----------------
+
+When an overlay target is not in the base policy, a new rule is created.
+In that case, the new rule must provide both ``expected`` and ``severity``
+as well. Below is an example overlay file which adds a new rule:
+
+.. code-block:: yaml
+
+ api_version: kconfig-audit.kernel.org/v1
+ kind: PolicyOverlay
+
+ rules:
+ - name: CONFIG_USB_STORAGE
+ expected: disabled
+ severity: high
+ rationale: This appliance does not accept removable storage.
+
+Overlay behavior
+----------------
+
+An overlay cannot delete a base rule. Use ``expected: neutral`` to exempt
+a symbol from policy checking. To retain inherited values, omit those
+fields.
+
.. _policy-file-reference:
-Policy file reference
-=====================
+Policy files reference
+======================
Top-level fields
----------------
@@ -304,11 +402,16 @@ tag is supported so far::
``kind``
++++++++
-*Required*. Identifies the YAML document's type. For a configuration
-policy file, the value must be::
+*Required*. Identifies the YAML document's type.
+
+For a configuration policy file, the value must be::
Policy
+For a policy overlay file, the value must be::
+
+ PolicyOverlay
+
``docs_url``
++++++++++++
@@ -323,7 +426,7 @@ A rule may then provide ``docs_hint`` to form a full rationale URL.
``rules``
+++++++++
-*Required*. A non-empty list of rule entries.
+*Required for policy files*. A non-empty list of rule entries.
Each rule describes either one exact configuration symbol or a pattern that
matches several symbols. See :ref:`Rule fields <rule-fields>`.
@@ -408,10 +511,12 @@ an exact ``name`` rule.
``expected``
++++++++++++
-*Required*. Describes the expected state of the matching symbol or
-symbols.
+*Required for all rules in policy files*.
+
+*Required for newly-added rules in policy overlays*.
-Allowed values are:
+Describes the expected state of the matching symbol or symbols. Allowed
+values are:
``enabled``
The symbol must be set to ``y`` or ``m``.
@@ -441,9 +546,12 @@ Allowed values are:
``severity``
++++++++++++
-*Required*. Describes how serious a rule violation is.
+*Required for all rules in policy files*.
+
+*Required for newly-added rules in policy overlays*.
-Allowed values are, from highest to lowest::
+Describes how serious a rule violation is. Allowed values are, from
+highest to lowest::
fatal
high
--
2.56.0
Technical Details
Message-ID:
<O6o65-fPfD-11@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodReferences:
<O6o65-fPfD-3@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!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: [PATCH v2 08/11] Documentation: kconfig-audit: Describe policy overlays Date: Fri, 04 Dec 2026 00:10:01 +0100 Message-ID: <O6o65-fPfD-11@gated-at.bofh.it> References: <O6o65-fPfD-3@gated-at.bofh.it> X-Mailbox-Line: From debian-kernel-request@lists.debian.org Thu Dec 3 23:07:42 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-Transfer-Encoding: 8bit X-Mailing-List: <debian-kernel@lists.debian.org> archive/latest/158719 List-ID: <debian-kernel.lists.debian.org> List-URL: <https://lists.debian.org/debian-kernel/> List-Archive: https://lists.debian.org/msgid-search/20261203224916.118064-9-darwi@linutronix.de Approved: robomod@news.nic.it Lines: 197 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-doc@vger.kernel.org, linux-kernel@vger.kernel.org, "Ahmed S. Darwish" <darwi@linutronix.de> X-Original-Date: Thu, 3 Dec 2026 23:49:09 +0100 X-Original-Message-ID: <20261203224916.118064-9-darwi@linutronix.de> X-Original-References: <20261203224916.118064-1-darwi@linutronix.de>