Skip to content

stage1: config on stdin, drop --url/--file; args smoke test + doc fixes#14

Merged
HarryR merged 1 commit into
mainfrom
stage1-stdin-config
Jul 7, 2026
Merged

stage1: config on stdin, drop --url/--file; args smoke test + doc fixes#14
HarryR merged 1 commit into
mainfrom
stage1-stdin-config

Conversation

@HarryR

@HarryR HarryR commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

What

  • Config on stdin. A user-data document piped on stdin now wins over the cloud metadata service (stage1 < user-data.json). stdin is read only when fd 0 is a pipe or regular file (never the console), so PID 1 never blocks. The --url/--file dev flags are removed -- pipe instead. --attest unchanged. The _stage2 -> stage2 argv path is untouched.
  • Args smoke test. New smoke-args-% target boots the full chain with an inline _stage2.args = ["--smoke","hello world"] and asserts the payload echoed arg[1]/arg[2] (the space proves a real argv vector, not shell word-splitting). Signed remote args stay covered by test-chain SIGN=1 SIGN_ARGS=1.
  • Doc corrections. The crate READMEs predated the deploy-tool split and the memfd/stdin work: drop --make-config/--url/--file and /tmp/stage2.exe; correct the measurement docs to code-only PCR 14 (config is NOT measured into PCR 15; attest nonce is H(binary), not H(H(binary)||H(config))). Add an args-model note to the root README.

Args model (documented, no behavior change)

  • stage1 config: cloud metadata (PID 1) or piped stdin (normal process).
  • stage2 argv: _stage2.args / signed args_url.
  • _stage1.args is stage0's generic EFI LoadOptions; for this Linux UKI the kernel cmdline is baked/measured/immutable and LoadOptions are ignored under Secure Boot, so operator config flows through _stage2, not the cmdline. (stage0 side documented separately.)

Verification

  • make smoke-args-x86_64 -> PASS (arg[1]: --smoke, arg[2]: hello world, space preserved).
  • make test-chain-x86_64 SIGN=1 SIGN_ARGS=1 -> signed args reach argv (--from, signed-args).
  • make test-chain-x86_64 and ... SIGN=1 -> full chain boots + powers off in both modes, config on stdin.
  • cargo test green; cargo check -p stage1 warning-free.

🤖 Generated with Claude Code

Config input the Unix way: a user-data document piped on stdin now wins
over the cloud metadata service (stage1 < user-data.json). stdin is only
read when fd 0 is a pipe or regular file, never the console, so PID 1
never blocks. The --url/--file dev flags are removed -- pipe instead.

stage1 no longer takes any config-source args; stage0 passes none, and a
piped config takes precedence over argv. --attest is unchanged.

Add a smoke-args-% target: boots the full chain with a known inline
_stage2.args array (one arg has a space, to prove a real argv vector and
not shell word-splitting) and asserts the payload echoed it. The signed
-remote-args path stays covered by test-chain SIGN=1 SIGN_ARGS=1.

Refresh the stale crate READMEs, which predated the deploy-tool split and
the memfd/stdin work: drop --make-config/--url/--file, and correct the
measurement docs (code-only PCR 14; config is NOT measured into PCR 15,
and the attestation nonce is H(binary), not H(H(binary)||H(config))).

Verified: full chain boots in both sha256 and ed25519 modes; smoke-args
passes for inline args and signed args reach argv.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@HarryR HarryR merged commit 7015546 into main Jul 7, 2026
4 checks passed
@HarryR HarryR deleted the stage1-stdin-config branch July 7, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant