FS#71822 - [sbsigntools] EFI singing checksum is wrong

Attached to Project: Arch Linux
Opened by Anatoly Velizhanin (anveliz) - Friday, 13 August 2021, 03:28 GMT
Last edited by David Runge (dvzrv) - Saturday, 02 September 2023, 13:41 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Tobias Powalowski (tpowa)
David Runge (dvzrv)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



A good description is here: https://bugs.launchpad.net/lp-signing/+bug/1921387

Briefly, when I need to sign EFI stub unified kernel, sbsign signs it with a wrong checksum so the file can't be validated by secure boot (and properly signed with osslsigncode files can't be validated by sbverify).

Additional info:
* package version(s) 0.9.4-1
* config and/or log files etc.
* link to upstream bug report, if any: https://bugs.launchpad.net/lp-signing/+bug/1921387

Steps to reproduce:
just create a PE/COFF file with gaps between sections with e.g.:

objcopy \
--add-section .osrel="/usr/lib/os-release" --change-section-vma .osrel=0x20000 \
--add-section .cmdline="/etc/commandline.conf" --change-section-vma .cmdline=0x30000 \
--add-section .linux="/boot/vmlinuz-linux" --change-section-vma .linux=0x40000 \
--add-section .initrd="/boot/initramfs-linux.img" --change-section-vma .initrd=0x3000000 \
"/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "/efi/EFI/Linux/Arch.efi"

then sign it with osslsigncode (from AUR) and the checksums are different. the file signed with osslsigncode passes secure boot validation, and the one signed with sbsign doesn't.

Btw, it seems that the package in arch repo is outdated since it has been fired already in ubuntu e.g.
This task depends upon

Closed by  David Runge (dvzrv)
Saturday, 02 September 2023, 13:41 GMT
Reason for closing:  No response
Comment by loqs (loqs) - Saturday, 01 October 2022, 19:37 GMT
Is the issue still fixed with the current Ubuntu release sbsigntool (0.9.4-3.1ubuntu1) kinetic? If so which patches from [1] need to be applied?

[1] https://git.launchpad.net/ubuntu/+source/sbsigntool/tree/debian/patches?id=d5ba5be2c8351d65a4496e29a8111f9f6ad55144