[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1399401557.9468.21.camel@dhcp-9-2-203-236.watson.ibm.com>
Date: Tue, 06 May 2014 14:39:17 -0400
From: Mimi Zohar <zohar@...ux.vnet.ibm.com>
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Dmitry Kasatkin <d.kasatkin@...sung.com>,
linux-security-module <linux-security-module@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: IMA & truncate
On Tue, 2014-05-06 at 17:59 +0100, Al Viro wrote:
> On Tue, May 06, 2014 at 04:32:27PM +0300, Dmitry Kasatkin wrote:
> > Hi,
> >
> > I have discovered one IMA related issue.
> >
> > IMA file hash is re-calculate if needed on file close.
> >
> > It works with ftruncate(fd, length) syscall, because it operates on
> > "opened" file.
> > Recalculation is happening on file close.
> >
> > truncate(path, length) syscall works with path and no file open/close
> > takes place.
> > Recalculation does not happen.
> > IMA denies file access later.
> >
> > It looks like vfs_truncate() should possibly call IMA to recalculate the
> > hash.
>
> Who said that it has permissions to read the file? Reread truncate(2)
> manpage; it requires the file to be *writable* for caller, but it doesn't
> need it to be readable.
Al, you're not going to like this, but ima_calc_file_hash() calls
ima_calc_file_hash_tfm(), which already sets/unsets FMODE_READ in order
to calculate the file hash.
Mimi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists