Skip to content

Commit fa4f3f5

Browse files
naynajainmpe
authored andcommitted
powerpc/ima: Fix secure boot rules in ima arch policy
To prevent verifying the kernel module appended signature twice (finit_module), once by the module_sig_check() and again by IMA, powerpc secure boot rules define an IMA architecture specific policy rule only if CONFIG_MODULE_SIG_FORCE is not enabled. This, unfortunately, does not take into account the ability of enabling "sig_enforce" on the boot command line (module.sig_enforce=1). Including the IMA module appraise rule results in failing the finit_module syscall, unless the module signing public key is loaded onto the IMA keyring. This patch fixes secure boot policy rules to be based on CONFIG_MODULE_SIG instead. Fixes: 4238fad ("powerpc/ima: Add support to initialize ima policy rules") Signed-off-by: Nayna Jain <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Mimi Zohar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c44dc63 commit fa4f3f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/powerpc/kernel/ima_arch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ bool arch_ima_get_secureboot(void)
1919
* to be stored as an xattr or as an appended signature.
2020
*
2121
* To avoid duplicate signature verification as much as possible, the IMA
22-
* policy rule for module appraisal is added only if CONFIG_MODULE_SIG_FORCE
22+
* policy rule for module appraisal is added only if CONFIG_MODULE_SIG
2323
* is not enabled.
2424
*/
2525
static const char *const secure_rules[] = {
2626
"appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
27-
#ifndef CONFIG_MODULE_SIG_FORCE
27+
#ifndef CONFIG_MODULE_SIG
2828
"appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
2929
#endif
3030
NULL
@@ -50,7 +50,7 @@ static const char *const secure_and_trusted_rules[] = {
5050
"measure func=KEXEC_KERNEL_CHECK template=ima-modsig",
5151
"measure func=MODULE_CHECK template=ima-modsig",
5252
"appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
53-
#ifndef CONFIG_MODULE_SIG_FORCE
53+
#ifndef CONFIG_MODULE_SIG
5454
"appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
5555
#endif
5656
NULL

0 commit comments

Comments
 (0)