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 360DBFA373D for ; Mon, 31 Oct 2022 03:00:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229726AbiJaC77 (ORCPT ); Sun, 30 Oct 2022 22:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbiJaC75 (ORCPT ); Sun, 30 Oct 2022 22:59:57 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C804657D for ; Sun, 30 Oct 2022 19:59:56 -0700 (PDT) Received: from fraeml704-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4N0yWP37kPz686FT; Mon, 31 Oct 2022 10:57:53 +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.31; Mon, 31 Oct 2022 03:59:54 +0100 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.31; Mon, 31 Oct 2022 02:59:53 +0000 From: Denis Semakin To: CC: , , , , , , , Subject: [RFC PATCH v2 2/4] ima: Use tpm_chip from init IMA namespace. Date: Mon, 31 Oct 2022 10:59:46 +0800 Message-ID: <20221031025946.298754-1-denis.semakin@huawei.com> X-Mailer: git-send-email 2.38.GIT In-Reply-To: <20221031025507.298323-1-denis.semakin@huawei.com> References: <20221031025507.298323-1-denis.semakin@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.123.70.102] X-ClientProxiedBy: mscpeml500001.china.huawei.com (7.188.26.142) 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 d29d113a322c..8093c61697a4 100644 --- a/security/integrity/ima/ima_init_ima_ns.c +++ b/security/integrity/ima/ima_init_ima_ns.c @@ -58,6 +58,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); -- 2.38.GIT