Skip to content

Check compiled files to filter kernel CVEs

[email protected] openembedded-core 9 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest3 patches 1 replyIn review
  2. v71 patch 6 repliesSuperseded
  3. v63 patches 5 repliesSuperseded
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v53 patches3 repliesSuperseded
v4 posting 2/23 patches10 repliesSuperseded
v4 posting 1/22 of 3 patches0 repliesSuperseded
v38 patches10 repliesSuperseded
v26 patches7 repliesSuperseded
v12 patches6 repliesSuperseded

v2 from the cover letter

- rewrite kernel_vulns to fetch similarly as cve-update-db-native
- add functionality into cve_check.py, for the classes that uses oe.get_patched_cves function
- add linux-vulns into the cve-check results
- add only compiled files in the spdx, so the check can be done outside the build
- include compiled files into spdx when CVE_CHECK_KERNEL_CONFIG and SPDX_INCLUDE_SOURCES is enabled

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3package: export debugsources in PKGDESTWORK as jsonmeta/conf/bitbake.conf meta/lib/oe/package.py+48 -00 replies
2/3spdx: add option to include only compiled sourcesmeta/classes/create-spdx-2.2.bbclass meta/classes/spdx-common.bbclass meta/lib/oe/spdx30_tasks.py +1 more+63 -01 reply
3/3improve_kernel_cve_report: add script for postprocesing of kernel CVE datascripts/contrib/improve_kernel_cve_report.py+467 -00 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchJoshua Watt
1/3
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH v8 0/3] Check compiled files to filter kernel CVEs

From: Daniel Turull <[email protected]>

Since kernel.org became a CNA, more information is available in the published CVEs, including details about which files are affected by a given CVE.

I have rewritten the original patch after the feedback received, including only the basic functionality in the build (extracting the sources as a text file and inside spdx) and created a postprocessing script that enrich the cve-summary.

To filter out CVEs that are not applicable, we extract the files used during the kernel compilation and compare it with the metadata in the CVE.

To enabled, add in your local.conf SPDX_INCLUDE_COMPILED_SOURCES. It will generated spdx files with only the used sources. If only the kernel is wanted use in your local.conf: SPDX_INCLUDE_COMPILED_SOURCES:pn-linux-yocto = "1".

This could use as a base to run the vulnerability check independently and run an external tool to filter the CVEs.

v1: initial proposal
v2:
- rewrite kernel_vulns to fetch similarly as cve-update-db-native
- add functionality into cve_check.py, for the classes that uses oe.get_patched_cves function
- add linux-vulns into the cve-check results
- add only compiled files in the spdx, so the check can be done outside the build
- include compiled files into spdx when CVE_CHECK_KERNEL_CONFIG and SPDX_INCLUDE_SOURCES is enabled
v3:
- make inclusion of compiled files generic for SPDX, so other systems that has knowledge of used files can also make more accurate sboms
- have the functions to extract files in kernel.bbclass. For other recipes that in the future want to use this feature can add the function in their recipe or in a build bbclass.
- move order of patches
- explicitly have the save_compiled_files added only when having the CVE_CHECK_KERNEL_CONFIG
- add first kernel cves in cve_check, so manual CVE_STATUS is preserved
- add CVE_STATUS for false positives
v4:
- Refactor and reduce series to 3 patches, one for spdx, one for the kernel, and one standalone script
v5:
- Use debug information from do_package to extract compiled files
- Read spdx file from the kernel in the script to process files
v6:
- Export debug sources as compressed json in pkgdata
- CVE script is kept intact
v7:
- Only updated do_package to include better description and add function in bitbake.conf for better sstate utilizationv8:
- Simply "magic" and align what spdx_common.py is generating. Addressed Joshua comments converting arrays to sets
- Modify CVE script to use sets for the list of files

CC Peter Marko <[email protected]>
CC Marta Rybczynska <[email protected]>
CC Joshua Watt <[email protected]>
CC Quentin Schulz <[email protected]>

Daniel Turull

Daniel Turull (3):
package: export debugsources in PKGDESTWORK as json
spdx: add option to include only compiled sources
improve_kernel_cve_report: add script for postprocesing of kernel CVE
data

 meta/classes/create-spdx-2.2.bbclass         |   9 +
 meta/classes/spdx-common.bbclass             |   3 +
 meta/conf/bitbake.conf                       |   2 +
 meta/lib/oe/package.py                       |  46 ++
 meta/lib/oe/spdx30_tasks.py                  |  10 +
 meta/lib/oe/spdx_common.py                   |  41 ++
 scripts/contrib/improve_kernel_cve_report.py | 467 +++++++++++++++++++
 7 files changed, 578 insertions(+)
 create mode 100755 scripts/contrib/improve_kernel_cve_report.py