Re: [patch 2/3] lsm: add bsdjail module

From: Stephen Smalley
Date: Wed Oct 13 2004 - 09:32:54 EST


On Tue, 2004-10-12 at 18:35, Ulrich Drepper wrote:
> Serge E. Hallyn wrote:
>
> > +If a private IP was specified for the jail, then
> > + cat /proc/$$/attr/current
>
> How is this going to interact with SELinux? Currently SELinux uses
> /proc/*/attr/current to report the current security context of the
> process. libselinux expects the file to contain one string (not even a
> newline) which is the textual representation of the context. Now with
> your changes you want to change this. libselinux as-is would break
> miserably.

libselinux is_selinux_enabled() checks /proc/filesystems for selinuxfs
first, and SELinux userland checks is_selinux_enabled(). As security
modules cannot presently be stacked if they both use the security
fields, this is sufficient. There were patches floated on
rhselinux-list circa Oct 2003 to add a "selinux/" prefix to the
/proc/pid/attr values to explicitly identify the security module, ala
the "security.selinux" attribute name for the file extended attribute,
but the consensus at that time was that it was sufficient to test for
the presence of SELinux via /proc/filesystems.

> I don't know the history of the file and who is hijacking the file.
> Fact is that the file content is currently unstructured and libselinux
> couldn't possibly determine what part is of interest to itself.

The /proc/pid/attr interface was submitted by us based on Al Viro's
recommendations when the SELinux API was overhauled. We attempted to
keep it sufficiently general that other security modules could also use
it, but not at the same time, as shared use of LSM security fields
wasn't supported anyway. We had earlier proposed [gs]etprocattr calls
ala [gs]etxattr calls with distinguished attribute names, but were
directed to use /proc instead.

> So, either you use another file, SELinux uses another file, or the file
> gets tagged lines like
>
> selinux: user_u:user_r:user_t

One value per file seems preferred, but /proc/pid doesn't lend itself to
dynamic extension by modules. [gs]etprocattr calls ala [gs]etxattr
calls would be simpler if we want to export multiple attribute names,
but that was also suggested earlier and rejected.

Side bar: Any change here also affects upstream procps, which presently
directly takes the /proc/pid/attr/current value and displays it as a
single field.

--
Stephen Smalley <sds@xxxxxxxxxxxxxx>
National Security Agency

-
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/