Make kallsyms heuristics stricter so it doesn't get confused on older devices.#208
Closed
ezdiy wants to merge 1 commit intobmax121:mainfrom
Closed
Make kallsyms heuristics stricter so it doesn't get confused on older devices.#208ezdiy wants to merge 1 commit intobmax121:mainfrom
ezdiy wants to merge 1 commit intobmax121:mainfrom
Conversation
on older devices.
bmax121
reviewed
Nov 7, 2025
|
|
||
| #define NOFS 10 | ||
| uint64_t ofs[NOFS] = { 0xffffff88c9481000,0xffffff88c9481000,0xffffff88c9481000,0xffffff88c94811c4,0xffffff88c948167c,0xffffff88c9481768,0xffffff88c94818a4,0xffffff88c9481944,0xffffff88c9481a2c,0xffffff88c9481c08, }; | ||
|
|
Owner
There was a problem hiding this comment.
This is unreliable; the kernel image doesn't contain runtime addresses.
Author
There was a problem hiding this comment.
#if 0. This is left in code if heuristic fails, you're supposed to fill in your own just by copy paste, hence runtime addresses - this is deliberate for simplicity. It works because only deltas between em are compared. It's not immediately apparent, but it's what the code below does:
uint64_t first = uint_unpack(img + pos, elem_size, info->is_be) - ofs[0];
for (int i = 1; i < NOFS; i++) {
if ((uint_unpack(img + pos + i * elem_size, elem_size, info->is_be) - ofs[i]) != first) {
goto gonext;
That is, ofs[0] is used to "rebase".
Collaborator
There was a problem hiding this comment.
hard to merge,The code is not universal
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.
Fixes "confused" kallsyms on 4.14 / A10.
This needs to be tested that it doesn't break newer kernels.
When kallsyms get "confused", we guess the offset of addresses/offsets wrong, and subsequently produce garbage kallsyms table. This then segfaults in page_init / other patches pointing to wrong (usually too large) address.
Potentially fixes #204, as they're getting segfault also (though it's not clear where).