File tree Expand file tree Collapse file tree 4 files changed +59
-2
lines changed Expand file tree Collapse file tree 4 files changed +59
-2
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,30 @@ config EFI_EMBEDDED_FIRMWARE
281281 bool
282282 select CRYPTO_LIB_SHA256
283283
284+ config EFI_SBAT
285+ def_bool y if EFI_SBAT_FILE!=""
286+
287+ config EFI_SBAT_FILE
288+ string "Embedded SBAT section file path"
289+ depends on EFI_ZBOOT
290+ help
291+ SBAT section provides a way to improve SecureBoot revocations of UEFI
292+ binaries by introducing a generation-based mechanism. With SBAT, older
293+ UEFI binaries can be prevented from booting by bumping the minimal
294+ required generation for the specific component in the bootloader.
295+
296+ Note: SBAT information is distribution specific, i.e. the owner of the
297+ signing SecureBoot certificate must define the SBAT policy. Linux
298+ kernel upstream does not define SBAT components and their generations.
299+
300+ See https://github.com/rhboot/shim/blob/main/SBAT.md for the additional
301+ details.
302+
303+ Specify a file with SBAT data which is going to be embedded as '.sbat'
304+ section into the kernel.
305+
306+ If unsure, leave blank.
307+
284308endmenu
285309
286310config UEFI_CPER
Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ AFLAGS_zboot-header.o += -DMACHINE_TYPE=IMAGE_FILE_MACHINE_$(EFI_ZBOOT_MACH_TYPE
4444$(obj)/zboot-header.o: $(srctree)/drivers/firmware/efi/libstub/zboot-header.S FORCE
4545 $(call if_changed_rule,as_o_S)
4646
47+ ifneq ($(CONFIG_EFI_SBAT_FILE),)
48+ $(obj)/zboot-header.o: $(CONFIG_EFI_SBAT_FILE)
49+ endif
50+
4751ZBOOT_DEPS := $(obj)/zboot-header.o $(objtree)/drivers/firmware/efi/libstub/lib.a
4852
4953LDFLAGS_vmlinuz.efi.elf := -T $(srctree)/drivers/firmware/efi/libstub/zboot.lds
Original file line number Diff line number Diff line change @@ -123,11 +123,29 @@ __efistub_efi_zboot_header:
123123 IMAGE_SCN_MEM_READ | \
124124 IMAGE_SCN_MEM_EXECUTE
125125
126+ #ifdef CONFIG_EFI_SBAT
127+ .ascii ".sbat\0\0\0"
128+ .long __sbat_size
129+ .long _sbat - .Ldoshdr
130+ .long __sbat_size
131+ .long _sbat - .Ldoshdr
132+
133+ .long 0 , 0
134+ .short 0 , 0
135+ .long IMAGE_SCN_CNT_INITIALIZED_DATA | \
136+ IMAGE_SCN_MEM_READ | \
137+ IMAGE_SCN_MEM_DISCARDABLE
138+
139+ .pushsection ".sbat" , "a" , @progbits
140+ .incbin CONFIG_EFI_SBAT_FILE
141+ .popsection
142+ #endif
143+
126144 .ascii ".data\0\0\0"
127145 .long __data_size
128- .long _etext - .Ldoshdr
146+ .long _data - .Ldoshdr
129147 .long __data_rawsize
130- .long _etext - .Ldoshdr
148+ .long _data - .Ldoshdr
131149
132150 .long 0 , 0
133151 .short 0 , 0
Original file line number Diff line number Diff line change @@ -29,7 +29,17 @@ SECTIONS
2929 . = _etext;
3030 }
3131
32+ #ifdef CONFIG_EFI_SBAT
33+ .sbat : ALIGN (4096 ) {
34+ _sbat = .;
35+ *(.sbat )
36+ _esbat = ALIGN (4096 );
37+ . = _esbat;
38+ }
39+ #endif
40+
3241 .data : ALIGN (4096 ) {
42+ _data = .;
3343 *(.data * .init .data *)
3444 _edata = ALIGN (512 );
3545 . = _edata;
@@ -52,3 +62,4 @@ PROVIDE(__efistub__gzdata_size =
5262
5363PROVIDE (__data_rawsize = ABSOLUTE (_edata - _etext));
5464PROVIDE (__data_size = ABSOLUTE (_end - _etext));
65+ PROVIDE (__sbat_size = ABSOLUTE (_esbat - _sbat));
You can’t perform that action at this time.
0 commit comments