Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2352921ybg; Fri, 5 Jun 2020 11:40:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyY/8SLzlnMyVlwIJJp9OElb3n6n+9P3RTQxJTsxG5wPhm7o49wjlFVR2Q2D5kXlMAeazL6 X-Received: by 2002:aa7:c143:: with SMTP id r3mr10802489edp.203.1591382401703; Fri, 05 Jun 2020 11:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591382401; cv=none; d=google.com; s=arc-20160816; b=rO8LPpHIEIKStWytz7oevikc95+BIppv6/+OCWtd46hcJ452NymjtzvJ9B47PzlcS3 2oqILAHZZeFXux0RJALD2bKCOneA9QEOhLmmW8xy+2dJBFDpmw9pBohu5Hz+GYtDPMQJ blWqC+T1JDJWQecOGK5CxoisNRtw0WdBbKV2deNjYf5kZh7dZBZx657VNTRQP+e5ewOl ke1tMgq9t2gVkSItgqJCSncuoV/H0vuxgfcG7kIzKskKIXmKWpZvAc4s1z4bsfs/fUh9 MoPy75/EhD/l9/5Idn5EHQFgrLbXwFnyH4B3Ni58sZilOugPqQGafmOLjEqStHzs+Zi4 xBPA== 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; bh=xE3tNj472tiRpRZYbsLPaeB28Y+CB/mTBzShLW2atOM=; b=N5qRZnqOb2nIIFpAqZRe4PC5onfPPvC4upupuRSwpDi50FwGTePXlwdH18MwjaVcz+ UblRe8JUe0s3xEWR1ufxJVPmlqBkhWoVZ1gYERSYZzLDdDnC6+vAwhenslPtvOjQmg5W Q9kNsu+rYiSTcc0sdIB34VgtmVoxlkCu7TbPI3DtBl9J7gkXcpHgTnkW/hmRqffU3cfk 8k8nlcKF00C2efIthcLl7qzdJhWj4D3VzjSgTfuWvT/6I20/ZMCSASiMDWScbhmkTU2c DJjsqxHZoy/CnUFYzbCcnm6Qm3xFJn3FhZBUxS13PwTvOZnz8OBdov3FNRsqLPBEEywI JaJw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 k4si3830471ejg.386.2020.06.05.11.39.38; Fri, 05 Jun 2020 11:40:01 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbgFEShx (ORCPT + 99 others); Fri, 5 Jun 2020 14:37:53 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45536 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726294AbgFEShw (ORCPT ); Fri, 5 Jun 2020 14:37:52 -0400 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 055IW5Gv123119; Fri, 5 Jun 2020 14:37:27 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 31f9dfg0s5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jun 2020 14:37:27 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 055IZdZb142400; Fri, 5 Jun 2020 14:37:26 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 31f9dfg0rc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jun 2020 14:37:26 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 055IZoGE002136; Fri, 5 Jun 2020 18:37:24 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 31bf47d60d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jun 2020 18:37:24 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 055IbLk263242476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 Jun 2020 18:37:21 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0E074C044; Fri, 5 Jun 2020 18:37:21 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CDBF64C04A; Fri, 5 Jun 2020 18:37:18 +0000 (GMT) Received: from localhost.localdomain (unknown [9.85.181.45]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 5 Jun 2020 18:37:18 +0000 (GMT) Message-ID: <1591382238.5816.27.camel@linux.ibm.com> Subject: Re: [PATCH 0/3] fs: reduce export usage of kerne_read*() calls From: Mimi Zohar To: Scott Branden , Kees Cook Cc: Christoph Hellwig , Luis Chamberlain , viro@zeniv.linux.org.uk, gregkh@linuxfoundation.org, rafael@kernel.org, ebiederm@xmission.com, jeyu@kernel.org, jmorris@namei.org, paul@paul-moore.com, stephen.smalley.work@gmail.com, eparis@parisplace.org, nayna@linux.ibm.com, dan.carpenter@oracle.com, skhan@linuxfoundation.org, geert@linux-m68k.org, tglx@linutronix.de, bauerman@linux.ibm.com, dhowells@redhat.com, linux-integrity@vger.kernel.org, linux-fsdevel@vger.kernel.org, kexec@lists.infradead.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 05 Jun 2020 14:37:18 -0400 In-Reply-To: <1c68c0c7-1b0a-dfec-0e50-1b65eedc3dc7@broadcom.com> References: <20200513152108.25669-1-mcgrof@kernel.org> <20200513181736.GA24342@infradead.org> <20200515212933.GD11244@42.do-not-panic.com> <20200518062255.GB15641@infradead.org> <1589805462.5111.107.camel@linux.ibm.com> <7525ca03-def7-dfe2-80a9-25270cb0ae05@broadcom.com> <202005221551.5CA1372@keescook> <1590288736.5111.431.camel@linux.ibm.com> <1c68c0c7-1b0a-dfec-0e50-1b65eedc3dc7@broadcom.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: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-05_05:2020-06-04,2020-06-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 adultscore=0 impostorscore=0 phishscore=0 malwarescore=0 clxscore=1011 suspectscore=0 cotscore=-2147483648 priorityscore=1501 mlxlogscore=984 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006050134 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-06-05 at 11:15 -0700, Scott Branden wrote: > Hi Mimi, > > On 2020-05-23 7:52 p.m., Mimi Zohar wrote: > > Scott, the change should be straight forward.  The additional patch > > needs to: > > - define a new kernel_read_file_id enumeration, like > > FIRMWARE_PARTIAL_READ. > > - Currently ima_read_file() has a comment about pre-allocated firmware > > buffers.  Update ima_read_file() to call process_measurement() for the > > new enumeration FIRMWARE_PARTIAL_READ and update ima_post_read_file() > > to return immediately. > Should this be what is in ima_read_file? > { >     enum ima_hooks func; >     u32 secid; Please don't remove the existing comment. >     if (read_id != READING_FIRMWARE_PARTIAL_READ) >         return 0; > >     if (!file) { /* should never happen */ >         if (ima_appraise & IMA_APPRAISE_ENFORCE) >             return -EACCES; >         return 0; >     } This checks for any IMA appraise rule.  You want to enforce firmware signature checking only if there is a firmware appraise rule.  Refer to ima_post_read_file(). >     security_task_getsecid(current, &secid); >     return process_measurement(file, current_cred(), secid, NULL, >                    0, MAY_READ, FILE_CHECK); The read_idmap enumeration should be updated similar to the other firmware.  Keep the code generic.  Refer to ima_post_read_file().  func will be defined as FIRMWARE_CHECK. thanks, Mimi