Skip to content

Add Fission deterministic decompiler backend - #129

Open
sjkim1127 wants to merge 5 commits into
Noelo-Lab:mainfrom
sjkim1127:feat/fission-raw-backend
Open

sjkim1127 wants to merge 5 commits into
Noelo-Lab:mainfrom
sjkim1127:feat/fission-raw-backend

Conversation

@sjkim1127

Copy link
Copy Markdown
Contributor

Summary

Add a runnable raw backend for Fission (decbench/decompilers/raw/fission_raw.py, @register_decompiler("fission")), modeled on #56 (glaurung_raw.py):

  • CLI & Docker Integration:
    • Resolves a native binary via FISSION_BIN (failing closed if set to an invalid path), DecBench decompilers.toml, or fission_cli / fission on $PATH, with optional --resource-root auto-detection (FISSION_RESOURCE_ROOT / share/fission / utils/).
    • Falls back to decbench/fission:latest (docker/fission.Dockerfile) built via decbench decompiler-build fission, resolving FISSION_REF to an immutable commit SHA (recorded at /opt/fission.rev) and bundling SLEIGH/signature resources.
    • Invokes fission_cli --no-db decomp <binary> --json --no-header --no-warnings with --addr 0x..., --addresses-file (mounted read-only in Docker mode), or --all --limit <N>, plus --timeout-ms wired to config.function_timeout_seconds.
  • Provenance & Variable Extraction:
    • Validates and rebases line_mappings and variables into the function span ([record_addr, record_addr + size)), separates call-site-only rows into metadata["call_mappings"] while preserving assignment definition line_mappings and VariableInfo (stack_offset, arg_index, size, kind, addresses, line_numbers).
  • Registry, Docs & Tests:
    • Export fission_raw in decbench/decompilers/raw/__init__.py and remove fission from decbench/decompilers/external.py (EXTERNAL_DECOMPILERS).
    • Update docker/README.md, docs/benchmarking.md, and docs/decompilers.md.
    • Add tests/test_fission_decompilers.py (TestRegistry, TestDockerInstall, TestSmokeDecompile), and extend tests/test_content.py, tests/test_decompiler_limits.py, and tests/test_raw_line_provenance.py.

Verification

  • pytest tests/test_fission_decompilers.py tests/test_external_decompilers.py tests/test_raw_line_provenance.py tests/test_type_match_correspondence.py (with native FISSION_BIN): 83 passed
  • pytest tests/test_content.py -k "fission or glaurung": 2 passed
  • pytest tests/test_decompiler_limits.py: 28 passed, 1 skipped (systemd cgroups unavailable on macOS)
  • ruff check and black --check: pass across all modified Python files
  • decbench list-decompilers: lists fission as plugin with resolved native version

sjkim1127 and others added 5 commits November 21, 2026 20:10
Version provenance: a native binary was recorded as the checkout's HEAD
even when it was built from another branch or from uncommitted changes.
It is now credited to a commit only when it reports one in --version, or
when the checkout has no tracked changes and the binary is newer than
both the HEAD commit and the last HEAD move. Otherwise the version reads
"<version> (unverified build in checkout git-<sha>)".

Docker: the image started with an empty SLEIGH cache, so every container
recompiled the frontends (about 1 s per run here; a first ARM binary
builds all eight ARM variants, ~80 MiB, more than the 64 MiB /tmp).
The build stage now decompiles one checked-in fixture per x86-64, x86,
ARM and AArch64 family into /opt/fission/cache/fission-sleigh and the
runtime image points FISSION_SLEIGH_CACHE_DIR at it.

Checked: the image builds; under --read-only --network none with a
64 MiB /tmp it decompiles x86-64, ARM and AArch64 fixtures, 1.30 s vs
2.27 s (x86-64) and 1.16 s vs 2.42 s (ARM) against an empty cache, with
identical output apart from timing fields. The new provenance tests fail
with the commit check disabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A cold ARM run in a 64 MiB /tmp completed (cache writes that do not fit
only warn), so the earlier 'more than the run's /tmp' wording overstated
the failure mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
[AUTOMATED] Addresses the PR Noelo-Lab#129 review:
- Credit a commit only from `--version` or a hash-bound
  `<binary>.provenance.json`; never from the surrounding git checkout.
- An invalid explicit binary (per-version, FISSION_BIN, default) is an
  error, and `fission@<version>` must match what the executable reports.
- Key the payload cache on binary content and backend settings.
- Count requested functions missing from Fission's output as failures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
sjkim1127 added a commit to fission-systems/freshbench that referenced this pull request Nov 25, 2026
… C text

DecBench's native line-mapping contract (Noelo-Lab/decbench#129), applied
to every tool:

- Records carry the tool's own evidence: line_mappings (output line ->
  instruction addresses), variables (ABI arg_index, stack_offset, size,
  addresses) and return_type. evidence.rs keeps only addresses that are
  instruction starts inside the function (x86 decoded with iced-x86, ARM
  aligned). An output with no line mapped to such an instruction is not
  scored (`no_line_mappings`); rows report mapped and total lines.
- Types are matched to DWARF through the evidence only: parameters by
  ABI position, locals by stack slot after one calibrated shift (DWARF
  DW_OP_fbreg slots now read). Perfect = arity, every parameter and
  every stack-slot local right; the return type counts when reported.
  The C text is no longer read for types.
- Adapters: Fission's JSON already carries the evidence; Kuna and Unlace
  share common/kuna_family.py on `decompile-all --json` (their own line
  mappings and variables); Ghidra renders the C from its token lines so
  line N carries its tokens' addresses, variables from the HighFunction;
  angr maps its codegen position map to lines. borer's CLI prints no
  mapping, so its decompiled output is not scored.

Measured on one project (Fission, 3,600 functions): 585 outputs (16%)
have no line mapping at all (Fission maps call sites only; 4.8% of
output lines carry an address) and are not scored; 4 of 184,897
addresses were dropped. With evidence, 1,312 of 2,964 have perfect
types; parameters 5,431 / 8,118, stack locals 1,608 / 3,023.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
sjkim1127 added a commit to fission-systems/freshbench that referenced this pull request Nov 25, 2026
… C text

DecBench's native line-mapping contract (Noelo-Lab/decbench#129), applied
to every tool:

- Records carry the tool's own evidence: line_mappings (output line ->
  instruction addresses), variables (ABI arg_index, stack_offset, size,
  addresses) and return_type. evidence.rs keeps only addresses that are
  instruction starts inside the function (x86 decoded with iced-x86, ARM
  aligned). An output with no line mapped to such an instruction is not
  scored (`no_line_mappings`); rows report mapped and total lines.
- Types are matched to DWARF through the evidence only: parameters by
  ABI position, locals by stack slot after one calibrated shift (DWARF
  DW_OP_fbreg slots now read). Perfect = arity, every parameter and
  every stack-slot local right; the return type counts when reported.
  The C text is no longer read for types.
- Adapters: Fission's JSON already carries the evidence; Kuna and Unlace
  share common/kuna_family.py on `decompile-all --json` (their own line
  mappings and variables); Ghidra renders the C from its token lines so
  line N carries its tokens' addresses, variables from the HighFunction;
  angr maps its codegen position map to lines. borer's CLI prints no
  mapping, so its decompiled output is not scored.

Measured on one project (Fission, 3,600 functions): 585 outputs (16%)
have no line mapping at all (Fission maps call sites only; 4.8% of
output lines carry an address) and are not scored; 4 of 184,897
addresses were dropped. With evidence, 1,312 of 2,964 have perfect
types; parameters 5,431 / 8,118, stack locals 1,608 / 3,023.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant