create-diff-object: don't mark prefix symbols as changed - #1512
Draft
Zinkelburger wants to merge 1 commit into
Draft
create-diff-object: don't mark prefix symbols as changed#1512Zinkelburger wants to merge 1 commit into
Zinkelburger wants to merge 1 commit into
Conversation
When a symbol moves between sections -- out of an ignored section, or
between text subsections -- kpatch_compare_correlated_symbol() marks it
CHANGED. A function's __pfx_/__cfi_ prefix symbol moves along with its
parent, so it gets marked CHANGED as well.
Prefix symbols are padding, not independently patchable functions.
kpatch_find_func_profiling_calls() already skips them, so they never have
has_func_profiling set, and kpatch_check_func_profiling_calls() then
rejects the build:
function __pfx_foo has no fentry/mcount call, unable to patch
Marking them CHANGED also emits a klp_func entry pointing at the padding
instead of the function.
This shows up on x86_64 with CONFIG_CALL_PADDING when patching a function
in a section that doesn't honor -ffunction-sections, such as .sched.text:
dropping __sched from the function and adding
KPATCH_IGNORE_SECTION(".sched.text") moves both the function and its
prefix symbol out of the shared section.
Leave the prefix symbol's status alone. It is still carried into the
output through its parent function's sym->pfx link.
Signed-off-by: Andrew Bernal <andrewlbernal@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
Hi @Zinkelburger : thanks for the PR, though since we are mostly in maintenance-mode only for kpatch-build, what are the intended use-cases for this fix? And then, which approach is better #1512 or #1503 ? |
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.
When a symbol moves between sections -- out of an ignored section, or between text subsections -- kpatch_compare_correlated_symbol() marks it CHANGED. A function's _pfx/_cfi prefix symbol moves along with its parent, so it gets marked CHANGED as well.
Prefix symbols are padding, not independently patchable functions. kpatch_find_func_profiling_calls() already skips them, so they never have has_func_profiling set, and kpatch_check_func_profiling_calls() then rejects the build:
function __pfx_foo has no fentry/mcount call, unable to patch
Marking them CHANGED also emits a klp_func entry pointing at the padding instead of the function.
This shows up on x86_64 with CONFIG_CALL_PADDING when patching a function in a section that doesn't honor -ffunction-sections, such as .sched.text: dropping __sched from the function and adding
KPATCH_IGNORE_SECTION(".sched.text") moves both the function and its prefix symbol out of the shared section.
Leave the prefix symbol's status alone. It is still carried into the output through its parent function's sym->pfx link.