]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-boot: pad .sbat section to 1k bytes
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 18 Aug 2025 07:43:26 +0000 (09:43 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 Aug 2025 09:50:27 +0000 (11:50 +0200)
commitb4a1854397e4072f884dd23c5ec2da22bd2cf114
tree613fa34552dec892df4dec1678d076afa09cf19f
parentec1d031f3de02f84beca89e2b402d085fba62be4
sd-boot: pad .sbat section to 1k bytes

Fedora's kernels now ship with a .sbat section:
  kernel,1,Red Hat,kernel-core,6.17.0-0.rc1.250814g0cc53520e68b.20.fc44.x86_64,mailto:secalert@redhat.com
  kernel.fedora,1,Red Hat,kernel-core,6.17.0-0.rc1.250814g0cc53520e68b.20.fc44.x86_64,mailto:secalert@redhat.com
This pushes the combined .sbat section just over its pre-allocated size of 512 bytes:
  File "/usr/bin/ukify", line 1048, in pe_add_sections
    raise PEError(f'Not enough space in existing section {section.name} to append new data')
  PEError: Not enough space in existing section .sbat to append new data

PE sections need to align to 512 bytes, so to make it all fit we pad the .sbat
section with zeros to 1k. Various tools already should strip trailing zeros when
using sbat sections, since ukify always inserts a trailing NUL.

The defines are moved to sbat.h, they are used only in sd-stub and sd-boot.
src/boot/stub.c
src/fundamental/macro-fundamental.h
src/fundamental/sbat.h