Skip to content

fix(llm): reject prompt images that do not decode 🐛 - #50

Merged
kp2pml30 merged 5 commits into
v0.3-devfrom
pr/v0.3/fix/malformed-image
Oct 3, 2026
Merged

kp2pml30 merged 5 commits into
v0.3-devfrom
pr/v0.3/fix/malformed-image

Conversation

@kp2pml30

@kp2pml30 kp2pml30 commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Auto-opened executor mirror of genlayerlabs/genvm-manager#57.

Carries the executor-side work for that manager PR. The manager branch update fast-forwards v0.3-dev to its pinned commit after landing.

Summary by CodeRabbit

  • Bug Fixes
    • Execution prompts now stop with an out-of-memory error when available VM memory is below the required minimum. Existing restrictions on deterministic execution and prompts containing more than two images still apply.
    • WebAssembly execution now enforces call-depth and value-stack limits, stopping execution with a stack-overflow error when those limits are exceeded.
    • Zero-budget allocations are no longer used to fund external emissions. An exact internal allocation with no remaining budget remains selected, and emissions using it fail rather than falling back to a wildcard allocation.

- Fail with out-of-memory when less than EXEC_PROMPT_MIN_SPACE (128 MiB) of the contract budget is left, as web calls already do
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: genlayerlabs/genvm-executor/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 2602b6bd-407c-4fef-bbb6-1e2e6fa3609e

📥 Commits

Reviewing files that changed from the base of the PR and between 84f9db9 and 49aa574.

⛔ Files ignored due to path filters (10)
  • .git-third-party/manifest.json is excluded by !**/*.json
  • executor/Cargo.lock is excluded by !**/*.lock, !**/*.lock
  • tests/integration/storage/bootstrapper/bootstrapper.0.hash is excluded by !**/*.hash, !**/tests/**
  • tests/integration/storage/bootstrapper/bootstrapper.0_0.hash is excluded by !**/*.hash, !**/tests/**
  • tests/integration/storage/bootstrapper/bootstrapper.0_0_0.hash is excluded by !**/*.hash, !**/tests/**
  • tests/integration/storage/bootstrapper/bootstrapper.0_0_0_0.hash is excluded by !**/*.hash, !**/tests/**
  • tests/integration/storage/bootstrapper/bootstrapper.0_0_0_0_0.hash is excluded by !**/*.hash, !**/tests/**
  • tests/integration/storage/bootstrapper/bootstrapper.0_0_0_0_0_0.hash is excluded by !**/*.hash, !**/tests/**
  • tests/integration/storage/bootstrapper/bootstrapper.jsonnet is excluded by !**/tests/**
  • tests/integration/storage/bootstrapper/bootstrapper.py is excluded by !**/tests/**
📒 Files selected for processing (7)
  • .git-third-party/patches/executor/third-party/wasmtime/fvfcbfxe3ng3djg8
  • .git-third-party/patches/executor/third-party/wasmtime/mgz066ws46rvhghv
  • .git-third-party/patches/executor/third-party/wasmtime/nwdw669v5p3aamta
  • .git-third-party/patches/executor/third-party/wasmtime/wyqzzn2hxndgbxbx
  • .git-third-party/patches/executor/third-party/wasmtime/x77t41kns34hzzhb
  • executor/src/wasi/genlayer_sdk/message.rs
  • executor/src/wasi/genlayer_sdk/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The changes add an exec-prompt memory guard, update allocation matching for zero-budget nodes, and modify Wasmtime floating-point traps, semantic stack limits, and memory fingerprints.

Changes

Exec prompt memory guard

Layer / File(s) Summary
Define and enforce the memory limit
executor/crates/common/src/internal_constants.rs, executor/src/wasi/genlayer_sdk/mod.rs
Adds EXEC_PROMPT_MIN_SPACE with a value of 134217728. gl_call_exec_prompt traps with an out-of-memory VM error when remaining memory is below this limit.

Allocation matching and emission

Layer / File(s) Summary
Update allocation candidate selection
executor/src/wasi/genlayer_sdk/message.rs
Internal matching can select recipient-specific nodes with zero budget. External selection excludes recipient-specific nodes with an explicit zero budget.
Specify matching and emission outcomes
executor/src/wasi/genlayer_sdk/tests.rs
Tests cover zero-budget exact and wildcard allocations, phase mismatch behavior, and emission failure before wildcard fallback.

Wasmtime runtime changes

Layer / File(s) Summary
Configure floating-point trap behavior
.git-third-party/patches/executor/third-party/wasmtime/wyqzzn2hxndgbxbx, .git-third-party/patches/executor/third-party/wasmtime/fvfcbfxe3ng3djg8, .git-third-party/patches/executor/third-party/wasmtime/x77t41kns34hzzhb
Adds deterministic-mode traps for floating-point operations when floats are disabled, renames the emitted trap to NondetInstruction, and allows the listed SIMD lane operations through the float guard.
Track semantic call and value stack limits
.git-third-party/patches/executor/third-party/wasmtime/nwdw669v5p3aamta, .git-third-party/patches/executor/third-party/wasmtime/wyqzzn2hxndgbxbx
Adds reverse call and value limits, checks them on function entry, and restores them on returns, tail calls, exception entry, and store-context restoration.
Calculate and expose memory fingerprints
.git-third-party/patches/executor/third-party/wasmtime/wyqzzn2hxndgbxbx, .git-third-party/patches/executor/third-party/wasmtime/mgz066ws46rvhghv
Adds on-demand fingerprint methods that hash unshared memory contents. Invocation no longer attaches fingerprints to errors.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 49aa5

The identified stack-limit concern is already handled, and no remaining issue in the supplied evidence requires resolution before merge.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 49aa5

The changes affect contract execution and message-fee decisions, so they merit design review. No new permission bypass was established, but failure and recovery behavior across a complete execution remains uncertain.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed decisions can affect contract-initiated messages and Wasm executions handled by the executor. The supplied evidence does not establish a wider service, tenant, or deployment blast radius.

Trust Boundaries and Controls

  • observed — The inspected external-message entrypoint retains permission and balance checks ahead of allocation selection, and fee consumption rechecks the selected node’s remaining budget. No newly reachable over-budget emission path was established.

Resilience and Maintainability Implications

  • inferred — Local reservation cleanup and fee checks cover ordinary failure within emission, but they do not establish how the enclosing execution handles cancellation or failure after effects have been accumulated.

Hardening Proposals

  • proposed — Establish the enclosing execution’s commit and rollback contract for emissions, consumed allocation counters, and fee accounting under cancellation and guest failure before relying on local ordering as an end-to-end guarantee.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 4 files. (5 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies prompt image rejection, which is related to the changes in prompt execution validation. It does not cover all changes, but the title need not summarize the full changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 4 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.98.1)

Clippy execution failed


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

kp2pml30 and others added 4 commits October 2, 2026 20:54
- `finish` sets the root `code_slot` to the slot `push_code` filled instead of copying the code into the default code slot; writes aimed at the default code slot land in that slot
- When the default code slot is locked, the pushed code slot is locked too
- Rebase the wasmtime patch series onto v48.0.3, which fixes GHSA-jqpg-j7w6-42pr and GHSA-m63x-6p34-q65x; the executor reaches neither, as it runs without fuel and outside the component model
- The stack-limit restore in catch blocks now follows upstream's new fuel reload; the patches are otherwise unchanged
- Consensus resolves internal allocation keys by presence, so an exact key with no budget left still wins over a funded `call_key` wildcard and its phase still decides; emission then fails with `out_of message_fee allocation_budget internal` without charging the wildcard
- External messages keep skipping zero-budget chain keys and fall back as before

Co-authored-by: Edgars <edgars@genlayerlabs.com>
@kp2pml30
kp2pml30 merged commit 49aa574 into v0.3-dev Oct 3, 2026
1 check passed
@kp2pml30
kp2pml30 deleted the pr/v0.3/fix/malformed-image branch October 3, 2026 02:17
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