eBPF-based security platform
docs: give the checks to run before sending one home
Daniel Borkmannccd68cdd18a5
diff --git a/Documentation/contribute/code/contributing.rst b/Documentation/contribute/code/contributing.rstindex a24edb59..317a0eaa 100644--- a/Documentation/contribute/code/contributing.rst+++ b/Documentation/contribute/code/contributing.rst@@ -222,58 +222,17 @@ its author has not seen.Before sending---------------:doc:`/contribute/code/developer-guide` shows how to run each of these locally.--- Build the operator binary, the helper and the target binary- (``make``, ``make shirudo-build``, ``make target``) and run ``make- tests``, which CI runs too. ``make -C testing functional/<family>``- runs the families the change touches while you work on it. Run- ``make tests VM=0 SANITIZE=address,undefined`` from a clean tree when- the change touches memory handling or binary formats. CI runs the- same sweep. See :doc:`/contribute/testing/testing`.-- Run ``make -C Documentation html`` when the change touches- ``Documentation/``. The build turns every Sphinx warning into an- error. See :doc:`/contribute/documentation/writing-docs`.-- Run :src:`.github/scripts/check-unused.sh` when the change removes or- renames a call: a function whose last caller went fails it. CI runs it- as the ``Unused functions`` job of the ``Lint`` workflow.-- Run :src:`.github/scripts/check-spdx.sh` when the change adds a file.- Every source carries an SPDX tag in the kernel's form for its type,- ``BSD-2-Clause`` for userspace and ``GPL-2.0 OR BSD-2-Clause`` for- everything compiled into a BPF object, the headers it includes and- the decoders a package ships. Run- ``.github/scripts/check-dco.sh origin/main..HEAD`` on the commits. CI- runs both.-- Run ``.github/scripts/check-style.sh origin/main..HEAD`` on the- commits. It runs the kernel's ``checkpatch.pl`` in strict mode over- the C each commit touches, at its default limit of 100 columns, and- over its message, with the checks that have no meaning in userspace- switched off, each listed in the script with its reason. It also- refuses a block comment whose text starts on the ``/*`` line (the- netdev form), the C library's integer names such as ``uint32_t``,- ``unsigned int`` and its kin in userspace, ``strtoul()``, ``atoi()``- and their kin, ``strcpy()`` and its kin, and ``sprintf()`` and its- kin outside the files the script names, and a subject longer than 75- characters. ``--diff`` checks the uncommitted changes, ``--files``- whole files and ``--types`` lists what stays enabled. CI runs it as- the ``Checkpatch`` job of the ``Lint`` workflow.-- Run ``make sparse`` when the change reads or writes a binary format.- It runs sparse over the userspace sources and fails on any warning,- such as a little-endian field read or written without- ``le32_to_cpu()``, ``cpu_to_le32()`` or their kin from- ``<shirudo/byteorder.h>``. CI runs it as the ``Sparse`` job of the- ``Lint`` workflow.-- Run ``.github/scripts/check-coccinelle.sh``. It runs every semantic- patch in :src:`testing/coccinelle/` over the tree and fails on any- match, such as a secret compared with ``memcmp()``, a descriptor- opened without close-on-exec or a pointer tested for NULL after its- use. CI runs it as the ``Coccinelle`` job of the ``Lint`` workflow.-- Keep each commit to one logical change that builds and passes on its+Run the checks CI runs on a pull request, as :ref:`run-ci-checks` lists+them in order, and the tests the change touches. Then check that:++- Each commit holds one logical change that builds and passes on itsown, so the history bisects. CI builds every commit of a pull request,- and every commit a push adds to ``main``, on its own in the- ``Build every commit`` workflow.- ``.github/scripts/build-commits.sh origin/main..HEAD`` does the same- locally.+ and every commit a push adds to ``main``, on its own in the ``Build+ every commit`` workflow; ``build-commits.sh`` does the same locally.+- Each commit carries your ``Signed-off-by:``, which+ ``.github/scripts/check-dco.sh origin/main..HEAD`` checks.+- A change to ``Documentation/`` renders: the build turns every Sphinx+ warning into an error. See :doc:`/contribute/documentation/writing-docs`.- Read :doc:`/security/threat-model` before changing anything on asecurity-relevant path, and say in the commit message which invariantthe change preserves or extends.diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rstindex 8ba52112..bd47d110 100644--- a/Documentation/contribute/code/developer-guide.rst+++ b/Documentation/contribute/code/developer-guide.rst@@ -453,6 +453,8 @@ Project layout``shirudo --list-cmds`` prints the top-level commands.+.. _run-ci-checks:+Run the CI checks locally-------------------------@@ -471,11 +473,22 @@ the commit at ``HEAD`` alone without them.``Signed-off-by:``. See :doc:`/contribute/code/contributing`.* - ``check-style.sh <range>``- The kernel's ``checkpatch.pl`` in strict mode over the C each- commit touches and over its message, plus the project rules.- ``--diff`` checks uncommitted changes and ``--files`` whole- files.+ commit touches, at its default limit of 100 columns, and over its+ message, with the checks that have no meaning in userspace+ switched off, each listed in the script with its reason. It also+ refuses a block comment whose text starts on the ``/*`` line, the+ C library's integer names such as ``uint32_t``, ``unsigned int``+ and its kin in userspace, ``strtoul()``, ``atoi()``,+ ``strcpy()``, ``sprintf()`` and their kin outside the files the+ script names, and a subject longer than 75 characters. ``--diff``+ checks uncommitted changes, ``--files`` whole files and+ ``--types`` lists what stays enabled.* - ``check-spdx.sh``- - The SPDX tag of every tracked source. Takes no range.+ - The SPDX tag of every tracked source, in the kernel's form for its+ type: ``BSD-2-Clause`` for userspace and ``GPL-2.0 OR+ BSD-2-Clause`` for everything compiled into a BPF object, the+ headers it includes and the decoders a package ships. Takes no+ range.* - ``check-unused.sh``- An extern function of the userspace C that nothing calls: thecompiler reports an unused ``static`` function, never an extern@@ -566,7 +579,7 @@ tag into ``build/checkpatch/`` and verifies its SHA-256. Set``CHECKPATCH=<path>`` to use a kernel tree's``scripts/checkpatch.pl`` instead, for example without network access.-Before you send a change:+Before you send a change, run what CI runs on a pull request:1. Run the checks over your commits:@@ -580,16 +593,26 @@ Before you send a change:$ .github/scripts/check-coccinelle.sh$ .github/scripts/build-commits.sh origin/main..HEAD-2. Run the tests the change touches, and ``make tests`` before you- send. See :doc:`/contribute/testing/testing`.+2. Run clang's static analyzer, in a throwaway container with+ ``scan-build.sh`` or on a host that has clang 23's tools:++ .. code-block:: console++ $ scan-build-23 --status-bugs --exclude vendor make ANALYZE=1++3. Run the tests the change touches, and ``make tests`` before you+ send. When the change touches memory handling or binary formats, run+ ``make tests VM=0 SANITIZE=address,undefined`` from a clean tree too,+ as CI does. See :doc:`/contribute/testing/testing`.-3. Render the documentation if you changed it:+4. If you changed the documentation, check it and render it:.. code-block:: console+ $ .github/scripts/check-docs.sh$ make -C Documentation html-4. Verify that every script printed its summary line and exited 0, for+5. Verify that every script printed its summary line and exited 0, forexample ``DCO: 3 commits checked`` and ``style: 3 commits checked``.Coccinelle rules