Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2652590ybl; Mon, 19 Aug 2019 05:36:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAuDB/LVMTok5PVOPfkbUj/AItbDJ1MvV0kg53cJBbbIdbg3I4Zee/0i45vnyiUBbhwXNZ X-Received: by 2002:a17:902:8b8a:: with SMTP id ay10mr7145186plb.305.1566218191563; Mon, 19 Aug 2019 05:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566218191; cv=none; d=google.com; s=arc-20160816; b=E2Wl1EgOUT68ZO4Rh0OvAz5EGmvynTzhQVjPF2sehQ/3FVKjhMnOrRTYTrvXtDSHrh IQvx5wXqn20oG+1bXqadj3lsdraQEFwoRSMUqmbprKgWaytmUD01vPQiMHJP4gv0EU1f j47mp5KDMax76hCnqFuzYctEilMkhjuvfbE/EgHhOVrzjtslQZk6wwbu2VESR3IsiID3 08y8shihIqtVuHt+1wgrYDuPcVALYmweVxywaF+elXQ79+lJiVqYgKUiMyS3fI0N6s22 unwgDcd4TZyGYEM/2QEszm0V+pvbWv4lP/w91xDiLrU61fdLKYOgnguLGj/5Ww/OIOS5 mChg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=R5eAN7O4PgZL9MhLQelnTaCUN1q+DroYTnYTtLEg1zg=; b=Jsc7NaCN0ISs9kEP3Hi48nwlPtjvljnhG2Q3Djaywh9keqVGvz+3bEzLZJZYsmE54X c3n25Pg105i68qbUNlpPSiYr1fi+Ut8vEDUa8r8zis8uJoBSbBzgXcxWhRmF16F73A9F C/wDdEiYa3dXLGGgbJ57qsnaukH0hAxkJPbGAsx67iORdlWhB2MlS7gqnusiIlPTvGDE 7e9iuxWRFoUnq4CsqbFUW/YVnDrScXLHr7Fticjy9VycU64tVcH4eQYEFunL+eHlgkAU 6HOokbcwoJOqZaQ3ak1tvWB0UGuHrE0g8VxPPzlYlOJddEDrfTUY/NGyQmZP+F2WK0+3 3Jzw== 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 g13si9843547pgj.498.2019.08.19.05.36.15; Mon, 19 Aug 2019 05:36:31 -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 S1727445AbfHSMf0 (ORCPT + 99 others); Mon, 19 Aug 2019 08:35:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48636 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726755AbfHSMf0 (ORCPT ); Mon, 19 Aug 2019 08:35:26 -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 x7JCYMM5042519 for ; Mon, 19 Aug 2019 08:35:24 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ufufh95cc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 19 Aug 2019 08:35:24 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Aug 2019 13:35:22 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) 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) Mon, 19 Aug 2019 13:35:19 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7JCYvPq27525584 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2019 12:34:57 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AEB5111C05B; Mon, 19 Aug 2019 12:35:17 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 467BA11C058; Mon, 19 Aug 2019 12:35:15 +0000 (GMT) Received: from swastik.ibm.com (unknown [9.80.231.242]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 19 Aug 2019 12:35:15 +0000 (GMT) From: Nayna Jain To: linuxppc-dev@ozlabs.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt , Ard Biesheuvel , Jeremy Kerr , Matthew Garret , Mimi Zohar , Claudio Carvalho , Elaine Palmer , George Wilson , Eric Ricther , Nayna Jain Subject: [PATCH v5 0/2] powerpc: Enabling IMA arch specific secure boot policies Date: Mon, 19 Aug 2019 08:35:06 -0400 X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 x-cbid: 19081912-0008-0000-0000-0000030AB4F0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19081912-0009-0000-0000-00004A28D83A Message-Id: <1566218108-12705-1-git-send-email-nayna@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-19_03:,, 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-1906280000 definitions=main-1908190142 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IMA subsystem supports custom, built-in, arch-specific policies to define the files to be measured and appraised. These policies are honored based on the priority where arch-specific policies is the highest and custom is the lowest. OpenPOWER systems rely on IMA for signature verification of the kernel. This patchset adds support for powerpc specific arch policies that are defined based on system's OS secureboot state. The OS secureboot state of the system is determined via device-tree entry. Changelog: v5: * secureboot state is now read via device tree entry rather than OPAL secure variables * ima arch policies are updated to use policy based template for measurement rules v4: * Fixed the build issue as reported by Satheesh Rajendran. v3: * OPAL APIs in Patch 1 are updated to provide generic interface based on key/keylen. This patchset updates kernel OPAL APIs to be compatible with generic interface. * Patch 2 is cleaned up to use new OPAL APIs. * Since OPAL can support different types of backend which can vary in the variable interpretation, the Patch 2 is updated to add a check for the backend version * OPAL API now expects consumer to first check the supported backend version before calling other secvar OPAL APIs. This check is now added in patch 2. * IMA policies in Patch 3 is updated to specify appended signature and per policy template. * The patches now are free of any EFIisms. v2: * Removed Patch 1: powerpc/include: Override unneeded early ioremap functions * Updated Subject line and patch description of the Patch 1 of this series * Removed dependency of OPAL_SECVAR on EFI, CPU_BIG_ENDIAN and UCS2_STRING * Changed OPAL APIs from static to non-static. Added opal-secvar.h for the same * Removed EFI hooks from opal_secvar.c * Removed opal_secvar_get_next(), opal_secvar_enqueue() and opal_query_variable_info() function * get_powerpc_sb_mode() in secboot.c now directly calls OPAL Runtime API rather than via EFI hooks. * Fixed log messages in get_powerpc_sb_mode() function. * Added dependency for PPC_SECURE_BOOT on configs PPC64 and OPAL_SECVAR * Replaced obj-$(CONFIG_IMA) with obj-$(CONFIG_PPC_SECURE_BOOT) in arch/powerpc/kernel/Makefile Nayna Jain (2): powerpc: detect the secure boot mode of the system powerpc: Add support to initialize ima policy rules arch/powerpc/Kconfig | 13 ++++++ arch/powerpc/include/asm/secboot.h | 27 ++++++++++++ arch/powerpc/kernel/Makefile | 2 + arch/powerpc/kernel/ima_arch.c | 50 +++++++++++++++++++++ arch/powerpc/kernel/secboot.c | 71 ++++++++++++++++++++++++++++++ include/linux/ima.h | 3 +- 6 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/include/asm/secboot.h create mode 100644 arch/powerpc/kernel/ima_arch.c create mode 100644 arch/powerpc/kernel/secboot.c -- 2.20.1