[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN PATCH] sbat: Add SBAT section to the xen binary
The SBAT section provides a way for the binary to declare a generation id for its upstream source and any vendor changes applied. A compatible loader can then revoke vulnerable binaries by generation, using the binary's declared generation id(s) to determine if it is safe to load. More information about SBAT is available here: https://github.com/rhboot/shim/blob/main/SBAT.md Vendors should append a custom line onto sbat.csv(.in) with their vendor specific sbat data. Populate the SBAT section in the Xen binary by using the information in xen/arch/x86/sbat.csv.in Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@xxxxxxxxx> Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxx> Tested-by: Gerald Elder-Vass <gerald.elder-vass@xxxxxxxxx> diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index d902fb7accd9..6db7475c2c23 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -74,6 +74,7 @@ obj-$(CONFIG_TBOOT) += tboot.o obj-y += hpet.o obj-y += vm_event.o obj-y += xstate.o +obj-y += sbat_data.o ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) obj-y += domctl.o @@ -277,6 +278,12 @@ $(obj)/efi.lds: AFLAGS-y += -DEFI $(obj)/xen.lds $(obj)/efi.lds: $(src)/xen.lds.S FORCE $(call if_changed_dep,cpp_lds_S) +$(obj)/sbat.csv: $(src)/sbat.csv.in + sed "s/@@VERSION@@/${XEN_FULLVERSION}/" $< > $@ + +$(obj)/sbat_data.o: $(obj)/sbat.csv + $(OBJCOPY) -I binary -O elf64-x86-64 --rename-section .data=.sbat,readonly,data,contents $< $@ + clean-files := \ include/asm/asm-macros.* \ $(objtree)/.xen-syms.[0-9]* \ diff --git a/xen/arch/x86/sbat.csv.in b/xen/arch/x86/sbat.csv.in new file mode 100644 index 000000000000..7cdc33dbd998 --- /dev/null +++ b/xen/arch/x86/sbat.csv.in @@ -0,0 +1,2 @@ +sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md +xen,1,Linux Foundation,xen,@@VERSION@@,https://xenproject.org/ diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 9a1dfe1b340a..e6405941e1b7 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -343,6 +343,8 @@ SECTIONS *(.reloc) __base_relocs_end = .; } + + .sbat (NOLOAD) : { *(.sbat) } #elif defined(XEN_BUILD_EFI) /* * Due to the way EFI support is currently implemented, these two symbols diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h index a17810bb286f..756f97d48183 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -92,7 +92,8 @@ *(.comment.*) \ *(.note.*) #else -#define DISCARD_EFI_SECTIONS +#define DISCARD_EFI_SECTIONS \ + *(.sbat) #endif /* Sections to be discarded. */
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |