boschresearch / gdbfuzz

Fuzzing Embedded Systems using Hardware Breakpoints
GNU Affero General Public License v3.0
174 stars 15 forks source link

Xtensa sample failed to run #6

Open Rrooach opened 3 months ago

Rrooach commented 3 months ago

Hi, when I compile the gdbfuzz, and try to run xtensa sample, I get the some error report.

In detail, when I run the esp-http-server sample, I have the following error:

2024-08-30 07:21:15,952 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'INFO  HEADLESS: execution starts (HeadlessAnalyzer)  \n'
2024-08-30 07:21:15,957 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'INFO  Creating project: /gdbfuzz/./output/esp32_http_no_corpus/trial-4/ghidra_projects/simple.elf (HeadlessAnalyzer)  \n'
2024-08-30 07:21:15,999 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'INFO  Creating project: /gdbfuzz/./output/esp32_http_no_corpus/trial-4/ghidra_projects/simple.elf (DefaultProject)  \n'
2024-08-30 07:21:16,011 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'INFO  REPORT: Processing input files:  (HeadlessAnalyzer)  \n'
2024-08-30 07:21:16,012 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'INFO       project: /gdbfuzz/./output/esp32_http_no_corpus/trial-4/ghidra_projects/simple.elf (HeadlessAnalyzer)  \n'
2024-08-30 07:21:16,012 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'INFO  IMPORTING: /gdbfuzz/./example_firmware/esp32_wifi_http_server/simple.elf (HeadlessAnalyzer)  \n'
2024-08-30 07:21:16,290 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'INFO  No load spec found for import file: /gdbfuzz/./example_firmware/esp32_wifi_http_server/simple.elf (AutoImporter)  \n'
2024-08-30 07:21:16,291 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'ERROR The AutoImporter could not successfully load /gdbfuzz/./example_firmware/esp32_wifi_http_server/simple.elf with the provided import parameters. Please ensure that any specified processor/cspec arguments are compatible with the loader that is used during import and try again. (HeadlessAnalyzer)  \n'
2024-08-30 07:21:16,291 [INFO Ghidra.py:180 start_ghidra_instance()] Ghidra process output:b'ERROR REPORT: Import failed for file: /gdbfuzz/./example_firmware/esp32_wifi_http_server/simple.elf (HeadlessAnalyzer)  \n'
2024-08-30 07:21:16,320 [INFO Ghidra.py:185 start_ghidra_instance()] Ghidra process bridge server has not started yet. Trying again in 3 seconds.
Traceback (most recent call last):
  File "./src/GDBFuzz/main.py", line 177, in <module>
    raise SystemExit(main())
  File "./src/GDBFuzz/main.py", line 171, in main
    GDBFuzzer(config, args.config)
  File "/gdbfuzz/src/GDBFuzz/GDBFuzzer.py", line 55, in __init__
    self.before_fuzzing(config, config_file_path)
  File "/gdbfuzz/src/GDBFuzz/GDBFuzzer.py", line 84, in before_fuzzing
    self.init_components(config)
  File "/gdbfuzz/src/GDBFuzz/GDBFuzzer.py", line 113, in init_components
    self.ghidra = Ghidra(
  File "/gdbfuzz/src/GDBFuzz/ghidra/Ghidra.py", line 66, in __init__
    self.start_ghidra_instance(binary_file, path_to_ghidra, output_directory, ghidra_port)
  File "/gdbfuzz/src/GDBFuzz/ghidra/Ghidra.py", line 176, in start_ghidra_instance
    raise Exception(f'Ghidra process has unexpectedly '
Exception: Ghidra process has unexpectedly terminated with exit_code=0 stdout=b''

I notice I may have forgotten to build Xtensa for ghidra; however, when I build it, I get the following error:

make
/ghidra/support/sleigh -x -u -l -n -t -e -f data/languages/xtensa.slaspec data/languages/xtensa.sla
openjdk version "11.0.24" 2024-07-16
OpenJDK Runtime Environment (build 11.0.24+8-post-Ubuntu-1ubuntu320.04)
OpenJDK 64-Bit Server VM (build 11.0.24+8-post-Ubuntu-1ubuntu320.04, mixed mode)
INFO  Using log config file: jar:file:/ghidra/Ghidra/Framework/Generic/lib/Generic.jar!/generic.log4j.xml (LoggingInitialization)
INFO  Using log file: /root/.ghidra/.ghidra_10.1.4_PUBLIC/application.log (LoggingInitialization)
ERROR xtensaInstructions.sinc:969: unknown macro, userop, or specific symbol 'lzcount' in macro, user operation, or subpiece application (SleighCompile)
ERROR Unrecoverable error(s), halting compilation (SleighCompile) java.lang.NullPointerException
    at ghidra.sleigh.grammar.SleighCompiler.assignment(SleighCompiler.java:6759)
    at ghidra.sleigh.grammar.SleighCompiler.statement(SleighCompiler.java:6001)
    at ghidra.sleigh.grammar.SleighCompiler.statements(SleighCompiler.java:5848)
    at ghidra.sleigh.grammar.SleighCompiler.code_block(SleighCompiler.java:5795)
    at ghidra.sleigh.grammar.SleighCompiler.semantic(SleighCompiler.java:5705)
    at ghidra.sleigh.grammar.SleighCompiler.ctorsemantic(SleighCompiler.java:3573)
    at ghidra.sleigh.grammar.SleighCompiler.constructor(SleighCompiler.java:3483)
    at ghidra.sleigh.grammar.SleighCompiler.constructorlike(SleighCompiler.java:3034)
    at ghidra.sleigh.grammar.SleighCompiler.constructorlikelist(SleighCompiler.java:3427)
    at ghidra.sleigh.grammar.SleighCompiler.withblock(SleighCompiler.java:3245)
    at ghidra.sleigh.grammar.SleighCompiler.constructorlike(SleighCompiler.java:3024)
    at ghidra.sleigh.grammar.SleighCompiler.root(SleighCompiler.java:482)
    at ghidra.pcodeCPort.slgh_compile.SleighCompile.run_compilation(SleighCompile.java:1810)
    at ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher.runMain(SleighCompileLauncher.java:263)
    at ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher.launch(SleighCompileLauncher.java:50)
    at ghidra.GhidraLauncher.launch(GhidraLauncher.java:59)
    at ghidra.Ghidra.main(Ghidra.java:47)

make: *** [Makefile:38: data/languages/xtensa.sla] Error 4

I've tried different jdk versions from 11 to 20, and on a different experiments like host machine and docker, it seems all failed. Do u have any idea what's going on here?

Best regrads.

Rrooach commented 3 months ago

solved by checkout to 4e1aa22