Skip to content

eBPF-based security platform

upatches/kernel-cve: build one shield package per detector

John Fastabend190b6f872c15
diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rst
index c71d4d42..97e55e0c 100644
--- a/Documentation/contribute/code/developer-guide.rst
+++ b/Documentation/contribute/code/developer-guide.rst
@@ -419,8 +419,8 @@ Project layout
- Kernel source, configuration, patches and built artifacts used
by CI. See :doc:`/internals/kernel-patches`.
* - :src:`upatches/`
- - The shipped packages, ``kernel-obs`` and ``kernel-cve``, each
- with its Beefile.
+ - The shipped packages: ``kernel-obs`` with its Beefile, and the
+ three ``kernel-cve`` detectors, 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 5c106521..f4e81eb1 100644
--- a/Documentation/contribute/testing/test-coverage.rst
+++ b/Documentation/contribute/testing/test-coverage.rst
@@ -1280,8 +1280,8 @@ Commands and procedures
- ``status --include-eventlog`` and ``--show-full``.
- ``upatch rewrite-rodata`` in ``shirudo-build``, which
``kernel-obs`` uses to rewrite its watch lists.
-- The ``kernel-cve`` package. Its Beefile is a seed of the ``beefile``
- fuzz target only.
+- The ``kernel-cve`` packages. A copy of an earlier Beefile of them is a
+ seed of the ``beefile`` fuzz target.
- The recovery, upgrade and decommissioning procedures of
:doc:`/operate/maintain/backup-recovery` and :doc:`/operate/maintain/upgrade`.
- Exit statuses. ``t8001``, ``t4003`` and ``t4102`` check a few, but no
diff --git a/Documentation/reference/formats/beefile.rst b/Documentation/reference/formats/beefile.rst
index d57abe5e..964aa333 100644
--- a/Documentation/reference/formats/beefile.rst
+++ b/Documentation/reference/formats/beefile.rst
@@ -642,16 +642,6 @@ and names the advisory it fixes.
operator$ shirudo bpm tree append ./xfs-fix-1.1.0.bee \
oci://registry.example.com/shirudo/fleet-base --keys-dir keys
-Not a model
-~~~~~~~~~~~
-
-:src:`upatches/kernel-cve/kernel-cve.bee` breaks these rules. Two of its
-load targets make member paths longer than 99 bytes with any version, so
-``bpm build`` fails. Its tree ids name the CVE directories while its
-upatch names are the detectors' base names, so ``bpm tree append`` would
-refuse every entry. And its ``unload_artifact`` paths name members the
-package does not have.
-
Related
-------
diff --git a/Documentation/upatches/learn/examples.rst b/Documentation/upatches/learn/examples.rst
index eb5e6cba..4424aa5f 100644
--- a/Documentation/upatches/learn/examples.rst
+++ b/Documentation/upatches/learn/examples.rst
@@ -8,10 +8,11 @@
Example packages
================
-The tree ships two packages under :src:`upatches/`: ``kernel-obs``, a
+The tree ships packages under :src:`upatches/`: ``kernel-obs``, a
complete observability package with arena tables, serializers, decoders
-and generated ``.rodata``, and ``kernel-cve``, a set of small CVE
-detectors exported from a mitigation campaign.
+and generated ``.rodata``, and in ``kernel-cve`` three small CVE
+detectors exported from a mitigation campaign, each a package of its
+own.
kernel-obs
----------
@@ -67,9 +68,15 @@ kernel-cve
:src:`upatches/kernel-cve/` holds three detectors, each in
``sources/<slug>/observability/``, a ``vmlinux.h``, ``manifest.json``
-with one record per detector, and the Beefile ``kernel-cve.bee``. The
-manifest names the kernel the detectors were loaded on,
-``7.2.0-shirudo-7.2``.
+with one record per detector, and one Beefile per detector,
+``<detector>.bee``. The manifest names the kernel the detectors were
+loaded on, ``7.2.0-shirudo-7.2``.
+
+Each Beefile builds a package named after its detector with one upatch
+and one ``[upatches.tree]`` entry of the same name. The entry's
+``fixes`` names the detector's CVE, and its selector the kernel of the
+manifest: release prefix ``7.2``, its build ID, ``x86_64`` and the
+Kconfig option of the driver or protocol the detector watches.
.. list-table::
:header-rows: 1
@@ -97,9 +104,7 @@ predicate as ``source_derived_unvalidated``: derived from the fix, not
checked against an exploit.
:doc:`/upatches/learn/kernel-fix-tutorial` takes the third detector from its fix
-to a package, as an ``fentry`` program. ``kernel-cve.bee`` itself does not
-build, and its tree entries do not match its upatch names.
-:doc:`/reference/formats/beefile` lists what is wrong with it.
+to a package, as an ``fentry`` program.
Related
-------
diff --git a/upatches/kernel-cve/cve-2025-71093-e1000-tbi-detector.bee b/upatches/kernel-cve/cve-2025-71093-e1000-tbi-detector.bee
new file mode 100644
index 00000000..f9a90491
--- /dev/null
+++ b/upatches/kernel-cve/cve-2025-71093-e1000-tbi-detector.bee
@@ -0,0 +1,20 @@
+[package]
+name = "cve-2025-71093-e1000-tbi-detector"
+description = "Counts e1000 TBI frames of length 0, CVE-2025-71093"
+license = "GPL-2.0 OR BSD-2-Clause"
+authors = ["Authors of shirudo"]
+
+[[upatches]]
+source = "sources/cve-2025-71093-e1000-oob-e1000-tbi-should-accept/observability/cve-2025-71093-e1000-tbi-detector.bpf.c"
+
+[upatches.tree]
+id = "cve-2025-71093-e1000-tbi-detector"
+fixes = ["CVE-2025-71093"]
+
+[upatches.tree.selector]
+kernel_release_prefix = ["7.2"]
+kernel_build_id = ["534043106db415bc0a983a3393e06c81b431bd39"]
+architecture = ["x86_64"]
+
+[upatches.tree.selector.kconfig]
+CONFIG_E1000 = ["y", "m"]
diff --git a/upatches/kernel-cve/cve-2026-31675-netem-detector.bee b/upatches/kernel-cve/cve-2026-31675-netem-detector.bee
new file mode 100644
index 00000000..fb86a5df
--- /dev/null
+++ b/upatches/kernel-cve/cve-2026-31675-netem-detector.bee
@@ -0,0 +1,20 @@
+[package]
+name = "cve-2026-31675-netem-detector"
+description = "Counts netem packets with an empty linear head, CVE-2026-31675"
+license = "GPL-2.0 OR BSD-2-Clause"
+authors = ["Authors of shirudo"]
+
+[[upatches]]
+source = "sources/cve-2026-31675-net-sched-sch-netem-oob-access-packet-corruption/observability/cve-2026-31675-netem-detector.bpf.c"
+
+[upatches.tree]
+id = "cve-2026-31675-netem-detector"
+fixes = ["CVE-2026-31675"]
+
+[upatches.tree.selector]
+kernel_release_prefix = ["7.2"]
+kernel_build_id = ["534043106db415bc0a983a3393e06c81b431bd39"]
+architecture = ["x86_64"]
+
+[upatches.tree.selector.kconfig]
+CONFIG_NET_SCH_NETEM = ["y", "m"]
diff --git a/upatches/kernel-cve/cve-2026-63984-rpl-detector.bee b/upatches/kernel-cve/cve-2026-63984-rpl-detector.bee
new file mode 100644
index 00000000..c01a263e
--- /dev/null
+++ b/upatches/kernel-cve/cve-2026-63984-rpl-detector.bee
@@ -0,0 +1,20 @@
+[package]
+name = "cve-2026-63984-rpl-detector"
+description = "Counts RPL source routing headers whose n + 1 exceeds 127, CVE-2026-63984"
+license = "GPL-2.0 OR BSD-2-Clause"
+authors = ["Authors of shirudo"]
+
+[[upatches]]
+source = "sources/cve-2026-63984-ipv6-rpl-hdrlen-overflow-ipv6-rpl-srh-decompress/observability/cve-2026-63984-rpl-detector.bpf.c"
+
+[upatches.tree]
+id = "cve-2026-63984-rpl-detector"
+fixes = ["CVE-2026-63984"]
+
+[upatches.tree.selector]
+kernel_release_prefix = ["7.2"]
+kernel_build_id = ["534043106db415bc0a983a3393e06c81b431bd39"]
+architecture = ["x86_64"]
+
+[upatches.tree.selector.kconfig]
+CONFIG_IPV6 = ["y", "m"]
diff --git a/upatches/kernel-cve/kernel-cve.bee b/upatches/kernel-cve/kernel-cve.bee
deleted file mode 100644
index 11412f70..00000000
--- a/upatches/kernel-cve/kernel-cve.bee
+++ /dev/null
@@ -1,56 +0,0 @@
-[package]
-name = "kernel-cve-upatches"
-description = "Exported shirudo kernel CVE upatch sources"
-license = "GPL-2.0 OR BSD-2-Clause"
-authors = ["shirudo Campaign Export"]
-
-[[upatches]]
-source = "sources/cve-2025-71093-e1000-oob-e1000-tbi-should-accept/observability/cve-2025-71093-e1000-tbi-detector.bpf.c"
-load_target = "upatches/cve-2025-71093-e1000-oob-e1000-tbi-should-accept.upatch"
-
-[upatches.tree]
-id = "cve-2025-71093-e1000-oob-e1000-tbi-should-accept"
-load_artifact = "upatches/cve-2025-71093-e1000-oob-e1000-tbi-should-accept.upatch"
-unload_artifact = "upatches/cve-2025-71093-e1000-oob-e1000-tbi-should-accept.unload.upatch"
-
-[upatches.tree.selector]
-kernel_release_prefix = ["7.2"]
-kernel_build_id = ["534043106db415bc0a983a3393e06c81b431bd39"]
-architecture = ["x86_64"]
-
-[upatches.tree.selector.kconfig]
-CONFIG_E1000 = ["y", "m"]
-
-[[upatches]]
-source = "sources/cve-2026-31675-net-sched-sch-netem-oob-access-packet-corruption/observability/cve-2026-31675-netem-detector.bpf.c"
-load_target = "upatches/cve-2026-31675-net-sched-sch-netem-oob-access-packet-corruption.upatch"
-
-[upatches.tree]
-id = "cve-2026-31675-net-sched-sch-netem-oob-access-packet-corruption"
-load_artifact = "upatches/cve-2026-31675-net-sched-sch-netem-oob-access-packet-corruption.upatch"
-unload_artifact = "upatches/cve-2026-31675-net-sched-sch-netem-oob-access-packet-corruption.unload.upatch"
-
-[upatches.tree.selector]
-kernel_release_prefix = ["7.2"]
-kernel_build_id = ["534043106db415bc0a983a3393e06c81b431bd39"]
-architecture = ["x86_64"]
-
-[upatches.tree.selector.kconfig]
-CONFIG_NET_SCH_NETEM = ["y", "m"]
-
-[[upatches]]
-source = "sources/cve-2026-63984-ipv6-rpl-hdrlen-overflow-ipv6-rpl-srh-decompress/observability/cve-2026-63984-rpl-detector.bpf.c"
-load_target = "upatches/cve-2026-63984-ipv6-rpl-hdrlen-overflow-ipv6-rpl-srh-decompress.upatch"
-
-[upatches.tree]
-id = "cve-2026-63984-ipv6-rpl-hdrlen-overflow-ipv6-rpl-srh-decompress"
-load_artifact = "upatches/cve-2026-63984-ipv6-rpl-hdrlen-overflow-ipv6-rpl-srh-decompress.upatch"
-unload_artifact = "upatches/cve-2026-63984-ipv6-rpl-hdrlen-overflow-ipv6-rpl-srh-decompress.unload.upatch"
-
-[upatches.tree.selector]
-kernel_release_prefix = ["7.2"]
-kernel_build_id = ["534043106db415bc0a983a3393e06c81b431bd39"]
-architecture = ["x86_64"]
-
-[upatches.tree.selector.kconfig]
-CONFIG_IPV6 = ["y", "m"]