Skip to content

fix(os): harden guest initramfs mounts and dm-verity corruption policy - #1274

Merged
kvinwang merged 1 commit into
nextfrom
fix/guest-initramfs-hardening
Sep 24, 2026
Merged

kvinwang merged 1 commit into
nextfrom
fix/guest-initramfs-hardening

Conversation

@kvinwang

@kvinwang kvinwang commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Hardens the guest initramfs init. The file lives under os/yocto/, but mkosi installs it as the UKI's /init (os/mkosi/scripts/make-release-artifacts.sh:92), so every shipped image runs it.

  • /proc, /sys, /run and /dev are now mounted with systemd's mount_table options. systemd skips paths that are already mount points, and mount --move keeps the options, so before this change the guest ran with a world-writable (1777) /run and without nosuid/nodev/noexec.
  • dm-verity now uses --panic-on-corruption. By default a corrupt block only returns EIO to the reader and the CVM keeps running. With panic=1 already on the cmdline, a panic reboots the guest.

Checked in containers against busybox 1.37.0 and cryptsetup 2.7.5 (trixie), not in a booted CVM. Changes the UKI measurement.

The initramfs mounted /proc, /sys, /run and /dev with no options. systemd
skips paths that are already mount points and mount --move keeps options,
so the guest ran with e.g. a 1777 /run. Use systemd's mount_table options.

Open the verity rootfs with --panic-on-corruption instead of the default,
which only returns EIO to the reader and keeps the CVM running.
@kvinwang
kvinwang force-pushed the fix/guest-initramfs-hardening branch from 435e78b to a999dd5 Compare September 24, 2026 06:52
@kvinwang
kvinwang merged commit 43678fb into next Sep 24, 2026
9 checks passed
@kvinwang
kvinwang deleted the fix/guest-initramfs-hardening branch September 24, 2026 06:53
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