Skip to content
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

Error while populating FunctionID database for Xtensa #6453

Closed
krsh opened this issue Apr 23, 2024 · 3 comments
Closed

Error while populating FunctionID database for Xtensa #6453

krsh opened this issue Apr 23, 2024 · 3 comments
Assignees
Labels
Feature: FID Feature: Loader/ELF Status: Internal This is being tracked internally by the Ghidra team
Milestone

Comments

@krsh
Copy link

krsh commented Apr 23, 2024

Describe the bug
I'm attempting to populate a FunctionIDs database for the Xtensa architecture, but I am encountering the following error:

Cannot invoke "ghidra.program.model.mem.MemoryBlock.isInitialized()" because "block" is null
java.lang.NullPointerException: Cannot invoke "ghidra.program.model.mem.MemoryBlock.isInitialized()" because "block" is null
	at ghidra.feature.fid.service.FidServiceLibraryIngest.functionIsExternal(FidServiceLibraryIngest.java:627)
	at ghidra.feature.fid.service.FidServiceLibraryIngest.addChildRelations(FidServiceLibraryIngest.java:431)
	at ghidra.feature.fid.service.FidServiceLibraryIngest.populateLibraryFromProgram(FidServiceLibraryIngest.java:283)
	at ghidra.feature.fid.service.FidServiceLibraryIngest.create(FidServiceLibraryIngest.java:244)
	at ghidra.feature.fid.service.FidService.createNewLibraryFromPrograms(FidService.java:201)
	at ghidra.feature.fid.plugin.IngestTask.run(IngestTask.java:95)
	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:1570)

---------------------------------------------------
Build Date: 2024-Apr-11 1104 UTC
Ghidra Version: 11.0.3
Java Home: /usr/lib/jvm/java-22-openjdk
JVM Version: N/A 22
OS: Linux 6.8.7-arch1-1 amd64

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Tools -> Function ID -> Create new empty FidDb'
  2. Click on 'Tools -> Function ID -> Populate FidDb'
  3. Select a xtensa Elf application as 'Root Folder'
  4. See error

Expected behavior
Populate the FidDb file with the functions found in the application

Environment (please complete the following information):

  • OS: Linux 6.8.7-arch1-1 amd64
  • Java Version: 22
  • Ghidra Version: 11.0.3
  • Ghidra Origin: third party distro
@emteere
Copy link
Contributor

emteere commented May 8, 2024

Can you tell which program it is ingesting and is causing the stacktrace?

Somehow there is a function defined in non-existent memory in one of your binaries you are ingesting. This code should check for that. However is could be a bug in the analysis creating a function in memory that doesn't exist, or it could be an issue with processing of declarations in the ELF file, especially if the binary is a .o file.

If you can identify which binary is being processed, can you share the binary?

@ryanmkurtz ryanmkurtz added the Status: Waiting on customer Waiting for customer feedback label May 8, 2024
@krsh
Copy link
Author

krsh commented May 8, 2024

This is the binary: app.elf.tar.gz

@ryanmkurtz ryanmkurtz added Status: Triage Information is being gathered and removed Status: Waiting on customer Waiting for customer feedback labels May 8, 2024
@ghidra1
Copy link
Collaborator

ghidra1 commented May 8, 2024

I have not seen an ELF binary like this before. It appears to be pre-linked with external symbol locations and does not rely on a dynamic linker. All of the external functions appear to have pre-assigned addresses which do not correspond to defined memory blocks. While a null block check would be simple enough to add to the offending code in this case, these functions will only appear in the symbol table/tree and will not be identified as external. Although, the function signatures can still be viewed (tree: tooltip, table: preview column) and the function editor invoked on these symbols.

Most things appear to work OK, but I also see the following issues with this binary during processing:

  • pcode errors related to SymbolicPropogator
  • DWARF processing errors (will be addressed separately)

@ghidra1 ghidra1 added Status: Internal This is being tracked internally by the Ghidra team and removed Status: Triage Information is being gathered labels May 8, 2024
@ghidra1 ghidra1 added this to the 11.1 milestone May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: FID Feature: Loader/ELF Status: Internal This is being tracked internally by the Ghidra team
Projects
None yet
Development

No branches or pull requests

4 participants