-
Notifications
You must be signed in to change notification settings - Fork 114
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
elf: fixed .text not allocated at 0 on MIPS linux ko. #517
base: master
Are you sure you want to change the base?
Conversation
Does it work if you just fix the offset increment and not add SHT_MIPS_REGINFO to this list? based on a cursory googling, it looks like it is desirable for this section to be mapped into memory. https://reviews.llvm.org/D3041 |
If I fix only the offset will I know IDA doesn't map this section, but maybe its required for dynamic analysis. |
CLE treats programs with no program headers as fully granularly relocatable. The default behavior is to append every mapped section and just apply relocations. CLE is a pretty competent linker. |
By reading the ABI here https://refspecs.linuxfoundation.org/elf/mipsabi.pdf , I understand that its So I made it the last section to be allocated. |
Sorry, I just realized something about this issue in general. Why is it important that .text is at offset 0? Can you not replace 0 with a.main_object.sections_map[".text"].vaddr? Also, why are you assuming the compiler has put important data at offset 0 in .text? Can you not consult the symbol table for your needs? |
Maybe I need to rename this PR better, but the Issue I am facing is that I am trying to load the kernel module to a specific address, same address as the kernel loads the module. But everything is loaded 0x40 bytes forward, because the Because of that explicitly about |
When trying to load a kernel module with
I've got the wrong bytes
b'\xe2\xff\x01\xfc'
for.text
entry.This is happens because the
.text
start is pushed forward by spam sections such as.reginfo
and.note.gnu...
.In order to fix this in this MR I've done two things:
remap_offset
for those sections.I dont know a lot about mips, but a point to keep in mind is maybe
SHT_MIPS_REGINFO
should be treated the same waySHT_NOTE
is treated?I've added the KO I used as well.
usbcore.zip