Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3147074pxa; Tue, 25 Aug 2020 12:45:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXb6ZmUP9CUzcpL0UUQHcnQCq+KFCw4GCT6F/XP2rUwDtX8bSUS2QIDfs5nL7MKy8547yR X-Received: by 2002:a17:906:bb0e:: with SMTP id jz14mr12830482ejb.525.1598384709750; Tue, 25 Aug 2020 12:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598384709; cv=none; d=google.com; s=arc-20160816; b=j6yDSJCjFphW3RFVpOasF8zu/lRZF14jwNSO6weUph4f97P/hBUfcjLPNsHTy+FhKD tfXOHfGpkdvnXw4s0w9I/97P5W3LgGO+PTPaKBdSAuZKSSaSswhK8bORGp6+3FoF+wdn awWpqH7cPmQtBrC0wC9GHhTSyZgwtkb656ucrVdK+DKT19GrepEtd7dochpqXSaCkgAI jwepoEtIzK+WgD7Nl8c4eqxj55laZSr8nAB8Qa0qWPYzHaqXV4C4e5NL7zC5qkDDpXNN wN9eK5F4EKpiyEHIzopkYhoS6kNyJPBA0poAz7/O4P6+kHUWwTKmxWWcjxjcK+mvGqeA 4bFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=o1vO+C4u5OWui1B01ltD9ynp/7MBsSPP+x7sdYABwIc=; b=lTYh8V4bSlQU8glhZNuSv9FWn8JGo9MG1qbz68l+iQR/Z2K9jaEViY9HnGw2a3lTuC i4h/MTB2ZyKspkpUKH3STcxNBY4t+9v44fwpOtQJU5/N3vDqVZtNYLSg1FWqjB9EK4jM Lqgu7CyIIt52pQ4UCvPOTtBHWuw9zjOnBY236xfoUIb+VA0lvF/0xm5k9YVUvIZR8t/x LQihW1tUgVqtMPLUtQN6Lmwv8pfg9FqMZqS4gW2p4/p3QdjiyDyPl4gQxxFITYFugaIb avHkXU5t47jgUUts5j6Dldrl3XZkhHrtPhgoTuqaSad5TmpRhUlni1mpocWOibZ/Gi0G sMfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Of0Z5xXl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a11si9315083edv.236.2020.08.25.12.44.45; Tue, 25 Aug 2020 12:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Of0Z5xXl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726717AbgHYToG (ORCPT + 99 others); Tue, 25 Aug 2020 15:44:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:10258 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbgHYToF (ORCPT ); Tue, 25 Aug 2020 15:44:05 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07PJLuu3164596; Tue, 25 Aug 2020 15:43:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=o1vO+C4u5OWui1B01ltD9ynp/7MBsSPP+x7sdYABwIc=; b=Of0Z5xXlukVSu2uW9xwQsynMDbxameMGFBYFki2J+OeTH1lLV5rfPdBXQxxn0jdNn+Ct IcgSx8CrLm7uRADgx6otKBF1NupGp+JENXb5SFyLhmn1NtomnmvzFNWEAu7DGAc76FQ0 RKb3/NadSV0CBSe9gRiy+QLIb02SKJqLpQfMLNCp1l9Lj05L62FYvQB/T6PrPjTJ4HdQ 47xVhYvswjq7miD0A3rs0Q3Vjbr9XT6KVOjC+EUDdvPzvanJ14yXJgrlzHPOd1zYOECv t+aWU89oR2QEMaxnVqQP3efVZNnfnc2db1dLvkfCdieYHMeG0qH6wphy3AS3YBpMbynH NQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3358r1rfym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Aug 2020 15:43:59 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07PJNITi170794; Tue, 25 Aug 2020 15:43:58 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3358r1rfxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Aug 2020 15:43:58 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07PJgTag000838; Tue, 25 Aug 2020 19:43:56 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03ams.nl.ibm.com with ESMTP id 332ujkuruk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Aug 2020 19:43:56 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07PJhsG618415902 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Aug 2020 19:43:54 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79335A4053; Tue, 25 Aug 2020 19:43:54 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CAF8BA4040; Tue, 25 Aug 2020 19:43:51 +0000 (GMT) Received: from li-f45666cc-3089-11b2-a85c-c57d1a57929f.ibm.com (unknown [9.160.103.4]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 25 Aug 2020 19:43:51 +0000 (GMT) Message-ID: Subject: Re: [PATCH] IMA: Handle early boot data measurement From: Mimi Zohar To: Lakshmi Ramasubramanian , stephen.smalley.work@gmail.com, casey@schaufler-ca.com Cc: tyhicks@linux.microsoft.com, tusharsu@linux.microsoft.com, sashal@kernel.org, jmorris@namei.org, linux-integrity@vger.kernel.org, selinux@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 25 Aug 2020 15:43:49 -0400 In-Reply-To: <958853ec-5354-fbcb-3fa0-2002954c3e40@linux.microsoft.com> References: <20200821231230.20212-1-nramas@linux.microsoft.com> <307617de-b42d-ac52-6e9e-9e0d16bbc20e@linux.microsoft.com> <49f8a616d80344c539b512f8b83590ea281ee54d.camel@linux.ibm.com> <52d2204b-5b6e-e13f-d0dd-192a776812bc@linux.microsoft.com> <805e35d6835df219b5836e8159742bed086e0554.camel@linux.ibm.com> <958853ec-5354-fbcb-3fa0-2002954c3e40@linux.microsoft.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-12.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-25_08:2020-08-25,2020-08-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008250143 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-08-25 at 12:35 -0700, Lakshmi Ramasubramanian wrote: > On 8/25/20 11:03 AM, Mimi Zohar wrote: > > On Tue, 2020-08-25 at 10:55 -0700, Lakshmi Ramasubramanian wrote: > > > On 8/25/20 10:42 AM, Mimi Zohar wrote: > > > > > > > > > Please limit the changes in this patch to renaming the functions and/or > > > > > > files. For example, adding "measure_payload_hash" should be a separate > > > > > > patch, not hidden here. > > > > > > > > > > > > > > > > Thanks for the feedback Mimi. > > > > > > > > > > I'll split this into 2 patches: > > > > > > > > > > PATCH 1: Rename files + rename CONFIG > > > > > PATCH 2: Update IMA hook to utilize early boot data measurement. > > > > > > > > I'm referring to introducing the "measure_payload_hash" flag. I assume > > > > this is to indicate whether the buffer should be hashed or not. > > > > > > > > Example 1: ima_alloc_key_entry() and ima_alloc_data_entry(0 comparison > > > > > -static struct ima_key_entry *ima_alloc_key_entry(struct key *keyring, > > > > > - const void *payload, > > > > > - size_t payload_len) > > > > > -{ > > > > > +static struct ima_data_entry *ima_alloc_data_entry(const char *event_name, > > > > > + const void *payload, > > > > > + size_t payload_len, > > > > > + const char *event_data, > > > > > + enum ima_hooks func, > > > > > + bool measure_payload_hash) <==== > > > > > +{ > > > > > > > > Example 2: > > > > diff --git a/security/integrity/ima/ima_asymmetric_keys.c b/security/integrity/ima/ima_asymmetric_keys.c > > > > index a74095793936..65423754765f 100644 > > > > --- a/security/integrity/ima/ima_asymmetric_keys.c > > > > +++ b/security/integrity/ima/ima_asymmetric_keys.c > > > > @@ -37,9 +37,10 @@ void ima_post_key_create_or_update(struct key *keyring, struct key *key, > > > > if (!payload || (payload_len == 0)) > > > > return; > > > > > > > > - if (ima_should_queue_key()) > > > > - queued = ima_queue_key(keyring, payload, payload_len); > > > > - > > > > + if (ima_should_queue_data()) > > > > + queued = ima_queue_data(keyring->description, payload, > > > > + payload_len, keyring->description, > > > > + KEY_CHECK, false); <=== > > > > if (queued) > > > > return; > > > > > > > > But in general, as much as possible function and file name changes > > > > should be done independently of other changes. > > > > > > > > thanks, > > > > > > I agree - but in this case, Tushar's patch series on adding support for > > > "Critical Data" measurement has already introduced > > > "measure_payload_hash" flag. His patch updates > > > "process_buffer_measurement()" to take this new flag and measure hash of > > > the given data. > > > > > > My patches extend that to queuing the early boot requests and processing > > > them after a custom IMA policy is loaded. > > > > > > If you still think "measure_payload_hash" flag should be introduced in > > > the queuing change as a separate patch I'll split the patches further. > > > Please let me know. > > > > There's a major problem if his changes add new function arguments > > without modifying all the callers of the function. I assume the kernel > > would fail to compile properly. > > Tushar's patch series does update all the existing callers of > process_buffer_measurement() to handle the new arguments. His patch > series is self contained, and builds and works fine. Yes, he's added "false" to existing calls. Still, defining a new IMA hook should be independent of adding this "measure_payload_hash" parameter. Each with its own patch description. > > > Changing the function parameters to include "measure_payload_hash" > > needs to be a separate patch, whether it is part of his patch set or > > yours. > > > > ok - I'll split the queuing patch to include "measure_payload_hash" in a > separate patch. thanks, Mimi