Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fbdev plugin to gracefully handle old/broken symbol tables #1686

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

atcuno
Copy link
Contributor

@atcuno atcuno commented Mar 8, 2025

This plugin backtraced when 1) fbdev was compiled as a module and 2) an old version of dwarf2json was used to generate the symbol table.

This caused the existing check for the symbol to exist to succeed, but its only as a forward declaration. Then object_from_symbol would fail as the address was recorded as 0.

My patch here makes it gracefully warn the user + exit when an old symbol table is passed, and then the existing check will work for modern symbol tables and samples with fbdev as a kernel module.

@atcuno atcuno requested a review from ikelos March 8, 2025 00:58
Copy link
Member

@ikelos ikelos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally just looks fine, but may be better to provide a warning at the top before anything gets going just to save them some time?

try:
num_registered_fb = kernel.object_from_symbol("num_registered_fb")
except exceptions.SymbolError:
vollog.error(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know the exact lowest required version number of dwarf2json? I think we've got code that can check and warn on such things? (see here )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm the thing there is that, if the fbdev driver is compiled into the kernel, then the plugin will work with the old symbols tables. The object_from_symbol call only fails when both conditions are met (compiled as module + old symbol table).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so then the check belongs in here? The point is we should be able to tell whether their symbol table is too old or if that's not the problem?

@Abyss-W4tcher
Copy link
Contributor

Thanks for spotting this issue! Once the btf2json framework integration is implemented, I think we'll be able to obtain the required module symbols directly from memory and handle that case properly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants