From patchwork Wed Aug 24 15:10:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Semakin X-Patchwork-Id: 12953702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37B8CC00140 for ; Wed, 24 Aug 2022 15:11:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231451AbiHXPLM (ORCPT ); Wed, 24 Aug 2022 11:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238039AbiHXPLK (ORCPT ); Wed, 24 Aug 2022 11:11:10 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25FF8816B1 for ; Wed, 24 Aug 2022 08:11:09 -0700 (PDT) Received: from fraeml704-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MCV0M3fbMz67dHc; Wed, 24 Aug 2022 23:10:43 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml704-chm.china.huawei.com (10.206.15.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.24; Wed, 24 Aug 2022 17:11:07 +0200 Received: from mscphispre00062.huawei.com (10.123.70.102) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 24 Aug 2022 16:11:06 +0100 From: Denis Semakin To: CC: , , , , , , , , Subject: [RFC PATCH v1 2/4] ima: Use tpm_chip from init IMA namespace. Date: Wed, 24 Aug 2022 23:10:58 +0800 Message-ID: <20220824151058.234521-1-denis.semakin@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.123.70.102] X-ClientProxiedBy: mscpeml100001.china.huawei.com (7.188.26.227) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org For now a child namespace uses the same tpm chip descriptor from init namespace. Signed-off-by: Denis Semakin --- security/integrity/ima/ima_init_ima_ns.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/security/integrity/ima/ima_init_ima_ns.c b/security/integrity/ima/ima_init_ima_ns.c index 1b20e07556e6..da0875765dff 100644 --- a/security/integrity/ima/ima_init_ima_ns.c +++ b/security/integrity/ima/ima_init_ima_ns.c @@ -59,6 +59,14 @@ int ima_init_namespace(struct ima_namespace *ns) mutex_init(&vpcr_list_mutex); list_add(&ns->vpcr.list, &vpcr_list); } else { + /** + * Here we just assign tpm_chip from init_ima_ns + * with new IMA namespace. + * In future a new API should be used I think + * Stefan's ima_ns_set_tpm_chip() and etc. to get + * TPM chip descriptor and provider. + */ + ns->ima_tpm_chip = init_ima_ns.ima_tpm_chip; mutex_lock(&vpcr_list_mutex); list_add_tail(&ns->vpcr.list, &vpcr_list); mutex_unlock(&vpcr_list_mutex);