RE: [PATCH V3 2/5] efi: Introduce __efi_init attribute

From: Prakhya, Sai Praneeth
Date: Tue Sep 04 2018 - 18:25:16 EST


Hi Boris and Ard,

> Buggy firmware could illegally access some efi regions even after the kernel has
> assumed control of the platform. When
> "CONFIG_EFI_WARN_ON_ILLEGAL_ACCESS" is enabled, the efi page fault
> handler will detect and recover from these illegal accesses.
> efi_md_typeattr_format() and memory_type_name are used by the efi page
> fault handler to print information about memory descriptor that was illegally
> accessed. As the page fault handler is present during/after kernel boot it doesn't
> have an __init attribute, but
> efi_md_typeattr_format() has it and thus during kernel build, "WARNING:
> modpost: Found * section mismatch(es)" build warning is observed. To fix it,
> remove __init attribute for efi_md_typeattr_format().
>
> In order to not keep efi_md_typeattr_format() and memory_type_name
> needlessly when "CONFIG_EFI_WARN_ON_ILLEGAL_ACCESS" is not selected,
> add a new __efi_init attribute whose value changes based on whether the config
> option is selected or not.

In previous versions (i.e. up to V2), where we handled EFI_BOOT_SERVICES_<CODE/DATA>
regions differently, it made sense to have a separate attribute like __efi_init because many
function definitions were modified. From V3, do you think it's still OK to have __efi_init or
should I just remove __init attribute (and not have __efi_init) for efi_md_typeattr_format()
and memory_type_name because we are just modifying two.

Regards,
Sai