kernel-cve-check: Improve error handling when fetch fails #459
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of pull request
If fetching cip-kernel-sec repository fails, the CVE checks cannot be performed. In this case, output backtrace [1] because there is insufficient error checking.
So improve to error handling.
[1]
Background
When cve-check cannot be performed, there are two ways of thinking depending on the purpose of bitbake:
e.g.
bitbake core-image-minimale.g.
bitbake linux-base -c cve_checkAdd "CVE_CHECK_ERROR_ON_FAILURE" variable to satisfy these wants.
By disabling "CVE_CHECK_DB_FILE" variable, CVE check will be skipped in Poky's do_cve_check() function.
This is the same behavior as if the NVD database download failed in Poky, skip the CVE check and continue with build.
Immediately exit with bb.fatal().
Details of improvements
In summary, the following changes in this commit:
(Even if fetching cip-kernel-sec repository fails,) A successfully fetched local repository may exist, so if the synced timestamp is today, it is considered a valid repository.
Test
How to test
local.conf setting
Add the following to local.conf.
And, for purpose of test, modify CVE_CHECK_ERROR_ON_FAILURE.
In preparation, complete the build of linux-base
Preparing for testing
Remove the local repository of cip-kernel-sec
Make cip-kernel-sec fetch fails
Build linux-base and check log
Test result
For skip behavior
Displayed
skipping CVE checkmessage and bitbake succeeds.For fatal behavior
By bb.fatal(), displayed ERROR message and bitbake stops.