Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3304160yba; Mon, 8 Apr 2019 15:57:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiE6RS60z7GXCJsJM0U3aDHmNbHC1uU1gBaemnIS2oR9WBmeIxuh/lsPIJAGlT/pQ/kwXV X-Received: by 2002:a65:47c6:: with SMTP id f6mr30869212pgs.173.1554764270288; Mon, 08 Apr 2019 15:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554764270; cv=none; d=google.com; s=arc-20160816; b=pMh5nsNKfZVO6iL8AhUrs6F5KPhucdKAZdrm8AZc0BfsxZw4gLuBui0qHu8R60xjzH BUh2yIAu1CiK7aR84EImqzQbqjfzbMyMSFqmIuDvNR6BQBeoUeva+RElTwxGOUjmT2L5 6el+xektDiBTbxLX57WShmDvLWPexYEA2QSfyxWLzT/jTQidG6Rmb0TsoFWwEW5ihXJU 7HF2bWOcTgCJORdm2JJkpI5DnJ8Z4h7bIOM4lO3UE2PyZIM8Gf7hMrR3xf0y3ePDgyi3 QpjMrocvUcCC5SA6IOE4kzpUZMllMY81q0sEzR/XN6sARQQTxK42nVpXOIYgOClc1eew hplg== 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=RJ2CVtZB58zAuGiTTRLrI8ZMqAHT95kchVVFSw4WYSo=; b=WaKoWt3NnZlJRpsGy7gjbSEFzYYGbdV4pG4gnn8kp7oipoVjOk2nkSrscN7tGaFuZf GOfZEYoy5v3kcsRlSB+JP7FX7g0YpVlUTzOTfxMbi9pjb2g06+nB6SHu8RrUAhsEMk+3 kENpGYTWfGafTIjO0LBXYVZSpg9rhIrp3DK6qYoxSxuFsBMyECFskEjs1/yRgzCvQsMx dbnZ+ecttnAwU9qpNKdOcB8VyEygwwA2qvaY+GSI3I4irmsrUziBi6aw6JJGgC/pV9WK NOHRJEjHtm/XvvGseajncRyNxwjG3Te6J2lADR/luMsue3o9MCpVZzW3a/P1V0/+nCk5 djxw== 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 b4si28030956pfj.16.2019.04.08.15.57.34; Mon, 08 Apr 2019 15:57:50 -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 S1727314AbfDHWwu (ORCPT + 99 others); Mon, 8 Apr 2019 18:52:50 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34266 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726188AbfDHWwt (ORCPT ); Mon, 8 Apr 2019 18:52:49 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x38MnAeW112219 for ; Mon, 8 Apr 2019 18:52:48 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rrcqnp4cc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 08 Apr 2019 18:52:47 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Apr 2019 23:52:46 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 8 Apr 2019 23:52:43 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x38MqfAQ55509016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Apr 2019 22:52:41 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1D7D4C04A; Mon, 8 Apr 2019 22:52:41 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 059964C040; Mon, 8 Apr 2019 22:52:40 +0000 (GMT) Received: from swastik.ibm.com (unknown [9.85.157.39]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 8 Apr 2019 22:52:39 +0000 (GMT) From: Nayna Jain To: linuxppc-dev@ozlabs.org, linux-efi@vger.kernel.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 , Nayna Jain Subject: [PATCH v2 0/3] powerpc: Enabling secure boot on powernv systems - Part 1 Date: Mon, 8 Apr 2019 18:52:31 -0400 X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 x-cbid: 19040822-4275-0000-0000-00000325B110 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040822-4276-0000-0000-00003834C80A Message-Id: <1554763954-11795-1-git-send-email-nayna@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-08_10:,, 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=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904080164 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set is part of a series that implements secure boot on PowerNV systems. In order to verify the OS kernel on PowerNV, secure boot requires X.509 certificates trusted by the platform, the secure boot modes, and several other pieces of information. These are stored in secure variables controlled by OPAL, also known as OPAL secure variables. The IMA architecture specific policy support on Power is dependent on OPAL runtime services to access secure variables. Instead of directly accessing the OPAL runtime services, version 1[1] of this patch set relied upon the EFI hooks. This version drops that dependency and calls the OPAL runtime services directly. Exposing the OPAL secure variables to userspace will be posted as a separate patch set, allowing the IMA architecture specific policy on Power to be upstreamed independently. This patch set adds the following features: 1. Add support for OPAL Runtime API to access secure variables controlled by OPAL. 2. Define IMA arch-specific policies based on the secure boot state and mode of the system. On secure boot enabled powernv systems, the OS kernel signature will be verified by IMA appraisal. [1] https://patchwork.kernel.org/cover/10882149/ Changelog: 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 Claudio Carvalho (1): powerpc/powernv: Add support for OPAL_SECVAR_GET Nayna Jain (2): powerpc/powernv: detect the secure boot mode of the system powerpc: Add support to initialize ima policy rules arch/powerpc/Kconfig | 14 +++ arch/powerpc/include/asm/opal-api.h | 3 +- arch/powerpc/include/asm/opal-secvar.h | 18 ++++ arch/powerpc/include/asm/opal.h | 2 + arch/powerpc/include/asm/secboot.h | 21 ++++ arch/powerpc/kernel/Makefile | 1 + arch/powerpc/kernel/ima_arch.c | 54 ++++++++++ arch/powerpc/platforms/powernv/Kconfig | 6 ++ arch/powerpc/platforms/powernv/Makefile | 2 + arch/powerpc/platforms/powernv/opal-call.c | 1 + arch/powerpc/platforms/powernv/opal-secvar.c | 107 +++++++++++++++++++ arch/powerpc/platforms/powernv/secboot.c | 54 ++++++++++ include/linux/ima.h | 3 +- 13 files changed, 284 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/include/asm/opal-secvar.h create mode 100644 arch/powerpc/include/asm/secboot.h create mode 100644 arch/powerpc/kernel/ima_arch.c create mode 100644 arch/powerpc/platforms/powernv/opal-secvar.c create mode 100644 arch/powerpc/platforms/powernv/secboot.c -- 2.20.1