Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp572352ybx; Wed, 30 Oct 2019 20:33:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyX4+sp6/o5s8TST6ZXDEIO3YP8LJwIppsMTKB+vE05Ce+zRXQHTxhirhcSOYGwRT+oFen X-Received: by 2002:a17:906:3592:: with SMTP id o18mr1594619ejb.17.1572492786130; Wed, 30 Oct 2019 20:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572492786; cv=none; d=google.com; s=arc-20160816; b=jsk6sZWHkd4zggd2XZOWopApcZGQ1bZ/3LubXK1NbLGvtr5UZ3PAvvtF2zHBk2+5vD krhkO4Lwsq9wfvIfYXYW6942TrQTw1dj/kHWQnUikKqoXaYAQpOHlhK8nALOionAAXIq 3nwWWQZuwqsJ9I1gvnYszffxFKXGvNCjhMBXi13eN6bS52E9IHrUZh7Pr58Vjn23rgsi clvGsa77MXPuUXxNK5LUVRkUaWOaKmMi8TDpXuQQjwUycCfUpmU6qCK8S5OC40287wlG WWM+sYYl3IpshL0T0KbV/Z/LufsL+rLsnRXAecyvxW2vBj7c5JveYgG9qf692hGdEtqw lFbg== 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=Rtk2GzfXAV7pONIMMJ9wlgtW3WwW9CXfXkfSaYKmT8s=; b=k5Sucq5RnbR0dcHdHnDPW9kgEvCkNiDbc0Uu5WNLQP7KwsG3GP7EWsh2XQxH0U0ZXZ +t2vIY+LAqCrSSRBCu3xgRup9kzHl0OywWrUGmZfnj7m/5fynp/hvkHN0nJm/YKwQL7H w+YuAgQ41lXubijK8A5OTaD38M0g7oqk3AW7SNCw41bZlvl6pX+SR3SLzN8GEQ4rPsBI 1cHRwC9CMyXrzA7ItEbz3p34gG9Ccs5/FtLBxZEFGpSbSTyJdLACKI20AEyEi5HKsNzZ GQa7C3KeNmEpwaYEUTxRfrVBRBR0Et+iMlh1f0FlRIXOjwLLcCpRZptWyPyIiJDWDr4L IPYw== 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 a40si2997250edc.92.2019.10.30.20.32.41; Wed, 30 Oct 2019 20:33:06 -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 S1726911AbfJaDb5 (ORCPT + 99 others); Wed, 30 Oct 2019 23:31:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43978 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726830AbfJaDb4 (ORCPT ); Wed, 30 Oct 2019 23:31:56 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x9V3RvKC101573 for ; Wed, 30 Oct 2019 23:31:55 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2vypg8t4ga-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Oct 2019 23:31:54 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 31 Oct 2019 03:31:53 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 31 Oct 2019 03:31:48 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x9V3VlHN54067224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2019 03:31:47 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0CE0AA405B; Thu, 31 Oct 2019 03:31:47 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66198A405F; Thu, 31 Oct 2019 03:31:45 +0000 (GMT) Received: from localhost.ibm.com (unknown [9.85.201.217]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 31 Oct 2019 03:31:45 +0000 (GMT) From: Mimi Zohar To: linuxppc-dev@ozlabs.org, linux-efi@vger.kernel.org, linux-integrity@vger.kernel.org Cc: Nayna Jain , linux-kernel@vger.kernel.org, Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Ard Biesheuvel , Jeremy Kerr , Eric Ricther , "Oliver O'Halloran" , Mimi Zohar Subject: [PATCH v10 4/9] powerpc/ima: define trusted boot policy Date: Wed, 30 Oct 2019 23:31:29 -0400 X-Mailer: git-send-email 2.7.5 In-Reply-To: <1572492694-6520-1-git-send-email-zohar@linux.ibm.com> References: <1572492694-6520-1-git-send-email-zohar@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19103103-0016-0000-0000-000002BF5594 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19103103-0017-0000-0000-00003320B621 Message-Id: <1572492694-6520-5-git-send-email-zohar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-31_01:,, 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=922 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910310031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nayna Jain This patch defines an arch-specific trusted boot only policy and a combined secure and trusted boot policy. Signed-off-by: Nayna Jain Signed-off-by: Mimi Zohar --- arch/powerpc/kernel/ima_arch.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/ima_arch.c b/arch/powerpc/kernel/ima_arch.c index d88913dc0da7..0ef5956c9753 100644 --- a/arch/powerpc/kernel/ima_arch.c +++ b/arch/powerpc/kernel/ima_arch.c @@ -31,13 +31,44 @@ static const char *const secure_rules[] = { }; /* + * The "trusted_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. */ 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.7.5