Skip to content

Commit 785ddc8

Browse files
Thomas Zimmermannbp3tk0v
authored andcommitted
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
1 parent 2afa799 commit 785ddc8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

arch/x86/include/asm/efi.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md,
409409
extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap,
410410
void *buf, struct efi_mem_range *mem);
411411

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()
414415

415416
#ifdef CONFIG_EFI_RUNTIME_MAP
416417
int efi_get_runtime_map_size(void);

arch/x86/platform/efi/efi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,3 +950,8 @@ umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n)
950950
}
951951
return attr->mode;
952952
}
953+
954+
enum efi_secureboot_mode __x86_ima_efi_boot_mode(void)
955+
{
956+
return boot_params.secure_boot;
957+
}

0 commit comments

Comments
 (0)