Skip to content

container: Move .vmlinuz.hmac along with the kernel in split-kernel-and-rootfs - #21

Closed
cgwalters-bot wants to merge 1 commit into
mainfrom
bot/split-kernel-hmac
Closed

cgwalters-bot wants to merge 1 commit into
mainfrom
bot/split-kernel-hmac

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Collaborator

bootc container split-kernel-and-rootfs moves vmlinuz and initramfs.img out of /usr/lib/modules/<kver>/, but it left the kernel's FIPS HMAC (.vmlinuz.hmac) behind, orphaned in the rootfs of a sealed image. This moves it into <output>/<kver>/ next to vmlinuz, under the same name, which is the layout ostree reads it from (it installs it as /boot/.vmlinuz-<kver>.hmac). The split logic moves into kernel.rs so it can be unit tested.

Found while building the rhel-bootc-examples sealing example.

Testing, on a 16-core devspace:

  • just unit-tests passed, including the new kernel::tests::test_split_kernel{,_uki}; just validate and just build passed.
  • A sealing-style CentOS Stream 10 build (build-rootfs, split, then bootc container ukify --kernel-dir in a tools stage, following the rhel-bootc-examples sealing Containerfile). With the stock bootc 1.16.13, /usr/lib/modules/6.12.0-269.el10.x86_64/.vmlinuz.hmac stayed in the final image. With this change it lands in /kernel/<kver>/ next to vmlinuz, nothing is left in /usr/lib/modules, and ukify still builds the UKI.

Caveat: in a UKI boot, dracut's FIPS check verifies /boot/EFI/Linux/.<uki>.hmac and not the vmlinuz HMAC. So the moved file is for consumers of the split kernel directory. Sealed images still don't get a UKI HMAC.

Generated-by: https://github.com/cgwalters/#llms


Review draft in cgwalters-forge, not upstream yet. This section is removed when the PR is opened upstream.

  • Upstream: bootc-dev/bootc, base main
  • Board item: PVTI_lAHOAQ_SPs4Bj2Gizg8q1Qw
  • Fork CI: off; the devspace testing described above is this PR's CI, and upstream CI runs once it is opened there

To review:

  • Approve, or comment /promote on a line of its own, to open it upstream, ready for review. Either covers only the commits pushed so far.
  • If upstream requires DCO, approving also signs off: promote adds Signed-off-by: Colin Walters <[email protected]> to the commits lacking it (the bot's and yours; anyone else's only if you ask), with you as committer.
  • Add a /draft line (in the same comment or before) to open it upstream as a draft (/ready undoes that).
  • Close to drop it.
  • Edit the title and description freely: they become the upstream PR's. Review comments are squashed into the commits they concern, with a reply here.

…nd-rootfs

Kernels built for FIPS ship /usr/lib/modules/<kver>/.vmlinuz.hmac, which
ostree and kernel-install copy next to vmlinuz when installing it.
split-kernel-and-rootfs moved vmlinuz and the initramfs out but left the
HMAC behind, orphaned in the rootfs of a sealed image. Move it into the
output directory next to vmlinuz, under the same name, so it goes
wherever the kernel goes.

While here, move the logic into kernel.rs as a cap-std based function
so it can be unit tested.

Generated-by: AI
Signed-off-by: Colin Walters <[email protected]>
@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

Signed off 1 commit(s) with Signed-off-by: Colin Walters <[email protected]> for bootc-dev/bootc's DCO check, on cgwalters's approval #21 (review) of 0f05c9c655c3. Same trees; the head is now 43b9a99f270a.

@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

Opened upstream as bootc-dev#2499. Closing this review draft.

@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

Signed off 1 commit(s) with Signed-off-by: Colin Walters <[email protected]> for bootc-dev/bootc's DCO check, on cgwalters's approval bootc-dev#2499 (review) of 8cf8ebaa7716. Same trees; the head is now 4c030e7e8ea2.

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.

2 participants