Skip to content

test(manager): reproduce unbounded safe log capture from malformed gl_call - #85

Draft
MuncleUscles wants to merge 1 commit into
v0.6-devfrom
handoff/bound-genvm-log-bytes-261107
Draft

MuncleUscles wants to merge 1 commit into
v0.6-devfrom
handoff/bound-genvm-log-bytes-261107

Conversation

@MuncleUscles

@MuncleUscles MuncleUscles commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Problem and outcome

A contract can pass a malformed map to the raw gl_call import, catch the resulting SystemError, and continue. The executor's decode_obj::<gl_call::Message> error echoes an unknown field name. Its @user error:err log capture serializes the entire field despite the 128-byte limit for byte captures. The manager reads each JSON log line without a byte limit, then safe capture retains up to 128 entries without a total-byte limit.

Repeated rejected calls can therefore amplify a modest reusable guest buffer into large, unmetered manager memory on nodes executing the transaction. This is a local memory-amplification reproduction, not proof that a live transaction crashes every testnet node. No testnet transaction was sent.

The node’s GenVM path requests output capture for transaction execution and maps it to manager safe; the production executor config logs at info. That makes this path relevant to leader, validator, and sync runs, although the test has not demonstrated a live multi-node crash.

Implementation and validation

This is a red handoff test. It generates the malformed EmitEvent request through the pinned GenVM calldata encoder, decodes it as gl_call::Message, serializes the real user log record, sends six copies through the real manager log pipe, and checks a proposed 4 MiB captured-log budget.

  • On current v0.6-dev, the focused test fails: safe capture retained 6292536 log bytes, above the proposed 4 MiB log budget.
  • The neighboring manager log-pipe test passes.
  • cargo fmt --check and git diff --check pass.
  • The local test used vendored Lua and locally available SQLite sources on macOS; no chain action was taken.

Follow-up

Bound the log line while reading (before lines().next_line() can allocate it), bound total retained log bytes in safe capture, and keep decoder/error logging bounded. Confirm a full GenVM contract can catch the invalid call and return, then run an isolated multi-node simulation before claiming fleet-wide impact.

A raw gl_call with an unknown 1 MiB field is rejected, but its decoder error is serialized into a 1 MiB user log record. The manager retains repeated records because its safe sink bounds entry count rather than bytes. The local test drives the real decoder, logger, pipe reader, and sink and fails at 6,292,536 captured bytes against a proposed 4 MiB budget. This is a red handoff; bound log lines while reading and cap total captured log bytes before accepting the test.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

GenVM PR actions

Tick a box to run it (the box unticks itself when handled). Actions only run while the PR has the ci-safe label.

  • Force run full tests
  • Provision executor PRs
Commands
  • /genvm-run-tests — run full tests once for the current manager snapshot
  • /merge — queue the exact manager snapshot through the App-owned E2E merge train

@github-actions github-actions Bot added ci-safe not rebased branch is behind its base; rebase before it can be merged labels Nov 7, 2026
@kp2pml30

Copy link
Copy Markdown
Member

fix plan is to impose same payload limit on string as it is on bytes in logger + add a limit to total items we dump per log line

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

Labels

ci-safe not rebased branch is behind its base; rebase before it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants