Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3768936ybl; Mon, 27 Jan 2020 10:04:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwMxLlnaqjAc0Txy6fuayyFrvTVQO1aVp/j5OgfK1gHR60m41lnfe0XKjvWzqngeSGXkF4s X-Received: by 2002:aca:2407:: with SMTP id n7mr222890oic.14.1580148243760; Mon, 27 Jan 2020 10:04:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580148243; cv=none; d=google.com; s=arc-20160816; b=yW6V1HfFBVFBz0yewOKZloYrg3qJpeLUvxop+5dNW9CdtmW1BlU6lQsN9H8XorZly0 Or14zNNaOe1FHPSv6lK7WQ1BEzoWQWjbxNJXXIseJaocZjhH64KWJDiOuSbcG3y8MegN X8lWxHe672WSiKpFVtbckebNaX/D+EJ/dosdxwr668WEFo/JSMu9KfdDozfK2vQVlTkU GN6lwfY29MtGsEktGIUMlc2Mczcqyqnv1Ztacsy1UnwtZDW9U3wfFE9EwuvrONBWUxAE 7ZIYTXA9Iv5Xp9uT2Mh/BAaBhaCFKoD8XARzKXVFOahuHm1DQzv5mAp2CKX3NkOte0FV 1BQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=IxLnucJVOM0ViHqQN8xsb99NdT7othlJh1rnsshiETo=; b=qfRKNl1JLdkbpGjX6AMc26qFVfyvgXH/RNw3ta4gDXcTFMjPcz95qIN4fIsBAGwmyn j/ei2PpRXyfJsqaiKY13EzSoObVKXlfoCvICZfh1WThqLYTjWB9Xjlny2ONbc8aWYayo Q5ZxckV5Tx+qqKfEy/+tIIqRimlOoti4HnHnkEg7qMhXEdxWylgMDUlUqGsXtGv6KBnH 40uj4rnISt903H88/OTZ/CpV7jpoHO8gRK5H9Ykj4RtBwtFwBV5aTz2mWAJBoLmGNhLM ugYgTJZr/Cs2KIe/Ov2QaALMtBirclOWXYYbMZMZ5kazIj0evQYbgOHwMhkvdwW/+u+N Cojg== 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 k20si2868629oiw.273.2020.01.27.10.03.52; Mon, 27 Jan 2020 10:04:03 -0800 (PST) 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 S1726080AbgA0SBq (ORCPT + 99 others); Mon, 27 Jan 2020 13:01:46 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:2536 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725893AbgA0SBq (ORCPT ); Mon, 27 Jan 2020 13:01:46 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00RHsKFB091754 for ; Mon, 27 Jan 2020 13:01:44 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2xrg62e820-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 27 Jan 2020 13:01:44 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 27 Jan 2020 18:01:42 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 27 Jan 2020 18:01:41 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 00RI1eMN51314770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Jan 2020 18:01:40 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12F6E11C052; Mon, 27 Jan 2020 18:01:40 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 431D411C04A; Mon, 27 Jan 2020 18:01:39 +0000 (GMT) Received: from localhost.localdomain (unknown [9.85.185.238]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 27 Jan 2020 18:01:39 +0000 (GMT) Subject: Re: [PATCH 2/2] ima: support calculating the boot_aggregate based on different TPM banks From: Mimi Zohar To: Lakshmi Ramasubramanian , linux-integrity@vger.kernel.org Cc: Jerry Snitselaar , James Bottomley , linux-kernel@vger.kernel.org Date: Mon, 27 Jan 2020 13:01:38 -0500 In-Reply-To: <87e6b531-3596-4523-a6b0-629ae8fd6995@linux.microsoft.com> References: <1580140919-6127-1-git-send-email-zohar@linux.ibm.com> <1580140919-6127-2-git-send-email-zohar@linux.ibm.com> <87e6b531-3596-4523-a6b0-629ae8fd6995@linux.microsoft.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 20012718-0020-0000-0000-000003A4778E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20012718-0021-0000-0000-000021FC1E62 Message-Id: <1580148098.5088.32.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-27_06:2020-01-24,2020-01-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 bulkscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1911200001 definitions=main-2001270145 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-01-27 at 08:50 -0800, Lakshmi Ramasubramanian wrote: > On 1/27/2020 8:01 AM, Mimi Zohar wrote: > > > + > > + for (i = 0; i < ima_tpm_chip->nr_allocated_banks; i++) { > > + if (ima_tpm_chip->allocated_banks[i].alg_id == d.alg_id) > > + break; > > + } > > + > > + if (i == ima_tpm_chip->nr_allocated_banks) > > + d.alg_id = ima_tpm_chip->allocated_banks[0].alg_id; > > + > > Can the number of allocated banks (ima_tpm_chip->nr_allocated_banks) be > zero? Should that be checked before accessing "allocated_banks"? Yes, that might be the true, but I think the solution is not fixing the problem here, but when ima_tpm_chip is set in ima_init(). tpm_default_chip() should be modified to return a TPM with at least one bank enabled; and ima_init() needs to go into TPM-bypass mode if there isn't. Can anyone look into this please? Mimi