Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
/.tmp-kickpoll-debug
/.tmp-vsh-vim-bench
/.tmp-virtiofs-exit-sweep
/internal/guestinit/payloads/guest-init-*
/internal/freebsd/guestinit/payloads/guest-init-*
/internal/netbsd/guestinit/payloads/guest-init-*
/internal/openbsd/guestinit/payloads/guest-init-*
/internal/guestinit/guest-init-linux-arm64
/internal/guestinit/guest-init-linux-amd64
/internal/freebsd/guestinit/guest-init-freebsd-arm64
Expand Down
48 changes: 30 additions & 18 deletions client/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,24 +617,36 @@ type VMState = InstanceState
type RunVMResponse = ExecResponse

type ExecRequest struct {
Kind string `json:"kind,omitempty"`
ID string `json:"id,omitempty"`
Image string `json:"image,omitempty"`
Command []string `json:"command"`
Env []string `json:"env,omitempty"`
RootDir string `json:"root_dir,omitempty"`
Path string `json:"path,omitempty"`
Directory bool `json:"directory,omitempty"`
ReplaceEnv bool `json:"replace_env,omitempty"`
SkipResolve bool `json:"skip_resolve,omitempty"`
WorkDir string `json:"workdir,omitempty"`
User string `json:"user,omitempty"`
Stdin []byte `json:"stdin,omitempty"`
TTY bool `json:"tty,omitempty"`
ControlFD bool `json:"control_fd,omitempty"`
Cols int `json:"cols,omitempty"`
Rows int `json:"rows,omitempty"`
ArchiveLimits *ArchiveLimits `json:"archive_limits,omitempty"`
// ProcessMode is single (signal only the direct PID; descendants may survive),
// group (signal the process group and tracked descendants), or empty (legacy
// family). Linux guestinit also terminates group/family descendants after
// the direct process exits: cgroups track forks and setsid. PID 1 fails
// launch if cgroup preparation fails; outside PID 1, unavailable cgroups
// use best-effort ancestry tracking that can miss rapid reparenting. Final
// stdout/stderr/control/PTY draining is bounded to 50ms after cleanup in
// all modes; remaining output may be discarded. Exit status is the direct
// process's, not a descendant's. This does not bound a blocked transport writer.
ProcessMode string `json:"process_mode,omitempty"`
// SandboxProtocol must be 1 when ProcessMode is nonempty; zero preserves cc requests.
SandboxProtocol int `json:"sandbox_protocol,omitempty"`
Kind string `json:"kind,omitempty"`
ID string `json:"id,omitempty"`
Image string `json:"image,omitempty"`
Command []string `json:"command"`
Env []string `json:"env,omitempty"`
RootDir string `json:"root_dir,omitempty"`
Path string `json:"path,omitempty"`
Directory bool `json:"directory,omitempty"`
ReplaceEnv bool `json:"replace_env,omitempty"`
SkipResolve bool `json:"skip_resolve,omitempty"`
WorkDir string `json:"workdir,omitempty"`
User string `json:"user,omitempty"`
Stdin []byte `json:"stdin,omitempty"`
TTY bool `json:"tty,omitempty"`
ControlFD bool `json:"control_fd,omitempty"`
Cols int `json:"cols,omitempty"`
Rows int `json:"rows,omitempty"`
ArchiveLimits *ArchiveLimits `json:"archive_limits,omitempty"`
}

// ArchiveLimits bounds the expanded work performed by an fs_extract request.
Expand Down
10 changes: 10 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,16 @@
"type": "object",
"required": ["command"],
"properties": {
"process_mode": {
"type": "string",
"enum": ["", "single", "group"],
"description": "Empty or omitted retains legacy process-family containment. single signals only the direct PID and preserves descendants on exit; group signals and cleans up the process group. Nonempty modes require sandbox_protocol 1."
},
"sandbox_protocol": {
"type": "integer",
"enum": [0, 1],
"description": "Zero or omitted preserves legacy cc requests. Version 1 must match the guest init protocol and is required for a nonempty process_mode."
},
"kind": { "type": "string" },
"id": { "type": "string" },
"image": { "type": "string" },
Expand Down
6 changes: 6 additions & 0 deletions guestinit/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Package guestinit implements the Linux cc and SA2 guest init entrypoints.
// Non-Linux entrypoints compile but panic if invoked.
package guestinit

// SandboxProtocol is the SA2 guest protocol supported by this init.
const SandboxProtocol = 1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build linux

package main
package guestinit

import (
"archive/tar"
Expand Down
Loading
Loading