From: David P. Quigley on
On Fri, 2010-07-09 at 08:48 +1000, James Morris wrote:
> On Thu, 8 Jul 2010, David P. Quigley wrote:
>
> > > The maximum security label size on Linux is:
> > >
> > > #define XATTR_SIZE_MAX 65536
> > >
> > > Why arbitrarily limit this over the network?
> >
> > Because there is no easy way not to. The specification doesn't specify a
> > limit to label size in the IETF draft. However there is no way to do
> > allocation of the memory needed to store the label where we first get
> > access to its size. We tried this before and it failed. When I asked
> > trond about it he said doing memory allocation in the rpc context isn't
> > allowed.
>
> In the NFSv3 code, the workaround I've been using is to always allocate
> 64k, but the correct way of doing this apparently is to use the page
> cache, as is used for ACLs and symlinks.
>
> > For the most part what would make this label size inadequate would be
> > the MLS component. There are some cases where people want every other
> > compartment or something crazy like that. In terms of a normal label
> > though 4096 should be more than enough.
>
> Yes, but we should not unnecessarily limit the network protocol when
> something is valid and possible in the local implementation (which is ~64k
> under Linux).
>
> > Just to put this in perspective the string below is 4096 a's.
>
> A security label include just about anything, e.g. an x509 certificate, or
> a base64 encoded image.
>
> In the Linux implementation, if we can store a local label up to 64k, then
> we should try and ensure that it can be conveyed via NFS.
>
>
>
> - James


If you want that to be the case you need to make your case to Trond
about that. I've already had this conversation before and he seems to
think that a page is sufficient. Bruce also has concerns about not
wanting these labels to require a high order allocation. Under memory
pressure finding 16 contiguous pages for each label might be a problem.

Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Stephen Smalley on
On Sat, 2010-07-10 at 22:12 -0700, Casey Schaufler wrote:
> Kyle Moffett wrote:
> > ...
> > Even in local filesystems like ext3 we prefer to turn labels into
> > numbers, store the number with each inode, and then keep the labels
> > indexed in a separate datastructure.
> >
>
> I don't know what system you're talking about, but that notion
> was pretty well dispelled in the late 1980's, after the SystemV/MLS
> and SecureWare examples.

SELinux did that too before switching to using xattrs for label storage.
Persistent security identifier (PSID) associated with each inode (either
stored directly in the inode in the original kernel patches or
associated through a separate mapping in the LSM-based implementation),
with a mapping from PSID to context stored in a mapping within each
filesystem. Allowed you to keep the labels with the volume but avoided
storing the same label multiple times.

The xattr based implementation can sometimes share storage but only when
the xattr is stored in the additional block (not when they are stored
inline) and only if all of the xattrs on the file are identical.

> > Cheers,
> > Kyle Moffett
> >
> >
> >

--
Stephen Smalley
National Security Agency

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/