Skip to content

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
dynup:masterfrom
benjamindonnachie:fix-defer-local-syms
Open

lookup: defer, don't fail closed, when a file's locals can't be matched against the reference symbol table#1517
benjamindonnachie wants to merge 1 commit into
dynup:masterfrom
benjamindonnachie:fix-defer-local-syms

Conversation

@benjamindonnachie

Copy link
Copy Markdown

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.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.

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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant