Libloader: report image info after relocation#1
Open
Conversation
This commit adds a hook to the app model abstraction. This hook is called in the ELF loader after the binary is loaded to a potentially relocated address. The users of the loader library (Moe, l4re_itas, Ned) override this virtual hook to signal the binary's image info to the debugging subsystem of the kernel. Signed-off-by: Viktor Reusch <viktor.reusch@barkhauseninstitut.org>
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.
I stumbled upon the issue that Moe, l4re_itas, and Ned seem to not send the correct base of loaded binaries via
l4_debugger_add_image_infoto the kernel if the binary is relocatable.Instead, the kernel receives a base address of
~0.The issue seems to be that all these loaders invoke the reporting function before they know the relocations, which are done in the ELF loader later on.
This commit adds a hook to the app model abstraction. This hook is called in the ELF loader after the binary is loaded to a potentially relocated address. The users of the loader library (Moe, l4re_itas, Ned) override this virtual hook to signal the binary’s image info to the debugging subsystem of the kernel.
I have not tested if this also works for loading an interpreter.
Also, none of my test cases set a
basehigher than 0. So, I do not know if this patch works with “actual” relocations; though, I would assume so.