feat(executor): capture bounded guest stderr tail in ExecutionReport#2859
Open
fakedev9999 wants to merge 1 commit into
Open
feat(executor): capture bounded guest stderr tail in ExecutionReport#2859fakedev9999 wants to merge 1 commit into
fakedev9999 wants to merge 1 commit into
Conversation
f876d27 to
d298f40
Compare
Contributor
|
d298f40 to
ad68ef9
Compare
A guest panic writes its message and source location to fd=2 (stderr) right before halting with a non-zero exit code, but SP1 printed that to the host's stderr and discarded it, so execute-only failures surfaced only as a bare HaltWithNonZeroExitCode. Retain the last 2048 bytes of guest fd=2 output and expose it on ExecutionReport::stderr_tail for failure debugging. Observability only (additive, fail-safe to None). Does not print stderr in SDK output or the explorer. Guest stderr is untrusted and bounded here; downstream storage/display must sanitize and re-bound. sp1-cluster wiring is a follow-up.
ad68ef9 to
7de0604
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Captures the last 2048 bytes of the guest program's
fd=2(stderr) during execution and exposes it asExecutionReport::stderr_tail: Option<String>.Why
A guest panic writes its message and source location (
panicked at <file>:<line>:<col>) to stderr right before halting non-zero, but SP1 printed that to the host and discarded it — so execute-only failures collapse to a bareHaltWithNonZeroExitCode, losing the panic detail before sp1-cluster can attach it toerror_trace.Scope
SP1-only. No sp1-cluster/network/infra wiring. No SDK or public-explorer printing; the existing host-stderr printing is preserved.
fd=1(stdout) is not captured.Safety
Guest stderr is untrusted, attacker-controlled text. It's bounded here (keep-last 2048 bytes, lossy UTF-8) and is observability-only/additive (fail-safe to
None). Downstream storage/display must sanitize and keep it internal.Tests
cargo test -p sp1-jit stderr_tail(bounded-tail unit tests);cargo test -p sp1-sdk --features slow-tests test_execute_panic(e2e: tail contains panic message + location);cargo check -p sp1-core-executor;cargo fmt --all --check; clippy on touched crates.Follow-up
sp1-cluster must read
report.stderr_tailinto the execute-onlyextra_data.failure_messagebefore this is live inerror_trace.