Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2245849ybg; Sat, 19 Oct 2019 11:07:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7deT6cRFs8ky5vSx8CfMtVYGssSwn60TVyj0rcywssZpKaMWvf8mo5CGqbBvcOYyGEL/i X-Received: by 2002:a05:6402:2042:: with SMTP id bc2mr16366295edb.12.1571508454706; Sat, 19 Oct 2019 11:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571508454; cv=none; d=google.com; s=arc-20160816; b=QvnxD6p48J/eIGbe0eBusm0rZqPzyKFqRx2ra+boXt9V4OiTOfAdUa+or3RqLedXhV GCbtBLOCwlmJt9Yoxu3N1RitRK9EsI3T2RuKRUEO3JTkcYodQydUsvUWC2CD4sUIpLaZ YuBkeMZIIZl5opB89DvE6SDwnpPrPDScfaAkq03p5B4Dwulgx02Q+moNVVhWvAe3ktTa NBcTD/Kx6SmJg9URJWw8Z/R0q6PImXF9I5gXSC+9YawaevgVIvASp6n2qBOgtHcUgTyY 4XRb5DpiQaqGsHA3qyC+UAm6NrfKO6o793JBAUk8zN5sDP0Zq09I6ytqnn4six068OnU Q8sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=fQYJx/8yDuaxCBS6HC2JXEDZ/0ngTpVJ7sNDumeqBhE=; b=StpS81DkUXhLiyd09P79XaxwuiSoFvmttCz08cALdeROhBjIHAtTN5R1odQ0a513r0 b8QI9BtkjMe9Oqxta4Qngd7XUeu0mb5zbNXjHeRAJFcQXusfGaYMmZtHoVIB0WoP9aJC EFCevU5ytLbYu4m7j8Npew2VbIFpW2rjH+hkRmyKx9LiwusP2rJvnjpzo5Fp/9hDL6Xb /nXu5nfVqc2oJ0Gu5V638yQlJN+qdrB2i2BrP+cJBmd1v77faiuOcnb5+SFOlY+Ovq0q b5mU/RCMl2iKzK7VmtdjAjfwWGBA5NvuQhc90EuW7PRFXvhIuJHDz+3Iudn65+4rUjVH 10ZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jz12si5481655ejb.193.2019.10.19.11.07.11; Sat, 19 Oct 2019 11:07:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbfJSSGw (ORCPT + 99 others); Sat, 19 Oct 2019 14:06:52 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48716 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726225AbfJSSGv (ORCPT ); Sat, 19 Oct 2019 14:06:51 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x9JI6fcV042379 for ; Sat, 19 Oct 2019 14:06:50 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vqucefpvs-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 19 Oct 2019 14:06:50 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 19 Oct 2019 19:06:48 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 19 Oct 2019 19:06:44 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x9JI6g5w32571810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 19 Oct 2019 18:06:42 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE3635204F; Sat, 19 Oct 2019 18:06:42 +0000 (GMT) Received: from swastik.ibm.com (unknown [9.85.146.216]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id EB7F752050; Sat, 19 Oct 2019 18:06:39 +0000 (GMT) From: Nayna Jain To: linuxppc-dev@ozlabs.org, linux-efi@vger.kernel.org, linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Ard Biesheuvel , Jeremy Kerr , Matthew Garret , Mimi Zohar , Greg Kroah-Hartman , Claudio Carvalho , George Wilson , Elaine Palmer , Eric Ricther , "Oliver O'Halloran" , Nayna Jain , Prakhar Srivastava , Lakshmi Ramasubramanian Subject: [PATCH v8 4/8] powerpc/ima: add measurement rules to ima arch specific policy Date: Sat, 19 Oct 2019 14:06:13 -0400 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1571508377-23603-1-git-send-email-nayna@linux.ibm.com> References: <1571508377-23603-1-git-send-email-nayna@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19101918-0008-0000-0000-0000032401CB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19101918-0009-0000-0000-00004A4325F1 Message-Id: <1571508377-23603-5-git-send-email-nayna@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-19_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910190171 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the measurement rules to the arch specific policies on trusted boot enabled systems. Signed-off-by: Nayna Jain --- arch/powerpc/kernel/ima_arch.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/ima_arch.c b/arch/powerpc/kernel/ima_arch.c index 65d82ee74ea4..710872ea8f35 100644 --- a/arch/powerpc/kernel/ima_arch.c +++ b/arch/powerpc/kernel/ima_arch.c @@ -26,6 +26,32 @@ static const char *const secure_rules[] = { NULL }; +/* + * The "measure_rules" are enabled only on "trustedboot" enabled systems. + * These rules add the kexec kernel image and kernel modules file hashes to + * the IMA measurement list. + */ +static const char *const trusted_rules[] = { + "measure func=KEXEC_KERNEL_CHECK", + "measure func=MODULE_CHECK", + NULL +}; + +/* + * The "secure_and_trusted_rules" contains rules for both the secure boot and + * trusted boot. The "template=ima-modsig" option includes the appended + * signature, when available, in the IMA measurement list. + */ +static const char *const secure_and_trusted_rules[] = { + "measure func=KEXEC_KERNEL_CHECK template=ima-modsig", + "measure func=MODULE_CHECK template=ima-modsig", + "appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig|modsig", +#ifndef CONFIG_MODULE_SIG_FORCE + "appraise func=MODULE_CHECK appraise_type=imasig|modsig", +#endif + NULL +}; + /* * Returns the relevant IMA arch-specific policies based on the system secure * boot state. @@ -33,7 +59,13 @@ static const char *const secure_rules[] = { const char *const *arch_get_ima_policy(void) { if (is_ppc_secureboot_enabled()) - return secure_rules; + if (is_ppc_trustedboot_enabled()) + return secure_and_trusted_rules; + else + return secure_rules; + else + if (is_ppc_trustedboot_enabled()) + return trusted_rules; return NULL; } -- 2.20.1