Smack: Transmute labels on specified directories
authorJarkko Sakkinen <ext-jarkko.2.sakkinen@nokia.com>
Tue, 7 Dec 2010 11:34:01 +0000 (13:34 +0200)
committerCasey Schaufler <casey@schaufler-ca.com>
Tue, 7 Dec 2010 22:04:02 +0000 (14:04 -0800)
commit5c6d1125f8dbd1bfef39e38fbc2837003be78a59
tree368d34e800bc5478442679323270d776b79501e8
parentfe27d4b012273640e033be80f143bdc54daa8e16
Smack: Transmute labels on specified directories

In a situation where Smack access rules allow processes
with multiple labels to write to a directory it is easy
to get into a situation where the directory gets cluttered
with files that the owner can't deal with because while
they could be written to the directory a process at the
label of the directory can't write them. This is generally
the desired behavior, but when it isn't it is a real
issue.

This patch introduces a new attribute SMACK64TRANSMUTE that
instructs Smack to create the file with the label of the directory
under certain circumstances.

A new access mode, "t" for transmute, is made available to
Smack access rules, which are expanded from "rwxa" to "rwxat".
If a file is created in a directory marked as transmutable
and if access was granted to perform the operation by a rule
that included the transmute mode, then the file gets the
Smack label of the directory instead of the Smack label of the
creating process.

Note that this is equivalent to creating an empty file at the
label of the directory and then having the other process write
to it. The transmute scheme requires that both the access rule
allows transmutation and that the directory be explicitly marked.

Signed-off-by: Jarkko Sakkinen <ext-jarkko.2.sakkinen@nokia.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
include/linux/xattr.h
security/smack/smack.h
security/smack/smack_access.c
security/smack/smack_lsm.c
security/smack/smackfs.c