Re: [RFC][Patch 2/6] integrity: fs hook placement
From: Mimi Zohar
Date: Thu Mar 08 2007 - 13:33:35 EST
On Thu, 2007-03-08 at 21:16 +0300, Dmitriy Monakhov wrote:
> Mimi Zohar <zohar@xxxxxxxxxxxxxxxxxx> writes:
>
> > This patch places calls to the new integrity hooks in the appropriate
> > places in the fs directory. It is not meant in any way to be viewed
> > as a complete set, but used as a basis for an initial discussion.
> >
> > Index: linux-2.6.21-rc3-mm2/fs/ext3/xattr_security.c
> > ===================================================================
> > --- linux-2.6.21-rc3-mm2.orig/fs/ext3/xattr_security.c
> > +++ linux-2.6.21-rc3-mm2/fs/ext3/xattr_security.c
> > @@ -10,6 +10,7 @@
> > #include <linux/ext3_jbd.h>
> > #include <linux/ext3_fs.h>
> > #include <linux/security.h>
> > +#include <linux/integrity.h>
> > #include "xattr.h"
> >
> > static size_t
> > @@ -58,12 +59,19 @@ ext3_init_security(handle_t *handle, str
> >
> > err = security_inode_init_security(inode, dir, &name, &value, &len);
> > if (err) {
> > + /* Even if creation of the security xattr fails, must
> > + * indicate this is a new inode. */
> > + integrity_inode_init_integrity(inode, dir, NULL, NULL, NULL);
> > if (err == -EOPNOTSUPP)
> > return 0;
> > return err;
> > }
> <<<< block begin
> > err = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_SECURITY,
> > name, value, len, 0);
> > +
> > + integrity_inode_init_integrity(inode, dir, &name, &value, &len);
> > + err = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_SECURITY,
> > + name, value, len, 0);
> <<<< block end
> May be i've missed something, but i don't get last block.
> Why you call ext3_xattr_set_handle() twise?,
> or you just mistyped and it has to look like this:
> <<<<block_begin
Both security_inode_init_security and integrity_inode_init_integrity
create extended attributes. The first ext3_xattr_set_handle creates the
security extended attribute and the second one creates the integrity
extended attribute. In the case of EVM, EVM calculates an HMAC on a set
of extended attributes, possibly including the initial security extended
attribute.
Mimi Zohar
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/