[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20081205223335.GJ28946@ZenIV.linux.org.uk>
Date: Fri, 5 Dec 2008 22:33:35 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Dave Hansen <dave@...ux.vnet.ibm.com>
Cc: Mimi Zohar <zohar@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
James Morris <jmorris@...ei.org>,
Christoph Hellwig <hch@...radead.org>,
David Safford <safford@...son.ibm.com>,
Serge Hallyn <serue@...ux.vnet.ibm.com>,
Mimi Zohar <zohar@...ibm.com>
Subject: Re: [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.
--
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