lkml.org 
[lkml]   [2008]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/6] integrity: IMA as an integrity service provider
On Tue, Dec 02, 2008 at 03:35:25PM -0800, Dave Hansen wrote:

>
> > + int rc;
> > +
> > + mdata.mask = MAY_READ;
> > + rc = ima_must_measure(&mdata);
> > + if (!rc || rc == -EEXIST) {
> > + if (atomic_read(&(path->dentry->d_count)) - 1 >
> > + atomic_read(&(mdata.inode->i_writecount)))
> > + ima_add_violation(mdata.inode,
> > + path->dentry->d_name.name,
> > + "invalid_pcr", "ToMToU");
> > + }
> > + return 0;
> > + }
>
>
> I have memories of talking about this bit. I was confused and you
> explained it to me, but it still isn't explained in the code. :( Again,
> I'm not convinced that this works. Can the code convince me, or should
> I go digging in my inbox?

This bit is crap, plain and simple. d_count doesn't work as a proxy for
"how many times had we opened this file". At all.

a) stat(2) and just about anything else that looks funny at the pathname
will bump d_count.

b) there may be several links to given file; all will share inode and have
different dentries.

In other words, result of that comparison happens to be junk.


\
 
 \ /
  Last update: 2008-12-05 23:35    [W:0.833 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site