blob: 1ba2c2fc99e0a6bc252df96c0bf6af631fa45150 [file] [log] [blame]
Joel Stanleya1fccbf2020-06-23 17:25:56 +09301From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Nayna Jain <nayna@linux.ibm.com>
3Date: Fri, 1 May 2020 10:16:52 -0400
Joel Stanleycb9bf572020-09-29 16:18:12 +09304Subject: [PATCH 16/19] powerpc/ima: Fix secure boot rules in ima arch policy
Joel Stanleya1fccbf2020-06-23 17:25:56 +09305
6To prevent verifying the kernel module appended signature
7twice (finit_module), once by the module_sig_check() and again by IMA,
8powerpc secure boot rules define an IMA architecture specific policy
9rule only if CONFIG_MODULE_SIG_FORCE is not enabled. This,
10unfortunately, does not take into account the ability of enabling
11"sig_enforce" on the boot command line (module.sig_enforce=1).
12
13Including the IMA module appraise rule results in failing the
14finit_module syscall, unless the module signing public key is loaded
15onto the IMA keyring.
16
17This patch fixes secure boot policy rules to be based on
18CONFIG_MODULE_SIG instead.
19
20Fixes: 4238fad366a6 ("powerpc/ima: Add support to initialize ima policy rules")
21Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
22Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
23Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
24Link: https://lore.kernel.org/r/1588342612-14532-1-git-send-email-nayna@linux.ibm.com
25(cherry picked from commit fa4f3f56ccd28ac031ab275e673ed4098855fed4)
26Signed-off-by: Joel Stanley <joel@jms.id.au>
27---
28 arch/powerpc/kernel/ima_arch.c | 6 +++---
29 1 file changed, 3 insertions(+), 3 deletions(-)
30
31diff --git a/arch/powerpc/kernel/ima_arch.c b/arch/powerpc/kernel/ima_arch.c
32index e34116255ced..957abd592075 100644
33--- a/arch/powerpc/kernel/ima_arch.c
34+++ b/arch/powerpc/kernel/ima_arch.c
35@@ -19,12 +19,12 @@ bool arch_ima_get_secureboot(void)
36 * to be stored as an xattr or as an appended signature.
37 *
38 * To avoid duplicate signature verification as much as possible, the IMA
39- * policy rule for module appraisal is added only if CONFIG_MODULE_SIG_FORCE
40+ * policy rule for module appraisal is added only if CONFIG_MODULE_SIG
41 * is not enabled.
42 */
43 static const char *const secure_rules[] = {
44 "appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
45-#ifndef CONFIG_MODULE_SIG_FORCE
46+#ifndef CONFIG_MODULE_SIG
47 "appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
48 #endif
49 NULL
50@@ -50,7 +50,7 @@ static const char *const secure_and_trusted_rules[] = {
51 "measure func=KEXEC_KERNEL_CHECK template=ima-modsig",
52 "measure func=MODULE_CHECK template=ima-modsig",
53 "appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
54-#ifndef CONFIG_MODULE_SIG_FORCE
55+#ifndef CONFIG_MODULE_SIG
56 "appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
57 #endif
58 NULL