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

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.

(From OE-Core rev: 645066ecec0f52eac0225a144285f44882003856)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2023-08-25 17:08:29 +01:00
committed by Richard Purdie
parent d2d5b2ad3c
commit 2b0eac4dd6

View File

@@ -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: