Skip to content

Report typed non-complete native guest states instead of invalid_output #255

Closed

Description

@HemSoft

Problem

The native VM guest returns a non-complete state (auth_failed, provider_unavailable, cancelled, …) with Report left nil. nativeVMFinished.Report is a json.RawMessage, so a nil value is encoded as null (4 bytes). The host's nativeVMFinished.valid (reviewer/native_vm_protocol.go:211) requires len(f.Report) == 0 for every non-complete state, so it rejects the record and the phase is classified as invalid_output. Typed guest failures therefore never reach the host; every non-complete guest outcome looks like malformed output.

Evidence

  • Found while diagnosing the cgroup stop race (Accept an original cgroup removed between open and read #252): with host-side diagnostics, the finished record of a passing hostile guard case failed valid() for this reason, so the phase was classified as invalid_output before the stop handling ran.
  • Encoding a struct with a nil json.RawMessage field produces "Report":null; decoding yields json.RawMessage("null").

Acceptance criteria

  • A non-complete finished record from the guest reaches the host with its typed state (e.g. auth_failed, provider_unavailable) instead of invalid_output.
  • valid() still refuses a non-complete record that carries a real report.
  • A unit test encodes a non-complete finished record exactly as the guest does and requires the host to accept it with its state; a complete record still needs a valid report.
  • The hostile/exhaustion matrices still pass, and their recorded error_class for refused cases reflects the guest's typed state.

Validation

go -C reviewer test -race -run 'NativeVM' . plus one hostile matrix run under the shared VM lock.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrisk:mediumMedium-risk: logic changes, new featuressource:manualManually created by developer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions