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
281
281
bool
282
282
select CRYPTO_LIB_SHA256
283
283
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
+
284
308
endmenu
285
309
286
310
config 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
44
44
$(obj)/zboot-header.o: $(srctree)/drivers/firmware/efi/libstub/zboot-header.S FORCE
45
45
$(call if_changed_rule,as_o_S)
46
46
47
+ ifneq ($(CONFIG_EFI_SBAT_FILE),)
48
+ $(obj)/zboot-header.o: $(CONFIG_EFI_SBAT_FILE)
49
+ endif
50
+
47
51
ZBOOT_DEPS := $(obj)/zboot-header.o $(objtree)/drivers/firmware/efi/libstub/lib.a
48
52
49
53
LDFLAGS_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:
123
123
IMAGE_SCN_MEM_READ | \
124
124
IMAGE_SCN_MEM_EXECUTE
125
125
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
+
126
144
.ascii ".data\0\0\0"
127
145
.long __data_size
128
- .long _etext - .Ldoshdr
146
+ .long _data - .Ldoshdr
129
147
.long __data_rawsize
130
- .long _etext - .Ldoshdr
148
+ .long _data - .Ldoshdr
131
149
132
150
.long 0 , 0
133
151
.short 0 , 0
Original file line number Diff line number Diff line change @@ -29,7 +29,17 @@ SECTIONS
29
29
. = _etext;
30
30
}
31
31
32
+ #ifdef CONFIG_EFI_SBAT
33
+ .sbat : ALIGN (4096) {
34
+ _sbat = .;
35
+ *(.sbat)
36
+ _esbat = ALIGN (4096);
37
+ . = _esbat;
38
+ }
39
+ #endif
40
+
32
41
.data : ALIGN (4096) {
42
+ _data = .;
33
43
*(.data* .init.data*)
34
44
_edata = ALIGN (512);
35
45
. = _edata;
@@ -52,3 +62,4 @@ PROVIDE(__efistub__gzdata_size =
52
62
53
63
PROVIDE (__data_rawsize = ABSOLUTE(_edata - _etext ));
54
64
PROVIDE (__data_size = ABSOLUTE(_end - _etext ));
65
+ PROVIDE (__sbat_size = ABSOLUTE(_esbat - _sbat ));
You can’t perform that action at this time.
0 commit comments