Public: anyone can read this; the crew can change it.
Main green on Linux: the loopback-only look skips (named) under the Landlock floor instead of failing every check #16954
Check · Review · Land · Live done — Landed and live in production.
fix/look-loopback-test → main 0 commits
5 files
changed +35
−4
docs/features/landlock-floor.md +1
| @@ -26,6 +26,7 @@ holds the work instead, with no root and no namespace. | ||
| 26 | 26 | - **Never silent.** The kernel's ABI is probed; rights it lacks are dropped and named. UDP is never |
| 27 | 27 | covered before ABI 10 and every record says so. |
| 28 | 28 | - `FORGE_LANDLOCK=off` declines the floor on purpose. |
| 29 | - A no-cell check step carries `FORGE_CHECK_FLOOR=landlock`. Under the floor no user namespace can be made (writing `/proc/self/uid_map` is denied), so the loopback-only look test skips there and names the floor, rather than failing as a missing prerequisite. | |
| 29 | 30 | |
| 30 | 31 | Not covered: network. Crew runs must reach their model's API and checks start servers on loopback |
| 31 | 32 | ports, so TCP connect is not confined yet (the plan supports `connect: [ports]`, ABI 4+, for a |
src/checks/run_tier.ts +2 −2
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | |
| 2 | import { READS_OPEN } from "../sandbox/landlock.ts"; | |
| 2 | import { CHECK_FLOOR_ENV, READS_OPEN } from "../sandbox/landlock.ts"; | |
| 3 | 3 | import { probeLandlock } from "../sandbox/landlock_probe.ts"; |
| 4 | 4 | import { cellHides } from "../spawn/hosted-mark.ts"; |
| 5 | 5 | import { forgeApiKey } from "../crew/runner_env.ts"; |
| @@ -285,7 +285,7 @@ async function runTierOnce(lane: LaneState, x: Execution, sample: (green: LentGr | ||
| 285 | 285 | // nested cells, and those never answer in time. Its children run as |
| 286 | 286 | // plain processes here — as they do on a runner without bwrap. |
| 287 | 287 | FORGE_CELLS: "off", |
| 288 | ...(floor === undefined ? {} : { TMPDIR: `${dir}.tmp`, HOME: home }), | |
| 288 | ...(floor === undefined ? {} : { TMPDIR: `${dir}.tmp`, HOME: home, [CHECK_FLOOR_ENV]: "landlock" }), | |
| 289 | 289 | }); |
| 290 | 290 | let ran: Result<void, string>; |
| 291 | 291 | const checkLines: string[] = []; |
src/sandbox/landlock.ts +7
| @@ -74,6 +74,13 @@ export function landlockNote(plan: LandlockPlan): string { | ||
| 74 | 74 | return `landlock ABI ${plan.abi}: ${held.join("; ")}; not enforced: ${gaps.join(", ")}`; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | /** | |
| 78 | * Set to `landlock` in a check step's environment when the step is held by the Landlock floor alone | |
| 79 | * (no cell): a test can then tell a namespace it cannot make there (the floor denies writing | |
| 80 | * `/proc/self/uid_map`) from a prerequisite the runner truly lacks. | |
| 81 | */ | |
| 82 | export const CHECK_FLOOR_ENV = "FORGE_CHECK_FLOOR"; | |
| 83 | ||
| 77 | 84 | /** What a floor used alone, with no bubblewrap above it, leaves open: said wherever it is named. */ |
| 78 | 85 | export const READS_OPEN = "reads are not hidden (the whole filesystem stays readable) and tcp is not confined"; |
| 79 | 86 |
test/look-loopback-only-verdict.test.ts +14
| @@ -23,6 +23,20 @@ describe("loopback-only look verdict", () => { | ||
| 23 | 23 | expect(verdict("cannot make a network namespace: denied", { FORGE_CHECK: "" }).kind).toBe("skip"); |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | test("in a check held by the Landlock floor, no user namespace is the floor's doing: it skips, naming it; any other gap still fails", () => { | |
| 27 | const held = { FORGE_CHECK: "01abc", FORGE_CHECK_FLOOR: "landlock" }; | |
| 28 | const namespace = "cannot make a network namespace: unshare: cannot open /proc/self/uid_map: Permission denied"; | |
| 29 | expect(verdict(namespace, held)).toEqual({ | |
| 30 | kind: "skip", | |
| 31 | line: `loopback-only look: skipped in the check, held by the Landlock floor, which makes no user namespace: ${namespace}`, | |
| 32 | }); | |
| 33 | expect(verdict("no Chromium found", held).kind).toBe("fail"); | |
| 34 | expect(verdict("unshare is not installed", held).kind).toBe("fail"); | |
| 35 | // In a check with a cell, or none at all, the same namespace gap fails as before. | |
| 36 | expect(verdict(namespace, { FORGE_CHECK: "01abc" }).kind).toBe("fail"); | |
| 37 | expect(verdict(namespace, { FORGE_CHECK: "01abc", FORGE_CHECK_FLOOR: "" }).kind).toBe("fail"); | |
| 38 | }); | |
| 39 | ||
| 26 | 40 | test("nothing missing runs, in the check or not", () => { |
| 27 | 41 | expect(verdict(undefined, { FORGE_CHECK: "01abc" })).toEqual({ kind: "run" }); |
| 28 | 42 | expect(verdict(undefined, {})).toEqual({ kind: "run" }); |
test/look-loopback-only.verdict.ts +11 −2
| @@ -3,9 +3,16 @@ | ||
| 3 | 3 | * the forge's check a missing prerequisite (Chromium, `unshare`, a network |
| 4 | 4 | * namespace) is a skip that says why; inside it — the check sets |
| 5 | 5 | * `FORGE_CHECK` to its run id — the same gap is a failure that names it, so a |
| 6 | * green check always means a picture was taken. | |
| 6 | * green check always means a picture was taken. One gap is the check's own | |
| 7 | * doing, not the runner's: a step held by the Landlock floor alone (#16888, | |
| 8 | * `FORGE_CHECK_FLOOR=landlock`) cannot write `/proc/self/uid_map`, so no user | |
| 9 | * namespace can be made there by design. That one skips, naming the floor; | |
| 10 | * every other gap in the check still fails. | |
| 7 | 11 | */ |
| 8 | 12 | import { findChromium } from "../src/looks/capture.ts"; |
| 13 | import { CHECK_FLOOR_ENV } from "../src/sandbox/landlock.ts"; | |
| 14 | ||
| 15 | const NO_NAMESPACE = "cannot make a network namespace"; | |
| 9 | 16 | |
| 10 | 17 | export type Verdict = |
| 11 | 18 | | { kind: "run" } |
| @@ -16,6 +23,8 @@ export type Verdict = | ||
| 16 | 23 | export function verdict(missing: string | undefined, env: Record<string, string | undefined>): Verdict { |
| 17 | 24 | if (missing === undefined) return { kind: "run" }; |
| 18 | 25 | const inCheck = (env["FORGE_CHECK"] ?? "") !== ""; |
| 26 | if (inCheck && env[CHECK_FLOOR_ENV] === "landlock" && missing.startsWith(NO_NAMESPACE)) | |
| 27 | return { kind: "skip", line: `loopback-only look: skipped in the check, held by the Landlock floor, which makes no user namespace: ${missing}` }; | |
| 19 | 28 | return inCheck |
| 20 | 29 | ? { kind: "fail", line: `loopback-only look: failed in the check, ${missing}` } |
| 21 | 30 | : { kind: "skip", line: `loopback-only look: skipped, ${missing}` }; |
| @@ -31,6 +40,6 @@ export function missingPrerequisite(): string | undefined { | ||
| 31 | 40 | stderr: "pipe", |
| 32 | 41 | }); |
| 33 | 42 | if (probe.exitCode !== 0) |
| 34 | return `cannot make a network namespace: ${probe.stderr.toString().trim().slice(0, 200)}`; | |
| 43 | return `${NO_NAMESPACE}: ${probe.stderr.toString().trim().slice(0, 200)}`; | |
| 35 | 44 | return undefined; |
| 36 | 45 | } |
new above
offline