[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190122163852.nbo7z5hrizfsb344@merlin>
Date: Tue, 22 Jan 2019 10:38:52 -0600
From: Goldwyn Rodrigues <rgoldwyn@...e.de>
To: Mimi Zohar <zohar@...ux.ibm.com>
Cc: Amir Goldstein <amir73il@...il.com>,
Ignaz Forster <iforster@...e.de>,
linux-integrity <linux-integrity@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Fabian Vogt <fvogt@...e.de>, Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH v2] ima: define ima_post_create_tmpfile() hook and add
missing call
On 10:43 22/01, Mimi Zohar wrote:
> On Mon, 2019-01-21 at 14:29 +0200, Amir Goldstein wrote:
> > On Mon, Jan 21, 2019 at 2:00 PM Mimi Zohar <zohar@...ux.ibm.com> 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.
>
Excellent. I will resend the patch as v3.
Thanks!
--
Goldwyn
Powered by blists - more mailing lists