fix(c): invalidate cache for .include and .incbin directives - #2795
Open
bleggett wants to merge 2 commits into
Open
fix(c): invalidate cache for .include and .incbin directives#2795bleggett wants to merge 2 commits into
bleggett wants to merge 2 commits into
Conversation
Contributor
|
This also should fix #2700 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2795 +/- ##
==========================================
+ Coverage 72.90% 73.25% +0.35%
==========================================
Files 72 72
Lines 37275 37819 +544
==========================================
+ Hits 27176 27705 +529
- Misses 10099 10114 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
Hi @bleggett , Looks like you have conflicts. Please, rebase your changes |
bleggett
force-pushed
the
pr/incbin-cachebust
branch
from
August 6, 2026 17:19
9e62ec3 to
0bb81ee
Compare
Author
Rebased, thanks! |
Contributor
|
Thanks for the fixes, @bleggett Is it ok for you, @sylvestre ? |
sylvestre
reviewed
Aug 26, 2026
sylvestre
reviewed
Aug 26, 2026
bleggett
force-pushed
the
pr/incbin-cachebust
branch
from
August 27, 2026 16:12
0bb81ee to
bd909f4
Compare
bleggett
force-pushed
the
pr/incbin-cachebust
branch
from
August 27, 2026 16:14
bd909f4 to
f864db1
Compare
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.
This fixes a really nasty bug with sccache for C code where
.incbinand.includedirectives weren't fully checked for cache consistency before being returned in the build cache.This led to a case where a Linux kernel build that used
sccacheended up with kmods signed with the wrong signing key, because the kernel'scerts/system_certificates.Sembeds the cert via assembler .incbin, andsccachewould mistakenly return a stale signing key from a previous build 🙃Ex:
certs/system_certificates.S embeds the cert via assembler .incbin:
The sizes come from label arithmetic, not from the source text. So the preprocessed text of that file is byte-identical on every build regardless of which key is in signing_key.x509.
sccachehashes the preprocessed output, gets a hit, and hands back an object containing the old certificate.ccacherefuses to cache any translation unit containing .incbin precisely because of this (ccache/ccache#136, documented in the ccache manual https://ccache.dev/manual/4.13.6.html).sccachehas the detector but only wires it into preprocessor cache mode, which isn't enough.Tested with a kernel build using this SHA, mismatch issue goes away. Also added some more unit tests.
I also did a pass to see if there are other similarly-shaped problems where the cache hashing/keying might be broken and return the wrong thing and found a few more minor ones, mostly around plugins/specs/struct layout randomization, those are fixed in the second commit.