Skip to content

kernel: lockdown's floor is integrity, and every machine but an enforcer's runs at confidentiality - #739

Merged
aledbf merged 3 commits into
mainfrom
kernel/734-lockdown-floor
Nov 26, 2026
Merged

aledbf merged 3 commits into
mainfrom
kernel/734-lockdown-floor

Conversation

@aledbf

@aledbf aledbf commented Nov 26, 2026

Copy link
Copy Markdown
Member

Why

Spinbox will run shirudo, a guest BPF LSM enforcer, in some workspaces. Its programs call bpf_probe_read_kernel, which lockdown at confidentiality refuses, and this machine's kernel forced confidentiality. The maintainer chose a per-machine level on #734: the kernel's forced floor becomes integrity, and the machine raises every guest to confidentiality on the kernel command line unless its Spec says it runs an enforcer that needs integrity. A workspace without shirudo keeps exactly today's protection. This closes #734 once merged.

What

  • Kernel. kernel/config-7.4-x86_64 forces integrity (CONFIG_LOCK_DOWN_KERNEL_FORCE_INTEGRITY=y). olddefconfig leaves it as committed, so the build's fixed-point check holds. Lockdown only rises (lock_kernel_down), so no command line can go below integrity. KERNEL_LOCKDOWN is now integrity|none. Its sed, its check, release traceable-kernel's config comparison (build.TraceableConfig) and the menuconfig build follow.
  • The data shape. machine.Cmdline gets one new field, LockdownIntegrity bool. Its zero value is the safe one: String adds lockdown=confidentiality unless the field is set. A consumer that builds its own Cmdline literal, as spin does, gets confidentiality without asking. validate refuses a lockdown= in Extra. The kernel keeps the higher of two levels, so one there would silently undo the choice or claim a level the guest does not run.
  • Not in the machine's record. The guest kernel reads its command line once, at boot. A checkpoint resumes the guest it saved, at the level it booted at, whatever the resuming machine's -append says. The level cannot make a resume load wrongly, so Target and CanResume do not carry it (docs/machine.md, "The kernel command line").
  • CLI. spin-machine boot|args --lockdown-integrity.
  • The traceable kernel stays unlocked. Lab boots go through the tree's own spin-machine boot, which would now add lockdown=confidentiality and lock the FORCE_NONE kernel. When a tree is made with --kernel traceable:TAG, MakeTree asks the tree's spin-machine for its line (args). If the line carries lockdown=, every boot of the tree gets --lockdown-integrity. It then asks again and refuses the tree if lockdown= is still there. A --spin-machine release from before this change knows no such flag and adds no lockdown=, so it gets nothing, which keeps measuring.md's ledger recipe working on older releases.
  • Docs. kernel/README.md ("Lockdown and the BPF LSM": the floor, the default, the choice, and what a shirudo machine trades), docs/machine.md, docs/cli.md, docs/measuring.md, a docs/log entry.
  • Follow-up boot:lockdown: drop the case for a kernel from before #734 once a release forces integrity #738. boot:lockdown accepts a kernel from before shirudo: lockdown at confidentiality withholds bpf_probe_read_kernel from its programs #734 that forces confidentiality, and expects the integrity guest to read the forced level there. compat boots the newest release's kernel for any change that does not reach the kernel, and until a release carries this kernel that one forces confidentiality. boot:lockdown: drop the case for a kernel from before #734 once a release forces integrity #738 removes this allowance after the next release.

Checked

task boot:lockdown on a lab tree of release v20261124.01 with this change's kernel (lab tree lock734 --from release --kernel $PWD/_output/kernel/vmlinux, laptop KVM):

=== RUN   TestTheGuestKernelIsLockedDown/confidentiality
    lockdown: none integrity [confidentiality]
    forced by the kernel: integrity; asked of it: lockdown=confidentiality
    LOCKDOWN_CHECK_OK
=== RUN   TestTheGuestKernelIsLockedDown/integrity
    lockdown: none [integrity] confidentiality
    forced by the kernel: integrity; asked of it: nothing
    LOCKDOWN_CHECK_OK
--- PASS: TestTheGuestKernelIsLockedDown (12.39s)
  • The check catches a broken setup. With the integrity guest's switch removed on purpose, the run printed a machine at integrity asked for a level: ... lockdown=confidentiality and failed (--- FAIL: .../integrity).
  • The release's own kernel (lab tree rel734 --from release, which forces confidentiality) passes both guests, each at [confidentiality].
  • The traceable kernel stays unlocked. lab tree tr734 --from release --kernel traceable:v20261124.01 wrote "boot": ["--lockdown-integrity"] into the manifest. A guest booted with that flag read [none] integrity confidentiality, and the same boot without it read none integrity [confidentiality].
  • spin-machine-dev release traceable-kernel built locally. Its config is CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE=y with integrity and confidentiality both unset, and it passed the comparison against the committed config.
  • go tool task lint test mutate after git fetch origin: all clean (mutate: 101 refused, 0 survived).

The consumer: spin's internal/runner/qemu/kernel_cmdline.go builds a machine.Cmdline{...} literal without the new field. With its zero value, spin gets lockdown=confidentiality once it bumps the machine module. Its tests match the line by contains. Nothing to change in spin and no issue needed. A shirudo workspace sets LockdownIntegrity, and that is spin's change to make when it runs shirudo.

🤖 Generated with Claude Code

aledbf and others added 3 commits November 25, 2026 21:39
…ery machine to confidentiality

shirudo's BPF programs call bpf_probe_read_kernel, which confidentiality
refuses (#734). The kernel now forces integrity, the floor no command line
goes below, and machine.Cmdline puts lockdown=confidentiality on every
line unless Cmdline.LockdownIntegrity (spin-machine --lockdown-integrity)
asks for the floor. The zero value is confidentiality, so a consumer that
builds its own Cmdline keeps today's level, and a lockdown= in Extra is
refused. The level is the booted guest's, so it stays out of the record.

The traceable kernel's swap is integrity to none, and a lab tree booting
it passes --lockdown-integrity when its spin-machine would add lockdown=.
boot:lockdown boots a guest at each level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ld by a test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aledbf

aledbf commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

Verified against shirudo itself before merging, in shirudo's own VM harness (shirudo main 5795f8d4, swtpm tpm-tis, dracut initrd). On this machine's 7.4-rc4 kernel with #735's config:

  • At confidentiality, shirudo init fails: prog 'shirudo_lsm_bpf': BPF program load failed: -EINVAL … BPF_CORE_READ(task, flags) @ verity.h:91 … cannot use helper bpf_probe_read#4.
  • At integrity, bpf2 and seal attached and init: complete, check-only passes 12/12, and the upatch tests t3105 (4/4), t3107 (7/7) and t3111 (8/9) pass. Test 9 of t3111 fails on shirudo's own kernel too.

init --check-only also passes 12/12 at confidentiality, so it cannot catch this. A machine check for shirudo has to read init's result or shirudo status.

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.

shirudo: lockdown at confidentiality withholds bpf_probe_read_kernel from its programs

1 participant