Description
Describe the bug
Please find attached a zip file of three binaries, each of which trigger an assertion failure when importing. The assertion failure seems similar; out of caution, I'm attaching all three of these.
These are x86-64 ELF binaries with dwarf debug information, produced by building a debug build of the EDK2 reference UEFI firmware. The actual runtime EFI binaries are PE/COFF; I believe these ELF files are the same but put inside an EFI and with dwarf debug info.
Of a few hundred such .debug binaries, only these three crash; others I have used successfully in Ghidra, so clearly all the required information seems to be usually present. Having said that, I do not know how functional these would be as executables; I assume they would be.
When importing the attached "Dhcp4Dxe.debug" file, I get this error message:
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf symbol table section .symtab linked to string table section .strtab
-- | -- | -- | --
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela.text linked to symbol table section .symtab affecting .text
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela.data linked to symbol table section .symtab affecting .data
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela linked to symbol table section .symtab affecting PT_LOAD
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_info linked to symbol table section .symtab affecting .debug_info
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_loclists linked to symbol table section .symtab affecting .debug_loclists
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_aranges linked to symbol table section .symtab affecting .debug_aranges
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_rnglists linked to symbol table section .symtab affecting .debug_rnglists
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_line linked to symbol table section .symtab affecting .debug_line
2025-02-19 | 16:14:21 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_frame linked to symbol table section .symtab affecting .debug_frame
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf symbol table section .symtab linked to string table section .strtab
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela.text linked to symbol table section .symtab affecting .text
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela.data linked to symbol table section .symtab affecting .data
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela linked to symbol table section .symtab affecting PT_LOAD
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_info linked to symbol table section .symtab affecting .debug_info
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_loclists linked to symbol table section .symtab affecting .debug_loclists
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_aranges linked to symbol table section .symtab affecting .debug_aranges
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_rnglists linked to symbol table section .symtab affecting .debug_rnglists
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_line linked to symbol table section .symtab affecting .debug_line
2025-02-19 | 16:14:23 | DEBUG | (ElfHeader) Elf relocation table section .rela.debug_frame linked to symbol table section .symtab affecting .debug_frame
2025-02-19 | 16:14:23 | DEBUG | (ElfProgramBuilder) Discarding 60-byte alignment/filler segment_1.2 at 0000d4c4
2025-02-19 | 16:14:24 | ERROR | (ImporterUtilities) Error Importing File: Error importing file: Dhcp4Dxe.debug ghidra.util.exception.AssertException: _GLOBAL_OFFSET_TABLE_ already allocated
| | | at ghidra.app.util.bin.format.elf.relocation.X86_64_ElfRelocationContext.allocateGot(X86_64_ElfRelocationContext.java:163)
| | | at ghidra.app.util.bin.format.elf.relocation.X86_64_ElfRelocationContext.getNextAllocatedGotEntryAddress(X86_64_ElfRelocationContext.java:203)
| | | at ghidra.app.util.bin.format.elf.relocation.X86_64_ElfRelocationContext.getGotEntryAddress(X86_64_ElfRelocationContext.java:250)
| | | at ghidra.app.util.bin.format.elf.relocation.X86_64_ElfRelocationHandler.relocate(X86_64_ElfRelocationHandler.java:275)
| | | at ghidra.app.util.bin.format.elf.relocation.X86_64_ElfRelocationHandler.relocate(X86_64_ElfRelocationHandler.java:29)
| | | at ghidra.app.util.bin.format.elf.relocation.AbstractElfRelocationHandler.relocate(AbstractElfRelocationHandler.java:119)
| | | at ghidra.app.util.bin.format.elf.relocation.ElfRelocationContext.processRelocation(ElfRelocationContext.java:146)
| | | at ghidra.app.util.bin.format.elf.relocation.ElfRelocationContext.processRelocation(ElfRelocationContext.java:121)
| | | at ghidra.app.util.opinion.ElfProgramBuilder.processRelocationTableEntries(ElfProgramBuilder.java:1055)
| | | at ghidra.app.util.opinion.ElfProgramBuilder.processRelocationTable(ElfProgramBuilder.java:950)
| | | at ghidra.app.util.opinion.ElfProgramBuilder.processRelocations(ElfProgramBuilder.java:887)
| | | at ghidra.app.util.opinion.ElfProgramBuilder.load(ElfProgramBuilder.java:174)
| | | at ghidra.app.util.opinion.ElfProgramBuilder.loadElf(ElfProgramBuilder.java:111)
| | | at ghidra.app.util.opinion.ElfLoader.load(ElfLoader.java:147)
| | | at ghidra.app.util.opinion.AbstractLibrarySupportLoader.doLoad(AbstractLibrarySupportLoader.java:864)
| | | at ghidra.app.util.opinion.AbstractLibrarySupportLoader.loadProgram(AbstractLibrarySupportLoader.java:107)
| | | at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:129)
| | | at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:424)
| | | at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:339)
| | | at ghidra.util.task.TaskBuilder$TaskBuilderTask.run(TaskBuilder.java:306)
| | | at ghidra.util.task.Task.monitoredRun(Task.java:134)
| | | at ghidra.util.task.TaskRunner.lambda$startTaskThread$0(TaskRunner.java:106)
| | | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
| | | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
| | | at java.base/java.lang.Thread.run(Thread.java:1575)
Also (this might be considered a separate issue?), during batch import, such an import error stops the entire batch.
To Reproduce
Unzip the attached zip. Import one or all of the binaries, for example Dhcp4Dxe.debug.
Expected behavior
- The import succeeds
Quite possibly:
- Even if the import fails, the a batch import process containing that binary still proceeds to the next binary.
Attachments
Environment (please complete the following information):
- OS: NixOS Linux
- Java Version: 23.0.1
- Ghidra Version: 11.3
- Ghidra Origin: NixOS/nixpkgs
Activity