Open
Conversation
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.
Followup from #11 with feedback and additions.
Built an export using default templates from Godot 4.5.1, seemingly returns the same output for both Windows and Linux binaries.
Previous issue:
The ELF key scanner failed to find encryption keys in Linux Godot binaries, while the PE scanner worked correctly for Windows binaries. Debug logs showed:
[find_lea] Found LEA at VA=0x14279126c- GOOD[find_lea] No matching LEA instruction found.- BADELF section headers contain absolute virtual addresses, unlike PE which uses RVAs relative to ImageBase. The code was adding a hardcoded base address (
0x400000) to already-absolute section addresses, causing all VA calculations to be off by 0x400000.GCC on Linux generates different code than MSVC on Windows:
LEA reg, [rip+disp32]48 8D 05 xx xx xx xxMOV r32, imm3241 B8 xx xx xx xxFor non-PIE binaries where addresses fit in 32 bits, GCC uses direct immediate loads instead of RIP-relative LEA instructions.
Changes
src/elf/elf_image.cppm_base_address = 0for ET_EXEC binaries since section VAs are already absolutesrc/elf/elf_patterns.cppMOV r32, imm32pattern support (5-byte and 6-byte forms)rex == 0x48→(rex & 0xF8) == 0x48.bssfrom data section filter (encryption keys are in.data)text_va_basecalculation to use section VA directlysrc/elf/elf_scanner.cppsrc/pe/pe_patterns.cppTesting
Windows Binary
Linux Binary