carlos / platform Public

Merge remote-tracking branch 'origin/main' into cert-import-1429

claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 0d75989aaa14268708db8e48ad27971f95a80fb2 parent 10106e6parent ce9fb95
25 files changed, +1,389 −45
  • approved_rootfs_copy_test.go +4 −2
  • docs/site/changelog.json +458 −0
  • docs/site/rootfs.md +2 −0
  • docs/superpowers/notes/census-proposal-rootfs-netlink-route-1419.md +33 −0
  • docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md +7 −2
  • internal/host/units/carlos-instance-rootfs-cmd@.service +13 −3
  • internal/host/units/carlos-instance-rootfs-gen@.service +13 −3
  • internal/host/units/carlos-instance-rootfs-probe.service +9 −2
  • internal/host/units/carlos-instance-rootfs-tty@.service +13 −3
  • internal/host/units/carlos-instance-rootfs-worker@.service +13 −3
  • internal/host/units/carlos-instance-rootfs@.service +13 −3
  • internal/host/units_rootfs_test.go +22 −20
  • internal/instanceexec/exec.go +21 −1
  • internal/instanceexec/exec_rootfs_scope_test.go +111 −0
  • internal/instanceexec/families_test.go +35 −0
  • internal/instanceexec/netlink_route_linux.go +169 −0
  • internal/instanceexec/netlink_route_linux_test.go +314 −0
  • internal/instanceexec/netlink_route_other.go +9 −0
  • internal/instanceexec/probe_rootfs.go +39 −0
  • internal/instanceexec/probe_rootfs_linux.go +4 −0
  • internal/instanceexec/probe_rootfs_other.go +4 −0
  • internal/instanceexec/probe_rootfs_test.go +61 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-rootfs-netlink-route-1419.tsv +19 −0
  • testdata/clireg-golden.jsonl +2 −2
diff --git a/approved_rootfs_copy_test.go b/approved_rootfs_copy_test.go
index de55a3986..c8b988523 100644
--- a/approved_rootfs_copy_test.go
+++ b/approved_rootfs_copy_test.go
@@ -21,7 +21,7 @@ import (
const rootfsCopyRecordPath = "docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md"
// Canonical ids only: two digits from C01 to C99, three digits from C100
-// (Plan 4 runs to RFS-4-C146; RFS-4-C147 is the rootfs-default-home follow-up, RFS-4-C155 the /etc/hosts one). No leading zero on a three-digit id, no C00.
+// (Plan 4 runs to RFS-4-C146; RFS-4-C147 is the rootfs-default-home follow-up, RFS-4-C155 the /etc/hosts one, RFS-4-C156 the netlink one). No leading zero on a three-digit id, no C00.
var rootfsCopyIDPattern = regexp.MustCompile(`^RFS-[1-6]-C(0[1-9]|[1-9][0-9]{1,2})$`)
// rootfsCopyIDs is the deck's inventory, pinned as a literal list in the
@@ -85,7 +85,7 @@ var rootfsCopyIDs = []string{
"RFS-4-C45", "RFS-4-C46", "RFS-4-C47", "RFS-4-C147", "RFS-4-C155", "RFS-4-C48",
"RFS-4-C49", "RFS-4-C50", "RFS-4-C51", "RFS-4-C52",
"RFS-4-C53", "RFS-4-C54", "RFS-4-C55", "RFS-4-C56",
- "RFS-4-C57", "RFS-4-C58", "RFS-4-C59", "RFS-4-C60",
+ "RFS-4-C57", "RFS-4-C156", "RFS-4-C58", "RFS-4-C59", "RFS-4-C60",
"RFS-4-C61", "RFS-4-C62", "RFS-4-C63", "RFS-4-C64",
"RFS-4-C65", "RFS-4-C66", "RFS-4-C67", "RFS-4-C68",
"RFS-4-C69", "RFS-4-C70", "RFS-4-C71", "RFS-4-C72",
@@ -256,6 +256,8 @@ var rootfsCopyBuilt = []string{
"RFS-4-C147",
// rootfs-etc-hosts-1349 (2026-11-22): carlos ship adds /etc/hosts (docs/site/rootfs.md)
"RFS-4-C155",
+ // rootfs-netlink-route-1419 (2026-11-25): rootfs processes read NETLINK_ROUTE (docs/site/rootfs.md)
+ "RFS-4-C156",
// rails-guide-run-console (2026-11-06): Commands and consoles on the
// Rootfs page and the Rails guide's pointer; RFS-4-C100 struck
"RFS-4-C148", "RFS-4-C149", "RFS-4-C150", "RFS-4-C151", "RFS-4-C152", "RFS-4-C153", "RFS-4-C154",
diff --git a/docs/site/changelog.json b/docs/site/changelog.json
index 1b9e2023a..5bfe25d19 100644
--- a/docs/site/changelog.json
+++ b/docs/site/changelog.json
@@ -2,6 +2,464 @@
"//": "Generated by go run ./cmd/changelog from git, the published release notes and Amadan. Do not edit; regenerate.",
"repo": "https://amadan.net/carlos/platform",
"releases": [
+ {
+ "tag": "v0.43.8",
+ "date": "2026-11-25",
+ "sha": "95539056f63dad93191407478c1ac951a9e6d6df",
+ "published": true,
+ "notes_url": "https://github.com/carlosframework/releases/releases/tag/v0.43.8",
+ "notes": {
+ "form": "markdown",
+ "md": "#### What's new\n\n- **Accept the data processing agreement in the console.** The pane appears in account Settings only after an operator has set a letterhead and published a data processing agreement. Until an agreement is in force, an account owner sees the newest version, its text, and a form for the company's legal name, registered address, country, signer's name and role. Members see no acceptance form. Once an owner accepts, the console sends that owner a confirmation email. The acceptance still stands if delivery fails. Any member can then open the record showing what was accepted, by whom and when. When a later version has an apply date, account members see that date and the privacy email to use to object before then.\n- **Longer videos convert.** The `video-720p` preset now converts SDR video at or below 1080p for up to 3 hours, up from 2. HDR video at or below 1080p stays limited to 75 minutes, and video above 1080p to 30 minutes.\n- **Write credentials for one store folder, not available yet.** `carlos store credential --write` is documented for services such as a LiveKit recorder. It would issue a temporary write-only credential for one store prefix. This release issues none. On a normal console, both routes return `503`: when write credentials are not configured, the code is `write_credentials_not_configured`; when they are configured, the code is `write_credentials_not_released`.\n\n#### For operators\n\n- **Roll order.** Roll your development deployment first, then production. Boxes first, then the console.\n- **Check `/etc` on every box before you roll it.** Every box's instance control opens `/etc`, `/etc/carlos` and `/etc/carlos/managed-box.json` without following symlinks. `/etc` and `/etc/carlos` must be owned by root and not writable by group or others. If the identity file is present, it must also be root-owned, not group- or other-writable, a regular file and singly linked. A present identity file that fails any check makes the box refuse every workload start (`/start`, `/seed`, `/cmd`, `/tty`, `/parent`, `/demo-build` and `/demo-snapshot`) with `409` and `box is joining its fleet`. Check all three paths with `stat -c '%n %U %a %F %h' /etc /etc/carlos /etc/carlos/managed-box.json`. A missing `/etc/carlos` or identity file is treated as a BYO box. Managed fleets stay off until a system operator turns them on with `carlos system managed-fleets set` and the console sets `CARLOS_MANAGED_FLEETS_BACKEND=aws`.\n- **The legal page: nothing changes until you publish.** Operators open `/fleet/legal`. The required letterhead fields are company name, registered office, company number, signatory line and privacy email. Logo, VAT number and footer line are optional. Saving the letterhead and each publish require a fresh sign-in. For a data processing agreement, enter an HTTPS page URL and a separate HTTPS agreement-text URL. The console fetches the agreement text once, accepts only headings, paragraphs, lists, links and emphasis, stores the fetched bytes and records their SHA-256. For the terms and privacy policy, it fetches the HTTPS page URL once and records its SHA-256. The page shows the published versions, their fingerprints and the accounts with an agreement in force. The first agreement applies on publication. A later one that needs notice applies at least 35 days after publication. The first terms or privacy version records the date it took effect. Later versions need notice unless marked as a typo fix. Published versions can't be edited or removed. Customers see the agreement only after the letterhead is set and an agreement is published.\n- **Leave store write credentials off.** The region host module gains a `store_write_credentials` switch, off by default, and it requires `store_bucket_prefix`. On a normal console, `POST /api/cli/apps/{account}/{app}/store/credentials` and `POST /api/cli/apps/{account}/{app}/store/credentials/revoke` return `503`. With the deployment switch off, the code is `write_credentials_not_configured`. With it on, this release returns `write_credentials_not_released`. No credential is minted or revoked by these routes in this release.\n- **Media conversion.** If your deployment runs media conversion, the 3-hour limit applies once the console runs this release. A `CARLOS_MEDIA_LIMITS` override still sets the deployment's limits."
+ },
+ "changes": [
+ {
+ "sha": "95539056f63dad93191407478c1ac951a9e6d6df",
+ "date": "2026-11-25",
+ "subject": "console: accept the data processing agreement in settings",
+ "branch": "dpa-and-retention",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/dpa-and-retention",
+ "commits": 1,
+ "discussions": [
+ {
+ "id": 1396,
+ "title": "Data processing agreements in the console, and retention set by customers",
+ "state": "open"
+ },
+ {
+ "id": 1397,
+ "title": "Spec: DPA and retention (4 Astra rounds; closed by Paul at rev 5)",
+ "state": "closed"
+ },
+ {
+ "id": 1398,
+ "title": "DPA text for carloku.com/dpa/ (copy review)",
+ "state": "closed"
+ },
+ {
+ "id": 1399,
+ "title": "Plan slice 1 (others planned after it merges)",
+ "state": "closed"
+ },
+ {
+ "id": 1400,
+ "title": "Slice 1: DPA acceptance (MERGED 9553905)",
+ "state": "closed"
+ },
+ {
+ "id": 1401,
+ "title": "Slice 2: legal notices",
+ "state": "open"
+ },
+ {
+ "id": 1402,
+ "title": "Slice 3: retention (statistics, logs, mail events; console sweep)",
+ "state": "open"
+ },
+ {
+ "id": 1403,
+ "title": "Slice 3b: folded into slice 3 (console sweep, no box change)",
+ "state": "closed"
+ },
+ {
+ "id": 1404,
+ "title": "Slice 4: deleting a person",
+ "state": "open"
+ },
+ {
+ "id": 1405,
+ "title": "Slice 5: flagship switch-on (Paul's go)",
+ "state": "open"
+ },
+ {
+ "id": 1410,
+ "title": "DPA copy: database backups deleted on request (re-review one string)",
+ "state": "open"
+ },
+ {
+ "id": 1411,
+ "title": "S1 T0: UX pass and copy deck (with Paul)",
+ "state": "closed"
+ },
+ {
+ "id": 1412,
+ "title": "S1 T1: store tables",
+ "state": "closed"
+ },
+ {
+ "id": 1413,
+ "title": "S1 T2: guarded fetch and canonical agreement",
+ "state": "closed"
+ },
+ {
+ "id": 1414,
+ "title": "S1 T3: /fleet/legal",
+ "state": "closed"
+ },
+ {
+ "id": 1415,
+ "title": "S1 T4: dpaInForce",
+ "state": "closed"
+ },
+ {
+ "id": 1416,
+ "title": "S1 T5: settings pane and accepting",
+ "state": "closed"
+ },
+ {
+ "id": 1417,
+ "title": "S1 T6: record page",
+ "state": "closed"
+ },
+ {
+ "id": 1418,
+ "title": "S1 T7: merged 9553905; dev witness after the next dev roll",
+ "state": "open"
+ },
+ {
+ "id": 1439,
+ "title": "S1 follow-ups (six) on branch dpa-followups",
+ "state": "open"
+ },
+ {
+ "id": 1440,
+ "title": "Release v0.43.8 dev only (Paul's GO 11-25), then dev witness",
+ "state": "open"
+ }
+ ],
+ "docs": [
+ "/docs/data-processing"
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ },
+ {
+ "sha": "2cadcb4354034ef772684c2a1a6debfbc0155a2e",
+ "date": "2026-11-25",
+ "subject": "store: write-only credentials, phase 1 (doors refuse until phase 2)",
+ "branch": "store-write-credential",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/store-write-credential",
+ "commits": 27,
+ "discussions": [
+ {
+ "id": 280,
+ "title": "Root trusts service-writable hostguard and health records under /data (claim root paths)",
+ "state": "open"
+ }
+ ],
+ "docs": [
+ "/docs/cli#a-store-for-one-environment",
+ "/docs/cli#carlos-store-credential",
+ "/docs/live-streams-bring-your-own-livekit#before-you-start",
+ "/docs/live-streams-bring-your-own-livekit#how-it-fits-together",
+ "/docs/live-streams-bring-your-own-livekit#recording-into-your-store"
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ },
+ {
+ "sha": "72e6fe91bfefbc7a8738e8e3cab338f967a5ebbe",
+ "date": "2026-11-25",
+ "subject": "managed fleets 2b-2: box side and the first real box (#457)",
+ "branch": "managed-fleets-2b2",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/managed-fleets-2b2",
+ "commits": 46,
+ "discussions": [
+ {
+ "id": 457,
+ "title": "Self-service managed fleets: rent EC2 boxes in carloku’s AWS account for rootfs apps",
+ "state": "open"
+ },
+ {
+ "id": 1251,
+ "title": "Gitleaks CI step: digest allowlist design",
+ "state": "open"
+ }
+ ],
+ "docs": [
+ "/docs/cli#carlos-system-managed-fleets-set",
+ "/docs/cli#managed-fleet-providers-on-the-console"
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ },
+ {
+ "sha": "c340dd431fdd4d6ecc709bdff22b0a6ce3253ec8",
+ "date": "2026-11-25",
+ "subject": "media: SDR video up to 1080p converts up to 3 hours",
+ "branch": "media-three-hour-sdr",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/media-three-hour-sdr",
+ "commits": 7,
+ "docs": [
+ "/docs/live-streams-bring-your-own-livekit#converting-and-playing-the-recording",
+ "/docs/media-conversion#limits"
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "tag": "v0.43.7",
+ "date": "2026-11-25",
+ "sha": "d74dff114597775618926c0400842b5d728d1018",
+ "published": true,
+ "notes_url": "https://github.com/carlosframework/releases/releases/tag/v0.43.7",
+ "notes": {
+ "form": "markdown",
+ "md": "#### What's new\n\n- **Rootfs images get a usable `/etc/hosts`.** When `carlos ship` builds a rootfs image, it replaces a missing or empty file, a directory, or a symlink that does not resolve to a non-empty regular file with `127.0.0.1 localhost` and `::1 localhost ip6-localhost ip6-loopback`. A non-empty regular file stays unchanged. A symlink to a non-empty regular file is replaced at `/etc/hosts` with that file's bytes, mode, owner and timestamp. Libraries that read it directly, such as Ruby's `Resolv`, no longer fail because the path is missing. Images shipped before this release are unchanged. Update your CLI and ship again to get the file.\n\nUpdate your CLI to use this.\n\n#### For operators\n\n- **No box or console update is needed.** Use the updated CLI before shipping rootfs images. The change is applied while `carlos ship` builds the image. Images already shipped are unchanged, and boxes and consoles already running v0.43.6 behave as before."
+ },
+ "changes": [
+ {
+ "sha": "d74dff114597775618926c0400842b5d728d1018",
+ "date": "2026-11-25",
+ "subject": "changelog: regenerate through v0.43.5 (release step 11b)",
+ "branch": "changelog-v0.43.5",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/changelog-v0.43.5",
+ "commits": 1,
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ },
+ {
+ "sha": "ca75631f311c415165f08eb031d4a66f8880bf7d",
+ "date": "2026-11-25",
+ "subject": "rootfs: carlos ship adds /etc/hosts to images that have none (#1349)",
+ "branch": "rootfs-etc-hosts-1349",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/rootfs-etc-hosts-1349",
+ "commits": 3,
+ "discussions": [
+ {
+ "id": 280,
+ "title": "Root trusts service-writable hostguard and health records under /data (claim root paths)",
+ "state": "open"
+ },
+ {
+ "id": 1349,
+ "title": "Rootfs apps have no /etc/hosts: Excon/fog S3 calls fail with ENOENT",
+ "state": "open"
+ },
+ {
+ "id": 1351,
+ "title": "Write failing tests for the default /etc/hosts",
+ "state": "closed"
+ },
+ {
+ "id": 1352,
+ "title": "carlos ship adds /etc/hosts when the image has none",
+ "state": "closed"
+ },
+ {
+ "id": 1353,
+ "title": "Document it in rootfs.md (Luna copy pass)",
+ "state": "closed"
+ },
+ {
+ "id": 1354,
+ "title": "Astra review",
+ "state": "closed"
+ },
+ {
+ "id": 1355,
+ "title": "Census note on #280",
+ "state": "closed"
+ },
+ {
+ "id": 1356,
+ "title": "Merge on green CI; tell Tito and Paul",
+ "state": "closed"
+ }
+ ],
+ "docs": [
+ "/docs/rootfs#what-every-process-gets"
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "tag": "v0.43.6",
+ "date": "2026-11-25",
+ "sha": "02fa02e3f3960e2b2fc615d9b4fe71e0fc7d9544",
+ "published": true,
+ "notes_url": "https://github.com/carlosframework/releases/releases/tag/v0.43.6",
+ "notes": {
+ "form": "markdown",
+ "md": "#### What's new\n\n- **Promote the exact build that staging tested.** `carlos releases pull <version> --app <a> --out <dir>` copies a shipped release's manifest and every named file out of a console, checking each file's size and sha256. `carlos ship --from-release <dir>` sends those files to another console under the manifest's version and release settings. You may still provide `--message` or `--program-change`. The target console checks every artifact against the source digests and stores nothing if any artifact differs. The CLI docs show the recipe: staging tests a build, production promotes the same build.\n- **A new instance can start with its config.** Before planning a new wake, the box tries to put the app config in place, so the first process starts configured instead of being restarted a few seconds later. The pass can wait up to 5 seconds, with a separate 5-second acknowledgement budget. If it cannot fetch or write the config, the wake proceeds as before and a later config sync may restart the process. A host-claim wake keeps the old behavior.\n- **Live streams guide.** A new docs page shows how to run a live stream with chat on your own LiveKit Cloud project, recorded into your app's store.\n\nUpdate your CLI to use these.\n\n#### For operators\n\n- **Roll order.** Roll your development deployment first, then production. Boxes first, then the console.\n- **Copying releases needs this release on both consoles.** Both the console you pull from and the console you ship to must run v0.43.6 or later, and so must the CLI.\n- **Media conversion: apply IAM and lifecycle changes before the console.** If your deployment runs media conversion, apply the media engine module at this release before any console runs it. The console role needs `s3:ListBucketVersions` on the deployment bucket with `s3:prefix` set to `media-results/*`, and `s3:DeleteObjectVersion` on `arn:aws:s3:::<deployment-bucket>/media-results/*`. Apply the deployment buckets lifecycle rules too. They make current and noncurrent objects under `media-results/` eligible for expiry after one day and remove expired delete markers. Without the IAM change, each due result cleanup is refused and retried. The lifecycle rules are the backstop when cleanup misses a result. If media conversion is off, this cleanup path has no new result objects to process."
+ },
+ "changes": [
+ {
+ "sha": "02fa02e3f3960e2b2fc615d9b4fe71e0fc7d9544",
+ "date": "2026-11-25",
+ "subject": "edge: burst flood test counts only its own allocations",
+ "branch": "fix-edge-burst-flake",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/fix-edge-burst-flake",
+ "commits": 1,
+ "discussions": [
+ {
+ "id": 1387,
+ "title": "CI flakes on main at e241f1ef9: TestBurstSingleKeyFloodBounded and TestPDFDoorEngineDown",
+ "state": "open"
+ }
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ },
+ {
+ "sha": "edaed8360ab2dd9e093f78b1558029ebecc40beb",
+ "date": "2026-11-25",
+ "subject": "docs: live streams on your own LiveKit Cloud project",
+ "branch": "docs-live-byo-livekit",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/docs-live-byo-livekit",
+ "commits": 3,
+ "docs": [
+ "/docs/live-streams-bring-your-own-livekit#before-you-start",
+ "/docs/live-streams-bring-your-own-livekit#how-it-fits-together",
+ "/docs/live-streams-bring-your-own-livekit#tokens-for-the-streamer-and-the-viewers",
+ "/docs/live-streams-bring-your-own-livekit#chat",
+ "/docs/live-streams-bring-your-own-livekit#recording-into-your-store"
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ },
+ {
+ "sha": "65951fbbdedcb1c5dffc925ff1148d947e14b5f9",
+ "date": "2026-11-25",
+ "subject": "Copy a shipped release between consoles (#1389)",
+ "branch": "release-copy-across-consoles",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/release-copy-across-consoles",
+ "commits": 19,
+ "discussions": [
+ {
+ "id": 280,
+ "title": "Root trusts service-writable hostguard and health records under /data (claim root paths)",
+ "state": "open"
+ },
+ {
+ "id": 1389,
+ "title": "Deploy pipeline needs: promote a tested build, run release once per build",
+ "state": "open"
+ },
+ {
+ "id": 1390,
+ "title": "T1 console read doors for manifest and artifacts",
+ "state": "closed"
+ },
+ {
+ "id": 1391,
+ "title": "T2 ship door honours expect_artifacts",
+ "state": "closed"
+ },
+ {
+ "id": 1392,
+ "title": "T3 carlos releases pull",
+ "state": "closed"
+ },
+ {
+ "id": 1393,
+ "title": "T4 carlos ship --from-release + two-console e2e",
+ "state": "closed"
+ },
+ {
+ "id": 1394,
+ "title": "T5 docs: CI recipe + release-once line",
+ "state": "closed"
+ },
+ {
+ "id": 1395,
+ "title": "Final review, CI, squash-merge",
+ "state": "closed"
+ }
+ ],
+ "docs": [
+ "/docs/cli#carlos-ship",
+ "/docs/cli#staging-tests-x-production-promotes-x",
+ "/docs/cli#carlos-releases",
+ "/docs/cli#carlos-releases-pull",
+ "/docs/stateless-replicas#deploys"
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ },
+ {
+ "sha": "bac71e00894d36e81a607be3587cf62c4be69d44",
+ "date": "2026-11-25",
+ "subject": "media: result objects never outlive their job",
+ "branch": "media-results-cleanup",
+ "branch_url": "https://amadan.net/carlos/platform/-/branch/media-results-cleanup",
+ "commits": 12,
+ "discussions": [
+ {
+ "id": 280,
+ "title": "Root trusts service-writable hostguard and health records under /data (claim root paths)",
+ "state": "open"
+ }
+ ],
+ "credit": [
+ {
+ "person": "Paul Campbell",
+ "agents": [
+ "claude"
+ ]
+ }
+ ]
+ }
+ ]
+ },
{
"tag": "v0.43.5",
"date": "2026-11-24",
diff --git a/docs/site/rootfs.md b/docs/site/rootfs.md
index d77ea92a8..a385c82d7 100644
--- a/docs/site/rootfs.md
+++ b/docs/site/rootfs.md
@@ -77,6 +77,8 @@ carlos ship --check warns when a process runs Node, Bun or Deno and the release
An instance can reach public addresses, such as an object store or a managed database's public endpoint. It cannot reach a private address unless a system operator allows it for the app with carlos apps set --egress-allow, and it never reaches the box it runs on or the cloud's metadata service.
+A process can read the box's network setup, such as its interfaces, addresses and routes, but cannot change it. So getifaddrs works, and with it Ruby's Socket.ip_address_list and Resolv and Node's os.networkInterfaces. Go's net.Interfaces works too. Other netlink sockets are refused.
+
## The visitor's address
Requests reach the web process with the visitor's address as the last entry of X-Forwarded-For. The platform writes that header itself and removes anything the visitor sent, so the last entry is always the address the platform saw. This also holds on a fleet box, where the request came in through the hub.
diff --git a/docs/superpowers/notes/census-proposal-rootfs-netlink-route-1419.md b/docs/superpowers/notes/census-proposal-rootfs-netlink-route-1419.md
new file mode 100644
index 000000000..be184ebc0
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-rootfs-netlink-route-1419.md
@@ -0,0 +1,33 @@
+# Census approval: rootfs-netlink-route-1419
+
+Ruling `census-ruling-rootfs-netlink-route-1419`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/host/units/carlos-instance-rootfs-cmd@.service` `external` | body | unchanged (1) | the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read |
+| `internal/host/units/carlos-instance-rootfs-gen@.service` `external` | body | unchanged (1) | the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read |
+| `internal/host/units/carlos-instance-rootfs-probe.service` `external` | body | unchanged (1) | the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read |
+| `internal/host/units/carlos-instance-rootfs-tty@.service` `external` | body | unchanged (1) | the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read |
+| `internal/host/units/carlos-instance-rootfs-worker@.service` `external` | body | unchanged (1) | the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read |
+| `internal/host/units/carlos-instance-rootfs@.service` `external` | body | unchanged (1) | the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read |
+
+Envelopes re-pinned: `internal/host/units`, `internal/instanceexec`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `internal/host/units/carlos-instance-rootfs-cmd@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-cmd@.service, accepted at census-ruling-carlos-run): new (rootfs Plan 2 Task 4): the rootfs cmd unit (oneshot, TimeoutStartSec=6h5m, the cmd log sockets), binding /run/carlos-control/exe/%I/rootfs/cmd/. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImage= with RootImageOptions=ro,nosuid,nodev; what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.
+- `internal/host/units/carlos-instance-rootfs-gen@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-gen@.service): new (rootfs Plan 2 Task 4): a rootfs generation's template, the run template without Slice=, StandardOutput=, the instance's binds and RootImage=, which only root's per-start drop-in (RootfsGenDropIn) supplies, so the template alone mounts and runs nothing. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImageOptions=ro,nosuid,nodev, with no RootImage= of its own (root's per-start drop-in names the image); what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.
+- `internal/host/units/carlos-instance-rootfs-probe.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=the rootfs probe's unit (embedded in the carlos binary, installed by root's unit install, applied by PID 1 as root; its process, carlos instance-probe --rootfs, runs as user carlos);basis=root-input (J4, as carlos-instance-probe.service): new (rootfs Plan 2 Task 7): a oneshot on carlos-instances.slice with the same restated block, RootImage= the probe image root builds itself (BuildProbeImage, under /run/carlos-control/probe), the probe's own _probe directories, root's launch.json, resolv.conf copy and box-addrs list read-only from /run/carlos-control/exe/_probe/rootfs/run/, and StandardOutput=truncate:/run/carlos-control/rootfs-probe.out, which PID 1 writes and root reads (runRootfsProbe); no tenant image, file or name reaches it;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, inside the rootfs block; plus one line outside it, Environment=CARLOS_PROBE_SYSCALL_FILTER=1, a constant the unit sets for its own process (the probe, as carlos); it names no path
+- `internal/host/units/carlos-instance-rootfs-tty@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the rootfs tty template, carlos-instance-rootfs-cmd@.service outside named lines held by TestRootfsTTYTemplateEqualsRootfsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit --rootfs tty %I, StandardInput=file:/run/carlos/logs/%I.tty.sock with StandardOutput/StandardError=journal, and RootImage plus the two BindReadOnlyPaths sources under /run/carlos-control/exe/%I/rootfs/tty/ (root-only exe layout) instead of rootfs/cmd/. The rootfs namespace block byte for byte (TestRootfsTemplatesShareOneNamespace), runs as carlos, binds only the instance own and root paths (TestRootfsTemplatesBindOnlyTheInstancesOwnAndRoots). Task 6: POST /tty runtime=rootfs (startRootfsCmd with RoleTTY) starts it through Plan 2's rootfs one-shot path (preflight, validateStagedImage, ensureRootfsExe under rootfs/tty/, jit drop-in and owed reload, post-start MemoryDenyWriteExecute check); its files go only through removeRootfsUnitFiles (stopRootfs and cleanCmdExe with RoleTTY, the sweep);rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.
+- `internal/host/units/carlos-instance-rootfs-worker@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-gen@.service): new (rootfs Plan 2 Task 4): a rootfs worker's template, the run template without Slice=, StandardOutput=, the instance's binds and RootImage=, which only root's per-start drop-in (WorkerDropIn) supplies. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImageOptions=ro,nosuid,nodev, with no RootImage= of its own (root's per-start drop-in names the image); what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.
+- `internal/host/units/carlos-instance-rootfs@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance@.service): new (rootfs Plan 2 Task 4): the run unit of a rootfs instance (ExecStart= the trampoline with --rootfs run, ExecStopPost= instance-exit --rootfs run), Slice=carlos-instances-%i.slice, binding /run/carlos-control/exe/%I/rootfs/run/. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImage= with RootImageOptions=ro,nosuid,nodev; what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/instanceexec/netlink_route_linux.go:ScopeNetlinkRoute`: reads +file:Syscall; written legacy, accepted-legacy, frozen
+
+Seal: `8b8e269938a575bfaeb8f0c9a5be508b4b22a10b7b5bd19d74fa511e5f15a302` → `0d02e63b6a67aab196e13324393148ab8faccbd4331af3eadb1ab52ff5b42bb1`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-rootfs-netlink-route-1419.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
index 8e3461e13..fa81048df 100644
--- a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
+++ b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
@@ -301,6 +301,7 @@ From the plan: Placeholders: `<app>` an app; `<fleet>` a fleet name; `<region>`
| RFS-4-C55 | docs/site/rootfs.md (fact, R11) | Memory is never writable and executable at once, unless the release is shipped with carlos ship --jit. A JIT compiler needs that: Node, Bun and Deno, the JVM, Ruby's YJIT and PHP's opcache JIT. Ruby, PHP and Python run well without one. | approved |
| RFS-4-C56 | docs/site/rootfs.md | Network | approved |
| RFS-4-C57 | docs/site/rootfs.md | An instance can reach public addresses, such as an object store or a managed database's public endpoint. It cannot reach a private address unless a system operator allows it for the app with carlos apps set --egress-allow, and it never reaches the box it runs on or the cloud's metadata service. | approved |
+| RFS-4-C156 | docs/site/rootfs.md (fact, rootfs-netlink-route-1419) | A process can read the box's network setup, such as its interfaces, addresses and routes, but cannot change it. So getifaddrs works, and with it Ruby's Socket.ip_address_list and Resolv and Node's os.networkInterfaces. Go's net.Interfaces works too. Other netlink sockets are refused. | approved |
| RFS-4-C148 | docs/site/rootfs.md (rails-guide-run-console) | Commands and consoles | approved |
| RFS-4-C149 | docs/site/rootfs.md (rails-guide-run-console) | carlos run runs a one-off command on an instance: a data fix, a rake task, an artisan or manage.py command. It runs inside the instance's image, in web's working_dir, with web's environment and the same database. Its output comes back to your terminal, and carlos exits with the command's own status. | approved |
| RFS-4-C150 | docs/site/rootfs.md (rails-guide-run-console) | A command with a slash in it, like bin/rails, is found from web's working_dir. A bare name, like php, is found along the image's PATH. Commands are not run through a shell, so for a pipe or a variable, run sh -c with the line in quotes. | approved |
@@ -610,6 +611,10 @@ RFS-4-C155 (2026-11-22, #1349: carlos ship adds /etc/hosts) was approved
by a Luna copy pass under Paul's delegation; its revision was applied,
then ", or a link to one" added when Astra R1 kept a symlinked hosts
file's target.
+RFS-4-C156 (2026-11-25, #1419: rootfs processes may read NETLINK_ROUTE)
+was reviewed by a Luna pass under Paul's delegation; its revision was
+applied with two facts corrected (getifaddrs lists interfaces and
+addresses, not routes; Go's net.Interfaces does not use getifaddrs).
Recounted from the rows on 2026-10-30 (Plan 6 amendment, Astra R1 P2-7);
the earlier counts had not followed Plans 1 and 4's later rows.
@@ -617,7 +622,7 @@ the earlier counts had not followed Plans 1 and 4's later rows.
- Plan 1: 99 live, 0 struck, 99 rows
- Plan 2: 12 live, 0 struck, 12 rows
- Plan 3: 32 live, 3 struck, 35 rows
-- Plan 4: 151 live, 3 struck, 154 rows (RFS-4-C100 struck and RFS-4-C148 to C154 added on 2026-11-06; RFS-4-C155 added on 2026-11-22)
+- Plan 4: 152 live, 3 struck, 155 rows (RFS-4-C100 struck and RFS-4-C148 to C154 added on 2026-11-06; RFS-4-C155 added on 2026-11-22; RFS-4-C156 on 2026-11-25)
- Plan 5: 44 live, 0 struck, 44 rows
- Plan 6: 75 live, 0 struck, 75 rows (RFS-6-C47 revised and RFS-6-C65 added and approved on 2026-10-30; RFS-6-C66 to C75 added and approved on 2026-10-31)
-- Total: 413 live, 6 struck, 419 rows
+- Total: 414 live, 6 struck, 420 rows
diff --git a/internal/host/units/carlos-instance-rootfs-cmd@.service b/internal/host/units/carlos-instance-rootfs-cmd@.service
index 0c12358e2..1adf28518 100644
--- a/internal/host/units/carlos-instance-rootfs-cmd@.service
+++ b/internal/host/units/carlos-instance-rootfs-cmd@.service
@@ -27,7 +27,10 @@ RemainAfterExit=yes
TimeoutStartSec=6h5m
# --rootfs before the role, in ExecStart= and ExecStopPost= alike, as in
# carlos-instance-rootfs@.service.
-ExecStart=/opt/carlos/carlos instance-exec --rootfs cmd %I
+# --netlink-scope: the trampoline scopes netlink to NETLINK_ROUTE before the
+# tenant starts (#1419). A carlos from before #1419 does not know the flag
+# and exits at once, so this unit's AF_NETLINK never reaches an unscoped tenant.
+ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope cmd %I
# The advisory exit record, as for the other templates. Not "+" (codex R3-2).
ExecStopPost=/opt/carlos/carlos instance-exit --rootfs cmd %I
User=carlos
@@ -187,8 +190,15 @@ PrivatePIDs=yes
RestrictNamespaces=yes
NoNewPrivileges=yes
CapabilityBoundingSet=
-# Kept, unchanged; a unit-file pin.
-RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+# AF_NETLINK is here for getifaddrs (#1419), and only NETLINK_ROUTE of it:
+# instance-exec --rootfs and the rootfs probe install a seccomp filter that
+# answers every other netlink protocol EAFNOSUPPORT (probe netlink-others).
+# Route is read-only here: changing links, addresses or routes takes
+# CAP_NET_ADMIN, and the capability set is empty (probe netlink-readonly).
+# It does let a tenant read and watch the box's links, addresses, routes,
+# neighbours and tc, so the box must never name a network object (an
+# interface, an altname, a tc handle) after a tenant.
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
# Abstract unix sockets live in the network namespace, which instances
# share with the box because they need outbound TCP, and the line above
# cannot tell them from path sockets (#178). The trampoline scopes them
diff --git a/internal/host/units/carlos-instance-rootfs-gen@.service b/internal/host/units/carlos-instance-rootfs-gen@.service
index 18d839479..abb01634f 100644
--- a/internal/host/units/carlos-instance-rootfs-gen@.service
+++ b/internal/host/units/carlos-instance-rootfs-gen@.service
@@ -24,7 +24,10 @@ Before=carlos-edge-drain.service
Type=simple
# --rootfs before the role, in ExecStart= and ExecStopPost= alike, as in
# carlos-instance-rootfs@.service.
-ExecStart=/opt/carlos/carlos instance-exec --rootfs run %I
+# --netlink-scope: the trampoline scopes netlink to NETLINK_ROUTE before the
+# tenant starts (#1419). A carlos from before #1419 does not know the flag
+# and exits at once, so this unit's AF_NETLINK never reaches an unscoped tenant.
+ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope run %I
# The tenant runs in its own data directory (#256 D). %I here is
# <id>:<n>, not the host's id, so the real directory comes from the
# generation's runtime drop-in, which overrides this line. This one only
@@ -167,8 +170,15 @@ PrivatePIDs=yes
RestrictNamespaces=yes
NoNewPrivileges=yes
CapabilityBoundingSet=
-# Kept, unchanged; a unit-file pin.
-RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+# AF_NETLINK is here for getifaddrs (#1419), and only NETLINK_ROUTE of it:
+# instance-exec --rootfs and the rootfs probe install a seccomp filter that
+# answers every other netlink protocol EAFNOSUPPORT (probe netlink-others).
+# Route is read-only here: changing links, addresses or routes takes
+# CAP_NET_ADMIN, and the capability set is empty (probe netlink-readonly).
+# It does let a tenant read and watch the box's links, addresses, routes,
+# neighbours and tc, so the box must never name a network object (an
+# interface, an altname, a tc handle) after a tenant.
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
# Abstract unix sockets live in the network namespace, which instances
# share with the box because they need outbound TCP, and the line above
# cannot tell them from path sockets (#178). The trampoline scopes them
diff --git a/internal/host/units/carlos-instance-rootfs-probe.service b/internal/host/units/carlos-instance-rootfs-probe.service
index 5f0291152..fad6de6c0 100644
--- a/internal/host/units/carlos-instance-rootfs-probe.service
+++ b/internal/host/units/carlos-instance-rootfs-probe.service
@@ -162,8 +162,15 @@ PrivatePIDs=yes
RestrictNamespaces=yes
NoNewPrivileges=yes
CapabilityBoundingSet=
-# Kept, unchanged; a unit-file pin.
-RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+# AF_NETLINK is here for getifaddrs (#1419), and only NETLINK_ROUTE of it:
+# instance-exec --rootfs and the rootfs probe install a seccomp filter that
+# answers every other netlink protocol EAFNOSUPPORT (probe netlink-others).
+# Route is read-only here: changing links, addresses or routes takes
+# CAP_NET_ADMIN, and the capability set is empty (probe netlink-readonly).
+# It does let a tenant read and watch the box's links, addresses, routes,
+# neighbours and tc, so the box must never name a network object (an
+# interface, an altname, a tc handle) after a tenant.
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
# Abstract unix sockets live in the network namespace, which instances
# share with the box because they need outbound TCP, and the line above
# cannot tell them from path sockets (#178). The trampoline scopes them
diff --git a/internal/host/units/carlos-instance-rootfs-tty@.service b/internal/host/units/carlos-instance-rootfs-tty@.service
index ca360a163..202f435a2 100644
--- a/internal/host/units/carlos-instance-rootfs-tty@.service
+++ b/internal/host/units/carlos-instance-rootfs-tty@.service
@@ -26,7 +26,10 @@ RemainAfterExit=yes
TimeoutStartSec=6h5m
# --rootfs before the role, in ExecStart= and ExecStopPost= alike, as in
# carlos-instance-rootfs@.service.
-ExecStart=/opt/carlos/carlos instance-exec --rootfs tty %I
+# --netlink-scope: the trampoline scopes netlink to NETLINK_ROUTE before the
+# tenant starts (#1419). A carlos from before #1419 does not know the flag
+# and exits at once, so this unit's AF_NETLINK never reaches an unscoped tenant.
+ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope tty %I
# The advisory exit record, as for the other templates. Not "+" (codex R3-2).
ExecStopPost=/opt/carlos/carlos instance-exit --rootfs tty %I
User=carlos
@@ -191,8 +194,15 @@ PrivatePIDs=yes
RestrictNamespaces=yes
NoNewPrivileges=yes
CapabilityBoundingSet=
-# Kept, unchanged; a unit-file pin.
-RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+# AF_NETLINK is here for getifaddrs (#1419), and only NETLINK_ROUTE of it:
+# instance-exec --rootfs and the rootfs probe install a seccomp filter that
+# answers every other netlink protocol EAFNOSUPPORT (probe netlink-others).
+# Route is read-only here: changing links, addresses or routes takes
+# CAP_NET_ADMIN, and the capability set is empty (probe netlink-readonly).
+# It does let a tenant read and watch the box's links, addresses, routes,
+# neighbours and tc, so the box must never name a network object (an
+# interface, an altname, a tc handle) after a tenant.
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
# Abstract unix sockets live in the network namespace, which instances
# share with the box because they need outbound TCP, and the line above
# cannot tell them from path sockets (#178). The trampoline scopes them
diff --git a/internal/host/units/carlos-instance-rootfs-worker@.service b/internal/host/units/carlos-instance-rootfs-worker@.service
index a003845bb..bb06682e4 100644
--- a/internal/host/units/carlos-instance-rootfs-worker@.service
+++ b/internal/host/units/carlos-instance-rootfs-worker@.service
@@ -28,7 +28,10 @@ Type=simple
# --rootfs before the role, in ExecStart= and ExecStopPost= alike: worker
# is a role the trampoline and instance-exit take only with it (there is
# no binary worker unit).
-ExecStart=/opt/carlos/carlos instance-exec --rootfs worker %I
+# --netlink-scope: the trampoline scopes netlink to NETLINK_ROUTE before the
+# tenant starts (#1419). A carlos from before #1419 does not know the flag
+# and exits at once, so this unit's AF_NETLINK never reaches an unscoped tenant.
+ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope worker %I
# The worker runs in the instance's own data directory, the one the
# instance's database is in (#256 D). %I here is <id>:<worker>, not the
# host's id, so the real directory comes from the worker's runtime
@@ -179,8 +182,15 @@ PrivatePIDs=yes
RestrictNamespaces=yes
NoNewPrivileges=yes
CapabilityBoundingSet=
-# Kept, unchanged; a unit-file pin.
-RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+# AF_NETLINK is here for getifaddrs (#1419), and only NETLINK_ROUTE of it:
+# instance-exec --rootfs and the rootfs probe install a seccomp filter that
+# answers every other netlink protocol EAFNOSUPPORT (probe netlink-others).
+# Route is read-only here: changing links, addresses or routes takes
+# CAP_NET_ADMIN, and the capability set is empty (probe netlink-readonly).
+# It does let a tenant read and watch the box's links, addresses, routes,
+# neighbours and tc, so the box must never name a network object (an
+# interface, an altname, a tc handle) after a tenant.
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
# Abstract unix sockets live in the network namespace, which instances
# share with the box because they need outbound TCP, and the line above
# cannot tell them from path sockets (#178). The trampoline scopes them
diff --git a/internal/host/units/carlos-instance-rootfs@.service b/internal/host/units/carlos-instance-rootfs@.service
index a5c768d3f..19605856d 100644
--- a/internal/host/units/carlos-instance-rootfs@.service
+++ b/internal/host/units/carlos-instance-rootfs@.service
@@ -25,7 +25,10 @@ Type=simple
# trampoline takes the rootfs launch shape (root's launch file names the
# command, the tenant's names only the environment; rootfs apps design
# §5.2), and instance-exit takes the rootfs roles only with it.
-ExecStart=/opt/carlos/carlos instance-exec --rootfs run %I
+# --netlink-scope: the trampoline scopes netlink to NETLINK_ROUTE before the
+# tenant starts (#1419). A carlos from before #1419 does not know the flag
+# and exits at once, so this unit's AF_NETLINK never reaches an unscoped tenant.
+ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope run %I
# Runs inside the same namespace, as carlos, after this invocation's
# processes have been signalled: leaves an ADVISORY exit record in the
# instance's own run directory (isolated-exec design §6.5). Not "+": the
@@ -209,8 +212,15 @@ PrivatePIDs=yes
RestrictNamespaces=yes
NoNewPrivileges=yes
CapabilityBoundingSet=
-# Kept, unchanged; a unit-file pin.
-RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+# AF_NETLINK is here for getifaddrs (#1419), and only NETLINK_ROUTE of it:
+# instance-exec --rootfs and the rootfs probe install a seccomp filter that
+# answers every other netlink protocol EAFNOSUPPORT (probe netlink-others).
+# Route is read-only here: changing links, addresses or routes takes
+# CAP_NET_ADMIN, and the capability set is empty (probe netlink-readonly).
+# It does let a tenant read and watch the box's links, addresses, routes,
+# neighbours and tc, so the box must never name a network object (an
+# interface, an altname, a tc handle) after a tenant.
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
# Abstract unix sockets live in the network namespace, which instances
# share with the box because they need outbound TCP, and the line above
# cannot tell them from path sockets (#178). The trampoline scopes them
diff --git a/internal/host/units_rootfs_test.go b/internal/host/units_rootfs_test.go
index ddf87f49e..f7275a989 100644
--- a/internal/host/units_rootfs_test.go
+++ b/internal/host/units_rootfs_test.go
@@ -72,12 +72,14 @@ func TestRootfsNamespaceRestatesTheBinaryBlock(t *testing.T) {
"PrivateTmp=yes": "replaced by a tmpfs on /tmp (probe tmp-private)",
"ProtectControlGroups=yes": "replaced by strict (probe cgroup-strict)",
"BindReadOnlyPaths=-/run/systemd/resolve/resolv.conf:/etc/resolv.conf": "replaced by root's per-instance copy outside the block (probe dns)",
+ "RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX": "AF_NETLINK added for getifaddrs (#1419); instance-exec --rootfs and the rootfs probe narrow it to NETLINK_ROUTE with seccomp (probe netlink-scope, netlink-route, netlink-others)",
}
added := map[string]bool{
- "RootImageOptions=ro,nosuid,nodev": true,
- "MountAPIVFS=yes": true,
- "TemporaryFileSystem=/tmp:mode=1777,nosuid,nodev": true,
- "ProtectControlGroups=strict": true,
+ "RootImageOptions=ro,nosuid,nodev": true,
+ "MountAPIVFS=yes": true,
+ "TemporaryFileSystem=/tmp:mode=1777,nosuid,nodev": true,
+ "ProtectControlGroups=strict": true,
+ "RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK": true,
}
for d := range bin {
if rfs[d] {
@@ -221,18 +223,18 @@ func TestRootfsTemplatesPerUnitLines(t *testing.T) {
"After=carlos-edge.service data-instances.mount run-carlos-instances.mount run-carlos-logs.mount",
"KillMode=mixed", "TimeoutStopSec=20", "TasksMax=256", "OOMScoreAdjust=500", "OOMPolicy=kill", "User=carlos", "Group=carlos"}
for name, wants := range map[string][]string{
- "carlos-instance-rootfs@.service": append([]string{"Type=simple", "ExecStart=/opt/carlos/carlos instance-exec --rootfs run %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs run %I",
+ "carlos-instance-rootfs@.service": append([]string{"Type=simple", "ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope run %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs run %I",
"RootImage=/run/carlos-control/exe/%I/rootfs/run/image",
"BindReadOnlyPaths=/run/carlos-control/exe/%I/rootfs/run/launch.json:/opt/carlos/launch.json /run/carlos-control/exe/%I/rootfs/run/resolv.conf:/etc/resolv.conf",
"BindPaths=/data/instances/%I /run/carlos/instances/%I", "ReadWritePaths=/data/instances/%I /run/carlos/instances/%I", "WorkingDirectory=/data/instances/%I", "StandardOutput=file:/run/carlos/logs/%I.run.sock",
"Slice=carlos-instances-%i.slice", "Restart=no", "SuccessExitStatus=129 130 141 143"}, common...),
- "carlos-instance-rootfs-gen@.service": append([]string{"Type=simple", "ExecStart=/opt/carlos/carlos instance-exec --rootfs run %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs run %I", "WorkingDirectory=/data/instances", "SuccessExitStatus=129 130 141 143", "Restart=no"}, common...),
- "carlos-instance-rootfs-worker@.service": append([]string{"Type=simple", "ExecStart=/opt/carlos/carlos instance-exec --rootfs worker %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs worker %I", "WorkingDirectory=/data/instances", "SuccessExitStatus=129 130 141 143", "Restart=no"}, common...),
+ "carlos-instance-rootfs-gen@.service": append([]string{"Type=simple", "ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope run %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs run %I", "WorkingDirectory=/data/instances", "SuccessExitStatus=129 130 141 143", "Restart=no"}, common...),
+ "carlos-instance-rootfs-worker@.service": append([]string{"Type=simple", "ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope worker %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs worker %I", "WorkingDirectory=/data/instances", "SuccessExitStatus=129 130 141 143", "Restart=no"}, common...),
// The command has exactly the instance's reach (C5): the same
// slice, whose parent carlos-instances.slice carries the only
// box-address fence (#367), the same two directories and the
// cmd pair of root's files.
- "carlos-instance-rootfs-cmd@.service": append([]string{"Type=oneshot", "RemainAfterExit=yes", "TimeoutStartSec=6h5m", "ExecStart=/opt/carlos/carlos instance-exec --rootfs cmd %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs cmd %I",
+ "carlos-instance-rootfs-cmd@.service": append([]string{"Type=oneshot", "RemainAfterExit=yes", "TimeoutStartSec=6h5m", "ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope cmd %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs cmd %I",
"RootImage=/run/carlos-control/exe/%I/rootfs/cmd/image",
"BindReadOnlyPaths=/run/carlos-control/exe/%I/rootfs/cmd/launch.json:/opt/carlos/launch.json /run/carlos-control/exe/%I/rootfs/cmd/resolv.conf:/etc/resolv.conf",
"BindPaths=/data/instances/%I /run/carlos/instances/%I", "ReadWritePaths=/data/instances/%I /run/carlos/instances/%I", "Slice=carlos-instances-%i.slice",
@@ -240,7 +242,7 @@ func TestRootfsTemplatesPerUnitLines(t *testing.T) {
// One interactive session (rootfs Plan 6): the rootfs cmd unit's
// reach, stdin from the agent's socket, and the tty set of root's
// files.
- "carlos-instance-rootfs-tty@.service": append([]string{"Type=oneshot", "RemainAfterExit=yes", "TimeoutStartSec=6h5m", "ExecStart=/opt/carlos/carlos instance-exec --rootfs tty %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs tty %I",
+ "carlos-instance-rootfs-tty@.service": append([]string{"Type=oneshot", "RemainAfterExit=yes", "TimeoutStartSec=6h5m", "ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope tty %I", "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs tty %I",
"RootImage=/run/carlos-control/exe/%I/rootfs/tty/image",
"BindReadOnlyPaths=/run/carlos-control/exe/%I/rootfs/tty/launch.json:/opt/carlos/launch.json /run/carlos-control/exe/%I/rootfs/tty/resolv.conf:/etc/resolv.conf",
"BindPaths=/data/instances/%I /run/carlos/instances/%I", "ReadWritePaths=/data/instances/%I /run/carlos/instances/%I", "Slice=carlos-instances-%i.slice",
@@ -300,11 +302,11 @@ func TestRootfsCmdTemplateEqualsRootfsOutsideTheNamedLines(t *testing.T) {
swap := map[string]string{
"Description=carlos rootfs instance %I": "Description=carlos rootfs instance %I (cmd)",
"Type=simple": "Type=oneshot",
- "ExecStart=/opt/carlos/carlos instance-exec --rootfs run %I": "ExecStart=/opt/carlos/carlos instance-exec --rootfs cmd %I",
- "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs run %I": "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs cmd %I",
- "StandardOutput=file:/run/carlos/logs/%I.run.sock": "StandardOutput=file:/run/carlos/logs/%I.cmd.sock",
- "StandardError=inherit": "StandardError=file:/run/carlos/logs/%I.cmd-err.sock",
- "RootImage=/run/carlos-control/exe/%I/rootfs/run/image": "RootImage=/run/carlos-control/exe/%I/rootfs/cmd/image",
+ "ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope run %I": "ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope cmd %I",
+ "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs run %I": "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs cmd %I",
+ "StandardOutput=file:/run/carlos/logs/%I.run.sock": "StandardOutput=file:/run/carlos/logs/%I.cmd.sock",
+ "StandardError=inherit": "StandardError=file:/run/carlos/logs/%I.cmd-err.sock",
+ "RootImage=/run/carlos-control/exe/%I/rootfs/run/image": "RootImage=/run/carlos-control/exe/%I/rootfs/cmd/image",
"BindReadOnlyPaths=/run/carlos-control/exe/%I/rootfs/run/launch.json:/opt/carlos/launch.json /run/carlos-control/exe/%I/rootfs/run/resolv.conf:/etc/resolv.conf": "BindReadOnlyPaths=/run/carlos-control/exe/%I/rootfs/cmd/launch.json:/opt/carlos/launch.json /run/carlos-control/exe/%I/rootfs/cmd/resolv.conf:/etc/resolv.conf",
}
onlyRun := map[string]bool{"Restart=no": true, "SuccessExitStatus=129 130 141 143": true}
@@ -368,12 +370,12 @@ func TestRootfsCmdTemplateEqualsRootfsOutsideTheNamedLines(t *testing.T) {
func TestRootfsTTYTemplateEqualsRootfsCmdOutsideTheNamedLines(t *testing.T) {
t.Parallel()
equalOutsideTheNamedLines(t, "carlos-instance-rootfs-cmd@.service", "carlos-instance-rootfs-tty@.service", map[string][]string{
- "Description=carlos rootfs instance %I (cmd)": {"Description=carlos rootfs instance %I (tty)"},
- "ExecStart=/opt/carlos/carlos instance-exec --rootfs cmd %I": {"ExecStart=/opt/carlos/carlos instance-exec --rootfs tty %I"},
- "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs cmd %I": {"ExecStopPost=/opt/carlos/carlos instance-exit --rootfs tty %I"},
- "StandardOutput=file:/run/carlos/logs/%I.cmd.sock": {"StandardInput=file:/run/carlos/logs/%I.tty.sock", "StandardOutput=journal"},
- "StandardError=file:/run/carlos/logs/%I.cmd-err.sock": {"StandardError=journal"},
- "RootImage=/run/carlos-control/exe/%I/rootfs/cmd/image": {"RootImage=/run/carlos-control/exe/%I/rootfs/tty/image"},
+ "Description=carlos rootfs instance %I (cmd)": {"Description=carlos rootfs instance %I (tty)"},
+ "ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope cmd %I": {"ExecStart=/opt/carlos/carlos instance-exec --rootfs --netlink-scope tty %I"},
+ "ExecStopPost=/opt/carlos/carlos instance-exit --rootfs cmd %I": {"ExecStopPost=/opt/carlos/carlos instance-exit --rootfs tty %I"},
+ "StandardOutput=file:/run/carlos/logs/%I.cmd.sock": {"StandardInput=file:/run/carlos/logs/%I.tty.sock", "StandardOutput=journal"},
+ "StandardError=file:/run/carlos/logs/%I.cmd-err.sock": {"StandardError=journal"},
+ "RootImage=/run/carlos-control/exe/%I/rootfs/cmd/image": {"RootImage=/run/carlos-control/exe/%I/rootfs/tty/image"},
"BindReadOnlyPaths=/run/carlos-control/exe/%I/rootfs/cmd/launch.json:/opt/carlos/launch.json /run/carlos-control/exe/%I/rootfs/cmd/resolv.conf:/etc/resolv.conf": {"BindReadOnlyPaths=/run/carlos-control/exe/%I/rootfs/tty/launch.json:/opt/carlos/launch.json /run/carlos-control/exe/%I/rootfs/tty/resolv.conf:/etc/resolv.conf"},
})
for _, d := range directives(readUnit(t, "carlos-instance-rootfs-tty@.service")) {
diff --git a/internal/instanceexec/exec.go b/internal/instanceexec/exec.go
index d08388a9a..6bbb5eeaa 100644
--- a/internal/instanceexec/exec.go
+++ b/internal/instanceexec/exec.go
@@ -50,7 +50,9 @@ func RunExec(args []string) {
log.Fatal(err)
}
if c.rootfs {
- err = execRootfsLaunch(dataDir(), instancectl.RootfsLaunchPath, c.role, c.inst, c.launcher())
+ err = rootfsStart(ScopeNetlinkRoute, func() error {
+ return execRootfsLaunch(dataDir(), instancectl.RootfsLaunchPath, c.role, c.inst, c.launcher())
+ })
} else {
err = execLaunch(dataDir(), c.role, c.inst, c.launcher())
}
@@ -59,6 +61,17 @@ func RunExec(args []string) {
}
}
+// rootfsStart runs scope, then launch: a rootfs tenant starts only with
+// netlink narrowed to NETLINK_ROUTE (#1419), and a scope that cannot be
+// installed refuses the start rather than run the tenant with every
+// netlink protocol the unit's AF_NETLINK would allow.
+func rootfsStart(scope, launch func() error) error {
+ if err := scope(); err != nil {
+ return refused("netlink scope: %v", err)
+ }
+ return launch()
+}
+
// errUsage is a command line of the wrong shape; the usage is printed.
var errUsage = errors.New("usage")
@@ -98,6 +111,11 @@ func parseExecArgs(args []string) (execCommand, error) {
fs.Usage = cliflag.Usage(fs, "usage: carlos instance-exec [--rootfs] <run|seed|sidecar|cmd|worker|tty> <instance-id>")
claim := fs.String("claim-reservation", "", "root launch reservation")
rootfs := fs.Bool("rootfs", false, "rootfs launch: root's launch file names the command")
+ // Every rootfs launch is scoped whether or not the flag is given; the
+ // rootfs units pass it so that a carlos from before #1419, which does
+ // not know it, refuses to start instead of running a tenant unscoped
+ // under the units' AF_NETLINK.
+ netlinkScope := fs.Bool("netlink-scope", false, "rootfs launch: scope netlink to NETLINK_ROUTE (always on with --rootfs)")
sandbox := fs.String("sandbox", "", "guest sandbox mode")
_ = fs.Parse(args)
if fs.NArg() != 2 {
@@ -110,6 +128,8 @@ func parseExecArgs(args []string) (execCommand, error) {
return execCommand{}, fmt.Errorf("instance-exec: role %q is not run, seed, sidecar or cmd", fs.Arg(0))
case role == instancectl.RoleWorker && !*rootfs:
return execCommand{}, fmt.Errorf("instance-exec: role %q is not run, seed, sidecar or cmd (worker needs --rootfs)", fs.Arg(0))
+ case *netlinkScope && !*rootfs:
+ return execCommand{}, errors.New("instance-exec: --netlink-scope needs --rootfs")
}
c := execCommand{role: role, inst: fs.Arg(1), rootfs: *rootfs, claim: *claim}
var err error
diff --git a/internal/instanceexec/exec_rootfs_scope_test.go b/internal/instanceexec/exec_rootfs_scope_test.go
new file mode 100644
index 000000000..93da67ed0
--- /dev/null
+++ b/internal/instanceexec/exec_rootfs_scope_test.go
@@ -0,0 +1,111 @@
+package instanceexec
+
+import (
+ "errors"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+// #1419: a rootfs start narrows netlink before anything of the tenant's
+// runs, and a scope that cannot be installed refuses the start.
+func TestRootfsStartScopesNetlinkFirst(t *testing.T) {
+ var order []string
+ err := rootfsStart(func() error { order = append(order, "scope"); return nil }, func() error { order = append(order, "launch"); return nil })
+ if err != nil || len(order) != 2 || order[0] != "scope" || order[1] != "launch" {
+ t.Fatalf("order %v, err %v", order, err)
+ }
+
+ launched := false
+ err = rootfsStart(func() error { return errors.New("seccomp: EINVAL") }, func() error { launched = true; return nil })
+ if launched {
+ t.Error("the tenant launched without its netlink scope")
+ }
+ if !errors.Is(err, errRootfsLaunchRefused) {
+ t.Errorf("err = %v, want a rootfs launch refusal", err)
+ }
+}
+
+// The rootfs units pass --netlink-scope (#1419 review, Fable P2-1): this
+// carlos takes it with --rootfs only.
+func TestNetlinkScopeFlag(t *testing.T) {
+ if c, err := parseExecArgs([]string{"--rootfs", "--netlink-scope", "run", "shop.example.com:1"}); err != nil || !c.rootfs {
+ t.Errorf("--rootfs --netlink-scope: %+v, %v", c, err)
+ }
+ if _, err := parseExecArgs([]string{"--netlink-scope", "run", "shop.example.com:1"}); err == nil {
+ t.Error("--netlink-scope was taken without --rootfs")
+ }
+}
+
+// Fable P2-1/P2-2: every rootfs launch goes through rootfsStart with
+// ScopeNetlinkRoute as its scope. execRootfsLaunch is called only inside
+// a function literal passed to rootfsStart(ScopeNetlinkRoute, ...), so a
+// refactor that launches a rootfs tenant without the scope fails here.
+func TestEveryRootfsLaunchIsScoped(t *testing.T) {
+ files, err := filepath.Glob("*.go")
+ if err != nil {
+ t.Fatal(err)
+ }
+ calls := 0
+ for _, file := range files {
+ if strings.HasSuffix(file, "_test.go") {
+ continue
+ }
+ f, err := parser.ParseFile(token.NewFileSet(), file, nil, parser.SkipObjectResolution)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var stack []ast.Node
+ ast.Inspect(f, func(n ast.Node) bool {
+ if n == nil {
+ stack = stack[:len(stack)-1]
+ return true
+ }
+ stack = append(stack, n)
+ // Every use of the name, not only direct calls: a value
+ // (launch := execRootfsLaunch) would escape a call-only guard
+ // (Fable R2 P3-b). The declaration's own name is not a use.
+ id, ok := n.(*ast.Ident)
+ if !ok || id.Name != "execRootfsLaunch" {
+ return true
+ }
+ if fd, ok := stack[len(stack)-2].(*ast.FuncDecl); ok && fd.Name == id {
+ return true
+ }
+ calls++
+ call, isCall := stack[len(stack)-2].(*ast.CallExpr)
+ if !isCall || call.Fun != ast.Expr(id) || !insideScopedStart(stack) {
+ t.Errorf("%s uses execRootfsLaunch other than as a call inside rootfsStart(ScopeNetlinkRoute, func ...)", file)
+ }
+ return true
+ })
+ }
+ if calls == 0 {
+ t.Error("found no call of execRootfsLaunch; the guard is looking in the wrong place")
+ }
+}
+
+// insideScopedStart reports whether the innermost function literal on
+// stack is an argument of rootfsStart(ScopeNetlinkRoute, ...).
+func insideScopedStart(stack []ast.Node) bool {
+ for i := len(stack) - 1; i > 0; i-- {
+ lit, ok := stack[i].(*ast.FuncLit)
+ if !ok {
+ continue
+ }
+ call, ok := stack[i-1].(*ast.CallExpr)
+ if !ok {
+ return false
+ }
+ fn, ok := call.Fun.(*ast.Ident)
+ if !ok || fn.Name != "rootfsStart" || len(call.Args) != 2 || call.Args[1] != ast.Expr(lit) {
+ return false
+ }
+ scope, ok := call.Args[0].(*ast.Ident)
+ return ok && scope.Name == "ScopeNetlinkRoute"
+ }
+ return false
+}
diff --git a/internal/instanceexec/families_test.go b/internal/instanceexec/families_test.go
index 08b322026..98a2587c9 100644
--- a/internal/instanceexec/families_test.go
+++ b/internal/instanceexec/families_test.go
@@ -39,6 +39,12 @@ func TestInstanceCodeOpensOnlyTheUnitsAddressFamilies(t *testing.T) {
"golang.org/x/sys/unix": {},
}
allowedAF := map[string]bool{"AF_INET": true, "AF_INET6": true, "AF_UNIX": true, "AF_UNSPEC": true}
+ // The one exception (#1419): the rootfs units also allow AF_NETLINK,
+ // narrowed to NETLINK_ROUTE by the seccomp scope this file installs,
+ // and only the rootfs paths (instance-exec --rootfs after the scope,
+ // the rootfs probe) call into it. TestOnlyRootfsPathsReachNetlink
+ // holds that.
+ netlinkFile := map[string]bool{"AF_NETLINK": true, "NetlinkRIB": true}
var found []string
seen := map[string]bool{}
@@ -90,6 +96,9 @@ func TestInstanceCodeOpensOnlyTheUnitsAddressFamilies(t *testing.T) {
return true
}
af := strings.HasPrefix(sel.Sel.Name, "AF_") && !allowedAF[sel.Sel.Name]
+ if filepath.Base(file) == "netlink_route_linux.go" && netlinkFile[sel.Sel.Name] {
+ return true
+ }
if names[sel.Sel.Name] || af {
found = append(found, strings.TrimPrefix(file, root+string(filepath.Separator))+": "+p+"."+sel.Sel.Name)
}
@@ -105,3 +114,29 @@ func TestInstanceCodeOpensOnlyTheUnitsAddressFamilies(t *testing.T) {
t.Errorf("the walk never reached instancectl: %v", seen)
}
}
+
+// The netlink exception above is safe only while the two functions that
+// open netlink sockets are wired into the rootfs probe and nowhere else: a
+// binary unit still refuses AF_NETLINK, and its probe would fail (#1419).
+func TestOnlyRootfsPathsReachNetlink(t *testing.T) {
+ files, err := filepath.Glob("*.go")
+ if err != nil {
+ t.Fatal(err)
+ }
+ allowed := map[string]bool{"netlink_route_linux.go": true, "netlink_route_other.go": true, "probe_rootfs_linux.go": true}
+ for _, file := range files {
+ if strings.HasSuffix(file, "_test.go") || allowed[file] {
+ continue
+ }
+ f, err := parser.ParseFile(token.NewFileSet(), file, nil, parser.SkipObjectResolution)
+ if err != nil {
+ t.Fatal(err)
+ }
+ ast.Inspect(f, func(n ast.Node) bool {
+ if id, ok := n.(*ast.Ident); ok && (id.Name == "netlinkAddrDump" || id.Name == "netlinkSocketOpen" || id.Name == "netlinkDeleteRefused") {
+ t.Errorf("%s names %s; only the rootfs probe's wiring may", file, id.Name)
+ }
+ return true
+ })
+ }
+}
diff --git a/internal/instanceexec/netlink_route_linux.go b/internal/instanceexec/netlink_route_linux.go
new file mode 100644
index 000000000..f1468be93
--- /dev/null
+++ b/internal/instanceexec/netlink_route_linux.go
@@ -0,0 +1,169 @@
+//go:build linux
+
+package instanceexec
+
+import (
+ "errors"
+ "fmt"
+ "runtime"
+ "syscall"
+ "unsafe"
+
+ "golang.org/x/sys/unix"
+)
+
+// ScopeNetlinkRoute narrows AF_NETLINK, which the rootfs units allow for
+// getifaddrs (#1419), to NETLINK_ROUTE: socket(AF_NETLINK, any type, any
+// other protocol) answers EAFNOSUPPORT, what a unit without AF_NETLINK
+// answers. systemd's RestrictAddressFamilies= cannot name a protocol, and
+// the others are leaks or attack surface even without capabilities
+// (SOCK_DIAG lists every socket in the box's network namespace,
+// KOBJECT_UEVENT streams device events, GENERIC reaches many kernel
+// families). The filter is installed on every thread (TSYNC) and kept
+// across fork and exec, so the tenant and everything it starts carry it.
+// It adds to the unit's filters and loosens nothing.
+func ScopeNetlinkRoute() error {
+ var arch uint32
+ switch runtime.GOARCH {
+ case "amd64":
+ arch = unix.AUDIT_ARCH_X86_64
+ case "arm64":
+ arch = unix.AUDIT_ARCH_AARCH64
+ default:
+ return errors.New("netlink scope: no seccomp architecture for " + runtime.GOARCH)
+ }
+ filter := netlinkRouteFilter(arch, unix.SYS_SOCKET, unix.SYS_SOCKETPAIR)
+ if err := unix.Prctl(unix.PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); err != nil {
+ return err
+ }
+ program := unix.SockFprog{Len: uint16(len(filter)), Filter: &filter[0]}
+ unsynced, _, errno := unix.Syscall(unix.SYS_SECCOMP, unix.SECCOMP_SET_MODE_FILTER, unix.SECCOMP_FILTER_FLAG_TSYNC, uintptr(unsafe.Pointer(&program)))
+ runtime.KeepAlive(filter)
+ if errno != 0 {
+ return errno
+ }
+ if unsynced != 0 {
+ return errors.New("netlink scope: a thread could not take the filter")
+ }
+ return nil
+}
+
+// netlinkRouteFilter is ScopeNetlinkRoute's program for arch, whose
+// socket(2) and socketpair(2) numbers are sysSocket and sysSocketpair.
+// socketpair(AF_NETLINK, ...) is refused whatever the protocol: netlink
+// never supports it, but the kernel creates (and for an unknown protocol
+// tries to load) both protocol sockets before it says so.
+// Arguments are read as their low 32 bits (offsets 16 and 32 on these
+// little-endian architectures), as the kernel reads the int family and
+// protocol.
+func netlinkRouteFilter(arch, sysSocket, sysSocketpair uint32) []unix.SockFilter {
+ ret := func(k uint32) unix.SockFilter { return unix.SockFilter{Code: unix.BPF_RET | unix.BPF_K, K: k} }
+ allow := ret(unix.SECCOMP_RET_ALLOW)
+ return []unix.SockFilter{
+ /* 0 */ {Code: unix.BPF_LD | unix.BPF_W | unix.BPF_ABS, K: 4},
+ /* 1 */ {Code: unix.BPF_JMP | unix.BPF_JEQ | unix.BPF_K, Jt: 1, K: arch},
+ // A nonnative call is refused, never killed: the unit's
+ // SystemCallArchitectures=native refuses it already, and this
+ // filter must not turn that answer into a kill.
+ /* 2 */ ret(unix.SECCOMP_RET_ERRNO | uint32(unix.ENOSYS)),
+ /* 3 */ {Code: unix.BPF_LD | unix.BPF_W | unix.BPF_ABS, K: 0},
+ // x32 calls carry this bit under AUDIT_ARCH_X86_64; refuse them
+ // rather than let a second socket number past the check below.
+ /* 4 */ {Code: unix.BPF_JMP | unix.BPF_JSET | unix.BPF_K, Jf: 1, K: 0x40000000},
+ /* 5 */ ret(unix.SECCOMP_RET_ERRNO | uint32(unix.ENOSYS)),
+ /* 6 */ {Code: unix.BPF_JMP | unix.BPF_JEQ | unix.BPF_K, Jt: 3, K: sysSocket},
+ /* 7 */ {Code: unix.BPF_JMP | unix.BPF_JEQ | unix.BPF_K, Jf: 7, K: sysSocketpair},
+ // socketpair: any netlink pair is refused.
+ /* 8 */ {Code: unix.BPF_LD | unix.BPF_W | unix.BPF_ABS, K: 16},
+ /* 9 */ {Code: unix.BPF_JMP | unix.BPF_JEQ | unix.BPF_K, Jt: 4, Jf: 5, K: unix.AF_NETLINK},
+ // socket: a netlink socket only of NETLINK_ROUTE.
+ /* 10 */ {Code: unix.BPF_LD | unix.BPF_W | unix.BPF_ABS, K: 16},
+ /* 11 */ {Code: unix.BPF_JMP | unix.BPF_JEQ | unix.BPF_K, Jf: 3, K: unix.AF_NETLINK},
+ /* 12 */ {Code: unix.BPF_LD | unix.BPF_W | unix.BPF_ABS, K: 32},
+ /* 13 */ {Code: unix.BPF_JMP | unix.BPF_JEQ | unix.BPF_K, Jt: 1, K: unix.NETLINK_ROUTE},
+ /* 14 */ ret(unix.SECCOMP_RET_ERRNO | uint32(unix.EAFNOSUPPORT)),
+ /* 15 */ allow,
+ }
+}
+
+// netlinkAddrDump makes glibc getifaddrs's two requests over
+// NETLINK_ROUTE: an RTM_GETLINK dump, then an RTM_GETADDR dump (glibc
+// getifaddrs_internal). Only the rootfs probe calls it.
+func netlinkAddrDump() error {
+ if _, err := syscall.NetlinkRIB(syscall.RTM_GETLINK, syscall.AF_UNSPEC); err != nil {
+ return fmt.Errorf("RTM_GETLINK dump: %w", err)
+ }
+ if _, err := syscall.NetlinkRIB(syscall.RTM_GETADDR, syscall.AF_UNSPEC); err != nil {
+ return fmt.Errorf("RTM_GETADDR dump: %w", err)
+ }
+ return nil
+}
+
+// netlinkSocketOpen opens and closes one netlink socket of proto. Only
+// the rootfs probe calls it.
+func netlinkSocketOpen(proto int) error {
+ fd, err := unix.Socket(unix.AF_NETLINK, unix.SOCK_RAW|unix.SOCK_CLOEXEC, proto)
+ if err != nil {
+ return err
+ }
+ return unix.Close(fd)
+}
+
+// netlinkDeleteRefused asks the kernel to delete 127.0.0.2 from interface
+// index 0 and answers the kernel's error. No device ever has index 0 (the
+// kernel allocates positive indexes), so the request cannot change the
+// box even when the capability it tests for is present (Astra R2 P1):
+// rtnetlink checks CAP_NET_ADMIN first, so a process without it gets
+// EPERM, and one with it gets ENODEV from inet_rtm_deladdr's device
+// lookup. Only the rootfs probe calls it (netlink-readonly).
+// deleteTargetIndex is the interface netlinkDeleteRefused names: 0, which
+// no device has. TestNetlinkDeleteCannotChangeTheBox pins it.
+const deleteTargetIndex = 0
+
+func netlinkDeleteRefused() error {
+ fd, err := unix.Socket(unix.AF_NETLINK, unix.SOCK_RAW|unix.SOCK_CLOEXEC, unix.NETLINK_ROUTE)
+ if err != nil {
+ return err
+ }
+ defer unix.Close(fd)
+ if err := unix.SetsockoptTimeval(fd, unix.SOL_SOCKET, unix.SO_RCVTIMEO, &unix.Timeval{Sec: 2}); err != nil {
+ return err
+ }
+ // nlmsghdr (16) + ifaddrmsg (8) + IFA_LOCAL rtattr (4 + 4).
+ const total = unix.SizeofNlMsghdr + unix.SizeofIfAddrmsg + 8
+ msg := make([]byte, total)
+ nlh := (*unix.NlMsghdr)(unsafe.Pointer(&msg[0]))
+ nlh.Len = total
+ nlh.Type = unix.RTM_DELADDR
+ nlh.Flags = unix.NLM_F_REQUEST | unix.NLM_F_ACK
+ nlh.Seq = 1
+ ifa := (*unix.IfAddrmsg)(unsafe.Pointer(&msg[unix.SizeofNlMsghdr]))
+ ifa.Family = unix.AF_INET
+ ifa.Prefixlen = 32
+ ifa.Index = deleteTargetIndex
+ attr := msg[unix.SizeofNlMsghdr+unix.SizeofIfAddrmsg:]
+ *(*uint16)(unsafe.Pointer(&attr[0])) = 8
+ *(*uint16)(unsafe.Pointer(&attr[2])) = unix.IFA_LOCAL
+ copy(attr[4:], []byte{127, 0, 0, 2})
+ if err := unix.Sendto(fd, msg, 0, &unix.SockaddrNetlink{Family: unix.AF_NETLINK}); err != nil {
+ return err
+ }
+ buf := make([]byte, 4096)
+ n, _, err := unix.Recvfrom(fd, buf, 0)
+ if err != nil {
+ return err
+ }
+ msgs, err := syscall.ParseNetlinkMessage(buf[:n])
+ if err != nil {
+ return err
+ }
+ for _, m := range msgs {
+ if m.Header.Type == unix.NLMSG_ERROR && len(m.Data) >= 4 {
+ if code := *(*int32)(unsafe.Pointer(&m.Data[0])); code != 0 {
+ return syscall.Errno(-code)
+ }
+ return nil
+ }
+ }
+ return errors.New("netlink: no acknowledgement")
+}
diff --git a/internal/instanceexec/netlink_route_linux_test.go b/internal/instanceexec/netlink_route_linux_test.go
new file mode 100644
index 000000000..f1f24b409
--- /dev/null
+++ b/internal/instanceexec/netlink_route_linux_test.go
@@ -0,0 +1,314 @@
+//go:build linux
+
+package instanceexec
+
+import (
+ "fmt"
+ "os"
+ "os/exec"
+ "runtime"
+ "strings"
+ "syscall"
+ "testing"
+
+ "golang.org/x/sys/unix"
+)
+
+// netlinkHelperEnv makes the test binary a helper: it scopes itself with
+// ScopeNetlinkRoute (stage "scope") or only reports, inheriting the scope
+// across an exec (stage "inherited"), and prints one line per socket.
+const netlinkHelperEnv = "CARLOS_NETLINK_SCOPE_HELPER"
+
+// TestNetlinkScopeHelper is not a test: it is the process the two tests
+// below run (go test's re-exec pattern).
+func TestNetlinkScopeHelper(t *testing.T) {
+ stage := os.Getenv(netlinkHelperEnv)
+ if stage == "" {
+ t.Skip("helper process only")
+ }
+ if stage == "privileged-delete" {
+ // In a new user and network namespace this process holds
+ // CAP_NET_ADMIN over the namespace: the delete must reach the
+ // device lookup and fail there, leaving the addresses alone.
+ // The prerequisite is a working route dump; an environment that
+ // refuses it (a sandbox's own filter) says so and nothing else.
+ before, err := syscall.NetlinkRIB(syscall.RTM_GETADDR, syscall.AF_UNSPEC)
+ if err != nil {
+ fmt.Printf("unavailable=%s\n", strings.ReplaceAll(err.Error(), " ", "_"))
+ os.Exit(0)
+ }
+ derr := netlinkDeleteRefused()
+ after, err := syscall.NetlinkRIB(syscall.RTM_GETADDR, syscall.AF_UNSPEC)
+ if err != nil {
+ fmt.Printf("after-dump=%s\n", strings.ReplaceAll(err.Error(), " ", "_"))
+ os.Exit(4)
+ }
+ fmt.Printf("delete=%v same=%v\n", strings.ReplaceAll(fmt.Sprint(derr), " ", "_"), string(before) == string(after))
+ os.Exit(0)
+ }
+ // A second OS thread, started and parked before the scope, opens a
+ // sock_diag socket after it: TSYNC must have reached it.
+ ready, scoped, done := make(chan struct{}), make(chan struct{}), make(chan string)
+ go func() {
+ runtime.LockOSThread()
+ close(ready)
+ <-scoped
+ fd, err := unix.Socket(unix.AF_NETLINK, unix.SOCK_RAW|unix.SOCK_CLOEXEC, unix.NETLINK_SOCK_DIAG)
+ if err != nil {
+ done <- strings.ReplaceAll(err.(syscall.Errno).Error(), " ", "_")
+ return
+ }
+ unix.Close(fd)
+ done <- "open"
+ }()
+ <-ready
+ if stage == "scope" {
+ if err := ScopeNetlinkRoute(); err != nil {
+ fmt.Println("scope", err)
+ os.Exit(3)
+ }
+ }
+ close(scoped)
+ fmt.Println(netlinkSocketReport() + " thread=" + <-done)
+ if stage == "scope" {
+ // Exec this binary again: the filter must survive execve.
+ cmd := exec.Command(os.Args[0], "-test.run=^TestNetlinkScopeHelper$")
+ cmd.Env = append(os.Environ(), netlinkHelperEnv+"=inherited")
+ out, err := cmd.Output()
+ fmt.Print("inherited ", string(out))
+ if err != nil {
+ fmt.Println("inherited exec", err)
+ }
+ }
+ os.Exit(0)
+}
+
+// netlinkSocketReport opens one socket of each kind and names the result:
+// route, then every other netlink protocol, then inet and unix.
+func netlinkSocketReport() string {
+ var b strings.Builder
+ open := func(family, typ, proto int) string {
+ fd, err := unix.Socket(family, typ|unix.SOCK_CLOEXEC, proto)
+ if err != nil {
+ return strings.ReplaceAll(err.(syscall.Errno).Error(), " ", "_")
+ }
+ unix.Close(fd)
+ return "open"
+ }
+ fmt.Fprintf(&b, "route=%s", open(unix.AF_NETLINK, unix.SOCK_RAW, unix.NETLINK_ROUTE))
+ fmt.Fprintf(&b, " route-dgram=%s", open(unix.AF_NETLINK, unix.SOCK_DGRAM, unix.NETLINK_ROUTE))
+ for p := 1; p < 32; p++ {
+ fmt.Fprintf(&b, " p%d=%s", p, open(unix.AF_NETLINK, unix.SOCK_RAW, p))
+ }
+ // A protocol with high bits set is the kernel's int: still not route.
+ fmt.Fprintf(&b, " phigh=%s", open(unix.AF_NETLINK, unix.SOCK_RAW, 0x10004))
+ pair := func(proto int) string {
+ _, err := unix.Socketpair(unix.AF_NETLINK, unix.SOCK_RAW|unix.SOCK_CLOEXEC, proto)
+ if err != nil {
+ return strings.ReplaceAll(err.(syscall.Errno).Error(), " ", "_")
+ }
+ return "open"
+ }
+ fmt.Fprintf(&b, " pair0=%s pair4=%s", pair(0), pair(4))
+ del := "nil"
+ if err := netlinkDeleteRefused(); err != nil {
+ del = err.Error()
+ }
+ fmt.Fprintf(&b, " delete=%s", strings.ReplaceAll(del, " ", "_"))
+ fmt.Fprintf(&b, " inet=%s unix=%s", open(unix.AF_INET, unix.SOCK_DGRAM, 0), open(unix.AF_UNIX, unix.SOCK_STREAM, 0))
+ return b.String()
+}
+
+func runNetlinkHelper(t *testing.T, stage string) string {
+ t.Helper()
+ cmd := exec.Command(os.Args[0], "-test.run=^TestNetlinkScopeHelper$")
+ cmd.Env = append(os.Environ(), netlinkHelperEnv+"="+stage)
+ out, err := cmd.Output()
+ if err != nil {
+ t.Fatalf("helper %s: %v\n%s", stage, err, out)
+ }
+ return string(out)
+}
+
+// fields parses a helper line into name -> result.
+func netlinkFields(line string) map[string]string {
+ f := map[string]string{}
+ for _, kv := range strings.Fields(line) {
+ k, v, _ := strings.Cut(kv, "=")
+ f[k] = v
+ }
+ return f
+}
+
+// #1419: after ScopeNetlinkRoute a process opens NETLINK_ROUTE sockets
+// and no other netlink protocol (EAFNOSUPPORT, what a unit without
+// AF_NETLINK answers), socketpair is refused the same way, a change over
+// route is refused (EPERM, this test runs without CAP_NET_ADMIN), inet
+// and unix answer as they did before the scope, and an exec'd child keeps
+// all of it.
+func TestScopeNetlinkRouteNarrowsNetlinkToRoute(t *testing.T) {
+ // As root the delete check would reach the kernel's address lookup:
+ // only that expectation is skipped.
+ root := os.Geteuid() == 0
+ before := netlinkFields(strings.TrimSpace(runNetlinkHelper(t, "plain")))
+ if before["route"] != "open" {
+ t.Skipf("this environment refuses NETLINK_ROUTE already: %v", before)
+ }
+ out := runNetlinkHelper(t, "scope")
+ lines := strings.Split(strings.TrimSpace(out), "\n")
+ if len(lines) != 2 || !strings.HasPrefix(lines[1], "inherited ") {
+ t.Fatalf("helper output:\n%s", out)
+ }
+ eaf := strings.ReplaceAll(syscall.EAFNOSUPPORT.Error(), " ", "_")
+ for i, line := range []string{lines[0], strings.TrimPrefix(lines[1], "inherited ")} {
+ f := netlinkFields(line)
+ wants := map[string]string{
+ "route": "open", "route-dgram": "open", "phigh": eaf, "pair4": eaf, "pair0": eaf,
+ "thread": eaf,
+ "delete": strings.ReplaceAll(syscall.EPERM.Error(), " ", "_"),
+ "inet": before["inet"], "unix": before["unix"],
+ }
+ if root {
+ delete(wants, "delete")
+ }
+ for k, want := range wants {
+ if f[k] != want {
+ t.Errorf("line %d: %s=%s, want %s", i, k, f[k], want)
+ }
+ }
+ for p := 1; p < 32; p++ {
+ if k := fmt.Sprintf("p%d", p); f[k] != eaf {
+ t.Errorf("line %d: netlink protocol %d = %s, want %s", i, p, f[k], eaf)
+ }
+ }
+ }
+}
+
+// runFilter is classic BPF as seccomp runs it, for the four instruction
+// kinds netlinkRouteFilter uses, over a little-endian seccomp_data of nr,
+// arch and the full 64-bit args 0 and 2 (low words at 16 and 32, high
+// words at 20 and 36).
+func runFilter(t *testing.T, prog []unix.SockFilter, nr, arch uint32, arg0, arg2 uint64) uint32 {
+ t.Helper()
+ data := map[uint32]uint32{0: nr, 4: arch, 16: uint32(arg0), 20: uint32(arg0 >> 32), 32: uint32(arg2), 36: uint32(arg2 >> 32)}
+ var a uint32
+ for pc := 0; pc < len(prog); pc++ {
+ ins := prog[pc]
+ switch ins.Code {
+ case unix.BPF_LD | unix.BPF_W | unix.BPF_ABS:
+ v, ok := data[ins.K]
+ if !ok {
+ t.Fatalf("load of offset %d", ins.K)
+ }
+ a = v
+ case unix.BPF_JMP | unix.BPF_JEQ | unix.BPF_K:
+ if a == ins.K {
+ pc += int(ins.Jt)
+ } else {
+ pc += int(ins.Jf)
+ }
+ case unix.BPF_JMP | unix.BPF_JSET | unix.BPF_K:
+ if a&ins.K != 0 {
+ pc += int(ins.Jt)
+ } else {
+ pc += int(ins.Jf)
+ }
+ case unix.BPF_RET | unix.BPF_K:
+ return ins.K
+ default:
+ t.Fatalf("instruction %d: code %#x", pc, ins.Code)
+ }
+ }
+ t.Fatal("ran off the end")
+ return 0
+}
+
+// The program, run for both architectures' syscall numbers (amd64 socket
+// 41, socketpair 53; arm64 198, 199): only netlink sockets of another
+// protocol are refused, a nonnative or x32 call is ENOSYS, never a kill,
+// and every other call falls through to ALLOW (the unit's own filters
+// still apply).
+func TestNetlinkRouteFilterProgram(t *testing.T) {
+ refuse := unix.SECCOMP_RET_ERRNO | uint32(unix.EAFNOSUPPORT)
+ enosys := unix.SECCOMP_RET_ERRNO | uint32(unix.ENOSYS)
+ allow := uint32(unix.SECCOMP_RET_ALLOW)
+ for _, a := range []struct {
+ name string
+ arch, sock, pair, rd uint32
+ }{
+ {"amd64", unix.AUDIT_ARCH_X86_64, 41, 53, 0},
+ {"arm64", unix.AUDIT_ARCH_AARCH64, 198, 199, 63},
+ } {
+ prog := netlinkRouteFilter(a.arch, a.sock, a.pair)
+ for _, c := range []struct {
+ name string
+ nr, arch uint32
+ a0, a2 uint64
+ want uint32
+ }{
+ {"route socket", a.sock, a.arch, unix.AF_NETLINK, 0, allow},
+ {"sock_diag socket", a.sock, a.arch, unix.AF_NETLINK, 4, refuse},
+ {"uevent socket", a.sock, a.arch, unix.AF_NETLINK, 15, refuse},
+ {"high-bit protocol", a.sock, a.arch, unix.AF_NETLINK, 0x10004, refuse},
+ {"sock_diag socketpair", a.pair, a.arch, unix.AF_NETLINK, 4, refuse},
+ {"route socketpair", a.pair, a.arch, unix.AF_NETLINK, 0, refuse},
+ // The kernel reads int family and protocol, the low words.
+ {"high word on the family", a.sock, a.arch, 1<<32 | unix.AF_NETLINK, 4, refuse},
+ {"high word on sock_diag", a.sock, a.arch, unix.AF_NETLINK, 1<<32 | 4, refuse},
+ {"high word only (the kernel's route)", a.sock, a.arch, unix.AF_NETLINK, 1 << 32, allow},
+ {"high word on inet", a.sock, a.arch, 1<<32 | unix.AF_INET, 4, allow},
+ {"inet socket", a.sock, a.arch, unix.AF_INET, 4, allow},
+ {"unix socketpair", a.pair, a.arch, unix.AF_UNIX, 0, allow},
+ {"another call", a.rd, a.arch, unix.AF_NETLINK, 4, allow},
+ {"nonnative", a.sock, unix.AUDIT_ARCH_I386, unix.AF_NETLINK, 4, enosys},
+ {"x32", a.sock | 0x40000000, a.arch, unix.AF_NETLINK, 4, enosys},
+ } {
+ if got := runFilter(t, prog, c.nr, c.arch, c.a0, c.a2); got != c.want {
+ t.Errorf("%s %s: %#x, want %#x", a.name, c.name, got, c.want)
+ }
+ }
+ for _, s := range prog {
+ if s.Code == unix.BPF_RET|unix.BPF_K && s.K == unix.SECCOMP_RET_KILL_PROCESS {
+ t.Errorf("%s: the filter kills", a.name)
+ }
+ }
+ }
+}
+
+// Astra R2 P1: with CAP_NET_ADMIN (a new user and network namespace, so
+// nothing real is at stake) the read-only witness still changes nothing:
+// it names interface index 0, which no device has, so the kernel answers
+// ENODEV and the namespace's addresses are as they were. ENODEV is the
+// device lookup's answer, made before any address is looked at; naming
+// lo (index 1) instead would answer EADDRNOTAVAIL here, so the test also
+// catches a return to a real interface.
+func TestNetlinkDeleteCannotChangeTheBox(t *testing.T) {
+ if deleteTargetIndex != 0 {
+ t.Fatalf("netlinkDeleteRefused names interface %d; it must name 0, which no device has", deleteTargetIndex)
+ }
+ cmd := exec.Command(os.Args[0], "-test.run=^TestNetlinkScopeHelper$")
+ cmd.Env = append(os.Environ(), netlinkHelperEnv+"=privileged-delete")
+ cmd.SysProcAttr = &syscall.SysProcAttr{
+ Cloneflags: syscall.CLONE_NEWUSER | syscall.CLONE_NEWNET,
+ UidMappings: []syscall.SysProcIDMap{{ContainerID: 0, HostID: os.Getuid(), Size: 1}},
+ GidMappings: []syscall.SysProcIDMap{{ContainerID: 0, HostID: os.Getgid(), Size: 1}},
+ }
+ var stdout, stderr strings.Builder
+ cmd.Stdout, cmd.Stderr = &stdout, &stderr
+ // Only a namespace that cannot be made is a skip; a helper that
+ // started and then failed is a failure (Astra R3 P2).
+ if err := cmd.Start(); err != nil {
+ t.Skipf("no user and network namespace here: %v", err)
+ }
+ if err := cmd.Wait(); err != nil {
+ t.Fatalf("privileged helper: %v\nstdout: %s\nstderr: %s", err, stdout.String(), stderr.String())
+ }
+ got := strings.TrimSpace(stdout.String())
+ if strings.HasPrefix(got, "unavailable=") {
+ t.Skipf("this environment refuses a route dump inside the namespace: %s", got)
+ }
+ enodev := strings.ReplaceAll(syscall.ENODEV.Error(), " ", "_")
+ if got != "delete="+enodev+" same=true" {
+ t.Errorf("privileged delete: %q, want delete=%s same=true", got, enodev)
+ }
+}
diff --git a/internal/instanceexec/netlink_route_other.go b/internal/instanceexec/netlink_route_other.go
new file mode 100644
index 000000000..b17ce885b
--- /dev/null
+++ b/internal/instanceexec/netlink_route_other.go
@@ -0,0 +1,9 @@
+//go:build !linux
+
+package instanceexec
+
+import "errors"
+
+// ScopeNetlinkRoute is linux-only (netlink_route_linux.go): off Linux it
+// refuses, so a rootfs start fails closed.
+func ScopeNetlinkRoute() error { return errors.New("netlink scope: linux only") }
diff --git a/internal/instanceexec/probe_rootfs.go b/internal/instanceexec/probe_rootfs.go
index cc43cc1f6..e1e9f0196 100644
--- a/internal/instanceexec/probe_rootfs.go
+++ b/internal/instanceexec/probe_rootfs.go
@@ -33,6 +33,16 @@ type rootfsProbeEnv struct {
// mkfile creates path exclusively and removes it again: the write
// probe behind root-read-only and tmp-private.
mkfile func(path string) error
+ // The netlink scope a rootfs tenant runs under (#1419): scopeNetlink
+ // installs it on the probe itself, netlinkDump is getifaddrs's
+ // RTM_GETLINK and RTM_GETADDR dumps, netlinkOpen opens one netlink
+ // socket of a protocol.
+ scopeNetlink func() error
+ netlinkDump func() error
+ netlinkOpen func(proto int) error
+ // netlinkWrite asks rtnetlink for a change that cannot alter the box
+ // (deleting an address that does not exist); it must answer EPERM.
+ netlinkWrite func() error
}
// The mounts an image root may have (mountsAllowlisted). Every mount
@@ -73,6 +83,9 @@ const inaccessibleDirRoot = "/systemd/inaccessible/dir"
// cgroup-ro-mount, and root-image with mounts-allowlisted for var-empty.
func runRootfsChecks(e rootfsProbeEnv) instancectl.ProbeReport {
v := &verdicts{}
+ // First, so every line below runs under the scope a tenant gets.
+ scopeErr := e.scopeNetlink()
+ v.pass("netlink-scope", fmt.Sprint(scopeErr), scopeErr == nil)
entries, merr := readMountinfo(e.mountinfo)
// The root is the probe image: a read-only squashfs on a loop device,
@@ -118,9 +131,35 @@ func runRootfsChecks(e rootfsProbeEnv) instancectl.ProbeReport {
v.pass("pts-private", d, ok)
networkAndIPCChecks(e.probeEnv, v.add, v.pass)
+ netlinkChecks(e, v)
return v.report()
}
+// netlinkChecks are #1419's lines: getifaddrs's dump works over
+// NETLINK_ROUTE, a change over it is refused, and every other netlink protocol (1 to 31, the kernel's
+// MAX_LINKS) is refused with EAFNOSUPPORT, the scope's answer. A
+// protocol the kernel itself does not know would answer EPROTONOSUPPORT
+// without the scope, so only EAFNOSUPPORT proves it.
+func netlinkChecks(e rootfsProbeEnv, v *verdicts) {
+ err := e.netlinkDump()
+ v.pass("netlink-route", fmt.Sprint(err), err == nil)
+ var bad []string
+ for p := 1; p < 32; p++ {
+ switch err := e.netlinkOpen(p); {
+ case err == nil:
+ bad = append(bad, fmt.Sprintf("protocol %d: opened", p))
+ case !errors.Is(err, syscall.EAFNOSUPPORT):
+ bad = append(bad, fmt.Sprintf("protocol %d: %v", p, err))
+ }
+ }
+ v.pass("netlink-others", strings.Join(bad, "; "), len(bad) == 0)
+ // Route is read-only only while the process has no CAP_NET_ADMIN
+ // (#1419 review, Fable P3-3): a drop-in that handed it back would show
+ // here.
+ werr := e.netlinkWrite()
+ v.pass("netlink-readonly", fmt.Sprintf("RTM_DELADDR: %v, want %v", werr, syscall.EPERM), errors.Is(werr, syscall.EPERM))
+}
+
// mountEntry is one line of /proc/self/mountinfo: the mount point, the
// root of the mount within its file system, the file system type, the
// source, the per-mount options, and the device (field 3, MAJ:MIN), which
diff --git a/internal/instanceexec/probe_rootfs_linux.go b/internal/instanceexec/probe_rootfs_linux.go
index 1a9b02b69..0f58bc2f4 100644
--- a/internal/instanceexec/probe_rootfs_linux.go
+++ b/internal/instanceexec/probe_rootfs_linux.go
@@ -27,6 +27,10 @@ func productionRootfsProbeEnv() rootfsProbeEnv {
cgroupRoot: cgroupMountpoint,
ownerUID: lstatUID,
mkfile: createThenRemove,
+ scopeNetlink: ScopeNetlinkRoute,
+ netlinkDump: netlinkAddrDump,
+ netlinkOpen: netlinkSocketOpen,
+ netlinkWrite: netlinkDeleteRefused,
}
}
diff --git a/internal/instanceexec/probe_rootfs_other.go b/internal/instanceexec/probe_rootfs_other.go
index b9af0b665..06e6685d9 100644
--- a/internal/instanceexec/probe_rootfs_other.go
+++ b/internal/instanceexec/probe_rootfs_other.go
@@ -18,5 +18,9 @@ func productionRootfsProbeEnv() rootfsProbeEnv {
ownerUID: func(string) (uint32, error) { return 0, errors.ErrUnsupported },
mkfile: unsupported,
selfCgroupFile: "/proc/self/cgroup",
+ scopeNetlink: ScopeNetlinkRoute,
+ netlinkDump: func() error { return errors.ErrUnsupported },
+ netlinkOpen: func(int) error { return errors.ErrUnsupported },
+ netlinkWrite: func() error { return errors.ErrUnsupported },
}
}
diff --git a/internal/instanceexec/probe_rootfs_test.go b/internal/instanceexec/probe_rootfs_test.go
index 864b84c4b..7960b0ba9 100644
--- a/internal/instanceexec/probe_rootfs_test.go
+++ b/internal/instanceexec/probe_rootfs_test.go
@@ -5,6 +5,7 @@ package instanceexec
import (
"encoding/json"
"errors"
+ "fmt"
"os"
"os/exec"
"path/filepath"
@@ -111,6 +112,17 @@ func goodRootfsEnv(t *testing.T) rootfsProbeEnv {
selfCgroupFile: selfCgroup,
cgroupRoot: cg,
ownerUID: func(string) (uint32, error) { return 0, nil },
+ // Scoped to NETLINK_ROUTE (#1419): route opens and dumps, every
+ // other protocol is the filter's EAFNOSUPPORT.
+ scopeNetlink: func() error { return nil },
+ netlinkDump: func() error { return nil },
+ netlinkWrite: func() error { return syscall.EPERM },
+ netlinkOpen: func(proto int) error {
+ if proto == 0 {
+ return nil
+ }
+ return syscall.EAFNOSUPPORT
+ },
// The image is read-only everywhere but the unit's own /tmp.
mkfile: func(path string) error {
if filepath.Dir(path) != tmp {
@@ -194,7 +206,8 @@ func TestRootfsProbePassesInsideAnImageRoot(t *testing.T) {
t.Fatalf("not ready: %+v", r.Lines)
}
for _, c := range []string{"root-image", "mounts-allowlisted", "data-tree", "run-tree", "opt-own-image", "launch-root-owned", "root-read-only", "tmp-private", "etc-carlos", "control-unreachable", "pid1", "shm-private", "symlink-eloop", "nosymfollow", "imds-v4", "imds-tcp", "cgroup-strict", "pts-private", "dns", "loopback-v4", "private-v4", "box-addr", "mdwe", "syscall-filter",
- "imds-v6", "resolver-ports", "loopback-v6", "private-v6", "ipc-private", "abstract-unix", "cpu-limits", "io-weight"} {
+ "imds-v6", "resolver-ports", "loopback-v6", "private-v6", "ipc-private", "abstract-unix", "cpu-limits", "io-weight",
+ "netlink-scope", "netlink-route", "netlink-others", "netlink-readonly"} {
if v := verdict(r, c); v != "ok" {
t.Errorf("%s = %s: %s", c, v, detail(r, c))
}
@@ -695,3 +708,50 @@ func TestRootfsOwnCgroup(t *testing.T) {
t.Error("a missing file: no error")
}
}
+
+// #1419: the rootfs probe scopes itself the way instance-exec scopes a
+// tenant, then proves route works and every other netlink protocol is
+// refused by the scope (EAFNOSUPPORT), not merely unknown to the kernel.
+func TestRootfsProbeNetlinkLines(t *testing.T) {
+ cases := []struct {
+ name string
+ edit func(*rootfsProbeEnv)
+ check string
+ want string
+ }{
+ {"scope not installed", func(e *rootfsProbeEnv) { e.scopeNetlink = func() error { return errors.New("seccomp: EINVAL") } }, "netlink-scope", "seccomp: EINVAL"},
+ {"route dump fails", func(e *rootfsProbeEnv) {
+ e.netlinkDump = func() error { return fmt.Errorf("RTM_GETLINK dump: %w", syscall.EAFNOSUPPORT) }
+ }, "netlink-route", "RTM_GETLINK dump: address family not supported"},
+ {"sock_diag opens", func(e *rootfsProbeEnv) {
+ e.netlinkOpen = func(p int) error {
+ if p == 0 || p == unix.NETLINK_SOCK_DIAG {
+ return nil
+ }
+ return syscall.EAFNOSUPPORT
+ }
+ }, "netlink-others", "protocol 4: opened"},
+ {"refused by the kernel, not the scope", func(e *rootfsProbeEnv) {
+ e.netlinkOpen = func(p int) error {
+ if p == 0 {
+ return nil
+ }
+ if p == 30 {
+ return syscall.EPROTONOSUPPORT
+ }
+ return syscall.EAFNOSUPPORT
+ }
+ }, "netlink-others", "protocol 30: protocol not supported"},
+ {"a change is not refused", func(e *rootfsProbeEnv) { e.netlinkWrite = func() error { return syscall.EADDRNOTAVAIL } }, "netlink-readonly", "cannot assign requested address"},
+ }
+ for _, c := range cases {
+ t.Run(c.name, func(t *testing.T) {
+ e := goodRootfsEnv(t)
+ c.edit(&e)
+ r := runRootfsChecks(e)
+ if r.Ready || verdict(r, c.check) != "fail" || !strings.Contains(detail(r, c.check), c.want) {
+ t.Errorf("ready=%v %s=%s %q, want a fail naming %q", r.Ready, c.check, verdict(r, c.check), detail(r, c.check), c.want)
+ }
+ })
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 43c59caa8..8420ecc0d 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -294,3 +294,4 @@ plan14-root-reads-release-copy-across-consoles.tsv 892cf87db700600490e3ec9e944f9
plan14-root-reads-rootfs-etc-hosts-1349.tsv 892cf87db700600490e3ec9e944f9dbe7151e43bc5471090634f1735bcb9a7bd
plan14-root-reads-managed-fleets-2b2.tsv 4bb3547d064b71134612e74b3b8269e16356d2832a8e579ace150349e55c6a27
plan14-root-reads-store-write-credential.tsv 8b8e269938a575bfaeb8f0c9a5be508b4b22a10b7b5bd19d74fa511e5f15a302
+plan14-root-reads-rootfs-netlink-route-1419.tsv 0d02e63b6a67aab196e13324393148ab8faccbd4331af3eadb1ab52ff5b42bb1
diff --git a/internal/provision/testdata/plan14-root-reads-rootfs-netlink-route-1419.tsv b/internal/provision/testdata/plan14-root-reads-rootfs-netlink-route-1419.tsv
new file mode 100644
index 000000000..921ba57c4
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-rootfs-netlink-route-1419.tsv
@@ -0,0 +1,19 @@
+# Census overlay rootfs-netlink-route-1419, written by census-propose (#369). census-ruling-rootfs-netlink-route-1419, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-rootfs-netlink-route-1419.md.
+# 6 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy b7f53cc6aa019c1e3edec3c5c23d026475d21e0c9f4cb2b1068e955d06b6db74 internal/host/units/carlos-instance-rootfs-cmd@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-cmd@.service, accepted at census-ruling-carlos-run): new (rootfs Plan 2 Task 4): the rootfs cmd unit (oneshot, TimeoutStartSec=6h5m, the cmd log sockets), binding /run/carlos-control/exe/%I/rootfs/cmd/. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImage= with RootImageOptions=ro,nosuid,nodev; what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 6a400c1ac2cb62e923593fb509ffd2b6f9bae4a6ff4436a80811b2971167f2e4
+@legacy 34550ec7c821dfbb93eae25d91f247326f47d2b1925cecb7603d2073ab1f8b7f internal/host/units/carlos-instance-rootfs-gen@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-gen@.service): new (rootfs Plan 2 Task 4): a rootfs generation's template, the run template without Slice=, StandardOutput=, the instance's binds and RootImage=, which only root's per-start drop-in (RootfsGenDropIn) supplies, so the template alone mounts and runs nothing. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImageOptions=ro,nosuid,nodev, with no RootImage= of its own (root's per-start drop-in names the image); what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 084918373f50eb37c8ad323cbff87c9a5d327c0d713c4bbc09ba2701c8b12aba
+@legacy 1d15a70ee71ece7d791507b11ca92a6c3b1e216138372160f2c232bf5f6381af internal/host/units/carlos-instance-rootfs-probe.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=the rootfs probe's unit (embedded in the carlos binary, installed by root's unit install, applied by PID 1 as root; its process, carlos instance-probe --rootfs, runs as user carlos);basis=root-input (J4, as carlos-instance-probe.service): new (rootfs Plan 2 Task 7): a oneshot on carlos-instances.slice with the same restated block, RootImage= the probe image root builds itself (BuildProbeImage, under /run/carlos-control/probe), the probe's own _probe directories, root's launch.json, resolv.conf copy and box-addrs list read-only from /run/carlos-control/exe/_probe/rootfs/run/, and StandardOutput=truncate:/run/carlos-control/rootfs-probe.out, which PID 1 writes and root reads (runRootfsProbe); no tenant image, file or name reaches it;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, inside the rootfs block; plus one line outside it, Environment=CARLOS_PROBE_SYSCALL_FILTER=1, a constant the unit sets for its own process (the probe, as carlos); it names no path;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 d16141b1ad33781e33ad61384c14f6b7764daa222dd27c4bfb06d1a45d3c0425
+@legacy 126c796b12a3ec3078ae0ce7441aa458ed30c3c7ad33fe960b360af6e96f9090 internal/host/units/carlos-instance-rootfs-tty@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the rootfs tty template, carlos-instance-rootfs-cmd@.service outside named lines held by TestRootfsTTYTemplateEqualsRootfsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit --rootfs tty %I, StandardInput=file:/run/carlos/logs/%I.tty.sock with StandardOutput/StandardError=journal, and RootImage plus the two BindReadOnlyPaths sources under /run/carlos-control/exe/%I/rootfs/tty/ (root-only exe layout) instead of rootfs/cmd/. The rootfs namespace block byte for byte (TestRootfsTemplatesShareOneNamespace), runs as carlos, binds only the instance own and root paths (TestRootfsTemplatesBindOnlyTheInstancesOwnAndRoots). Task 6: POST /tty runtime=rootfs (startRootfsCmd with RoleTTY) starts it through Plan 2's rootfs one-shot path (preflight, validateStagedImage, ensureRootfsExe under rootfs/tty/, jit drop-in and owed reload, post-start MemoryDenyWriteExecute check); its files go only through removeRootfsUnitFiles (stopRootfs and cleanCmdExe with RoleTTY, the sweep);rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 157482e343556817fd4a4d1b571d4bd5b3fce1d55c9610f24a4ef4a43dd44a25
+@legacy c9069c49657d2a7bc666aed876e10b34ebff592f3bc098e6db291620826f5516 internal/host/units/carlos-instance-rootfs-worker@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-gen@.service): new (rootfs Plan 2 Task 4): a rootfs worker's template, the run template without Slice=, StandardOutput=, the instance's binds and RootImage=, which only root's per-start drop-in (WorkerDropIn) supplies. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImageOptions=ro,nosuid,nodev, with no RootImage= of its own (root's per-start drop-in names the image); what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 f6484843ed12db291646fcce9d935b5cdc0be8cc00160c3e2d58ad4b4dfd8c2e
+@legacy e44594c8b6b05bf6be771d2874db8acd79a8f39ae67375da2af7697b5a316582 internal/host/units/carlos-instance-rootfs@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance@.service): new (rootfs Plan 2 Task 4): the run unit of a rootfs instance (ExecStart= the trampoline with --rootfs run, ExecStopPost= instance-exit --rootfs run), Slice=carlos-instances-%i.slice, binding /run/carlos-control/exe/%I/rootfs/run/. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImage= with RootImageOptions=ro,nosuid,nodev; what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 4459dcc0c3b3a7fc1b75194769f9ce46ffa598d844a1547b487704f76620daf9
+@legacy 39724b3733fab1aa435b945da65a694873fa1c908a14038cf137d4eccfe595cd internal/instanceexec/netlink_route_linux.go ScopeNetlinkRoute legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-netlink-route-1419;basis=new (#1419): installs a seccomp filter on its own process (carlos, inside a rootfs unit, every thread via TSYNC) answering socket(AF_NETLINK, any type, protocol other than NETLINK_ROUTE) with EAFNOSUPPORT; nonnative and x32 calls ENOSYS. Its one read is the seccomp syscall; it opens no path and takes no tenant input; it only narrows what the unit allows. Not run by root. Round-1 fix: socketpair(AF_NETLINK, ...) is refused too file:Syscall@527 2a49962af9cb77dc3ef4e34514f951ae03d001c1466cfae3a749eb4e1b6d4ebc
+internal/host/units/carlos-instance-rootfs-cmd@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-cmd@.service, accepted at census-ruling-carlos-run): new (rootfs Plan 2 Task 4): the rootfs cmd unit (oneshot, TimeoutStartSec=6h5m, the cmd log sockets), binding /run/carlos-control/exe/%I/rootfs/cmd/. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImage= with RootImageOptions=ro,nosuid,nodev; what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 6a400c1ac2cb62e923593fb509ffd2b6f9bae4a6ff4436a80811b2971167f2e4
+internal/host/units/carlos-instance-rootfs-gen@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-gen@.service): new (rootfs Plan 2 Task 4): a rootfs generation's template, the run template without Slice=, StandardOutput=, the instance's binds and RootImage=, which only root's per-start drop-in (RootfsGenDropIn) supplies, so the template alone mounts and runs nothing. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImageOptions=ro,nosuid,nodev, with no RootImage= of its own (root's per-start drop-in names the image); what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 084918373f50eb37c8ad323cbff87c9a5d327c0d713c4bbc09ba2701c8b12aba
+internal/host/units/carlos-instance-rootfs-probe.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=the rootfs probe's unit (embedded in the carlos binary, installed by root's unit install, applied by PID 1 as root; its process, carlos instance-probe --rootfs, runs as user carlos);basis=root-input (J4, as carlos-instance-probe.service): new (rootfs Plan 2 Task 7): a oneshot on carlos-instances.slice with the same restated block, RootImage= the probe image root builds itself (BuildProbeImage, under /run/carlos-control/probe), the probe's own _probe directories, root's launch.json, resolv.conf copy and box-addrs list read-only from /run/carlos-control/exe/_probe/rootfs/run/, and StandardOutput=truncate:/run/carlos-control/rootfs-probe.out, which PID 1 writes and root reads (runRootfsProbe); no tenant image, file or name reaches it;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, inside the rootfs block; plus one line outside it, Environment=CARLOS_PROBE_SYSCALL_FILTER=1, a constant the unit sets for its own process (the probe, as carlos); it names no path;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 d16141b1ad33781e33ad61384c14f6b7764daa222dd27c4bfb06d1a45d3c0425
+internal/host/units/carlos-instance-rootfs-tty@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the rootfs tty template, carlos-instance-rootfs-cmd@.service outside named lines held by TestRootfsTTYTemplateEqualsRootfsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit --rootfs tty %I, StandardInput=file:/run/carlos/logs/%I.tty.sock with StandardOutput/StandardError=journal, and RootImage plus the two BindReadOnlyPaths sources under /run/carlos-control/exe/%I/rootfs/tty/ (root-only exe layout) instead of rootfs/cmd/. The rootfs namespace block byte for byte (TestRootfsTemplatesShareOneNamespace), runs as carlos, binds only the instance own and root paths (TestRootfsTemplatesBindOnlyTheInstancesOwnAndRoots). Task 6: POST /tty runtime=rootfs (startRootfsCmd with RoleTTY) starts it through Plan 2's rootfs one-shot path (preflight, validateStagedImage, ensureRootfsExe under rootfs/tty/, jit drop-in and owed reload, post-start MemoryDenyWriteExecute check); its files go only through removeRootfsUnitFiles (stopRootfs and cleanCmdExe with RoleTTY, the sweep);rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 157482e343556817fd4a4d1b571d4bd5b3fce1d55c9610f24a4ef4a43dd44a25
+internal/host/units/carlos-instance-rootfs-worker@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance-gen@.service): new (rootfs Plan 2 Task 4): a rootfs worker's template, the run template without Slice=, StandardOutput=, the instance's binds and RootImage=, which only root's per-start drop-in (WorkerDropIn) supplies. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImageOptions=ro,nosuid,nodev, with no RootImage= of its own (root's per-start drop-in names the image); what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 f6484843ed12db291646fcce9d935b5cdc0be8cc00160c3e2d58ad4b4dfd8c2e
+internal/host/units/carlos-instance-rootfs@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=a rootfs unit template (embedded in the carlos binary, installed under /etc/systemd/system by root's unit install as the other templates are, applied by PID 1 as root; its process runs as user carlos);basis=root-input (J4, as carlos-instance@.service): new (rootfs Plan 2 Task 4): the run unit of a rootfs instance (ExecStart= the trampoline with --rootfs run, ExecStopPost= instance-exit --rootfs run), Slice=carlos-instances-%i.slice, binding /run/carlos-control/exe/%I/rootfs/run/. The template carries the binary template's hardening block restated for an image root (ProtectSystem=strict, the /data, /run/carlos and /opt/carlos tmpfs mounts read-only, PrivateDevices=, PrivateIPC=, ProtectControlGroups=strict, PrivatePIDs=, RestrictNamespaces=, NoNewPrivileges=, an empty CapabilityBoundingSet=, the IPAddressDeny= list, MemoryDenyWriteExecute=yes) plus RootImage= with RootImageOptions=ro,nosuid,nodev; what PID 1 mounts for it: the image, a link root's ensureRootfsExe made under /run/carlos-control/exe (root's, never in any instance's namespace) to the image validateStagedImage checked; root's launch.json and resolv.conf copy from the same root-only directory, read-only; the platform binary, read-only; the instance's own two directories. Provenance: the RootImage= path is fixed and root-controlled (a link root made to the image validateStagedImage checked), but the image's contents are tenant-built: PID 1 and the kernel mount a tenant-produced squashfs (read-only, nosuid, nodev) as the unit's root, after root has checked its bytes against root's own staged manifest; that mount is the new authority this template carries. The tenant also writes its own two directories; it names no path PID 1 or root opens;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the restated rootfs block (byte-identical across the rootfs units);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-rootfs-netlink-route-1419;basis=the restated rootfs block's RestrictAddressFamilies= gains AF_NETLINK (#1419), with a comment, byte-identical across the six rootfs units; applied by PID 1 to the unit's own process as carlos (empty CapabilityBoundingSet=, NoNewPrivileges=), narrowed to NETLINK_ROUTE by instance-exec --rootfs and the rootfs probe's seccomp scope. No bind source, Exec line, user, mount or path read by root added. Round-1 fix: the five tenant units' ExecStart= add --netlink-scope, a constant flag instance-exec accepts with --rootfs (a pre-#1419 binary exits on it); the block comment says what route lets a tenant read file:external@0 4459dcc0c3b3a7fc1b75194769f9ce46ffa598d844a1547b487704f76620daf9
+internal/instanceexec/netlink_route_linux.go ScopeNetlinkRoute legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-netlink-route-1419;basis=new (#1419): installs a seccomp filter on its own process (carlos, inside a rootfs unit, every thread via TSYNC) answering socket(AF_NETLINK, any type, protocol other than NETLINK_ROUTE) with EAFNOSUPPORT; nonnative and x32 calls ENOSYS. Its one read is the seccomp syscall; it opens no path and takes no tenant input; it only narrows what the unit allows. Not run by root. Round-1 fix: socketpair(AF_NETLINK, ...) is refused too file:Syscall@527 2a49962af9cb77dc3ef4e34514f951ae03d001c1466cfae3a749eb4e1b6d4ebc
+@coverage internal/host/units 8e2d527d528d57f1a1970c6789d6f443dc2efcba64b8a243e10f72d02bae5c00
+@coverage internal/instanceexec d9b267b002ec3a8f20a06ec8123d76bb6a7c8ae5316df663456f1b8cea1625c7
diff --git a/testdata/clireg-golden.jsonl b/testdata/clireg-golden.jsonl
index f1c233134..f92b62a6c 100644
--- a/testdata/clireg-golden.jsonl
+++ b/testdata/clireg-golden.jsonl
@@ -432,8 +432,8 @@
{"case":"help | -h","argv":["help","-h"],"exit":0,"stdout":"usage: carlos <command> [flags]\n\nOne binary, three roles. \"carlos <command> -h\" prints a command's own\nflags; --app, the flag on nearly every app verb, shortens to -a.\n\nYour apps — ship and run software on a CARLOS deployment\n auth log in, see who this terminal is, log out\n config edit .carlos/config: \"config destinations\" lists, adds,\n changes and removes the named places -d deploys to\n apps create | place | delete | restore an app name — --place\n fleet/<f> claims and places in one step, and \"apps place\"\n repoints an app's routes and instances onto a customer\n fleet or back to \"\"\n deploy put a build live: ship it, promote it and wait until the\n URL serves it. Use this unless you need the steps apart\n canary the same, onto a host and channel of this branch's own, so\n nothing the app already serves changes: deploy | ls | rm\n ship upload a release without putting it live; --label and\n --notes name it, and --version is optional once a version\n target is set\n promote move a shipped version onto one of the app's own channels —\n the channel is optional when the app has only one\n (\"carlos channels\" lists them; \"carlos pipeline\" orders them)\n devbox publish a dev server or a folder as a link on this devbox\n restart cycle an app's instances — no new version, no config change;\n --host or --environment narrows it, --dry-run names the set\n db read a copy of an instance's database, restored from its\n replica: pull (save it) | query (one read-only query)\n run run one of your app's commands against one instance, as that instance\n console open the console process your app's manifest declares, on one instance, in a terminal session\n schedule recurring or one-shot work per app: ls | set | rm | run\n store object storage: create | status | apply | approvals | approve | decline | grant | rotate\n relay the platform STUN/TURN relay: serve (what the unit runs)\n and keygen (mint a region master)\n email tenant email sending: enable | domains add | status | test |\n credentials create/list/revoke | rotate | pause | resume\n rollback point a channel back at an earlier version\n channels show what each of an app's channels is serving\n pipeline show or shape an app's release channels\n releases every version shipped, newest first, with labels and tags\n version target the semver ship counts iterations under: print it, or set\n it — \"carlos version target --app <a> 0.5.0\"\n env plain per-app config vars: set | unset | list\n secrets sealed per-app secrets: set | unset | list | genkey\n instances an app's instances: enable | create | list | delete |\n set-upstreams | set-channel | set-assets | set-pages — set-channel is\n the only door onto which channel a route follows\n sidecars a process nothing dials, one per enrolled member: enable |\n create | ls | wake | rm | logs\n steering opt an instance into DNS latency steering, or back off —\n --app <a> --host <h> latency|off (shared pool only, v1)\n routes an app's routes and what each is bound to: upstream,\n channel, config environment, status\n domains a customer's own hostname attached to an app's route:\n attach | detach | list\n features an app's own feature flags, stored and served by the\n platform, never interpreted: set | list\n assets the copies servers keep of an app's asset files: purge | status\n gate a shared password in front of an app's hostnames\n ratelimit per-client limits on an app's instances\n logs an app's merged log timeline: its own output plus platform\n events (wakes, restarts, failures); -f follows live\n errors error groups for an app: log lines at the set level plus\n 500s the edge saw\n availability requests an app's instances could not answer (502/503/504),\n grouped by cause, plus failed wakes and exits\n analytics an app's page views and visitors from a terminal, counted at\n the edge as it serves your app\n protection show or set whether protection only records on this app\n geo what the platform's GeoIP database says about an address\n explain what a reference code from a page the edge answered says\n ledger open ledgers: append | head | list | publish | blob | verify\n vet check a release against the platform contract\n update update this carlos binary to the latest release (or name\n the brew/apt command when a package manager owns it);\n -y skips the prompt, terminal still required\n skills the platform's published agent skills: list them, or print one —\n \"carlos skills getting-started\" pipes the recipe to an agent\n\nYour deployment — stand up and administer boxes, routes and accounts\n bootstrap prepare a host: units, dirs, user\n accounts the tenancy primitive: create | list | migrate\n billing billing problems, house accounts: problems | close | house\n fleets account-owned groups of remote boxes that dial this\n console: create | add-box | rotate-token | tag-box |\n detach-box | ls — box tokens print exactly once, at mint\n or rotate, and a compromised box needs detach-box, not\n rotate-token\n link publish this deployment's apps through a Carloku account:\n create | status | publish | unpublish | rotate | remove\n links the deployments linked to an account: ls\n services credentials a SERVER holds, not a person: create | ls |\n rotate | revoke, owner-only and closed to service\n credentials themselves — secrets print exactly once, and\n a compromised one needs revoke, not rotate\n platform customer accounts a platform runs: customers | credentials\n add route a hostname on this box to an app\n remove drop one of this box's routes\n route repoint a route's channel or config environment, grant or\n revoke a capability, hibernate it, change its backing\n instances with no sub-verb: list THIS box's registry routes\n release-keygen mint the root signing key, or a scoped signing key\n proof dev proofs a box requires before adopting: keygen | get | put\n economics bill: record the month's AWS bill; backhaul: what region\n edges cost us this period\n status --live: what every box last reported; --dry-run: leak check\n move move an instance to another region: status | cut | abort |\n resolve --retry (operators; off unless the console enables it)\n\nOn the host — what systemd runs; rarely typed by hand\n edge the mesh front door (router)\n agent edge + activator + release adoption for this host\n adopt one release-adoption pass (the hourly timer's verb)\n ops box operations: litestream | restore-verify\n system platform self-update: update | status | rollback (apply is the\n root oneshot); antivirus: deployment-wide object scanning\n version print the build id\n","stderr":""}
{"case":"instance-control | --zz-unknown-flag","argv":["instance-control","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos instance-control (socket-activated by carlos-instance-control.socket)\n"}
{"case":"instance-control | -h","argv":["instance-control","-h"],"exit":0,"stdout":"","stderr":"usage: carlos instance-control (socket-activated by carlos-instance-control.socket)\n"}
-{"case":"instance-exec | --zz-unknown-flag","argv":["instance-exec","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos instance-exec [--rootfs] <run|seed|sidecar|cmd|worker|tty> <instance-id>\nflags:\n --claim-reservation <string> root launch reservation\n --rootfs rootfs launch: root's launch file names the command\n --sandbox <string> guest sandbox mode\n"}
-{"case":"instance-exec | -h","argv":["instance-exec","-h"],"exit":0,"stdout":"","stderr":"usage: carlos instance-exec [--rootfs] <run|seed|sidecar|cmd|worker|tty> <instance-id>\nflags:\n --claim-reservation <string> root launch reservation\n --rootfs rootfs launch: root's launch file names the command\n --sandbox <string> guest sandbox mode\n"}
+{"case":"instance-exec | --zz-unknown-flag","argv":["instance-exec","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos instance-exec [--rootfs] <run|seed|sidecar|cmd|worker|tty> <instance-id>\nflags:\n --claim-reservation <string> root launch reservation\n --netlink-scope rootfs launch: scope netlink to NETLINK_ROUTE (always on with --rootfs)\n --rootfs rootfs launch: root's launch file names the command\n --sandbox <string> guest sandbox mode\n"}
+{"case":"instance-exec | -h","argv":["instance-exec","-h"],"exit":0,"stdout":"","stderr":"usage: carlos instance-exec [--rootfs] <run|seed|sidecar|cmd|worker|tty> <instance-id>\nflags:\n --claim-reservation <string> root launch reservation\n --netlink-scope rootfs launch: scope netlink to NETLINK_ROUTE (always on with --rootfs)\n --rootfs rootfs launch: root's launch file names the command\n --sandbox <string> guest sandbox mode\n"}
{"case":"instance-exit | --zz-unknown-flag","argv":["instance-exit","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos instance-exit [--rootfs] <run|seed|sidecar|cmd|worker|tty> <instance-id>\nflags:\n --rootfs the unit is a rootfs template\n --run-dir <string> run directory holding instances/<id> (default: /run/carlos)\n --sandbox <string> guest sandbox mode\n"}
{"case":"instance-exit | -h","argv":["instance-exit","-h"],"exit":0,"stdout":"","stderr":"usage: carlos instance-exit [--rootfs] <run|seed|sidecar|cmd|worker|tty> <instance-id>\nflags:\n --rootfs the unit is a rootfs template\n --run-dir <string> run directory holding instances/<id> (default: /run/carlos)\n --sandbox <string> guest sandbox mode\n"}
{"case":"instance-probe | --zz-unknown-flag","argv":["instance-probe","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos instance-probe [--rootfs]\nflags:\n --rootfs the rootfs probe's checks, from inside the probe image (carlos-instance-rootfs-probe.service)\n --sandbox <string> guest sandbox mode\n"}