Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1216203imm; Wed, 20 Jun 2018 13:45:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJzOWi1b7swJiLCJdvOjI1wQaYmuF6MKtxD245eXZWsQ7osUtmBnXJD/Gg7BV8OYK0d3IUX X-Received: by 2002:a63:3c4c:: with SMTP id i12-v6mr20216441pgn.309.1529527548495; Wed, 20 Jun 2018 13:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529527548; cv=none; d=google.com; s=arc-20160816; b=ZciUyLYcqRJsXqrcEkt8Iqv3JUscaBRSFhAjI9aEMHcsM9u53dX9B03fS49Qza5bcK yJHyXok4baeVbNuUEnitUkXLweGsWLaQN1bdli8oCQlYJjiirQmpHXAt0WG8UJwPHt/2 FzyDoM8IfWxyP+MTop08Q5yHAfly4jUNZzmZHPrddYFYf07vDZl+WqS7jTrVTiAbi1RZ h5DsSodfpqQCX1iYRocu4RI2Ue5DNBL+jazUMzePnJTnM/Ss3WK7Q+KNusOux/YuYxzE fcPQyK/7cCr383le5puzQ6KASplStypVwkqicssvVToOK0c3gZ4fVZ45cMCB7Mwrku7E FuTQ== 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:arc-authentication-results; bh=Zy+ywR48CmXyHGHD8byAtEZ6Pm/nXxcCm2UB8cdTAl8=; b=X/vLlbqleNPVDR8RVXjGq91ZYIVYxJ+iPYyleqfxZjOeMzS/+bZeDWKyHsA53pT7BQ hN0++tfONC8HIgq5IVpRCVKEkj6RbvDf2ym5PAz2HoBZmTY1NGfpXIW2syV+EyF7l9SG xgwCAX9MG/0bju6EGEGC9Ec5pjUraEXzetKLtWxvcPlAkPJ53j4ZCOCy/+YSQ71jCykf v1wf9v9suYysrg3+zWC6mxULpjN2d17RWl4sB1CrQhnSARjg2D03ELcu5upbf0GL/3Wy DY07GHmtNkgvqXqAhZHxDtD2dHZFMGzB/pMCkqreedebH9AL87Q34B0SBDYLTEGxUzba 1YDA== 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 u8-v6si3021713plh.492.2018.06.20.13.45.34; Wed, 20 Jun 2018 13:45:48 -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 S933563AbeFTUn7 (ORCPT + 99 others); Wed, 20 Jun 2018 16:43:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36178 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933384AbeFTUmr (ORCPT ); Wed, 20 Jun 2018 16:42:47 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5KKenCV143811 for ; Wed, 20 Jun 2018 16:42:47 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jqvwx2ud3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 20 Jun 2018 16:42:47 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Jun 2018 14:42:46 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 20 Jun 2018 14:42:42 -0600 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5KKggZM000414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 20 Jun 2018 13:42:42 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EBDDC6A051; Wed, 20 Jun 2018 14:42:41 -0600 (MDT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C2DA6A047; Wed, 20 Jun 2018 14:42:41 -0600 (MDT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 20 Jun 2018 14:42:41 -0600 (MDT) From: Stefan Berger To: linux-integrity@vger.kernel.org, jarkko.sakkinen@linux.intel.com, zohar@linux.vnet.ibm.com Cc: jgg@ziepe.ca, linux-kernel@vger.kernel.org, Stefan Berger Subject: [PATCH v2 2/4] ima: Implement ima_shutdown and register it as a reboot_notifier Date: Wed, 20 Jun 2018 16:42:34 -0400 X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180620204236.1572523-1-stefanb@linux.vnet.ibm.com> References: <20180620204236.1572523-1-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18062020-0036-0000-0000-00000A018A63 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009228; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01049869; UDB=6.00537986; IPR=6.00828842; MB=3.00021764; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-20 20:42:44 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18062020-0037-0000-0000-000047CF8C29 Message-Id: <20180620204236.1572523-3-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-20_09:,, 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-1805220000 definitions=main-1806200224 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement ima_shutdown so that we can release the tpm_chip before devices are shut down. Register it as a low-priority reboot_notifier. Signed-off-by: Stefan Berger --- security/integrity/ima/ima_init.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/security/integrity/ima/ima_init.c b/security/integrity/ima/ima_init.c index 29b72cd2502e..8a5258eb32b6 100644 --- a/security/integrity/ima/ima_init.c +++ b/security/integrity/ima/ima_init.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "ima.h" @@ -104,11 +105,24 @@ void __init ima_load_x509(void) } #endif +static int ima_shutdown(struct notifier_block *this, unsigned long action, + void *data) +{ + return NOTIFY_DONE; +} + +static struct notifier_block ima_reboot_notifier = { + .notifier_call = ima_shutdown, + .priority = 0, +}; + int __init ima_init(void) { u8 pcr_i[TPM_DIGEST_SIZE]; int rc; + register_reboot_notifier(&ima_reboot_notifier); + ima_used_chip = 0; rc = tpm_pcr_read(NULL, 0, pcr_i); if (rc == 0) -- 2.13.6