Skip to contentSkip to conversation

linux/generate-cve-exclusions: add version check warning

PATCH New [email protected] 1 participant 2 messages Aug 25, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 linux/generate-cve-exclusions: add version check warning

From: Ross Burton <[email protected]>

Embed the version that this file was generated for in the include, and compare it to the version that is being checked.

This should act as a reminder to update the file when the kernel is upgraded.

---
 .../linux/generate-cve-exclusions.py              | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
meta/recipes-kernel/linux/generate-cve-exclusions.py +12 -3
index 34f9ee731dc..3bc1c7096ff 100755
@@ -42,9 +42,18 @@ def main(argp=None):
     with open(datadir / "data" / "stream_fixes.json", "r") as f:
         stream_data = json.load(f)
 
-    print("# Auto-generated CVE metadata, DO NOT EDIT BY HAND.")
-    print(f"# Generated at {datetime.datetime.now()} for version {version}")
-    print()
+    print(f"""
+# Auto-generated CVE metadata, DO NOT EDIT BY HAND.
+# Generated at {datetime.datetime.now()} for version {version}
+
+python check_kernel_cve_status_version() {{
+    this_version = "{version}"
+    kernel_version = d.getVar("LINUX_VERSION")
+    if kernel_version != this_version:
+        bb.warn("Kernel CVE status needs updating: generated for %s but kernel is %s" % (this_version, kernel_version))
+}}
+do_cve_check[prefuncs] += "check_kernel_cve_status_version"
+""")
 
     for cve, data in cve_data.items():
         if "affected_versions" not in data:
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/2 linux-yocto: update CVE exclusions files

From: Ross Burton <[email protected]>

No changes to the data, but the version checks are added.

---
 meta/recipes-kernel/linux/cve-exclusion_6.1.inc | 11 ++++++++++-
 meta/recipes-kernel/linux/cve-exclusion_6.4.inc | 11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
meta/recipes-kernel/linux/cve-exclusion_6.1.inc +10 -1
index 499785f6d2d..ce3a534cf34 100644
@@ -1,5 +1,14 @@
+
 # Auto-generated CVE metadata, DO NOT EDIT BY HAND.
-# Generated at 2023-08-21 12:41:13.991251 for version 6.1.43
+# Generated at 2023-08-25 12:42:35.329668 for version 6.1.46"
+
+python check_kernel_cve_status_version() {
+    this_version = "6.1.46"
+    kernel_version = d.getVar("LINUX_VERSION")
+    if kernel_version != this_version:
+        bb.warn("Kernel CVE status needs updating: generated for %s but kernel is %s" % (this_version, kernel_version))
+}
+do_cve_check[prefuncs] += "check_kernel_cve_status_version"
 
 CVE_STATUS[CVE-2003-1604] = "fixed-version: Fixed after version 2.6.12rc2"
 
meta/recipes-kernel/linux/cve-exclusion_6.4.inc +10 -1
index b9210724bf0..63f0760b2d3 100644
@@ -1,5 +1,14 @@
+
 # Auto-generated CVE metadata, DO NOT EDIT BY HAND.
-# Generated at 2023-08-21 12:41:33.545124 for version 6.4.9
+# Generated at 2023-08-25 12:42:28.369507 for version 6.4.11"
+
+python check_kernel_cve_status_version() {
+    this_version = "6.4.11"
+    kernel_version = d.getVar("LINUX_VERSION")
+    if kernel_version != this_version:
+        bb.warn("Kernel CVE status needs updating: generated for %s but kernel is %s" % (this_version, kernel_version))
+}
+do_cve_check[prefuncs] += "check_kernel_cve_status_version"
 
 CVE_STATUS[CVE-2003-1604] = "fixed-version: Fixed after version 2.6.12rc2"
 
Signature · 1 line
2.34.1