mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #7142] [Feature] Unicorn-backed function-level emulation provider (building block for #4972) #4285
Open
opened 2026-10-31 00:48:31 +00:00 by bsakaguchi
·
4 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
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#4285
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 @reynold-hu on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/7142
[Feature] Unicorn-backed function-level emulation provider (building block for #4972)
Problem
REA can statically inspect native binaries (Ghidra, Hopper, IDA) and observe
live processes (Frida, debugger adapters), but it has no provider that
executes one native function in isolation under a declared harness. There is
currently no way to ask: "with these registers, this memory image, and these
stubbed imports, what does this function observably do?"
This gap is load-bearing for #4972 (semantic-equivalence verification for
reconstructed native code). Its step 4 requires a differential harness that
runs "the original function and candidate with equivalent initial state and
inputs" and states: "For pointer/ABI-sensitive functions, require an
appropriate native harness or dual-emulation strategy." No provider today
supplies the emulation side of that strategy.
Precision about the current state: Unicorn is not absent from this project.
Unicorn 2.1.2 is pinned inside the pwntools binary-diagnostics profile
(
pwntools@4.15.0; pyelftools@0.33; unicorn@2.1.2), where it is used only forstatic PLT-map derivation. The contract text states explicitly that those
outputs "do not establish target runtime behavior." This proposal elevates
Unicorn from that hidden sub-dependency into a first-class,
Evidence-producing execution provider. It does not introduce Unicorn to the
project, and it does not claim the pwntools lane already executes code.
Proposed scope (Phase 1 only)
One operation, working name
emulate_function(name to be confirmed), thatruns a single native function in isolation:
address), resolved through the existing provider's inventory; or raw
function bytes with an explicitly declared architecture and entry offset.
Phase 1 starts with x86_64 only.
(address → bytes), and a stack setup. Nothing is read from the host
process or filesystem at run time.
recorded, never executed. The harness records each stubbed call (name or
address, arguments as observed) and returns a caller-declared value or a
default zero value, stated in the result. No host syscall is performed.
cap, with the pwntools lane's limits as the starting proposal (input
32 MiB, output 64 MiB, address space 3 GiB, CPU 30 s, default timeout
30 s) — to be confirmed. Exceeding any budget stops the run and reports
the stop reason; it is never a partial success.
instruction, stubbed import/syscall, or budget exhaustion. Each is
reported explicitly.
Result model
One run returns, as Evidence:
return_valueand final register state (as observed);memory_writes: a diff of the memory image (address, bytes before, bytesafter), bounded by the output budget;
calls_hit: imports/syscalls reached, each markedexecuted: falseandstubbed: true, with observed arguments and the value returned by thestub;
instructions_executed,stop_reason, and the harness declaration(architecture, entry, initial state digest, budgets, engine version).
Evidence mapping (proposed):
confidence: "observed"for effects the runactually produced;
authority: "controlled-replay";environment.isolation: "process"(the run happens in an owned bridgesubprocess, never in the REA process and never on the host). The result
states the engine version and the harness declaration so a later run can be
compared against the same declaration.
Limitations (Phase 1)
signals, no filesystem, no network. Anything the function needs beyond
the declared memory and stubs is reported as unobserved, not assumed.
outside the declared function bytes stops the run with an explicit reason.
needing its own verification.
It is not a proof of equivalence and must never be reported as one.
Non-goals
MISMATCH, or TESTED_ONLY; the differential harness and verdict belong to
a later phase built on top of it.
evasion, no DRM/license/anti-cheat bypass, no exploit or payload
automation. The harness runs caller-declared bytes under caller-declared
state; it does not defeat protections.
already cover live observation).
other tool. No new npm dependency. No in-process native binding.
ordinary usage; availability is optional and explicit, like every other
engine provider.
Dependency and licensing
profile (Unicorn 2.1.2) behind the existing caller-supplied-Python
pattern (
REA_PWNTOOLS_PYTHON). REA would not install Python orpackages, would not add an npm dependency, and would not need a new
configuration variable for Phase 1. The bridge script would be a new,
separately owned script (not an extension of the diagnostics scripts),
speaking the same owned-subprocess pattern as the existing bridges.
npm binding for Unicorn 2.x was found (the
unicornpackage on npm is anunrelated string-coloring library; the only JavaScript binding is a
community project with no evidence of Unicorn 2.x support or maintenance).
A node-ffi route would additionally require users to install libunicorn
separately and would add the project's first native dependency. If the
maintainers prefer an in-process route, that is a separate scope decision.
caller-supplied-subprocess pattern does not distribute Unicorn with REA,
matching how the pwntools lane already handles it, but this needs the
license review that #4972's non-goals require ("without explicit approval
and license review").
to Linux x64 hosts (
pwntoolsHostSupported), even though Unicorn wheelsexist for Windows and macOS. Phase 1 inherits that gate. Lifting it for
other hosts is a later phase requiring its own verification; it is not
claimed here.
Relationship to #4972
This provider is step 4's building block, not the epic. It supplies the
"dual-emulation strategy" input (a controlled run of the original function
under a declared harness) on which a later differential harness can run the
original and a candidate side by side. It deliberately does not implement
#4972's symbolic/concolic exploration, formal checks, or verdict model.
Per #4972's own acceptance criteria, it also must not be presented as "a
custom replay/execution subsystem": it composes an existing, already-pinned
engine through a provider adapter, which is exactly the integration
direction #4972 requests ("Integrate existing analysis/verification engines
through provider adapters").
Open questions for the maintainer
emulate_functionacceptable, or should it liveunder a different operation family?
auxiliary operation set attached to a bound session? Phase 1 is small
either way; the choice affects
src/composition/binary.tswiring.currently bound target's inventory, or is raw-bytes-plus-architecture an
acceptable Phase 1 input?
should emulation have its own budget table?
right default, or should unknown imports stop the run by default?
or ride on the existing pwntools profile verification?
Scope decision request
Per
CONTRIBUTING.md("Fail-closed integration"), this issue requests anexplicit maintainer scope decision on the Phase 1 behavior above before
substantial implementation intended for integration. I am happy to build a
small exploratory prototype and/or a draft PR to inform that decision; I
understand neither authorizes integration, and that a scope expansion needs
a new decision.
@XinwangTao commented on GitHub (Oct 25, 2026):
This would fill a real gap: a function-level emulation provider is exactly the differential harness step 4 of #4972 needs, and doing it behind a provider abstraction keeps the comparison logic independent of the emulator. Suggestions from the design side: make the harness contract explicit up front (register file, memory image, import stubbing, and the observable side effects you compare — return value, memory deltas, syscall/import calls), and consider starting with a minimal x86/x64 slice of Unicorn so the feature lands incrementally instead of waiting for full ISA coverage.
@ashishgit4 commented on GitHub (Oct 25, 2026):
/assign
@reynold-hu commented on GitHub (Oct 26, 2026):
Thanks for the feedback — both suggestions are already the plan: Phase 1 is a minimal x86_64 slice with an explicit harness contract (registers, memory image, stub policy, and the compared observables: return value, memory deltas, syscall/import calls). I have a working Phase 1 implementation with tests passing locally, and I'm happy to open a draft PR to inform the scope decision once maintainers confirm the direction.
@XinwangTao commented on GitHub (Oct 26, 2026):
Great to hear the Phase 1 plan and that you already have a working implementation with tests passing — opening a draft PR sounds like the right next step so the scope decision can be made against actual code. Two small things that would help the review: (1) spell out the default stub policy for undeclared imports/syscalls (e.g. return 0, log-and-continue, or abort) so the harness contract is unambiguous, and (2) clarify how the initial memory image is sourced — explicit user-provided map, or exported from an existing provider (Ghidra segments / Frida dump). That would make the differential-harness semantics for #4972 easy to verify.