Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7549254imu; Tue, 22 Jan 2019 07:45:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN43xfuFfIyi7Yt/VYtBZhYJcBGpSJnKgMszYE85qSUjh8bvF6z6HUo3uKQcbhCooQc1gm9E X-Received: by 2002:a63:6bc1:: with SMTP id g184mr33057711pgc.25.1548171924268; Tue, 22 Jan 2019 07:45:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548171924; cv=none; d=google.com; s=arc-20160816; b=JxSHbrg84tipyYepjVX0TVuHn+57Snv4Sq01D1rd5GAUiSU2pOJNgu/v/jZk15xebe gLQKy51r/2FLbF+nyfqpJ7qXEjQAOHNGb1WiJPDmcVMvUi+1yzfWfFgCpC11kL8CaYpn 5xVm4kHmDRkkoFdCa7yX2JlMKL15gz7CnpB+QpcBD+5eIdauBYbtdwAWmDj2wdVSsADd Cps0Dlmd5yD72MzAfL7UaeBtMl4LyA9+hJgzfGNp+k3cxlHSoxIudzPfsK2Vk9cNn/ak T978sFBc+hRoFHRxEQBx0z9tL2GyPhDUD2fEnKZ3sfU5gxRzUV+OySroVw73byh4nbhw QOYQ== 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=goTvMFzbej37zW5ow/FdKjs+g8847d5+zUU3lRUl3YQ=; b=GjR02r5Y8nKi2V9NAad9RbHlJny6WlXE/F4ifAKYisoLV3RuxvoJ+6UMOZ3YAgS3ma yUSGeO1xah/TsSKu1OrNTjJFwuHFVXsGA1k5svIHhOkidswdU/2SMwGJM0F3IkwQUx1t cPUkx4PtA5JTX2tGtKICpFI3CwlaGqT8mjFsoVuVsCsFYdQUs9wXdxH648HJpZ6NUrkG iiZXnGzuRHQ9ZHXaXwZEPuUCkEX7xHgYXGl9eXo6k9lhFM7N3c19JETsyVQFGjZbANxr 7Sww66Tpx8VoDk2K7S8updXAP/yZRKI3Bq5To3D/yN4zIj3OlbYnhsEL7y3lf8fz9ZDn 70bw== 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 l33si16581741pld.142.2019.01.22.07.45.08; Tue, 22 Jan 2019 07:45:24 -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 S1728949AbfAVPn2 (ORCPT + 99 others); Tue, 22 Jan 2019 10:43:28 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59982 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728633AbfAVPn2 (ORCPT ); Tue, 22 Jan 2019 10:43:28 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0MFe2eS122333 for ; Tue, 22 Jan 2019 10:43:26 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2q65adjfav-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 22 Jan 2019 10:43:26 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Jan 2019 15:43:24 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Tue, 22 Jan 2019 15:43:22 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0MFhLDL8192264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Jan 2019 15:43:21 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 19FE64203F; Tue, 22 Jan 2019 15:43:21 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EECF242041; Tue, 22 Jan 2019 15:43:19 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.91.23]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jan 2019 15:43:19 +0000 (GMT) Subject: Re: [PATCH v2] ima: define ima_post_create_tmpfile() hook and add missing call From: Mimi Zohar To: Amir Goldstein Cc: Goldwyn Rodrigues , Ignaz Forster , linux-integrity , linux-kernel , Fabian Vogt , Al Viro Date: Tue, 22 Jan 2019 10:43:09 -0500 In-Reply-To: References: <1545158873.4206.86.camel@linux.ibm.com> <20190117213421.ggasuc263dpqh46c@merlin> <1548072003.3782.24.camel@linux.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: 7bit X-TM-AS-GCONF: 00 x-cbid: 19012215-0020-0000-0000-00000309E46C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19012215-0021-0000-0000-0000215B1A49 Message-Id: <1548171789.4038.6.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-22_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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901220122 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-01-21 at 14:29 +0200, Amir Goldstein wrote: > On Mon, Jan 21, 2019 at 2:00 PM Mimi Zohar wrote: > > > > On Thu, 2019-01-17 at 15:34 -0600, Goldwyn Rodrigues wrote: > > > On 13:47 18/12, Mimi Zohar wrote: > > > > If tmpfiles can be made persistent, then newly created tmpfiles need to > > > > be treated like any other new files in policy. > > > > > > > > This patch indicates which newly created tmpfiles are in policy, causing > > > > the file hash to be calculated on __fput(). > > > > > > Discussed in overlayfs, this would be better if we use this on inode > > > and called from vfs_tmpfile() instead of do_tmpfile(). This will cover > > > the overlayfs case which uses tmpfiles while performing copy_up(). > > > The patch is attached. > > > > > > Here is the updated patch which works for my cases. > > > However, it is the the failure case after setting the IMA flags > > > I am concerned about, though I don't think that should be as harmful. > > > > Right. The new IMA hook allocates memory for storing the flags, which > > needs to be cleaned up on failure. For this reason, the IMA call is > > deferred until after the transition from locally freeing memory on > > failure to relying on __fput(). In "do_last", the call to IMA is > > after "opened"; and in the original version of this patch the call to > > IMA is after finish_open(). > > > > Not sure I understand the concern. > The integrity context is associated with the inode and will be freed > on destroy_inode() no matter which error path is taken. > Am I missing something? No, as long as destroy_inode() is called, it should be fine. thanks, Mimi