lookup: defer, don't fail closed, when a file's locals can't be matched against the reference symbol table - #1517
Open
benjamindonnachie wants to merge 1 commit into
Conversation
matched against the reference symbol table gcc's inlining decisions for a handful of functions per translation unit are not always reproducible between a local kpatch-build rebuild and the officially published kernel build it's diffing against -- most plausibly because the published build applies profile-guided optimization data the local rebuild has no access to. A function can end up split into a .part.N cold-path clone, or fully inlined away, in one build but not the other, with no actual source change at all. find_local_syms() previously failed the whole build the moment this happened for *any* file, including files kpatch-build only recompiled as a side effect of Kbuild dependency tracking (an unrelated header changed) and that have no bearing on the actual patch. That makes an otherwise-successful build fail on files nowhere near the real diff. Since lookup_local_symbol() already handles a NULL lookup_table_file_sym cleanly (it just reports "not found" instead of crashing -- the in_file flag never sets because nothing will equal NULL in the symbol walk), leaving a file's locals uncorrelated here is safe: this only becomes a real, later failure at the point something in the actual patch tries and fails to resolve one of this file's local symbols, which is exactly where a genuine problem should be caught. Reproduced and fixed while building a real cumulative EL9 5.14 kernel livepatch: this took the failure count on that build from 40 files down to functions actually relevant to the patch. Co-authored-by: Claude <noreply@anthropic.com>
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.
Part of #1514.
gcc's inlining decisions for a handful of functions per translation
unit are not always reproducible between a local kpatch-build
rebuild and the officially published kernel build it's diffing
against — most plausibly because the published build applies
profile-guided optimization data the local rebuild has no access to.
A function can end up split into a
.part.Ncold-path clone, orfully inlined away, in one build but not the other, with no actual
source change at all.
find_local_syms()previously failed the whole build the momentthis happened for any file, including files kpatch-build only
recompiled as a side effect of Kbuild dependency tracking (an
unrelated header changed) and that have no bearing on the actual
patch. That makes an otherwise-successful build fail on files
nowhere near the real diff.
Since
lookup_local_symbol()already handles a NULLlookup_table_file_symcleanly (it just reports "not found" insteadof crashing — the
in_fileflag never sets because nothing willequal NULL in the symbol walk), leaving a file's locals uncorrelated
here is safe: this only becomes a real, later failure at the point
something in the actual patch tries and fails to resolve one of this
file's local symbols, which is exactly where a genuine problem
should be caught.
Testing
Reproduced and fixed while building a real cumulative EL9 5.14
kernel livepatch: this took the failure count on that build from 40
files down to just files needing the CSWTCH fix in #1514 (0 after
that too). See #1514 for full context.
Co-authored-by: Claude noreply@anthropic.com