Skip to content

eBPF-based security platform

Documentation: cover the CVE-2026-31431 mitigations and their tests

John Fastabend80533b184562
diff --git a/Documentation/contribute/arch-support.rst b/Documentation/contribute/arch-support.rst
index 3cda5580..6d8e58b1 100644
--- a/Documentation/contribute/arch-support.rst
+++ b/Documentation/contribute/arch-support.rst
@@ -89,8 +89,8 @@ x86-64
``CONFIG_CC_OPTIMIZE_FOR_SIZE=y``, can crash when a BPF trampoline is
updated. :doc:`/operate/plan/system-requirements` says which
kernels need it.
-- ``kernel-cve`` defines ``__TARGET_ARCH_x86`` for its ``kprobe``
- programs and loads on x86-64 only.
+- The ``kernel-cve`` detectors define ``__TARGET_ARCH_x86`` for their
+ ``kprobe`` programs and load on x86-64 only.
arm64
-----
@@ -146,7 +146,7 @@ shirudo
against the 512 bytes of riscv64.
- Let ``kprobe`` upatches build for more than one architecture.
``shirudo build`` passes no ``__TARGET_ARCH_*`` define, so the source
- picks one, as ``kernel-cve`` picks x86-64.
+ picks one, as the ``kernel-cve`` detectors pick x86-64.
Linux kernel
~~~~~~~~~~~~
diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rst
index 1077e7df..a3c434ab 100644
--- a/Documentation/contribute/code/developer-guide.rst
+++ b/Documentation/contribute/code/developer-guide.rst
@@ -424,7 +424,8 @@ Project layout
by CI. See :doc:`/internals/kernel-patches`.
* - :src:`upatches/`
- The shipped packages: ``kernel-obs`` with its Beefile, and the
- three ``kernel-cve`` detectors, each with its own.
+ three ``kernel-cve`` detectors and the ``kernel-cve``
+ mitigation, each with its own.
* - :src:`systemd/`
- Unit and timer templates for the target.
* - :src:`completion/`
diff --git a/Documentation/contribute/testing/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rst
index 0ee58945..c19615b8 100644
--- a/Documentation/contribute/testing/test-coverage.rst
+++ b/Documentation/contribute/testing/test-coverage.rst
@@ -305,6 +305,14 @@ signed config image.
admit, and a BPF unload directive that names the agent are
refused; the unload removes options and archive, measures a
``java_unload`` and leaves a jar whose agent does nothing
+ * - ``t3115-af-alg-block``
+ - The CVE-2026-31431 mitigation of ``upatches/kernel-cve``, built
+ from its shipped source, driven by the shipped reproducer against
+ the ``AF_ALG`` aead interface the CI kernel enables: the probe
+ reaches the ``algif_aead`` decrypt before the load (``SAFE`` or
+ ``BROKEN``), is refused (``BLOCKED``) while the mitigation is
+ loaded with no ``AF_UNIX`` socket refused, and reaches the path
+ again after the unload
``tpm`` (4)
~~~~~~~~~~~
@@ -839,12 +847,15 @@ signed config image.
dot or byte outside printable ASCII recorded as ``?``
* - ``t9105-delivery``
- The operator package built and installed in an operator VM
- without a TPM, which publishes ``kernel-obs`` and the Java agent
- ``e2e-java`` it compiles, and verifies the evidence, its
- ``java_load`` included; registry, tree sync, load, export and
- attestation on the target, and a JVM a user manager starts
- picking up ``JAVA_TOOL_OPTIONS`` and running the agent from its
- sealed jar
+ without a TPM, which publishes ``kernel-obs``, the Java agent
+ ``e2e-java`` it compiles and the precise CVE-2026-31431 mitigation
+ ``cve-2026-31431-alg-splice-block``, and verifies the evidence,
+ its ``java_load`` and the mitigation's load included; registry,
+ tree sync, load, export and attestation on the target, a JVM a
+ user manager starts picking up ``JAVA_TOOL_OPTIONS`` and running
+ the agent from its sealed jar, and the shipped CVE probe, which
+ reached the zero-copy splice into an AF_ALG socket before the
+ sync, refused once the delivered mitigation is loaded
* - ``t9106-policy-exec-graph``
- A signed SHPL section labels five executables; its BPF policy
allows unlabeled tasks to exec unlabeled files and 0x1, allows
diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rst
index 830a76bc..b01bc30d 100644
--- a/Documentation/contribute/testing/testing.rst
+++ b/Documentation/contribute/testing/testing.rst
@@ -1056,8 +1056,9 @@ config image, as ``t9105`` configures node A:
* - ``config-end2end``
- ``role=edge``
- The tree ``shirudo/end2end-tree`` and the test's collector. Node
- A activates it in ``t9105``, and the ``kernel-obs`` and
- ``e2e-java`` operations select ``role=edge``.
+ A activates it in ``t9105``, and the ``kernel-obs``, ``e2e-java``
+ and ``cve-2026-31431-alg-splice-block`` operations select
+ ``role=edge``.
* - ``config-edge``
- ``role=edge``
- The tree ``shirudo/pipeline-tree`` on the test's registry and the
diff --git a/Documentation/upatches/learn/examples.rst b/Documentation/upatches/learn/examples.rst
index cee8c8d7..ed157dc5 100644
--- a/Documentation/upatches/learn/examples.rst
+++ b/Documentation/upatches/learn/examples.rst
@@ -11,8 +11,8 @@ Example packages
The tree ships packages under :src:`upatches/`: ``kernel-obs``, a
complete observability package with arena tables, serializers, decoders
and generated ``.rodata``, and in ``kernel-cve`` three small CVE
-detectors exported from a mitigation campaign, each a package of its
-own.
+detectors exported from a mitigation campaign and one CVE mitigation,
+each a package of its own.
kernel-obs
----------
@@ -108,6 +108,23 @@ checked against an exploit.
:doc:`/upatches/learn/kernel-fix-tutorial` takes the third detector from its fix
to a package, as an ``fentry`` program.
+The directory also holds a mitigation, which the manifest does not
+list: ``cve-2026-31431-af-alg-block.bee`` builds
+``sources/cve-2026-31431-crypto-algif-aead-copy-fail/mitigation/cve-2026-31431-af-alg-block.bpf.c``
+into a package of the same shape, with ``fixes`` naming CVE-2026-31431.
+Its one program, at ``lsm/socket_create``, refuses every ``AF_ALG``
+socket with ``EPERM``. That keeps the ``algif_aead`` code the CVE is in
+out of reach, and with it every other use of the kernel's crypto
+algorithms through sockets, so a target that needs those cannot take
+it. The program reads only the hook's arguments, keeps no state and
+loads on every architecture; its selector is the Kconfig option
+``CONFIG_CRYPTO_USER_API_AEAD`` alone. :src:`tools/put-shields`
+publishes it with the detectors. Beside the source a reproducer,
+``reproducer/cve-2026-31431-repro.py``, splices a file's page cache
+through a pipe into an ``AF_ALG`` aead socket and reports whether the
+bug corrupted it; ``t3115-af-alg-block`` drives it to check the
+mitigation refuses the socket.
+
Related
-------