Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/efi: Implement arch_ima_efi_boot_mode() in source file

The x86 implementation of arch_ima_efi_boot_mode() uses the global
boot_param state. Move it into a source file to clean up the header.
Avoid potential rebuilds of unrelated source files if boot_params
changes.

Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20240112095000.8952-4-tzimmermann@suse.de

authored by

Thomas Zimmermann and committed by
Borislav Petkov (AMD)
785ddc8b 2afa7994

+8 -2
+3 -2
arch/x86/include/asm/efi.h
··· 409 409 extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap, 410 410 void *buf, struct efi_mem_range *mem); 411 411 412 - #define arch_ima_efi_boot_mode \ 413 - ({ extern struct boot_params boot_params; boot_params.secure_boot; }) 412 + extern enum efi_secureboot_mode __x86_ima_efi_boot_mode(void); 413 + 414 + #define arch_ima_efi_boot_mode __x86_ima_efi_boot_mode() 414 415 415 416 #ifdef CONFIG_EFI_RUNTIME_MAP 416 417 int efi_get_runtime_map_size(void);
+5
arch/x86/platform/efi/efi.c
··· 950 950 } 951 951 return attr->mode; 952 952 } 953 + 954 + enum efi_secureboot_mode __x86_ima_efi_boot_mode(void) 955 + { 956 + return boot_params.secure_boot; 957 + }