vmexec

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package vmexec is the ossein guest container runtime — the Go port of Apple's vmexec. It runs as a re-exec'd `stage2` child of the agent: the agent launches /proc/self/exe with the container's namespaces already applied via clone, and stage2 performs the in-namespace setup (stdio, rootfs pivot, mounts, caps, uid/gid) then execs the workload.

The re-exec replaces vmexec's unshare()+fork(): Go cannot run arbitrary code after fork(), so namespaces are created at clone time (SysProcAttr.Cloneflags on the agent side) and this fresh process does the rest, mirroring the order of vmexec's RunCommand.childSetup.

The package doc lives in this portable file rather than stage2.go (linux-only) so the package is documented on every GOOS the native analysis runs under.

Index

Constants

View Source
const Stage2Command = "stage2"

Stage2Command is the argv[0+1] token that selects the stage2 role of the multi-call guest binary. Three places must agree on it — guest/vminitd dispatches on it, guestagent passes it when re-execing, and Stage2 names its flag set with it — so it is declared once, here, where the role is implemented. It is guest-internal, NOT part of the host↔guest protocol: the host never sees this argv.

Variables

This section is empty.

Functions

func ParseMountOptions

func ParseMountOptions(options []string) (uintptr, string)

ParseMountOptions splits OCI mount options into a mount(2) flag bitmask and the comma-joined remainder (filesystem-specific data). It is the single implementation shared with the agent's Mount RPC.

func Stage2

func Stage2() error

Stage2 is the entry point for the `stage2` subcommand. On success it execs the workload (never returns); on failure it reports the error to the agent.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL