Open U-Scripter opened 1 year ago
This is the extracted kernel which results in the corrupt elf file: kernel.zip
I zipped it because Github does not allow .lz4 extensions.
This unfortunately also happens with the boot image of the Lenovo tab M10 gen 2 codename X606F.
When you get "WARNING! bad rela offset" apply_elf64_rela() exits early. It (or something else) normally inserts relative_base_address between kallsyms_offsets and kallsyms_num_syms__offset, but hasn't in this case, which causes find_kallsyms_addresses_or_symbols() to find an incorrect address for kallsyms_offsets.
A temporary solution here could be to comment out this line https://github.com/marin-m/vmlinux-to-elf/blob/master/vmlinux_to_elf/kallsyms_finder.py#L922C17-L922C46
First, I would like to thank you all for this amazing work.
Second, I would like to point out a bug (I think) I encountered. I tried running vmlinux-to-elf on a boot.img extracted from the Factory firmware downloaded from Google's image archive, and the generated elf file had offsets pointing at incorrect locations (but it does open as valid elf file in RE tools).
The exact image I used was for build number SP1A.210812.016.C1 for the Google Pixel 3 XL. You can download it from here (search for 67ea87fc in that page).
Reproduction
Actual Result
The binary has the symbols at invalid locations, which clearly visible through Ghidra's decompilation of most functions. For example, this is the
binder_ioctl
function:The assembly code does not have any resemblance of the actual
binder_ioctl
code and there are no calls to any other binder functions.Expected Result
The binary should have the symbols at valid locations. This is an example of a valid
binder_ioctl
decompilation or a valid elf generated using your tool (for another kernel):Attempted Workarounds/Solutions
I tried:
I would also like to note that using the kallsyms-finder script did extract the symbols' addresses correctly on that same boot.img.