• Ard Biesheuvel's avatar
    ima: defer arch_ima_get_secureboot() call to IMA init time · b000d5cb
    Ard Biesheuvel authored
    Chester reports that it is necessary to introduce a new way to pass
    the EFI secure boot status between the EFI stub and the core kernel
    on ARM systems. The usual way of obtaining this information is by
    checking the SecureBoot and SetupMode EFI variables, but this can
    only be done after the EFI variable workqueue is created, which
    occurs in a subsys_initcall(), whereas arch_ima_get_secureboot()
    is called much earlier by the IMA framework.
    
    However, the IMA framework itself is started as a late_initcall,
    and the only reason the call to arch_ima_get_secureboot() occurs
    so early is because it happens in the context of a __setup()
    callback that parses the ima_appraise= command line parameter.
    
    So let's refactor this code a little bit, by using a core_param()
    callback to capture the command line argument, and deferring any
    reasoning based on its contents to the IMA init routine.
    
    Cc: Chester Lin <clin@suse.com>
    Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
    Cc: James Morris <jmorris@namei.org>
    Cc: "Serge E. Hallyn" <serge@hallyn.com>
    Link: https://lore.kernel.org/linux-arm-kernel/20200904072905.25332-2-clin@suse.com/Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Reported-by: kernel test robot <lkp@intel.com> [missing core_param()]
    [zohar@linux.ibm.com: included linux/module.h]
    Tested-by: default avatarChester Lin <clin@suse.com>
    Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
    b000d5cb
ima_appraise.c 15.2 KB