DeviceTree Support #369
Labels
No labels
bug
dependency
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
review-next
security
stub
tool
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: raito/lanzaboote#369
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi.
I'm playing with Snapdragon X Elite support, though I don't have applicable hardware for another couple of weeks.
I have an ISO generated with the custom kernel, but I had to commit some sins to try and maybe make the installer Grub (maybe) work:
hardware.deviceTree
properly${kernelPkg]/${deviceTree.name}
which I'm hoping will just work.To me, lanzaboote is a chance to iterate on this, out-of-tree from nixpkgs, and I'd prefer to use lanzaboote on all of my machines anyway.
From what I can tell, lanzaboote happily compiled for aarch64-linux, but I doubt it has support for device-tree.
Questions:
I'm naively thinking that the lanzaboote module would just look at
config.hardware.deviceTree.{enable,name}
and then add the appropriate line to the generation's boot cfg file/entry.So, I want to support devicetree better for nixos, outside of extlinux. I don't want to touch grub (perl), I don't want to touch something that feels bespoke and doesn't work for non-iso scenarios (iso-image grub), I don't want to touch systemd-boot (python).
I'd much rather invest in bootspec + lanzaboote:
I realize that using lanzaboote for the ISO is a bit weird, since normally you'd install -> provision -> sign -> load key -> turn on enforcing. But also, it's no worse than the existing setup, and could lead to a reduction of duplication in nixpkgs (if there was appetite for standardizing on lanzaboote).
I could certainly use some advice/guidance/help on this. I'm willing to throw some money at it, too, if there are interested folks.
So, I think the issue here is going to be signing the DTB.
systemd-boot
will not do anything to verify any signature of itsdevicetree
field. Now, withsystemd-stub
, at least, you can include a.dtb
section in the UKI. So we probably want to support that in the lanzaboote stub.The other issue will be (as we talked briefly about on matrix) choosing the right DTB during boot. Right now this problem has been kind of punted, and all the systemd stuff just assumes you have the correct DTB chosen ahead of time, before signing even. But I think we could use something similar to @RaitoBezarius's work on using addons for
.initrd
but for the.dtb
section. This, of course, depends on there being an agreed upon standard for identifying which device tree is the right one during boot, and there is no such standard.For now, I'm going to hack the systemd-boot-builder.py and limp along with that for now. I'm still interested in this, though, if someone wants to shepherd me (probably not for a month or so), or if I can fund someone to do it. Thanks for the thoughts @ElvishJerricco. (Also, I'm fine with punting on the harder part of selecting the DTB from firmware, that seems like a much bigger thing than just some hard-coded
.dtb
stub support)Until we have TPM support on the X1E the case for using secure boot isn't very strong, but once we have that I might be motivated to have a crack at this, and see if I can get a PoC working.
Why wouldn't it be? Verification and measurement are almost kinda orthogonal. The TPM can facilitate things like passwordless (or just hardware-bound) FDE, but Secure Boot is what actually verifies the UKI, which can then verify the filesystem even without any FDE at all (dm-verity, fs-verity, IMA/EVM) – see https://github.com/NixOS/nix/issues/4917 – or you can type your FDE password into a verified initrd and then rely on FDE for further runtime, etc.
Not anymore! 🙃 Since https://github.com/systemd/systemd/pull/34855 the systemd stub supports matching HWIDs to DTBs (basically a mini-dtbloader embedded in each UKI)!
NixOS has also meanwhile gained a stock UKI module based on systemd's
ukify
, so I think it should be possible to use that, addingboot.uki.settings.UKI.{DeviceTreeAuto,HWIDs}
for DTB selection (no existing download of the HWID files in JSON format yet: https://github.com/TravMurav/dtbloader/issues/7current JSON file collection), and signing can be added in the same place! It's only thesystemd-boot-builder
that would need to be extended or replaced to drop the UKIs into the ESP instead of generating configs (and systemd-boot itself should be signed for Secure Boot).I guess you are right, I usually think of Secure Boot as something that's easy to turn off for an attacker, but as long as your hardware is reasonably well protected against resetting the UEFI password, I think it should be mostly secure. (We should be on the lookout for any "BIOS reset" jumpers on X1E motherboards though, on my desktop motherboard at least there is just a labeled jumper for this.)