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

Linux: Replace uses of specific types with the more generic pointer #1151

Merged
merged 2 commits into from
Jun 9, 2024

Conversation

ikelos
Copy link
Member

@ikelos ikelos commented May 20, 2024

Attempts to fix #1041 by changing hard coded types into the more general pointer (since the type is usually for a pointer). This is due to LLVM producing a different base type. It doesn't necessarily resolve the situation permanently, but it should alleviate the main situations where it arises.

@ikelos ikelos self-assigned this May 20, 2024
@ikelos ikelos requested a review from atcuno May 20, 2024 20:10
@ikelos
Copy link
Member Author

ikelos commented May 20, 2024

Could someone on #1041 please test this to see if it resolves the issue at hand? The other options available are to hard code our own version of that type, or force dwarf2json to inject it, neither of which seem all that clean...

@ikelos
Copy link
Member Author

ikelos commented May 20, 2024

Welp, that didn't work. Looks like I'll need to investigate what went wrong...
Seems to be returning no results for linux plugins (but not throw an issue). Should be easy to check the difference between the working version and the patched version.

@ikelos
Copy link
Member Author

ikelos commented May 21, 2024

Ok, turns out this doesn't work for a number of reasons. Firstly, it's being done on the physical layer, which still comes out with the right pointer size, but the pointer is then limited to the size of the layer it's in, so it gets cropped. Secondly, the symbol space has been loaded, but the higher layer hasn't been decided yet (because that depends on the init_task, which is what we're trying to make) so there's no way of using it as the native_layer for the pointer.

So now I'm doing a little bit of ugly gymnastics to cast the pointer to bytes (to get the original value) and then read the integer value from it the same way the pointer would, but without the address layer mask. Shouldn't be necessary for the other use because just wants the size, which should match the system's pointer size (not sure if that holds true for 32-bit systems, I'm not sure what long unsigned int is defined as in 32-bit systems). There may still be other places where the core depends on symbols that may not be present in the final symbol table. Some will be in plugins, but I care less about them than the core.

@ikelos ikelos merged commit faadfab into develop Jun 9, 2024
26 checks passed
@ikelos ikelos deleted the feature/linux-replace-intunsignedlong branch June 9, 2024 22:20
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.

Add support for newer LLVM parsing for Linux - Replace "long unsigned int" with"unsigned long"
1 participant