mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 07:47:29 +00:00
[GH-ISSUE #8461] [Bug] Ghidra RISC-V lanes lose DWARF and no-return facts for ESP-IDF flash code #6615
Open
opened 2026-11-01 21:12:41 +00:00 by bsakaguchi
·
0 comments
No Branch/Tag specified
main
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/procedure-reference-stacked
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#6615
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Entrpi on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/8461
Before submitting
Area
Native analysis or decompilation
Observed behavior
On
main6e9ee97a6with Ghidra 12.1.4, the RISC-V ilp32 lane (#8229) admits ESP-IDF v6.1'shello_worldfor ESP32-C6, but Ghidra loads the image's.flash.textinto an overlay address space.rea function v61-c6.elf app_main --provider ghidra --jsonreportsapp_mainat.flash.text:0x42008398asundefined __rea_ilp32 app_main(), although the image's DWARF declaresvoid app_main(void). Its pseudocode continues past the finalesp_restart()call into the next function,riscv_decode_offset_from_jal_instruction. No limitation mentions this.A Ghidra probe that used REA's import arguments and post-scripts in
analyzeHeadlessmeasured the wider effect in the same image. Only 18 of the 549 DWARF-described flash functions carry an imported signature, and 16 of those 18 are C library names whose parameters come from Ghidra's archives; in IRAM, 405 of 405 do.esp_restartandpanic_restartare not flagged no-return, so pseudocode continues past 4 call sites in 4 functions. Ghidra creates a 1-byte shadow function in the reservation for each of the 549 flash functions. A second probe found 48 computed calls from.iram0.textthat resolve to those shadows. ESP-IDF v5.5.2's ESP32-H4 image, run the same way with the post-scripts of draft #8401's ilp32f lane, shows the same: 6 of 278 DWARF-described flash functions have an imported signature, there are 278 shadows, and 27 computed calls from.iram0.textresolve to them. There,rea function v552-h4.elf 0x42002ab6(the ELF address ofapp_main) on #8401's branch selects a shadow: it exits 0 withhalt_baddata()pseudocode.Reproduction
examples/get-started/hello_worldforesp32c6with the default configuration.rea function build/hello_world.elf app_main --provider ghidra --jsonwith Ghidra 12.1.4.normalized_result.procedure.addresswith the ELF symbol address ofapp_main, and read the end ofnormalized_result.pseudocode.This reproduced on every run of the C6 image. A source-owned fixture in the linked draft PR (
tests/conformance/c/riscv-esp-layout.clinked withtests/conformance/esp/esp32c6-shared-window.ld) shows the same onmain:rea_riscv_esp_mainat.flash.text:0x42000064, pseudocode that endsrea_riscv_esp_restart(); rea_riscv_esp_sink = 0x5a5a;(the next function's store), andrea_riscv_esp_sum(int param_1,int param_2)without its DWARF parameter names.Expected behavior
Flash code is analyzed at its ELF address with its DWARF facts, as IRAM code already is.
app_mainshould appear at0x42008398asvoid app_main(void), its pseudocode should end atesp_restart();, and there should be no shadow functions. When REA cannot establish a correct memory map for a layout, it should refuse the image or state a limitation, not return analysis of a partial map.docs/ghidra-riscv.mddoes not mention this case (source).Impact and scope
Affected: every ESP-IDF image whose linker script places flash text and rodata in one virtual window and reserves the text's addresses with the NOBITS
.flash_rodata_dummy. ESP-IDF v5.5.2's linker scripts do this for ESP32-C5, C6, C61, H2, H21 and H4:sections.ld.indefines the reservation, andmemory.ld.inasserts that it starts the rodata segment (source). C2 and C3 put rodata in a separate window and should be unaffected (source, not run). The merged ilp32 lane admits C5, C6, C61, H2 and H21.Observed in Ghidra on C6 (REA's CLI and
analyzeHeadless) and H4 (analyzeHeadless, plus the selector run on #8401's branch):esp_restartandpanic_restartget no no-return flag;Observed with
readelf -SWon ESP-IDF v5.5.2hello_worldbuilds for C5, C61, H2 and H21 (C5 and C61 also with PSRAM enabled): all reserve the text with.flash_rodata_dummyat0x42000020. The C5 and C61 builds add a second NOBITS section,.ext_ram.dummy, at the same address; it covers the text and the rodata (0x1ffe0and0x17fe0bytes). Onmain6e9ee97a6, REA's CLI reports the C5 build'sapp_mainat.flash.text:0x42006430and the H2 build's at.flash.text:0x420077b4; neither pseudocode ends at the finalesp_restart()call (observed). ESP-IDF v5.5.2 defines.ext_ram.dummyunconditionally incomponents/esp_system/ld/esp32c5/sections.ld.in:490andesp32c61/sections.ld.in:335(source).Source-derived, not run:
REA version
Source
main6e9ee97a6. The H4 measurement used draft #8401 atba174afe6.Runtime and platform
Debian container on x86-64, Ghidra 12.1.4 PUBLIC, OpenJDK 21, Node.js 24.22.1.
Target and artifact context
hello_world(v61-c6.elf, sha256b61ed35815f56287f5ae32454e9aaf75f600e3772a11079fac6f7b21e8cb8794), ELF32 RISC-VET_EXEC, soft-float. DWARF 4 from GCC 15.2.0 (-gdwarf-4 -ggdb -Og).hello_world(v552-h4.elf, sha256e9b477a3f32cc273498baf8ff04b46d135b1f4a56198d397fd33e2919240025f), single-float, DWARF from GCC 14.2.0..flash.text(PROGBITS) and.flash_rodata_dummy(NOBITS) start at0x42000020, in twoPT_LOADsegments.Interface
CLI
Earliest failure stage
Native analysis or reconstruction
Relevant output or evidence
Observed with
readelf -SW v61-c6.elf:Observed end of
app_main's pseudocode onmain6e9ee97a6(rea function v61-c6.elf app_main --provider ghidra --json):The same session's limitation reads "RISC-V calling-convention outcome: 1502 functions and 541 function definitions use __rea_ilp32". The
analyzeHeadlessprobe of the same image found 1,506 functions, 549 of them shadows.Typed outcome or recovery expected
Either the flash code of an admitted image is analyzed in the default address space, or the session is refused, or it states a limitation that names the overlap.
Analysis or suspected cause
Source-derived, Ghidra 12.1.4:
MemorySectionResolverprocesses overlapping sections in reverse order: "last-in takes precedence" (MemorySectionResolver.java:281). So the NOBITS reservation takes the default address space, and.flash.textbecomes an overlay.DWARFProgram.getCodeAddressmaps every DWARF address into the default space. There,DWARFFunction.syncWithExistingGhidraFunctionfinds no executable block and skips the function (DWARFFunction.java:369). The only call tosetNoReturnis in the signature update (DWARFFunction.java:480), so the skipped functions never get the flag.Additional context
Proposed fix. The fix is a draft PR from
Entrpi/reafix-ghidra-esp-idf-flash-overlay(78a413531), linked to this issue. It works in three steps:The draft PR refuses every other overlap that involves executable code, including the C5 and C61 builds' second reservation. It follows the GameCube DOL lane, whose pre-script rebuilds Ghidra's memory map from facts REA validated.
Ghidra 12.1.4 constraints. The pre-script works around three of them:
Memory.moveBlockkeeps a block in its address space.ProgramDB.moveAddressRangemoves the references from a range, not the references into it: the entry points and the loader's section-header reference.Questions for the maintainer:
.flash.text:0x…to0x…, and the analysis profiles of these images would change.ProgramDB.moveAddressRangeacceptable in a bridge script verified against Ghidra 12.1.4? It is internal to Ghidra's database layer, and it is the callMemory.moveBlockitself makes. The alternative is to move labels, functions and entry points by hand through the public API, which covers less..flash_rodata_dummyand.ext_ram.dummy, and the draft refuses them. Should a follow-up policy, verified on those builds, also prepare a second reservation such as.ext_ram.dummy, so that these images are admitted?auipc+jalrcalls from flash to IRAM functions such asabortand__assert_funckeep a Listing fall-through in 44 (H4) and 118 (C6) functions. The pseudocode is already right.Related. #3615 (ESP32 firmware), #8233 (unbounded byte search skips loaded overlays) and the embedded roadmap #7955.