Received: by 10.223.176.5 with SMTP id f5csp3087922wra; Mon, 29 Jan 2018 08:34:51 -0800 (PST) X-Google-Smtp-Source: AH8x225WZd0j6D5MxNVU1Mip747O+2ID+MRAVy7CNwrHPWQWqdH1F+X+aURgYl059Xy33LmLpvVI X-Received: by 10.98.141.199 with SMTP id p68mr26483154pfk.25.1517243691666; Mon, 29 Jan 2018 08:34:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517243691; cv=none; d=google.com; s=arc-20160816; b=CONbcTqnXspcNGY8e5xcdzTEVWLjNvVYxVTrnCpqJlWxFxzEoiD/wFyUq9bjUV0Jhd AuIZJOCyQuBp188QYTnRmp1m3a+uifwcix+/R1PicTD6jvnyillKTSdt5DPYyWmLd9BE 9k9uUZFvsywDt2Yf/4du8Knlr5Ov72MmDz6ws5rBMNFaHyLmFAcI6ETbYp+WF3aAgjd8 GhRuEsRlpzwupWNj9hf36GiJKwU1akpEwBacRUfM8pZUJez4TqsBmoAEEwnyrYYi3pDe o+Y1c2N1hcTbhLPKs7lcHm10hOf1k8ccgp1aDzsMA0MjiKCmOzYBfX4fXLjBQoY7ZAOK tWcQ== 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 :arc-authentication-results; bh=gHo+qxoBafe43YRIPL7E3Cpfz1pxbUlvZ3RhrjlvJm0=; b=HatSfaQT6Z/p8IAdS6COmh9O+4aUSgv1qvw/UPPlt12HMG94EGCZu2y2FzTpEQjyr3 7KSJVUeeak8LfZ6ROEs9Yl3Exl50QUNRMKfotn6JK/jVoGgtH7s/FzM++5agVhVjKZKa Q7FKL6wVHGMXjTmhJodzRKm0uyPCvF+CS79RvRtDRqtkE55o24rrQfupsEqq4NnKv+qh HKT1ZzTzFpfK3gsxvb1XxrwdnTqK60vbtpdMYWURss/WUbw70EWdRxqHTXo6pi3fYQtx lcd5Snehk/1PBNC2g7aib7vDMP3B+d0J5jUF5N7jRqhhVc8HE5Cs0G51PSnMMaTFLCpD L8Vg== 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 124si7085887pfa.286.2018.01.29.08.34.37; Mon, 29 Jan 2018 08:34:51 -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 S1751579AbeA2QdS (ORCPT + 99 others); Mon, 29 Jan 2018 11:33:18 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39276 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751417AbeA2QdQ (ORCPT ); Mon, 29 Jan 2018 11:33:16 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0TGT1et146557 for ; Mon, 29 Jan 2018 11:33:15 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ft46ch9tk-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 29 Jan 2018 11:33:14 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Jan 2018 16:33:12 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 29 Jan 2018 16:33:08 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0TGX8s847906954; Mon, 29 Jan 2018 16:33:08 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D4F04204C; Mon, 29 Jan 2018 16:26:17 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D78A42041; Mon, 29 Jan 2018 16:26:15 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.95.57]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 29 Jan 2018 16:26:15 +0000 (GMT) Subject: Re: [RFC PATCH v3 2/2] ima: force re-appraisal on filesystems with FS_IMA_NO_CACHE From: Mimi Zohar To: "Serge E. Hallyn" , Alban Crequy Cc: alban@kinvolk.io, dongsu@kinvolk.io, iago@kinvolk.io, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, viro@zeniv.linux.org.uk, dmitry.kasatkin@gmail.com, james.l.morris@oracle.com, seth.forshee@canonical.com, hch@infradead.org Date: Mon, 29 Jan 2018 11:33:05 -0500 In-Reply-To: <1516881401.3751.37.camel@linux.vnet.ibm.com> References: <20180122162452.8756-1-alban@kinvolk.io> <20180122162452.8756-3-alban@kinvolk.io> <20180124175234.GA29811@mail.hallyn.com> <1516881401.3751.37.camel@linux.vnet.ibm.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-cbid: 18012916-0016-0000-0000-0000051D0CF4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18012916-0017-0000-0000-00002859A662 Message-Id: <1517243585.29187.546.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-29_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801290215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alban, On Thu, 2018-01-25 at 06:56 -0500, Mimi Zohar wrote: > > > @@ -228,9 +229,28 @@ static int process_measurement(struct file *file, char *buf, loff_t size, > > > IMA_APPRAISE_SUBMASK | IMA_APPRAISED_SUBMASK | > > > IMA_ACTION_FLAGS); > > > > > > - if (test_and_clear_bit(IMA_CHANGE_XATTR, &iint->atomic_flags)) > > > - /* reset all flags if ima_inode_setxattr was called */ > > > + /* > > > + * Reset the measure, appraise and audit cached flags either if: > > > + * - ima_inode_setxattr was called, or > > > + * - based on filesystem feature flag > > > + * forcing the file to be re-evaluated. > > > + */ > > > + if (test_and_clear_bit(IMA_CHANGE_XATTR, &iint->atomic_flags)) { > > > iint->flags &= ~IMA_DONE_MASK; > > > + } else if (inode->i_sb->s_type->fs_flags & FS_IMA_NO_CACHE) { > > > + if (action & IMA_MEASURE) { > > > + iint->measured_pcrs = 0; > > > + iint->flags &= > > > + ~(IMA_COLLECTED | IMA_MEASURE | IMA_MEASURED); > > > + } > > > + if (action & IMA_APPRAISE) > > > + iint->flags &= > > > + ~(IMA_COLLECTED | IMA_APPRAISE | IMA_APPRAISED | > > > + IMA_APPRAISE_SUBMASK | IMA_APPRAISED_SUBMASK); > > > + if (action & IMA_AUDIT) > > > + iint->flags &= > > > + ~(IMA_COLLECTED | IMA_AUDIT | IMA_AUDITED); > > > + } > > > > > Alban, I don't know what I was thinking, but this can be simplified > like for the IMA_CHANGE_XATTR case.  Except in the IMA_CHANGE_XATTR > case, "measured_pcrs" was already reset, whereas in this case > "measured_pcrs" needs to be reset. Did you get a chance to make the change and test it? Mimi