]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
linux/generate-cve-exclusions: fix mishandling of boundary values
authorYuta Hayama <hayama@lineo.co.jp>
Tue, 5 Sep 2023 07:29:06 +0000 (16:29 +0900)
committerSteve Sakoman <steve@sakoman.com>
Tue, 10 Oct 2023 15:14:28 +0000 (05:14 -1000)
affected_versions in kernel_cves.json does not mean "first affected version
to last affected version" but actually "first affected version to fixed
version". Therefore, the variable names, conditional expressions, and
CVE_STATUS descriptions should be fixed.

For example, when the script was run against v6.1, if affected_versions was
"xxx to 6.1", the output was "cpe-stable-backport: Backported in 6.1", but
this should be "fixed-version: Fixed from version 6.1".

Signed-off-by: Yuta Hayama <hayama@lineo.co.jp>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 2064b2f9b92e2dff45dab633598b5ed37145d0b6)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-kernel/linux/generate-cve-exclusions.py

index ef47f39c1b9d6ebe8f5c8e9ee550f411c7241ba4..b52c75c18c965a94fcf8cd974e5bdb8990adf2ab 100755 (executable)
@@ -62,18 +62,18 @@ do_cve_check[prefuncs] += "check_kernel_cve_status_version"
             continue
 
         affected = data["affected_versions"]
-        first_affected, last_affected = re.search(r"(.+) to (.+)", affected).groups()
+        first_affected, fixed = re.search(r"(.+) to (.+)", affected).groups()
         first_affected = parse_version(first_affected)
-        last_affected = parse_version(last_affected)
+        fixed = parse_version(fixed)
 
         handled = False
-        if not last_affected:
+        if not fixed:
             print(f"# {cve} has no known resolution")
         elif first_affected and version < first_affected:
             print(f"# fixed-version: only affects {first_affected} onwards")
             handled = True
-        elif last_affected < version:
-            print(f"# fixed-version: Fixed after version {last_affected}")
+        elif fixed <= version:
+            print(f"# fixed-version: Fixed from version {fixed}")
             handled = True
         else:
             if cve in stream_data:
@@ -87,9 +87,9 @@ do_cve_check[prefuncs] += "check_kernel_cve_status_version"
                         # TODO print a note that the kernel needs bumping
                         print(f"# {cve} needs backporting (fixed from {backport_ver})")
                 else:
-                    print(f"# {cve} needs backporting (fixed from {last_affected})")
+                    print(f"# {cve} needs backporting (fixed from {fixed})")
             else:
-                print(f"# {cve} needs backporting (fixed from {last_affected})")
+                print(f"# {cve} needs backporting (fixed from {fixed})")
 
         if handled:
             print(f'CVE_CHECK_IGNORE += "{cve}"')