Skip to content

fix(kuna): recover explicit direct-call destinations - #12106

Merged
morluto merged 2 commits into
mainfrom
codex/8352-kuna-call-destination
Nov 19, 2026
Merged

morluto merged 2 commits into
mainfrom
codex/8352-kuna-call-destination

Conversation

@morluto

@morluto morluto commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Fixes #8352.

Kuna can report an exact direct call to an address that its procedure inventory omits. On an authored arm64 Mach-O with a call into an unflagged executable section, Kuna 1.990 and 1.1000 both returned the call and decompiled the destination on request. REA's ordinary pseudocode lookup refused the address.

Change

Use procedure_pseudo_code with analysis: "call_destination" or rea decompile --analysis call_destination to request a standalone attempt. Kuna's selected file must be arm64 Mach-O. The Mach-O layout must place the exact address in file-backed executable section bytes, and Kuna must report an exact direct call from an entry in its procedure inventory.

The result retains the call site, caller, target, instruction, and xref digest in linked source Evidence. A failed or cancelled standalone attempt carries the completed call observation alongside the original error. A target-format refusal applies to the selected mode, so ordinary decompilation stays available. The standalone body does not establish function boundaries or add an entry to procedure inventory or project export. Existing procedure lookups and bulk decompilation retain their own inventory rules. The standalone mode uses the existing Kuna process owner, timeout and cleanup.

Validation

  • The initial 163 focused tests passed. The review follow-up passed another 115 focused tests, including linked source retention, recovery after command failure and timeout, and ordinary ELF decompilation after a mode refusal. Direct client transport cancellation was outside those tests. All 112 CLI parity cases passed after refreshing the decompile help snapshot.
  • Real Kuna 1.990 and 1.1000 on macOS arm64 passed the CLI and MCP workflow. Both returned return 0x2a; for the exact call destination. MCP recovered it before and after export and refused adjacent known data. Forced native decompilation of that data returned plausible pseudocode. The fixture was not run and its digest was unchanged.
  • Kuna 1.1000's default project export recorded the call without the body. A native project export with an explicit --addr included the body.
  • Cold check:ci:fast and docs:check passed. The advertised catalog check validated all 256 schemas with Python jsonschema and all patterns with the available V8, Go, Python, and C++ engines. The optional Rust validators were unavailable locally.
  • Real-provider verification used one thin arm64 Mach-O on macOS. Other image architectures and formats are outside this mode.
Minimal arm64 Mach-O fixture

Save as fixture.s and build with clang -arch arm64 -Wl,-e,_main fixture.s -o fixture. Use nm fixture for the two addresses.

.section __TEXT,__text,regular,pure_instructions
.p2align 2
.globl _main
_main:
  bl _placed_in_const
  ret
.section __TEXT,__const
.p2align 2
.globl _placed_in_const
_placed_in_const:
  mov w0, #42
  ret
.globl _inline_instruction_data
_inline_instruction_data:
  .long 0xd65f03c0
.section __DATA,__data
.p2align 2
.globl _audit_data
_audit_data:
  .long 42

Author readiness

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@morluto
morluto marked this pull request as ready for review November 18, 2026 23:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T23:52:48.277176Z 2acfcc9 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds an explicit Kuna recovery path for arm64 Mach-O call destinations outside the procedure inventory, without changing normal lookups or exports.

  • Kuna can decompile an executable address backed by an exact direct call.
  • Callers can select and check Kuna's direct-call decompile option.

No superseding fix was found in the available local history.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Explicit call-destination request] --> B[Check target, executable bytes, and exact incoming call]
  B -->|Checks pass| C[Create call evidence]
  B -->|Checks fail| D[Refuse this request]
  C --> E[Run standalone Kuna decompilation]
  E -->|Success| F[Return body linked to call evidence]
  E -->|Failure or cancellation| G[Keep call evidence with the error]
Loading

Reviews (2) · Last reviewed commit: "fix(kuna): preserve call evidence on dec..." · Reviewed by Greptile

Comment thread src/kuna/KunaSessionClient.ts Resolved
Comment thread src/kuna/KunaSessionClient.ts Resolved
@morluto
morluto merged commit 2182996 into main Nov 19, 2026
55 checks passed
@morluto
morluto deleted the codex/8352-kuna-call-destination branch November 19, 2026 00:07
@morluto morluto added bug Something isn't working provider: kuna Analysis provider / engine: kuna labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working provider: kuna Analysis provider / engine: kuna

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kuna cannot follow an exact call destination outside its procedure inventory

1 participant