The module guest_builder
Sandboxed freestanding guest builder module .
Boots a Linux kernel of 64 bits in a guest of the kernel's Guest_Run, and answers its exits with the machine of modus:contract/guest_os. Runs inside a call host with zero network, zero real clock, and zero ambient grants:
- decodes and validates the canonical Guest_Build_Spec;
- copies the kernel image into the memory of the guest and verifies it against spec.kernel_hash via BLAKE3 there, before any parse;
- copies the initial archive that the spec names to its place in the memory of the guest and verifies it against spec.initial_archive_hash there, before the boot gives it to Linux;
- loads it by the 64-bit boot protocol of Linux (zero page, page table, descriptors, command line with the command of the build);
- maps the memory of the guest in regions that switch between Write and Execute, never both;
- gives the guest a serial console, a virtio console, a read-only virtio disk of inputs and a writable virtio disk of outputs, and no network device;
- extracts the output disk into canonical MODTREE1 bytes only on clean exit code 0 with zero sandbox violations, and reports the BLAKE3 hash of the whole output disk.
guest_builder module with no entry
- Hash
2f0d19bdcdf542de6e04337d530a273c45e85d049acd479f7bedfe43c920dfea- Size
143360 bytes- Exports
3- Imports
0- Imported by
0- License
- MIT
Sandboxed freestanding guest builder module
| Fact | Value |
|---|---|
| Kind | Modules with no entry |
| Source | src/modules/system/guest_builder |
| Boot image | yes: in the boot image, 143360 bytes in this build |
| Build settings | none: the defaults of the source |
| Imports | none |
| Imported by | none |
Neighbours
It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.
Exports
| Export | What it does |
|---|---|
build(spec_bytes: Bytes(Read), kernel_image: Bytes(Read), initial_archive: Bytes(Read), input_disk: Bytes(Read), output_tree: Handle(Read, Write), report: Guest_Build_Report) -> Integer | boots the Linux kernel of the spec in a sandboxed guest and writes the canonical MODTREE1 output tree into output_tree on clean exit code 0, returning the canonical tree byte count written or -1 with an error record |
status() -> Table(Guest_Builder_Status) | gives the counts of the builds of this process in one row |
disks_check(spec_bytes: Bytes(Read), input_disk: Bytes(Read)) -> Integer | checks a build before it runs, with no guest: the spec, the input disk as a read-only disk of inputs, and the bound of the blank output disk against what this process holds |
build
build(spec_bytes: (Read), kernel_image: (Read), initial_archive: (Read), input_disk: (Read), output_tree: (Read, Write), report: ) ->
build boots the Linux kernel of the spec in a sandboxed guest and writes the canonical MODTREE1 output tree into output_tree on clean exit code 0, returning the canonical tree byte count written or -1 with an error record. The report holds the BLAKE3 hash of the whole output disk.
spec_bytes: (Read)kernel_image: (Read)initial_archive: (Read)input_disk: (Read)output_tree: (Read, Write)report:
- When it fails
- a negative result, and the error record
src/modules/system/guest_builder/main.odin:254
status
status() -> ()
status gives the counts of the builds of this process in one row.
The result is 1.
- none
()- When it fails
- a negative result, and the error record
src/modules/system/guest_builder/status.odin:56
disks_check
disks_check(spec_bytes: (Read), input_disk: (Read)) ->
disks_check checks a build before it runs, with no guest: the spec, the input disk as a read-only disk of inputs, and the bound of the blank output disk against what this process holds. A build that passes it can still fail in its guest, never at its disks.
- spec_bytes: the canonical Guest_Build_Spec.
- input_disk: the MODGBD1 image of the inputs; empty for no input.
The result is the bytes of the blank output disk that the build gives the guest, or ERROR with an error record whose value found is the Guest_Builder_Refusal.
spec_bytes: (Read)input_disk: (Read)
- When it fails
- a negative result, and the error record
src/modules/system/guest_builder/status.odin:75
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
Bytes wire form
A wire form of the module contract: one word of a call. Bytes with no description.
Handle wire form
A wire form of the module contract: one word of a call. A handle that the caller lends for the time of the call, in a register.
Guest_Build_Report record of a module
A record of the module guest_builder: 128 bytes, aligned on 8 bytes, 0 bytes of padding.
statei6408 bytesrefusali6488 bytesguest_exit_codei64168 bytesguest_exitsi64248 bytessandbox_violationsi64328 bytestree_bytes_writteni64408 bytesmachine_failurei64488 bytesconsole_bytesi64568 bytes
and 2 more
Integer wire form
A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.
Error_Record record of a module
A record of the module guest_builder: 56 bytes, aligned on 8 bytes, 0 bytes of padding.
kindi6408 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 bytes
Table wire form
A wire form of the module contract: one word of a call. Records of one description that follow each other (a table).
Guest_Builder_Status record of a module
A record of the module guest_builder: 96 bytes, aligned on 8 bytes, 0 bytes of padding.
buildsi6408 bytessucceededi6488 bytesrefusedi64168 bytesfailedi64248 bytestimed_outi64328 byteslast_statei64408 byteslast_refusali64488 byteslast_tree_bytesi64568 bytes
and 1 more
