From 1e9ec1d251ece720160a081a47e88952ccce00c8 Mon Sep 17 00:00:00 2001 From: Michal Koutný Date: Apr 05 2024 14:18:24 +0000 Subject: mass-cve: Add processing of all known history --- diff --git a/scripts/cve_tools/Makefile b/scripts/cve_tools/Makefile index 756ee4a..0e76022 100644 --- a/scripts/cve_tools/Makefile +++ b/scripts/cve_tools/Makefile @@ -1,13 +1,18 @@ # Expects VULNS_GIT environment variable with a clone of https://git.kernel.org/pub/scm/linux/security/vulns.git # Expects KSOURCE_GIT environment variable CVE_TO_BUG=../cve-to-bug.py + ADD_REF=./add-missing-reference -YEAR=2024 +# oldest stable 4.19 when kernel.org CNA started is from 2018 +FIRST_YEAR=2018 +# Outer parameter, can be overriden +YEAR=$(shell date +%Y) # Outer parameter, can be overriden BRANCH=cve/linux-5.14 branch=$(subst /,_,$(BRANCH)) +.PHONY: update_refs_history update_refs_$(branch)_$(YEAR) hash_cve_$(YEAR).dat: $(wildcard $(VULNS_GIT)/cve/published/$(YEAR)/*.sha1) for f in $^ ; do \ echo $$(head -n1 $$f) $$(basename $${f%.sha1}) ; \ @@ -31,10 +36,15 @@ hash_cve_bug_$(YEAR).dat: hash_cve_$(YEAR).dat cve_bug_$(YEAR).dat update_refs: update_refs_$(branch)_$(YEAR) -update_refs_$(branch)_$(YEAR): hash_file_$(branch).dat hash_cve_bug_$(YEAR).dat +update_refs_history: set -e; pushd "$(KSOURCE_GIT)" >/dev/null ; \ git checkout -f -B users/$$USER/$(BRANCH)/cve-refs origin/$(BRANCH) 2>/dev/null ; \ popd >/dev/null + for y in $$(seq $(FIRST_YEAR) $(YEAR)) ; do \ + make BRANCH=$(BRANCH) YEAR=$$y update_refs ; \ + done + +update_refs_$(branch)_$(YEAR): hash_file_$(branch).dat hash_cve_bug_$(YEAR).dat set -e ; \ join hash_file_$(branch).dat hash_cve_bug_$(YEAR).dat | \ while read sha file cve bug ; do \