fix(kernel): narrow do_sign/do_deploy DISTRO_FEATURES vardep to secureboot - #670
Open
HarryWaschkeit wants to merge 1 commit into
Open
Conversation
…eboot do_sign (linux-common-secureboot.inc) and do_deploy (linux-phytec-fitimage.inc) each read the raw DISTRO_FEATURES string directly to check for 'secureboot' membership. BitBake's automatic vardep scanner therefore ties both tasks' taskhash to the entire feature list, not just the secureboot flag. Because do_compile/do_configure/do_kernel_metadata/do_compile_kernelmodules have no sstate object of their own, any unrelated DISTRO_FEATURES change (e.g. wifi/bluetooth flags driven by device_caps.json, introduced in e1ad988) forces the whole kernel compile lineage to re-run for real on the next build, while do_package_write_ipk's own signature is untouched and gets served from an older cached object. This produces an internally inconsistent image where the deployed kernel Image and the packaged kernel modules originate from different builds and refuse to load (module version magic mismatch). Observed directly in omnect-os-build/tauril2,gateway-devel build 107 (2026-07-10): do_sign/do_deploy executed fresh due to a DISTRO_FEATURES change, while do_package_write_ipk hit the shared sstate cache with an object from build 104, shipping kernel modules incompatible with the freshly built kernel Image. This adds a derived SECUREBOOT_ENABLED variable and excludes the raw DISTRO_FEATURES var from do_sign/do_deploy's tracked vardeps, so their taskhash only changes when secureboot membership itself actually toggles.
mlilien
approved these changes
Jul 24, 2026
JanZachmann
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
do_sign(recipes-kernel/linux/linux-common-secureboot.inc) anddo_deploy(linux-phytec-fitimage.inc, from meta-phytec) each read the rawDISTRO_FEATURESstring directly to check forsecurebootmembership:BitBake's automatic vardep scanner ties both tasks' taskhash to the entire feature list, not just the
securebootflag. Becausedo_compile/do_configure/do_kernel_metadata/do_compile_kernelmoduleshave no sstate object of their own (onlydo_populate_lic,do_package*,do_populate_sysroot,do_packagedata,do_deployparticipate in sstate for this recipe), any unrelatedDISTRO_FEATURESchange forces the entire kernel compile lineage to re-run for real on the next build — whiledo_package_write_ipk's own signature is untouched and gets served from an older cached sstate object.Observed incident
In
omnect-os-build/tauril2,gateway-develbuild 107 (2026-07-10), thedevice_caps.json-drivenDISTRO_FEATURESrework (#665 / e1ad988) changedDISTRO_FEATURES's value for unrelated wifi/bluetooth reasons. This invalidateddo_sign/do_deploy's taskhash, forcing a fresh kernel rebuild (do_kernel_metadata→ ... →do_compile_kernelmodules→do_deploy, all real executions, confirmed in the Concourse build log). Meanwhiledo_package_write_ipkhit the shared sstate cache with an object from build 104. The result: the deployed kernel Image and the packaged kernel modules originated from two different kernel builds and failed to load on the device (module version magic mismatch, confirmed viauname -rvs. the modules directory name differing in their kernel-yocto merge-tree hash).Fix
Add a derived
SECUREBOOT_ENABLEDvariable and exclude the rawDISTRO_FEATURESvar fromdo_sign/do_deploy's tracked vardeps, so their taskhash only changes whensecurebootmembership itself actually toggles — not on every unrelatedDISTRO_FEATURESchurn.Scope / limitations
This closes the specific trigger seen in this incident. It does not fix the general architectural gap that
do_package_write_ipk/do_populate_sysroothave no dependency on whetherdo_compile_kernelmoduleswas actually re-executed vs. served from sstate — a follow-up hardening this dependency directly is being considered separately.