mkosi uses sbvarsign to sign PK, KEK and db signature lists for use with systemd-boot secure boot auto-enrollment. sbsigntools, when built against gnu-efi 3.18.0 produces a signed PK signature list that results in a security violation when systemd-boot tries to enroll it within a UEFI OVMF virtual machine. If I install sbsigntools-0.9.5-1.fc38.x86_64.rpm from Fedora 38 the signed PK signature list is accepted again by the OVMF secure boot firmware. If I build sbsigntools from Fedora Rawhide against gnu-efi 3.11.0, the PK signature list is also accepted as expected. This leads me to believe that gnu-efi 3.18.0 is what's causing this breakage. Reproducible: Always Steps to Reproduce: On a Fedora 40 or rawhide system, run the following: - git clone https://github.com/systemd/mkosi - ln -s $PWD/mkosi/bin/mkosi /usr/local/bin/mkosi - mkdir tmp - cd tmp - mkosi genkey - mkosi -d fedora -r rawhide -p kernel-core -p systemd -p udev -p systemd-boot --secure-boot --secure-boot-auto-enroll=yes -i -f qemu Actual Results: Enrolling secure boot keys from directory: \loader\keys\auto Failed to write PK secure boot variable: Security violation Expected Results: Enrolling secure boot keys from directory: \loader\keys\auto Custom Secure Boot keys successfully enrolled, rebooting the system now!
Bisected to 189200d0b0f6fff473d302880d9569f45d4d8c4d. If I revert that on top of the gnu-efi master branch I can't reproduce the issue anymore.
The fix is to build sbsigntools with -fshort-wchar
That commit exists in gnu-efi-3.0.16, too.
I looked at the commit in gnu-efi and it looks correct. See also https://github.com/ncroxon/gnu-efi/commit/edfda7c396134c7109444b230ce4b0da1e61d524 . It looks like uint16_t should be used instead of wchar_t and -fshort-wchar. So the bug might actually be in sbsigntools.
gnu-efi upstream also says the bug is in sbsigntools, so reassigning.
Daan, can you try this? https://src.fedoraproject.org/rpms/sbsigntools/pull-request/2
FEDORA-2024-caed0c598b (sbsigntools-0.9.5-7.fc42) has been submitted as an update to Fedora 42. https://bodhi.fedoraproject.org/updates/FEDORA-2024-caed0c598b
FEDORA-2024-caed0c598b (sbsigntools-0.9.5-7.fc42) has been pushed to the Fedora 42 stable repository. If problem still persists, please make note of it in this bug report.