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
28 changes: 28 additions & 0 deletions build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ struct ProgramConfig {
/// and puts it in its view beside the session's `HOME`. A service's is
/// implied. No row's view holds another's (`toyos_manifest::Program::view`).
state: bool,
/// The installer: `/apps` is read-write in its view and read-only in
/// every other row's (`toyos_manifest::Program::installs`).
installs: bool,
/// The file-server roles this binary serves, one process each
/// (`toyos_manifest::Program::roles`).
roles: Vec<String>,
Expand Down Expand Up @@ -918,6 +921,7 @@ fn render_manifest(config: &SystemConfig) -> Vec<u8> {
authorize: cfg.authorize.clone(),
service: cfg.service,
state: cfg.state,
installs: cfg.installs,
roles: cfg.roles.clone(),
restart: cfg.restart,
pager: cfg.pager,
Expand Down Expand Up @@ -3340,6 +3344,30 @@ mod tests {
}
}

/// **Only the installer's view holds `/apps` read-write**: `pkg` in the
/// shipped image, and in no config a shell. A test image's writer is the
/// row its job installs through.
#[test]
fn only_the_installer_s_view_writes_apps() {
let root = Path::new(env!("CARGO_MANIFEST_DIR"));
for config in ALL_CONFIGS {
let rendered = render_manifest(&parse_config(&root.join(config)));
let manifest = toyos_manifest::parse(std::str::from_utf8(&rendered).unwrap());
let writers: Vec<&str> = manifest
.programs
.iter()
.filter(|row| row.view().iter().any(|v| v.dir == toyos_manifest::package::DIR && v.write))
.map(|row| row.name.as_str())
.collect();
let installers: &[&str] = match *config {
"images/system.toml" | "tests/images/hostedclangcase.toml" => &["pkg"],
"tests/images/proctreecase.toml" => &["test-runner"],
_ => &[],
};
assert_eq!(writers, installers, "{config}");
}
}

/// One prefix and no other, so a doc naming `/etc/logkeeper` or `/apps/logkeeper` is a
/// token the filter below drops and an assertion that reds.
const LOG_DOC_BIN: &str = "/system/bin/";
Expand Down
4 changes: 2 additions & 2 deletions docs/src/architecture/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ prefix. An empty view names nothing.
reaches it only through the file picker, which hands over that one file.
- **No special cases.** The boot partition is in the updater's view and nobody
else's; login data is in the login authority's view alone; `/apps` is
writable only in the installer service's view, and every other program sees
it read-only.
writable only in the installer's view, and every other program sees it
read-only.

The working directory is the client's: a spawn states the child's starting
directory, which the child resolves in its own view.
Expand Down
13 changes: 8 additions & 5 deletions images/system.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ memory-floor-mib = 96
start = ["logkeeper", "uart", "diskserver", "fileserver", "compositor", "soundserver", "netstack", "filepicker", "acpiserver", "ps2server", "wlan", "vdagent"]

# What every program launched out of `/apps` holds, whatever its own directory
# says. A package is unpacked by `/system/bin/pkg` into a writable directory, so
# a row read out of one would be a directory deciding what the machine hands
# out; this is the image's answer, one for all of them. Connectors only —
# says. A package is what an archive carried, so a row read out of one would
# be a directory deciding what the machine hands out; this is the image's
# answer, one for all of them. Connectors only —
# `devices` and `syscap` have no spelling here, so nothing installed claims
# hardware or enters the RT band — and no directory: a package sees its own
# `/apps/<name>` read-only and its own `/home/toy/Apps/<name>`, its `HOME`.
Expand All @@ -52,10 +52,13 @@ folder = "read-write"
# with the session user's home, and `state = true` gives it a `/state/<name>`
# beside it. No row's view holds any other part of `/state`.
[programs]
# The installer. It writes under `/apps` because `/apps` is writable to it.
# The installer: `installs = true` makes `/apps` read-write in its view, and
# it is read-only in every other row's, so `launch pkg install <file>` installs
# and a shell's own writes and its helpers' are refused, a `pkg` it spawns as
# one among them. Who may install is the `starts` that list it.
# `/state/pkg` is where the machine's copy of the repository metadata it last
# accepted belongs (`toyos_update::repo::Holder::Machine`).
pkg = { state = true }
pkg = { state = true, installs = true }

# **Every image that carries a `TOYOS-LOG` partition runs this**, and every
# image does. The kernel keeps the record ring, writes the console only before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ the binary in a ToyOS guest is this track's harness's job, not gbae's.
stay for crates, `rust/` and LLVM. Recipes and patches live in this
repository, where `NOTICE` and the licence gate carry them, not in a ports
repository.
- **The installer** is `/system/bin/pkg`. Who may write `/apps` (owner
ruling, 2026-11-05) is staged in stage 2 of
`issues/every-program-sees-only-the-files-it-was-given.md`. `pkg`
- **The installer** is `/system/bin/pkg`, and only its row's view holds
`/apps` read-write (owner ruling, 2026-11-05; stage 2 of
`issues/every-program-sees-only-the-files-it-was-given.md`): it installs
and removes launched, `launch pkg install <file>`, and a `pkg` spawned as
a helper lists and refuses the rest by name. A caller that can launch
`pkg` answers its question itself, by `--yes` or the stdin it supplies, so
who decides an install is the `starts` that list `pkg`. `pkg`
fetches, verifies, unpacks and commits, and it asks the user
before it installs — at install, the moment the user typed the command,
never at first run, so a refusal leaves nothing on disk and no answer has
Expand Down Expand Up @@ -72,7 +76,7 @@ The storage track's users and mount-protocol stages do not block this one.
`issues/the-guest-suite-runs-only-what-no-cheaper-tier-reaches.md`
owes. **What a package holds is the image's `[apps]` row, never
its own `manifest.toml`** — that file names which of the directory's
binaries a launch starts and nothing else, so a writable `/apps` cannot name
binaries a launch starts and nothing else, so no file under `/apps` can name
a device or a right. The stage-then-commit above amends it: `pkg` writes
`/apps/<name>/` in place today, its `manifest.toml` last
(`system/pkg/src/main.rs`). It streams an archive of any size that fits
Expand Down
42 changes: 31 additions & 11 deletions issues/every-program-sees-only-the-files-it-was-given.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,37 @@ other, with the same per-session isolation (owner, 2026-11-05).
`/system` read-only, its own `/tmp` (`toyos_manifest::app_temporary`, a
directory of the machine's), and nothing else a file server serves
(`toyos_manifest::Program::view`). Every row the image declares still sees
the whole tree, `/system` read-only and the rest read-write but `/state`,
of which each row holds only its own directory where it keeps state
(`service = true` or `state = true`: the daemons' own state is built).
`/apps` is included, so a shell and everything it starts can
rewrite an installed package. Only the installer service writes `/apps`
(owner ruling, 2026-11-05): this stage gives that one row `/apps`
read-write and every other row, the shell included,
`/apps` read-only. Whether `pkg` becomes that service or its client is
this stage's brief. **Its exit**: a shell's write under `/apps` is refused
by the file server, and an install through the installer service still
commits; granting the shell's row `/apps` read-write reds the first.
the whole tree but `/state`, of which each row holds only its own
directory where it keeps state (`service = true` or `state = true`: the
daemons' own state is built); `/system` is read-only, `/log` and `/apps`
are read-only to all but one row each, and the rest is read-write. The
storage rows are started outside that
(`issues/storage-rows-start-holding-the-supervisors-whole-tree.md`),
which this stage's exit closes.
Only the installer service writes `/apps` (owner ruling, 2026-11-05).
Built: `/apps` is read-only in every declared row's view but the row
that declares `installs = true` (`toyos_manifest::Program::installs`),
which in the image is `pkg`'s. `pkg` is that service and not a client of
one: a launch already gives a row its own view, and who may launch it is
the `starts` that list it, so the authority is `images/system.toml`'s
alone and no port, protocol or daemon was added. `launch pkg install
<file>` installs; a `pkg` a shell spawns as a helper holds the shell's
view and refuses by name. Judged on the host:
`toyos_manifest`'s `only_the_installer_writes_apps`, red with the view
ignoring `installs`, and the build's
`only_the_installer_s_view_writes_apps` over every committed config, red
with that and with the shell's row granted `installs`. **Its exit**: a
shell's write under `/apps` is refused by the file server, and an install
through the installer service still commits. The first's check is the
metal `app_view` row's shell arm, in place of a boot with the shell's row
granted `/apps` read-write (orchestrator, 2026-11-11): the shell's
redirect into `/apps` is refused with the file server's read-only reason
while the same redirect into `/home` writes, and the two are one volume
and one server differing only in the grant, so the grant is what
refused. That row is green on the T14, both lines in its log (#1203).
Owed on a machine: the second, which is `pkg_install_gbae`'s
(`issues/the-guest-suite-runs-only-what-no-cheaper-tier-reaches.md`,
stage D), whose client launches `pkg`.
`/dev/null` is a name only libc's `open` knows, answered with a kernel
null handle (`SYS_NULL`): no view holds it, so `stat` of it and a program
that does not open through libc find nothing. Whether views name it is
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
status: open
kind: tooling
opened: 2026-11-11
---

# process_tree's metal judge waits for a kernel line no spawn prints

The metal `process_tree` row's judge (`process_tree` in `tests/toyos.rs`)
requires the kernel's log to say `spawn: /tmp/process_tree_invalid_elf: `
twice, once per B: the kernel loader refusing the 64 zero bytes the job
writes there. Since the spawner lays a program out itself
(`toyos::elf::program::lay_out` in `Helper::spawn`, `sdk/toyos/src/spawn.rs`),
an image that is no ELF is refused in the caller before any syscall, so the
kernel never sees it and never prints the line. The job still passes: B
asserts only that the spawn failed.

Evidence: the T14's `proctreecase` boot of #1203 at e78085e47. The job ended
`===TEST_END test_rs_process_tree exit=0===`, the kernel's log holds no line
naming `/tmp/process_tree_invalid_elf`, and the judge answered `the loader
refused the invalid executable 0 times, not once per B`; the row's other
three tests passed. #1203 changes no kernel, spawn or `process_tree` code.
https://github.com/ToyOSOrg/evidence/tree/eff6d9e767dc90c4472908660613872f68f76dbb/r3.

So the row is red on every bench, and what it meant to hold, a spawn refused
after admission under B releasing what admission took, is no longer reached
by this job.

Exit: the job reaches a kernel refusal after admission again, with an image
that lays out and the kernel refuses, and the judge counts that line; or the
arm and the judge's count go, if a cheaper test holds that release.

Owner: the guest-suite track.
36 changes: 36 additions & 0 deletions issues/storage-rows-start-holding-the-supervisors-whole-tree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
status: open
kind: defect
opened: 2026-11-11
---

# Storage rows start holding the supervisor's whole-tree namespace

By inspection, and unverified on a machine: `diskserver` and the file servers
for the `memory` and `system` roles are started holding a duplicate of the
supervisor's own namespace, every directory of the tree read-write but
`/system`; `/apps` and `/log` are among them.

The supervisor gives a storage row no view (`Grants::view` in
`system/supervisor/src/main.rs`), since a file server resolving a path
through itself waits for ever. Where such a row has no other name either,
`build_namespace` answers no namespace at all, and a spawn that names none
endows a duplicate of the spawner's own (`Helper::spawn`,
`sdk/toyos/src/spawn.rs`). The supervisor's own is the whole tree
(`toyos_manifest::whole_tree`).

All three are the signed image's storage stack and open no path, so no
boundary between a session's programs and `/apps` or `/log` depends on it.
But "a storage row sees none" is not what happens, and no other row is
started this way.

Evidence owed: `names.open("fs:/apps")` from one of those processes, which
answers a connection if this is right; if not, the process holds no
namespace, or one without `fs:/apps`.

Exit: a storage row is started with an empty namespace where its row names
nothing, the check above refused on a machine, as part of stage 2 of
`issues/every-program-sees-only-the-files-it-was-given.md`, whose exit is
that nothing still sees the global tree.

Owner: the file-isolation track.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ and NVMe. Exit: as stage A.
`Gone` and reconnect, and the supervisor's restart, its bound and its refusal by name of a
restart whose claim is held, as module tests.
- metal `layout_fresh_boot`: `/home`'s layout on the disk.
- metal `pkg_install_gbae`: `pkg install` lands a package that runs.
- metal `pkg_install_gbae`: a launched `pkg install` lands a package that runs.
- metal `kernel_log_file`, `log_partition_layout`, `log_partition_identity`: `/log` on the stick
and its layout.
- metal `file_mtime_survives_a_reboot`: a file's mtime survives a reboot.
Expand Down
Loading